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).
This commit is contained in:
Pim van Pelt
2022-06-22 15:32:33 +00:00
parent 91899a3908
commit 29736a3d6b

View File

@ -1092,31 +1092,31 @@ class Reconciler:
if "bvi" in config_bridge_iface: if "bvi" in config_bridge_iface:
bviname = config_bridge_iface["bvi"] bviname = config_bridge_iface["bvi"]
if ( if not (
bviname in self.vpp.cache["interface_names"] bviname in self.vpp.cache["interface_names"]
and self.vpp.cache["interface_names"][bviname].sw_if_index and self.vpp.cache["interface_names"][bviname].sw_if_index
== bvi_sw_if_index == bvi_sw_if_index
): ):
continue cli = f"set interface l2 bridge {bviname} {int(instance)} bvi"
cli = f"set interface l2 bridge {bviname} {int(instance)} bvi" self.cli["sync"].append(cli)
self.cli["sync"].append(cli)
if not "interfaces" in config_bridge_iface: if "interfaces" in config_bridge_iface:
continue for member_ifname in config_bridge_iface["interfaces"]:
for member_ifname in config_bridge_iface["interfaces"]: member_ifname, _member_iface = interface.get_by_name(
member_ifname, _member_iface = interface.get_by_name( self.cfg, member_ifname
self.cfg, member_ifname )
) if not member_ifname in bridge_members:
if not member_ifname in bridge_members: cli = f"set interface l2 bridge {member_ifname} {int(instance)}"
cli = f"set interface l2 bridge {member_ifname} {int(instance)}" self.cli["sync"].append(cli)
self.cli["sync"].append(cli) operation = "disable"
operation = "disable" if interface.is_qinx(self.cfg, member_ifname):
if interface.is_qinx(self.cfg, member_ifname): operation = "pop 2"
operation = "pop 2" elif interface.is_sub(self.cfg, member_ifname):
elif interface.is_sub(self.cfg, member_ifname): operation = "pop 1"
operation = "pop 1" cli = (
cli = f"set interface l2 tag-rewrite {member_ifname} {operation}" f"set interface l2 tag-rewrite {member_ifname} {operation}"
self.cli["sync"].append(cli) )
self.cli["sync"].append(cli)
return True return True
def sync_l2xcs(self): def sync_l2xcs(self):