Prune sub-ints that have a different encap than their config counterpart

This commit is contained in:
Pim van Pelt
2022-03-27 16:14:37 +00:00
parent b97a0f46b8
commit 90c23cf987

View File

@ -329,8 +329,8 @@ class Reconciler():
return match return match
def prune_sub_interfaces(self): def prune_sub_interfaces(self):
""" Remove interfaces from VPP if they are not in the config. Start with inner-most (QinQ/QinAD), then """ Remove interfaces from VPP if they are not in the config, or if their encapsulation is different.
Dot1Q/Dot1AD.""" Start with inner-most (QinQ/QinAD), then Dot1Q/Dot1AD."""
removed_interfaces=[] removed_interfaces=[]
for numtags in [ 2, 1 ]: for numtags in [ 2, 1 ]:
for vpp_ifname in self.vpp.get_sub_interfaces(): for vpp_ifname in self.vpp.get_sub_interfaces():
@ -347,6 +347,13 @@ class Reconciler():
self.logger.info("1> delete sub %s" % vpp_ifname) self.logger.info("1> delete sub %s" % vpp_ifname)
removed_interfaces.append(vpp_ifname) removed_interfaces.append(vpp_ifname)
continue 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 = [] addresses = []
if 'addresses' in config_iface: if 'addresses' in config_iface:
addresses = config_iface['addresses'] addresses = config_iface['addresses']