From 3e108025a16a6d4db1bc08ea9161709b13295dfb Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 24 Sep 2019 18:48:49 +0200 Subject: Python/ifconfig: T1557: loopback: implement derived remove() --- src/conf_mode/interface-loopback.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/conf_mode/interface-loopback.py b/src/conf_mode/interface-loopback.py index 46fc6809b..10722d137 100755 --- a/src/conf_mode/interface-loopback.py +++ b/src/conf_mode/interface-loopback.py @@ -72,20 +72,20 @@ def generate(loopback): return None def apply(loopback): - lo = LoopbackIf(loopback['intf']) - if not loopback['deleted']: + l = LoopbackIf(loopback['intf']) + if loopback['deleted']: + l.remove() + else: # update interface description used e.g. within SNMP - lo.set_alias(loopback['description']) + l.set_alias(loopback['description']) # Configure interface address(es) # - not longer required addresses get removed first # - newly addresses will be added second + for addr in loopback['address_remove']: + l.del_addr(addr) for addr in loopback['address']: - lo.add_addr(addr) - - # remove interface address(es) - for addr in loopback['address_remove']: - lo.del_addr(addr) + l.add_addr(addr) return None -- cgit v1.2.3