From 23ee8a64bc2ca68459a143f4591989fd47621e2d Mon Sep 17 00:00:00 2001 From: mkilar Date: Mon, 11 Aug 2025 11:31:39 +0200 Subject: [PATCH 1/2] add support for IPv6 redistribute route-map --- docs/cisco.dcnm.dcnm_vrf_module.rst | 17 +++++++++++++++++ plugins/modules/dcnm_vrf.py | 15 +++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/docs/cisco.dcnm.dcnm_vrf_module.rst b/docs/cisco.dcnm.dcnm_vrf_module.rst index 7bb77f744..ff67c8dfa 100644 --- a/docs/cisco.dcnm.dcnm_vrf_module.rst +++ b/docs/cisco.dcnm.dcnm_vrf_module.rst @@ -870,6 +870,23 @@ Parameters
Can be configured only when TRM is enabled
+ + + +
+ v6_redist_direct_rmap + +
+ string +
+ + + Default:
"FABRIC-RMAP-REDIST-SUBNET"
+ + +
IPv6 Redistribute Direct Route Map
+ + diff --git a/plugins/modules/dcnm_vrf.py b/plugins/modules/dcnm_vrf.py index 3971cf10b..89eb02873 100644 --- a/plugins/modules/dcnm_vrf.py +++ b/plugins/modules/dcnm_vrf.py @@ -116,6 +116,12 @@ type: str required: false default: 'FABRIC-RMAP-REDIST-SUBNET' + v6_redist_direct_rmap: + description: + - IPv6 Redistribute Direct Route Map + type: str + required: false + default: 'FABRIC-RMAP-REDIST-SUBNET' max_bgp_paths: description: - Max BGP Paths @@ -1460,6 +1466,7 @@ def update_create_params(self, vrf, vlan_id=""): "mtu": vrf.get("vrf_int_mtu", ""), "tag": vrf.get("loopback_route_tag", ""), "vrfRouteMap": vrf.get("redist_direct_rmap", ""), + "v6VrfRouteMap": vrf.get("v6_redist_direct_rmap", ""), "maxBgpPaths": vrf.get("max_bgp_paths", ""), "maxIbgpPaths": vrf.get("max_ibgp_paths", ""), "ipv6LinkLocalFlag": vrf.get("ipv6_linklocal_enable", True), @@ -1596,6 +1603,7 @@ def get_have(self): "mtu": json_to_dict.get("mtu", 9216), "tag": json_to_dict.get("tag", 12345), "vrfRouteMap": json_to_dict.get("vrfRouteMap", ""), + "v6VrfRouteMap": json_to_dict.get("v6VrfRouteMap", ""), "maxBgpPaths": json_to_dict.get("maxBgpPaths", 1), "maxIbgpPaths": json_to_dict.get("maxIbgpPaths", 2), "ipv6LinkLocalFlag": json_to_dict.get("ipv6LinkLocalFlag", True), @@ -2204,6 +2212,7 @@ def diff_merge_create(self, replace=False): "mtu": json_to_dict.get("mtu"), "tag": json_to_dict.get("tag"), "vrfRouteMap": json_to_dict.get("vrfRouteMap"), + "v6VrfRouteMap": json_to_dict.get("v6VrfRouteMap"), "maxBgpPaths": json_to_dict.get("maxBgpPaths"), "maxIbgpPaths": json_to_dict.get("maxIbgpPaths"), "ipv6LinkLocalFlag": json_to_dict.get("ipv6LinkLocalFlag"), @@ -2493,6 +2502,7 @@ def format_diff(self): found_c.update({"vrf_int_mtu": json_to_dict.get("mtu", "")}) found_c.update({"loopback_route_tag": json_to_dict.get("tag", "")}) found_c.update({"redist_direct_rmap": json_to_dict.get("vrfRouteMap", "")}) + found_c.update({"v6_redist_direct_rmap": json_to_dict.get("v6VrfRouteMap", "")}) found_c.update({"max_bgp_paths": json_to_dict.get("maxBgpPaths", "")}) found_c.update({"max_ibgp_paths": json_to_dict.get("maxIbgpPaths", "")}) found_c.update( @@ -2973,6 +2983,7 @@ def push_diff_create(self, is_rollback=False): "mtu": json_to_dict.get("mtu"), "tag": json_to_dict.get("tag"), "vrfRouteMap": json_to_dict.get("vrfRouteMap"), + "v6VrfRouteMap": json_to_dict.get("v6VrfRouteMap"), "maxBgpPaths": json_to_dict.get("maxBgpPaths"), "maxIbgpPaths": json_to_dict.get("maxIbgpPaths"), "ipv6LinkLocalFlag": json_to_dict.get("ipv6LinkLocalFlag"), @@ -3959,6 +3970,10 @@ def vrf_spec(self): "default": "FABRIC-RMAP-REDIST-SUBNET", "type": "str", } + spec["v6_redist_direct_rmap"] = { + "default": "FABRIC-RMAP-REDIST-SUBNET", + "type": "str", + } spec["rp_address"] = {"default": "", "type": "str"} spec["rp_external"] = {"default": False, "type": "bool"} spec["rp_loopback_id"] = {"default": "", "range_max": 1023, "type": "int"} From e7ddb1f4465923dbd5a3526c11d1ce6a6fdef09f Mon Sep 17 00:00:00 2001 From: mkilar Date: Mon, 11 Aug 2025 12:57:33 +0200 Subject: [PATCH 2/2] modifying the test files --- tests/unit/modules/dcnm/fixtures/dcnm_network.json | 4 ++-- tests/unit/modules/dcnm/fixtures/dcnm_vrf.json | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_network.json b/tests/unit/modules/dcnm/fixtures/dcnm_network.json index 3b0327563..d5d097b03 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_network.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_network.json @@ -370,7 +370,7 @@ "vrfName": "ansible-vrf-int1", "vrfTemplate": "Default_VRF_Universal", "vrfExtensionTemplate": "Default_VRF_Extension_Universal", - "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008011\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"ansible-vrf-int1\"}", + "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008011\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"v6VrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"ansible-vrf-int1\"}", "tenantName": null, "vrfId": 9008011, "serviceVrfTemplate": null, @@ -1124,7 +1124,7 @@ "vrfId": 9008011, "vrfName": "test_vrf_1", "vrfTemplate": "Default_VRF_Universal", - "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"routeTargetImport\":\"\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"disableRtAuto\":\"false\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008013\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"routeTargetExport\":\"\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"routeTargetExportMvpn\":\"\",\"ENABLE_NETFLOW\":\"false\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"routeTargetExportEvpn\":\"\",\"NETFLOW_MONITOR\":\"\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"routeTargetImportMvpn\":\"\",\"isRPAbsent\":\"false\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"52125\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\",\"routeTargetImportEvpn\":\"\"}", + "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"routeTargetImport\":\"\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"disableRtAuto\":\"false\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008013\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"routeTargetExport\":\"\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"v6VrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"routeTargetExportMvpn\":\"\",\"ENABLE_NETFLOW\":\"false\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"routeTargetExportEvpn\":\"\",\"NETFLOW_MONITOR\":\"\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"routeTargetImportMvpn\":\"\",\"isRPAbsent\":\"false\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"52125\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\",\"routeTargetImportEvpn\":\"\"}", "vrfStatus": "DEPLOYED" } ] diff --git a/tests/unit/modules/dcnm/fixtures/dcnm_vrf.json b/tests/unit/modules/dcnm/fixtures/dcnm_vrf.json index 521ca5cf3..a3fc3ae46 100644 --- a/tests/unit/modules/dcnm/fixtures/dcnm_vrf.json +++ b/tests/unit/modules/dcnm/fixtures/dcnm_vrf.json @@ -820,7 +820,7 @@ "vrfId": 9008011, "vrfName": "test_vrf_1", "vrfTemplate": "Default_VRF_Universal", - "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"vrfSegmentId\":\"9008013\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"trmBGWMSiteEnabled\":\"false\",\"tag\":\"12345\",\"rpAddress\":\"\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\"}", + "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"vrfSegmentId\":\"9008013\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"v6VrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"trmBGWMSiteEnabled\":\"false\",\"tag\":\"12345\",\"rpAddress\":\"\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\"}", "vrfStatus": "DEPLOYED" } ] @@ -1053,7 +1053,7 @@ "serviceVrfTemplate": "None", "source": "None", "vrfStatus": "DEPLOYED", - "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"vrfSegmentId\":\"9008013\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"trmBGWMSiteEnabled\":\"false\",\"tag\":\"12345\",\"rpAddress\":\"\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_dcnm\"}", + "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"L3VniMcastGroup\":\"\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"vrfSegmentId\":\"9008013\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"v6VrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"configureStaticDefaultRouteFlag\":\"true\",\"trmBGWMSiteEnabled\":\"false\",\"tag\":\"12345\",\"rpAddress\":\"\",\"nveId\":\"1\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"34343\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_dcnm\"}", "vrfId": "9008013" } ] @@ -1936,7 +1936,7 @@ "vrfId": 9008011, "vrfName": "test_vrf_1", "vrfTemplate": "Default_VRF_Universal", - "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"routeTargetImport\":\"\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"disableRtAuto\":\"false\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008013\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"routeTargetExport\":\"\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"routeTargetExportMvpn\":\"\",\"ENABLE_NETFLOW\":\"false\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"routeTargetExportEvpn\":\"\",\"NETFLOW_MONITOR\":\"\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"routeTargetImportMvpn\":\"\",\"isRPAbsent\":\"false\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"52125\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\",\"routeTargetImportEvpn\":\"\"}", + "vrfTemplateConfig": "{\"advertiseDefaultRouteFlag\":\"true\",\"routeTargetImport\":\"\",\"vrfVlanId\":\"202\",\"isRPExternal\":\"false\",\"vrfDescription\":\"\",\"disableRtAuto\":\"false\",\"L3VniMcastGroup\":\"\",\"vrfSegmentId\":\"9008013\",\"maxBgpPaths\":\"1\",\"maxIbgpPaths\":\"2\",\"routeTargetExport\":\"\",\"ipv6LinkLocalFlag\":\"true\",\"vrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"v6VrfRouteMap\":\"FABRIC-RMAP-REDIST-SUBNET\",\"routeTargetExportMvpn\":\"\",\"ENABLE_NETFLOW\":\"false\",\"configureStaticDefaultRouteFlag\":\"true\",\"tag\":\"12345\",\"rpAddress\":\"\",\"trmBGWMSiteEnabled\":\"false\",\"nveId\":\"1\",\"routeTargetExportEvpn\":\"\",\"NETFLOW_MONITOR\":\"\",\"bgpPasswordKeyType\":\"3\",\"bgpPassword\":\"\",\"mtu\":\"9216\",\"multicastGroup\":\"\",\"routeTargetImportMvpn\":\"\",\"isRPAbsent\":\"false\",\"advertiseHostRouteFlag\":\"false\",\"vrfVlanName\":\"\",\"trmEnabled\":\"false\",\"loopbackNumber\":\"\",\"asn\":\"52125\",\"vrfIntfDescription\":\"\",\"vrfName\":\"test_vrf_1\",\"routeTargetImportEvpn\":\"\"}", "vrfStatus": "DEPLOYED" } ]