Skip to content

Commit c4f6695

Browse files
authored
Update dcnm_network.py
add condition if fabric is Multisite, remove mcastGroup key
1 parent ae2b9ce commit c4f6695

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

plugins/modules/dcnm_network.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,11 @@ def update_create_params(self, net):
12681268
template_conf["vrfDhcp3"] = ""
12691269
if template_conf["loopbackId"] is None:
12701270
template_conf["loopbackId"] = ""
1271-
if template_conf["mcastGroup"] is None:
1272-
template_conf["mcastGroup"] = ""
1271+
if self.is_ms_fabric is True:
1272+
template_conf.pop("mcastGroup")
1273+
else:
1274+
if template_conf["mcastGroup"] is None:
1275+
template_conf["mcastGroup"] = ""
12731276
if template_conf["gatewayIpV6Address"] is None:
12741277
template_conf["gatewayIpV6Address"] = ""
12751278
if template_conf["secondaryGW1"] is None:
@@ -1378,6 +1381,10 @@ def get_have(self):
13781381
t_conf.update(SVI_NETFLOW_MONITOR=json_to_dict.get("SVI_NETFLOW_MONITOR", ""))
13791382
t_conf.update(VLAN_NETFLOW_MONITOR=json_to_dict.get("VLAN_NETFLOW_MONITOR", ""))
13801383

1384+
# Remove mcastGroup when Fabric is MSD
1385+
if "mcastGroup" not in json_to_dict:
1386+
del t_conf["mcastGroup"]
1387+
13811388
net.update({"networkTemplateConfig": json.dumps(t_conf)})
13821389
del net["displayName"]
13831390
del net["serviceNetworkTemplate"]
@@ -1905,7 +1912,8 @@ def get_diff_merge(self, replace=False):
19051912
dhcp2_vrf_changed.update({want_c["networkName"]: dhcp2_vrf_chg})
19061913
dhcp3_vrf_changed.update({want_c["networkName"]: dhcp3_vrf_chg})
19071914
dhcp_loopback_changed.update({want_c["networkName"]: dhcp_loopbk_chg})
1908-
multicast_group_address_changed.update({want_c["networkName"]: mcast_grp_chg})
1915+
if self.is_ms_fabric == False:
1916+
multicast_group_address_changed.update({want_c["networkName"]: mcast_grp_chg})
19091917
gwv6_changed.update({want_c["networkName"]: gwv6_chg})
19101918
sec_gw1_changed.update({want_c["networkName"]: sec_gw1_chg})
19111919
sec_gw2_changed.update({want_c["networkName"]: sec_gw2_chg})
@@ -2902,8 +2910,9 @@ def dcnm_update_network_information(self, want, have, cfg):
29022910
if cfg.get("dhcp_loopback_id", None) is None:
29032911
json_to_dict_want["loopbackId"] = json_to_dict_have["loopbackId"]
29042912

2905-
if cfg.get("multicast_group_address", None) is None:
2906-
json_to_dict_want["mcastGroup"] = json_to_dict_have["mcastGroup"]
2913+
if self.is_ms_fabric is False:
2914+
if cfg.get("multicast_group_address", None) is None:
2915+
json_to_dict_want["mcastGroup"] = json_to_dict_have["mcastGroup"]
29072916

29082917
if cfg.get("gw_ipv6_subnet", None) is None:
29092918
json_to_dict_want["gatewayIpV6Address"] = json_to_dict_have["gatewayIpV6Address"]

0 commit comments

Comments
 (0)