Update to ordering

- Prune bridgedomains before pruning BVIs. The reason for this is that
  prune_bridgedomains() will set the BVI to L3 mode, and if the BVI is
  removed before the bridge is pruned, this is an error.
- When pruning bridge members, use the VPP configuration as the member
  may not exist in the config, upon which the call to interface.is_sub()
  will return False even if it is actually a VPP sub-int.

Update README.md, also take into account the previous change which calls
prune_addresses() before object deletion.
This commit is contained in:
Pim van Pelt
2022-03-25 13:56:04 +00:00
parent a068f25f19
commit 152fa12099
2 changed files with 23 additions and 16 deletions

View File

@ -138,42 +138,46 @@ and finally all objects are synchronized with the configuration (IP addresses, M
if `e0.100` exists with dot1q 100, but has moved to dot1ad 1234. if `e0.100` exists with dot1q 100, but has moved to dot1ad 1234.
* Remove those that do exist in the config but have mismatched VPP/LCP interface names, * Remove those that do exist in the config but have mismatched VPP/LCP interface names,
for example if `e0` was paired with interface Te1/0/0 but has moved to interface Te1/0/1. for example if `e0` was paired with interface Te1/0/0 but has moved to interface Te1/0/1.
1. Retrieve all Loopbacks and BVIs from VPP 1. Retrieve all Loopbacks from VPP
* Remove those that do not exist in the config
* Remove all IP addresses that are not in the config * Remove all IP addresses that are not in the config
* Remove those that do not exist in the config
1. Retrieve all Bridge Domains from VPP 1. Retrieve all Bridge Domains from VPP
* Remove those that do not exist in the config * Remove those that do not exist in the config
* Remove all member interfaces (including BVIs) that are not in the config, return them to * Remove all member interfaces (including BVIs) that are not in the config, return them to
L3 mode L3 mode
* Remove tag-rewrite options on removed member interfaces if they have encapsulation * Remove tag-rewrite options on removed member interfaces if they have encapsulation
1. Retrieve all BVIs from VPP
* Remove all IP addresses that are not in the config
* Remove those that do not exist in the config
1. For L2 Cross Connects from VPP 1. For L2 Cross Connects from VPP
* For interfaces that do not exist in the config (either as source or target): * For interfaces that do not exist in the config (either as source or target):
* Return the interface to L3 mode * Return the interface to L3 mode
* Remove tag-rewrite options on if it has encapsulation * Remove tag-rewrite options on if it has encapsulation
1. Retrieve all Tunnels from VPP 1. Retrieve all Tunnels from VPP
* Remove those that do not exist in the config
* Remove all IP addresses that are not in the config * Remove all IP addresses that are not in the config
* Remove those that do not exist in the config
1. Retrieve all sub-interfaces from VPP 1. Retrieve all sub-interfaces from VPP
* Starting with QinQ/QinAD, then Dot1Q/Dot1AD: * Starting with QinQ/QinAD, then Dot1Q/Dot1AD:
* Remove all IP addresses that are not in the config
* Remove those that do not exist in the config * Remove those that do not exist in the config
* Remove those that do exist in the config but have a different encapsulation * Remove those that do exist in the config but have a different encapsulation
* Remove all IP addresses that are not in the config
1. Retrieve all BondEthernets from VPP 1. Retrieve all BondEthernets from VPP
* Remove all IP addresses that are not in the config
* Remove those that do not exist in the config * Remove those that do not exist in the config
* Remove all member interfaces that are not in the config * Remove all member interfaces that are not in the config
* Remove all IP addresses that are not in the config
1. And finally, for each PHY interface: 1. And finally, for each PHY interface:
* Remove all IP addresses that are not in the config * Remove all IP addresses that are not in the config
* If not in the config, return to default (L3 mode, MTU 9000, admin-state down) * If not in the config, return to default (L3 mode, MTU 9000, admin-state down)
### Creating ### Creating
1. Loopbacks and BVIs 1. Loopbacks
1. Bridge Domains
1. BondEthernets 1. BondEthernets
1. Tunnels
1. Dot1Q and Dot1AD sub-interfaces 1. Dot1Q and Dot1AD sub-interfaces
1. Qin1Q and Qin1AD sub-interfaces 1. Qin1Q and Qin1AD sub-interfaces
1. Tunnels
1. BVIs
1. Bridge Domains
1. LCP pairs for Tunnels (TUN type) 1. LCP pairs for Tunnels (TUN type)
1. LCP pairs for PHYs, BondEthernets, Dot1Q/Dot1AD and finally QinQ/QinAD (TAP type) 1. LCP pairs for PHYs, BondEthernets, Dot1Q/Dot1AD and finally QinQ/QinAD (TAP type)
@ -194,5 +198,7 @@ and finally all objects are synchronized with the configuration (IP addresses, M
* Set tag-rewrite options if any of the interfaces have encapsulation * Set tag-rewrite options if any of the interfaces have encapsulation
1. Decrease MTU for QinQ/QinAD, then Dot1Q/Dot1AD, then (BondEthernets, Tunnels, PHYs) 1. Decrease MTU for QinQ/QinAD, then Dot1Q/Dot1AD, then (BondEthernets, Tunnels, PHYs)
1. Raise MTU for (PHYs, Tunnels, BondEthernets), then Dot1Q/Dot1AD, then QinQ/QinAD 1. Raise MTU for (PHYs, Tunnels, BondEthernets), then Dot1Q/Dot1AD, then QinQ/QinAD
* Take special care for PHYs which need a max-frame-size change (some interfaces
must be temporarily set admin-down to change that!)
1. Add IPv4/IPv6 addresses 1. Add IPv4/IPv6 addresses
1. Set admin state up 1. Set admin state for all interfaces

View File

@ -57,12 +57,12 @@ class Reconciler():
if not self.prune_loopbacks(): if not self.prune_loopbacks():
self.logger.warning("Could not prune loopbacks from VPP") self.logger.warning("Could not prune loopbacks from VPP")
ret = False ret = False
if not self.prune_bvis():
self.logger.warning("Could not prune BVIs from VPP")
ret = False
if not self.prune_bridgedomains(): if not self.prune_bridgedomains():
self.logger.warning("Could not prune BridgeDomains from VPP") self.logger.warning("Could not prune BridgeDomains from VPP")
ret = False ret = False
if not self.prune_bvis():
self.logger.warning("Could not prune BVIs from VPP")
ret = False
if not self.prune_l2xcs(): if not self.prune_l2xcs():
self.logger.warning("Could not prune L2 Cross Connects from VPP") self.logger.warning("Could not prune L2 Cross Connects from VPP")
ret = False ret = False
@ -70,13 +70,13 @@ class Reconciler():
self.logger.warning("Could not prune VXLAN Tunnels from VPP") self.logger.warning("Could not prune VXLAN Tunnels from VPP")
ret = False ret = False
if not self.prune_sub_interfaces(): if not self.prune_sub_interfaces():
self.logger.warning("Could not prune interfaces from VPP") self.logger.warning("Could not prune sub-interfaces from VPP")
ret = False ret = False
if not self.prune_bondethernets(): if not self.prune_bondethernets():
self.logger.warning("Could not prune BondEthernets from VPP") self.logger.warning("Could not prune BondEthernets from VPP")
ret = False ret = False
if not self.prune_phys(): if not self.prune_phys():
self.logger.warning("Could not prune interfaces from VPP") self.logger.warning("Could not prune PHYs from VPP")
ret = False ret = False
return ret return ret
@ -134,8 +134,9 @@ class Reconciler():
members = [] members = []
if not config_iface: if not config_iface:
for member in bridge.sw_if_details: for member in bridge.sw_if_details:
member_ifname = self.vpp.config['interfaces'][member.sw_if_index].interface_name member_iface = self.vpp.config['interfaces'][member.sw_if_index]
if interface.is_sub(self.cfg, member_ifname): member_ifname = member_iface.interface_name
if member_iface.sub_id > 0:
self.logger.info("1> set interface l2 tag-rewrite %s disable" % member_ifname) self.logger.info("1> set interface l2 tag-rewrite %s disable" % member_ifname)
self.logger.info("1> set interface l3 %s" % member_ifname) self.logger.info("1> set interface l3 %s" % member_ifname)
self.logger.info("1> create bridge-domain %d del" % idx) self.logger.info("1> create bridge-domain %d del" % idx)