diff --git a/README.md b/README.md index a3be6b0..e7f4c63 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ and finally for all interfaces, they are synchronized with the configuratino (IP * Remove tag-rewrite options on if it has encapsulation 1. Retrieve all BondEthernets from VPP * Remove those that do not exist in the config - * Remove all member interfaces that are not in the config, return them to L3 mode + * Remove all member interfaces that are not in the config * Remove all IP addresses that are not in the config 1. Retrieve all Tunnels from VPP * Remove those that do not exist in the config diff --git a/vpp/reconciler.py b/vpp/reconciler.py index d51099f..c84cab3 100644 --- a/vpp/reconciler.py +++ b/vpp/reconciler.py @@ -72,6 +72,9 @@ class Reconciler(): if not self.prune_l2xcs(): self.logger.warning("Could not prune L2 Cross Connects from VPP that are not in the config") ret = False + if not self.prune_bondethernets(): + self.logger.warning("Could not prune BondEthernets from VPP that are not in the config") + ret = False return ret def prune_loopbacks(self): @@ -150,6 +153,26 @@ class Reconciler(): self.logger.debug("L2XC OK: %s -> %s" % (vpp_rx_ifname, vpp_tx_ifname)) return True + def prune_bondethernets(self): + for idx, bond in self.vpp.config['bondethernets'].items(): + vpp_ifname = bond.interface_name + config_ifname, config_iface = bondethernet.get_by_name(self.cfg, vpp_ifname) + if not config_iface: + for member in self.vpp.config['bondethernet_members'][idx]: + self.logger.info("1> bond del %s" % self.vpp.config['interfaces'][member].interface_name) + self.logger.info("1> delete bond %s" % (vpp_ifname)) + continue + for member in self.vpp.config['bondethernet_members'][idx]: + member_ifname = self.vpp.config['interfaces'][member].interface_name + if 'interfaces' in config_iface and not member_ifname in config_iface['interfaces']: + self.logger.info("2> bond del %s" % member_ifname) + addresses = [] + if 'addresses' in config_iface: + addresses = config_iface['addresses'] + self.prune_addresses(vpp_ifname, addresses) + self.logger.debug("BondEthernet OK: %s" % (vpp_ifname)) + return True + def __parent_iface_by_encap(self, sup_sw_if_index, outer, dot1ad=True): """ Returns the idx of an interface on a given super_sw_if_index with given dot1q/dot1ad outer and inner-dot1q=0 """ for idx, iface in self.vpp.config['interfaces'].items():