summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-31 13:08:45 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-31 13:08:45 +0200
commite461fcf77c8b071a26e5c57021890bb96ccb7504 (patch)
tree11d9a67364efe41c7a7686b81ac4bb6b699e0f3e /src/conf_mode
parent3dc08ceaf2c9574133f3b4ff94822b65789a2139 (diff)
downloadvyos-1x-e461fcf77c8b071a26e5c57021890bb96ccb7504.tar.gz
vyos-1x-e461fcf77c8b071a26e5c57021890bb96ccb7504.zip
loopback: T1601: migrate from pyroute2 -> vyos.ifconfig
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interface-loopback.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/conf_mode/interface-loopback.py b/src/conf_mode/interface-loopback.py
index 5c1419b11..1dd68c039 100755
--- a/src/conf_mode/interface-loopback.py
+++ b/src/conf_mode/interface-loopback.py
@@ -18,7 +18,7 @@
from os import environ
from sys import exit
from copy import deepcopy
-from pyroute2 import IPDB
+from vyos.ifconfig import LoopbackIf
from vyos.config import Config
from vyos import ConfigError
@@ -75,28 +75,19 @@ def generate(loopback):
return None
def apply(loopback):
- ipdb = IPDB(mode='explicit')
- lo_if = loopback['intf']
-
- # the loopback device always exists
- lo = ipdb.interfaces[lo_if]
- # begin() a transaction prior to make any change
- lo.begin()
-
+ lo = LoopbackIf(loopback['intf'])
if not loopback['deleted']:
# update interface description used e.g. within SNMP
# update interface description used e.g. within SNMP
lo.ifalias = loopback['description']
# configure interface address(es)
for addr in loopback['address']:
- lo.add_ip(addr)
+ lo.add_addr(addr)
# remove interface address(es)
for addr in loopback['address_remove']:
- lo.del_ip(addr)
+ lo.del_addr(addr)
- # commit changes on loopback interface
- lo.commit()
return None
if __name__ == '__main__':