summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-06-24 11:26:48 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-06-24 11:26:48 +0100
commite507d0867326782bf93ed703ca877ca31dead2d6 (patch)
tree4d42fed3915745b09dd282e0db3fbaee842a628b
parent3caf131cae11d9ed0f81d632afea5ea3e6f8b8d3 (diff)
downloadvyos-1x-e507d0867326782bf93ed703ca877ca31dead2d6.tar.gz
vyos-1x-e507d0867326782bf93ed703ca877ca31dead2d6.zip
dictconfig: T2637: identify sub-interfaces (vif) to delete
-rw-r--r--python/vyos/configdict.py8
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py4
2 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 973fbdd8b..ce086872e 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -224,6 +224,14 @@ def intf_to_dict(conf, default):
intf = deepcopy(default)
intf['intf'] = ifname_from_config(conf)
+ current_vif_list = conf.list_nodes(['vif'])
+ previous_vif_list = conf.list_effective_nodes(['vif'])
+
+ # set the vif to be deleted
+ for vif in previous_vif_list:
+ if vif not in current_vif_list:
+ intf['vif_remove'].append(vif)
+
# retrieve interface description
if conf.exists(['description']):
intf['description'] = conf.return_value(['description'])
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index 8d657acba..8b895c4d2 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -187,6 +187,9 @@ def generate(eth):
def apply(eth):
e = EthernetIf(eth['intf'])
if eth['deleted']:
+ # apply all vlans to interface (they need removing too)
+ apply_all_vlans(e, eth)
+
# delete interface
e.remove()
else:
@@ -304,7 +307,6 @@ def apply(eth):
# apply all vlans to interface
apply_all_vlans(e, eth)
- return None
if __name__ == '__main__':
try: