From 90c23cf987961be4dc73fd1ec39fd13666c42b71 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Sun, 27 Mar 2022 16:14:37 +0000 Subject: [PATCH] Prune sub-ints that have a different encap than their config counterpart --- vpp/reconciler.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/vpp/reconciler.py b/vpp/reconciler.py index 3e69824..5af7fe3 100644 --- a/vpp/reconciler.py +++ b/vpp/reconciler.py @@ -329,8 +329,8 @@ class Reconciler(): return match def prune_sub_interfaces(self): - """ Remove interfaces from VPP if they are not in the config. Start with inner-most (QinQ/QinAD), then - Dot1Q/Dot1AD.""" + """ Remove interfaces from VPP if they are not in the config, or if their encapsulation is different. + Start with inner-most (QinQ/QinAD), then Dot1Q/Dot1AD.""" removed_interfaces=[] for numtags in [ 2, 1 ]: for vpp_ifname in self.vpp.get_sub_interfaces(): @@ -347,6 +347,13 @@ class Reconciler(): self.logger.info("1> delete sub %s" % vpp_ifname) removed_interfaces.append(vpp_ifname) continue + config_encap = interface.get_encapsulation(self.cfg, vpp_ifname) + vpp_encap = self.__get_encapsulation(vpp_iface) + if config_encap != vpp_encap: + self.prune_addresses(vpp_ifname, []) + self.logger.info("2> delete sub %s" % vpp_ifname) + removed_interfaces.append(vpp_ifname) + continue addresses = [] if 'addresses' in config_iface: addresses = config_iface['addresses']