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:
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):