1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: vxlan: ifquery-check: mcastgrp-map: use bridge vni show

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2021-06-23 14:00:00 +02:00
parent 3376c23335
commit 9ca87c5e8b

View File

@@ -1477,21 +1477,30 @@ class vxlan(Vxlan, moduleBase):
user_mcastgrp_map = self.__get_vxlan_mcastgrp_map(ifaceobj) user_mcastgrp_map = self.__get_vxlan_mcastgrp_map(ifaceobj)
user_remote_ip_map = self.__get_vxlan_remote_ip_map(ifaceobj) user_remote_ip_map = self.__get_vxlan_remote_ip_map(ifaceobj)
if not user_mcastgrp_map or not user_remote_ip_map: if not user_mcastgrp_map and not user_remote_ip_map:
return return
fdb_mcast = {} fdb_mcast = {}
fdb_remote = {} fdb_remote = {}
for _, src_vni, dst in self.get_svd_running_fdb(ifname): if user_remote_ip_map:
ip = ipnetwork.IPv4Address(dst) for _, src_vni, dst in self.get_svd_running_fdb(ifname):
ip = ipnetwork.IPv4Address(dst)
if ip.is_multicast: if not ip.is_multicast:
# we need to reconvert back to ipaddress.IPv4Address because fdb_remote.setdefault(int(src_vni), []).append(ip)
# the existing code uses this type of obj (namely: __get_vxlan_mcastgrp_map)
fdb_mcast[int(src_vni)] = IPv4Address(ip.ip) if user_mcastgrp_map:
else: for obj in json.loads(utils.exec_command("bridge -j -p vni show dev %s" % ifname) or "[]"):
fdb_remote.setdefault(int(src_vni), []).append(ip) for vni in obj.get("vnis", []):
group = vni.get("group")
if not group:
continue
# we need to reconvert back to ipaddress.IPv4Address because
# the existing code uses this type of obj (namely: __get_vxlan_mcastgrp_map)
fdb_mcast[vni.get("vni")] = IPv4Address(group)
# #
# vxlan-mcastgrp-map # vxlan-mcastgrp-map