mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
addons: bridge: bridge-vlan-vni-map: use vlan and vni ranges within iproute2 cmds
Instead of exploding vlans and vnis ranges we can simply pass those ranges to iproute2 which will reduce the load on ifupdown2 side and scale better Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
@ -2422,15 +2422,9 @@ class bridge(Bridge, moduleBase):
|
||||
except:
|
||||
return self.__warn_bridge_vlan_vni_map_syntax_error(vxlan_name, vlan_vni_map)
|
||||
|
||||
vlans = self._ranges_to_ints([vlans_str])
|
||||
vnis = self._ranges_to_ints([vni_str])
|
||||
|
||||
if len(vlans) != len(vnis):
|
||||
return self.__warn_bridge_vlan_vni_map_syntax_error(vxlan_name, vlan_vni_map)
|
||||
|
||||
# TODO: query the cache prio to executing those commands
|
||||
self.iproute2.bridge_vlan_add_vid_list_self(vxlan_name, vlans, False)
|
||||
self.iproute2.bridge_vlan_add_vlan_tunnel_info(vxlan_name, vlans, vnis)
|
||||
self.iproute2.bridge_vlan_add_vid_list_self(vxlan_name, [vlans_str], False)
|
||||
self.iproute2.bridge_vlan_add_vlan_tunnel_info(vxlan_name, vlans_str, vni_str)
|
||||
|
||||
self.iproute2.batch_commit()
|
||||
except Exception as e:
|
||||
|
@ -662,17 +662,16 @@ class IPRoute2(Cache, Requirements):
|
||||
)
|
||||
|
||||
def bridge_vlan_add_vlan_tunnel_info(self, ifname, vids, vnis):
|
||||
for i in range(0, len(vids)):
|
||||
try:
|
||||
self.__execute_or_batch(
|
||||
utils.bridge_cmd,
|
||||
"vlan add dev %s vid %s tunnel_info id %s" % (
|
||||
ifname, vids[i], vnis[i]
|
||||
)
|
||||
try:
|
||||
self.__execute_or_batch(
|
||||
utils.bridge_cmd,
|
||||
"vlan add dev %s vid %s tunnel_info id %s" % (
|
||||
ifname, vids, vnis
|
||||
)
|
||||
except Exception as e:
|
||||
if "exists" not in str(e).lower():
|
||||
self.logger.error(e)
|
||||
)
|
||||
except Exception as e:
|
||||
if "exists" not in str(e).lower():
|
||||
self.logger.error(e)
|
||||
|
||||
@staticmethod
|
||||
def bridge_vlan_add_vid_list(ifname, vids):
|
||||
|
Reference in New Issue
Block a user