Skip to content

Commit

Permalink
Merge pull request #256 from dsx1123/dcnm_link_merge_bug
Browse files Browse the repository at this point in the history
fix an issue when using merge to update mpls_underlay link
  • Loading branch information
mikewiebe authored Sep 5, 2023
2 parents 56696c5 + fe2a7cb commit f784874
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions plugins/modules/dcnm_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ def dcnm_links_get_inter_fabric_links_payload(self, link, link_payload):
Returns:
link_payload (dict): Link payload information populated with appropriate data from playbook config
"""

link_payload["nvPairs"] = {}
if (
link["template"] == self.templates["ext_multisite_underlay_setup"]
Expand Down Expand Up @@ -1871,16 +1870,20 @@ def dcnm_links_update_inter_fabric_links_information(
if (
wlink["templateName"]
== self.templates["ext_multisite_underlay_setup"]
) or (wlink["templateName"] == self.templates["ext_fabric_setup"]):
) or (
wlink["templateName"] == self.templates["ext_fabric_setup"]
) or (
wlink["templateName"] == self.templates["ext_vxlan_mpls_underlay_setup"]
):
if cfg["profile"].get("ipv4_subnet", None) is None:
wlink["nvPairs"]["IP_MASK"] = hlink["nvPairs"]["IP_MASK"]

if cfg["profile"].get("mtu", None) is None:
wlink["nvPairs"]["MTU"] = hlink["nvPairs"]["MTU"]

if cfg["profile"].get("peer1_decription", None) is None:
if cfg["profile"].get("peer1_description", None) is None:
wlink["nvPairs"]["PEER1_DESC"] = hlink["nvPairs"]["PEER1_DESC"]
if cfg["profile"].get("peer2_decription", None) is None:
if cfg["profile"].get("peer2_description", None) is None:
wlink["nvPairs"]["PEER2_DESC"] = hlink["nvPairs"]["PEER2_DESC"]

# Note down that 'want' is updated with information from 'have'. We will need
Expand All @@ -1891,7 +1894,7 @@ def dcnm_links_update_inter_fabric_links_information(
if cfg["profile"].get("peer2_cmds", None) is None:
wlink["nvPairs"]["PEER2_CONF"] = hlink["nvPairs"]["PEER2_CONF"]
wlink["peer2_conf_defaulted"] = True
else:
elif wlink["templateName"] != self.templates["ext_vxlan_mpls_overlay_setup"]:
if cfg["profile"].get("ipv4_addr", None) is None:
wlink["nvPairs"]["SOURCE_IP"] = hlink["nvPairs"]["SOURCE_IP"]

Expand All @@ -1902,10 +1905,18 @@ def dcnm_links_update_inter_fabric_links_information(

if cfg["profile"].get("neighbor_ip", None) is None:
wlink["nvPairs"]["NEIGHBOR_IP"] = hlink["nvPairs"]["NEIGHBOR_IP"]
if cfg["profile"].get("src_asn", None) is None:
wlink["nvPairs"]["asn"] = hlink["nvPairs"]["asn"]
if cfg["profile"].get("dst_asn", None) is None:
wlink["nvPairs"]["NEIGHBOR_ASN"] = hlink["nvPairs"]["NEIGHBOR_ASN"]

if (
wlink["templateName"] == self.templates["ext_multisite_underlay_setup"]
) or (
wlink["templateName"] == self.templates["ext_fabric_setup"]
) or (
wlink["templateName"] == self.templates["ext_vxlan_mpls_overlay_setup"]
):
if cfg["profile"].get("src_asn", None) is None:
wlink["nvPairs"]["asn"] = hlink["nvPairs"]["asn"]
if cfg["profile"].get("dst_asn", None) is None:
wlink["nvPairs"]["NEIGHBOR_ASN"] = hlink["nvPairs"]["NEIGHBOR_ASN"]

if wlink["templateName"] == self.templates["ext_fabric_setup"]:
if cfg["profile"].get("auto_deploy", None) is None:
Expand Down

0 comments on commit f784874

Please sign in to comment.