From 29736a3d6ba87ace7319c3db8b8ca9f33e768248 Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Wed, 22 Jun 2022 15:32:33 +0000 Subject: [PATCH] bugfix: bridgedomain sync When a bridge-domain has a BVI, it will not sync/add the interfaces to the bridge. As an example: bridgedomains: bd1001: bvi: loop1001 interfaces: [ tap1001 ] mtu: 9000 taps: tap1001: host: bridge: br0 mac: 02:fe:83:97:f4:7f mtu: 9000 name: vpp-bd1001 Before this change, the 'tap1001' would get created, but if the BVI 'loop1001' was correctly set up on the bridge, the code would continue and skip over enumerating config_bridge_iface. After this change, both the BVI will be checked (and added if not present), AND all interfaces will be enumerated (and added if not present). --- vpp/reconciler.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/vpp/reconciler.py b/vpp/reconciler.py index d4cd9e2..00e7d94 100644 --- a/vpp/reconciler.py +++ b/vpp/reconciler.py @@ -1092,31 +1092,31 @@ class Reconciler: if "bvi" in config_bridge_iface: bviname = config_bridge_iface["bvi"] - if ( + if not ( bviname in self.vpp.cache["interface_names"] and self.vpp.cache["interface_names"][bviname].sw_if_index == bvi_sw_if_index ): - continue - cli = f"set interface l2 bridge {bviname} {int(instance)} bvi" - self.cli["sync"].append(cli) + cli = f"set interface l2 bridge {bviname} {int(instance)} bvi" + self.cli["sync"].append(cli) - if not "interfaces" in config_bridge_iface: - continue - for member_ifname in config_bridge_iface["interfaces"]: - member_ifname, _member_iface = interface.get_by_name( - self.cfg, member_ifname - ) - if not member_ifname in bridge_members: - cli = f"set interface l2 bridge {member_ifname} {int(instance)}" - self.cli["sync"].append(cli) - operation = "disable" - if interface.is_qinx(self.cfg, member_ifname): - operation = "pop 2" - elif interface.is_sub(self.cfg, member_ifname): - operation = "pop 1" - cli = f"set interface l2 tag-rewrite {member_ifname} {operation}" - self.cli["sync"].append(cli) + if "interfaces" in config_bridge_iface: + for member_ifname in config_bridge_iface["interfaces"]: + member_ifname, _member_iface = interface.get_by_name( + self.cfg, member_ifname + ) + if not member_ifname in bridge_members: + cli = f"set interface l2 bridge {member_ifname} {int(instance)}" + self.cli["sync"].append(cli) + operation = "disable" + if interface.is_qinx(self.cfg, member_ifname): + operation = "pop 2" + elif interface.is_sub(self.cfg, member_ifname): + operation = "pop 1" + cli = ( + f"set interface l2 tag-rewrite {member_ifname} {operation}" + ) + self.cli["sync"].append(cli) return True def sync_l2xcs(self):