diff --git a/plugins/module_utils/network/ios/argspec/vrf_address_family/vrf_address_family.py b/plugins/module_utils/network/ios/argspec/vrf_address_family/vrf_address_family.py index 8c6990d57..027b36c6d 100644 --- a/plugins/module_utils/network/ios/argspec/vrf_address_family/vrf_address_family.py +++ b/plugins/module_utils/network/ios/argspec/vrf_address_family/vrf_address_family.py @@ -108,25 +108,6 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 }, }, }, - "maximum": { - "type": "dict", - "options": { - "routes": { - "type": "dict", - "options": { - "limit": {"type": "int"}, - "threshold": {"type": "int"}, - "reinstall": { - "type": "dict", - "options": { - "threshold_val": {"type": "int"} - }, - }, - "warning_only": {"type": "bool"}, - }, - } - }, - }, "inter_as_hybrid": { "type": "dict", "options": { @@ -1143,59 +1124,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 }, }, }, - "route_replicate_distance": { - "type": "dict", - "options": { - "from_config": { - "type": "dict", - "options": { - "multicast": { - "type": "dict", - "options": { - "distance": {"type": "int"}, - "topology": { - "type": "dict", - "options": { - "base": { - "type": "dict", - "options": { - "distance": { - "type": "int" - } - }, - } - }, - }, - }, - }, - "unicast": { - "type": "dict", - "options": { - "distance": {"type": "int"}, - "topology": { - "type": "dict", - "options": { - "base": { - "type": "dict", - "options": { - "distance": { - "type": "int" - } - }, - } - }, - }, - }, - }, - }, - } - }, - }, "route_target": { "type": "dict", "options": { "export": {"type": "str"}, - "stitching": {"type": "bool"}, "import_config": {"type": "str"}, "both": {"type": "str"}, }, diff --git a/plugins/module_utils/network/ios/config/vrf_address_family/vrf_address_family.py b/plugins/module_utils/network/ios/config/vrf_address_family/vrf_address_family.py index f82eeb389..02d0a20e4 100644 --- a/plugins/module_utils/network/ios/config/vrf_address_family/vrf_address_family.py +++ b/plugins/module_utils/network/ios/config/vrf_address_family/vrf_address_family.py @@ -103,8 +103,6 @@ def __init__(self, module): "route_replicate.from.vrf.vrf_name.unicast.static.route_map", "route_target.export", "route_target.import_config", - "route_target.import_config.stitching", - "route_target.export.stitching" ] diff --git a/plugins/module_utils/network/ios/rm_templates/vrf_address_family.py b/plugins/module_utils/network/ios/rm_templates/vrf_address_family.py index ce4cec90f..486125073 100644 --- a/plugins/module_utils/network/ios/rm_templates/vrf_address_family.py +++ b/plugins/module_utils/network/ios/rm_templates/vrf_address_family.py @@ -151,7 +151,7 @@ def __init__(self, lines=None, module=None): \s+export\sipv4\sunicast\s(?P\d+)\smap\s(?P\S+)\s(?Pallow-evpn) $""", re.VERBOSE, ), - "setval": "export ipv4 unicast {{ export.ipv4.unicast.prefix }} map {{ export.ipv4.unicast.map }} allow-evpn", + "setval": "export ipv4 unicast {{ prefix }} map {{ export_map }} allow-evpn", "result": { '{{ name }}': { 'name': '{{ name }}', @@ -184,7 +184,7 @@ def __init__(self, lines=None, module=None): \s+import\sipv4\smulticast\s(?P\d+)\smap\s(?P\S+) $""", re.VERBOSE, ), - "setval": "import ipv4 multicast {{ import.ipv4.multicast.prefix }} map {{ import.ipv4.multicast.map }}", + "setval": "import ipv4 multicast {{ prefix }} map {{ import_map }}", "result": { '{{ name }}': { 'name': '{{ name }}', @@ -216,7 +216,7 @@ def __init__(self, lines=None, module=None): \s+import\sipv4\sunicast\s(?P\d+)\smap\s(?P\S+)\s(?Pallow-evpn) $""", re.VERBOSE, ), - "setval": "import ipv4 unicast {{ import.ipv4.unicast.limit }} map {{ import.ipv4.unicast.map }} allow-evpn", + "setval": "import ipv4 unicast {{ limit }} map {{ import_map }} allow-evpn", "result": { '{{ name }}': { 'name': '{{ name }}', @@ -1087,7 +1087,7 @@ def __init__(self, lines=None, module=None): \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sall\sroute-map\s(?P\S+) $""", re.VERBOSE, ), - "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast all route-map {{ route_replicate.from.vrf.vrf_name.unicast.all.route_map }}", + "setval": "route-replicate from vrf {{ vrf_name }} unicast all route-map {{ route_map }}", "result": { '{{ name }}': { 'name': '{{ name }}', @@ -1801,34 +1801,6 @@ def __init__(self, lines=None, module=None): }, }, }, - { - "name": "route_target.export.stitching", - "getval": re.compile( - r""" - ^vrf\sdefinition\s(?P\S+) - \saddress-family - \s(?P\S+) - (\s(?P\S+))? - \s+route-target\sexport\s(?P\S+)\sstitching - $""", re.VERBOSE, - ), - "setval": "route-target export {{ route_target.export }} stitching", - "result": { - '{{ name }}': { - 'name': '{{ name }}', - "address_families": { - '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { - "afi": "{{ afi }}", - "safi": "{{ safi if safi is defined else 'unicast' }}", - "route_target": { - "export": "{{ route_target_export }}", - "stitching": "{{ true }}", - }, - }, - }, - }, - }, - }, { "name": "route_target.import_config", "getval": re.compile( @@ -1856,33 +1828,5 @@ def __init__(self, lines=None, module=None): }, }, }, - { - "name": "route_target.import_config.stitching", - "getval": re.compile( - r""" - ^vrf\sdefinition\s(?P\S+) - \saddress-family - \s(?P\S+) - (\s(?P\S+))? - \s+route-target\simport\s(?P\S+)\sstitching - $""", re.VERBOSE, - ), - "setval": "route-target import {{ route_target.import_config }} stitching", - "result": { - '{{ name }}': { - 'name': '{{ name }}', - "address_families": { - '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { - "afi": "{{ afi }}", - "safi": "{{ safi if safi is defined else 'unicast' }}", - "route_target": { - "import_config": "{{ route_target_import_config }}", - "stitching": "{{ true }}", - }, - }, - }, - }, - }, - }, ] # fmt: on diff --git a/plugins/modules/ios_vrf_address_family.py b/plugins/modules/ios_vrf_address_family.py index 51fb88634..51ae184d2 100644 --- a/plugins/modules/ios_vrf_address_family.py +++ b/plugins/modules/ios_vrf_address_family.py @@ -124,30 +124,6 @@ allow_evpn: description: allow Global->VRF routes into EVPN type: bool - maximum: &maximum - description: Set a limit to a routing table - type: dict - suboptions: - routes: - description: Maximum number of routes allowed in the routing table - type: dict - suboptions: - limit: - description: Maximum number of routes allowed - type: int - threshold: - description: Threshold value (%) at which to generate a warning msg - type: int - reinstall: - description: Reinstall previous rejected route due to over maximum route limit - type: dict - suboptions: - threshold_val: - description: Threshold value (%) at which to reinstall routes back to VRF - type: int - warning_only: - description: Only give a warning message if limit is exceeded - type: bool inter_as_hybrid: &inter_as_hybrid description: Inter AS hybrid mode type: dict @@ -480,40 +456,6 @@ ospf: *ospf rip: *rip static: *static - route_replicate_distance: &route_replicate_distance - description: Route replicate distance - type: dict - suboptions: - from_config: - description: Route replicate distance from another VRF - type: dict - suboptions: - multicast: - description: Multicast SAFI - type: dict - suboptions: - distance: - description: Route replicate distance range - type: int - topology: &id001 - description: Specify a Routing Topology - type: dict - suboptions: - base: - description: Base routing topology - type: dict - suboptions: - distance: - description: Route replicate distance range - type: int - unicast: - description: Unicast SAFI - type: dict - suboptions: - distance: - description: Route replicate distance range - type: int - topology: *id001 route_target: &route_target description: Specify Target VPN Extended Communities. type: dict @@ -521,9 +463,6 @@ export: description: Export Target-VPN community. type: str - stitching: - description: VXLAN route target set. - type: bool import_config: description: Export Target-VPN community. type: str diff --git a/tests/unit/modules/network/ios/test_ios_vrf_address_family.py b/tests/unit/modules/network/ios/test_ios_vrf_address_family.py index 464cddeb7..8af6c81eb 100644 --- a/tests/unit/modules/network/ios/test_ios_vrf_address_family.py +++ b/tests/unit/modules/network/ios/test_ios_vrf_address_family.py @@ -64,9 +64,13 @@ def test_ios_vrf_address_family_merged_idempotent(self): """\ vrf definition test address-family ipv4 unicast - bgp next-hop loopback 23 import map "import-map" export map "testing-map" + export ipv4 unicast 37 map test allow-evpn + inter-as-hybrid csc next-hop 1.2.3.4 + route-target export 10.12.0.1:20 + route-target import 10.0.0.1:30 + mdt auto-discovery ingress-replication inter-as mdt-hello-enable """, ) self.get_config.return_value = run_cfg @@ -82,10 +86,31 @@ def test_ios_vrf_address_family_merged_idempotent(self): bgp=dict(next_hop=dict(loopback=23)), export=dict( map="testing-map", + ipv4=dict( + unicast=dict( + prefix=37, + map="test", + allow_evpn=True, + ), + ), ), import_config=dict( map="import-map", ), + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), + ), + route_target=dict( + export="10.12.0.1:20", + import_config="10.0.0.1:30", + ), + mdt=dict( + auto_discovery=dict( + ingress_replication=dict( + inter_as=dict(mdt_hello_enable=True), + ), + ), + ), ), ], ), @@ -106,13 +131,19 @@ def test_ios_vrf_address_family_merged(self): dict( afi="ipv4", safi="unicast", - bgp=dict(next_hop=dict(loopback=23)), export=dict( map="testing-map", ), import_config=dict( map="import-map", ), + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), + ), + route_target=dict( + export="10.12.0.1:20", + import_config="10.0.0.1:10", + ), ), ], ), @@ -121,14 +152,16 @@ def test_ios_vrf_address_family_merged(self): ), ) commands = [ + "vrf definition VRF1", "address-family ipv4 unicast", - "bgp next-hop loopback 23", "export map testing-map", "import map import-map", - "vrf definition VRF1", + "inter-as-hybrid csc next-hop 1.2.3.4", + "route-target export 10.12.0.1:20", + "route-target import 10.0.0.1:10", ] result = self.execute_module(changed=True) - self.assertEqual(sorted(result["commands"]), sorted(commands)) + self.assertEqual((result["commands"]), (commands)) def test_ios_vrf_address_family_replaced(self): """Test the replaced state of the ios_vrf_address_family module.""" @@ -136,9 +169,11 @@ def test_ios_vrf_address_family_replaced(self): """\ vrf definition VRF1 address-family ipv4 unicast - bgp next-hop loopback 23 import map "import-map" export map "testing-map" + inter-as-hybrid csc next-hop 1.2.3.4 + route-target export 10.12.0.1:20 + route-target import 10.0.0.1:10 exit-address-family """, ) @@ -153,13 +188,19 @@ def test_ios_vrf_address_family_replaced(self): dict( afi="ipv4", safi="unicast", - bgp=dict(next_hop=dict(loopback=32)), export=dict( map="testing-map", ), import_config=dict( map="import-map", ), + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), + ), + route_target=dict( + export="10.12.0.1:20", + import_config="10.0.0.1:10", + ), ), ], ), @@ -170,9 +211,11 @@ def test_ios_vrf_address_family_replaced(self): commands = [ "vrf definition VRF2", "address-family ipv4 unicast", - "bgp next-hop loopback 32", "export map testing-map", "import map import-map", + "inter-as-hybrid csc next-hop 1.2.3.4", + "route-target export 10.12.0.1:20", + "route-target import 10.0.0.1:10", ] result = self.execute_module(changed=True) self.assertEqual((result["commands"]), (commands)) @@ -183,9 +226,11 @@ def test_ios_vrf_address_family_replaced_idempotent(self): """\ vrf definition VRF2 address-family ipv4 unicast - bgp next-hop loopback 32 import map "import-map" export map "testing-map" + inter-as-hybrid csc next-hop 1.2.3.4 + route-target export 10.12.0.1:20 + route-target import 10.0.0.1:10 """, ) self.get_config.return_value = run_cfg @@ -199,72 +244,27 @@ def test_ios_vrf_address_family_replaced_idempotent(self): dict( afi="ipv4", safi="unicast", - bgp=dict(next_hop=dict(loopback=32)), export=dict( map="testing-map", ), import_config=dict( map="import-map", ), - ), - ], - ), - ], - state="replaced", - ), - ) - self.execute_module(changed=False, commands=[]) - - def test_ios_vrf_address_family_overridden(self): - """Test the overridden state of the ios_vrf_address_family module.""" - run_cfg = dedent( - """\ - vrf definition VRF2 - address-family ipv4 unicast - bgp next-hop loopback 32 - import map "import-map" - export map "testing-map" - """, - ) - self.get_config.return_value = run_cfg - - set_module_args( - dict( - config=[ - dict( - name="VRF7", - address_families=[ - dict( - afi="ipv4", - safi="unicast", - bgp=dict(next_hop=dict(loopback=40)), - export=dict( - map="testing-map2", + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), ), - import_config=dict( - map="import-map1", + route_target=dict( + export="10.12.0.1:20", + import_config="10.0.0.1:10", ), ), ], ), ], - state="overridden", + state="replaced", ), ) - commands = [ - "vrf definition VRF2", - "address-family ipv4 unicast", - "no bgp next-hop loopback 32", - "no export map testing-map", - "no import map import-map", - "vrf definition VRF7", - "address-family ipv4 unicast", - "bgp next-hop loopback 40", - "export map testing-map2", - "import map import-map1", - ] - result = self.execute_module(changed=True) - self.assertEqual((result["commands"]), (commands)) + self.execute_module(changed=False, commands=[]) def test_ios_vrf_address_family_overridden_idempotent(self): """Test the idempotent nature of the ios_vrf_address_family module in overridden state.""" @@ -275,6 +275,7 @@ def test_ios_vrf_address_family_overridden_idempotent(self): bgp next-hop loopback 40 import map import-map1 export map testing-map2 + inter-as-hybrid csc next-hop 1.2.3.4 """, ) self.get_config.return_value = run_cfg @@ -295,6 +296,9 @@ def test_ios_vrf_address_family_overridden_idempotent(self): import_config=dict( map="import-map1", ), + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), + ), ), ], ), @@ -304,36 +308,6 @@ def test_ios_vrf_address_family_overridden_idempotent(self): ) self.execute_module(changed=False, commands=[]) - def test_ios_vrf_address_family_deleted(self): - """Test the deleted state of the ios_vrf_address_family module.""" - run_cfg = dedent( - """\ - vrf definition VRF7 - address-family ipv4 unicast - bgp next-hop loopback 40 - import map import-map1 - export map testing-map2 - """, - ) - self.get_config.return_value = run_cfg - set_module_args( - dict( - config=[ - dict( - name="VRF7", - ), - ], - state="deleted", - ), - ) - - commands = [ - "vrf definition VRF7", - "no address-family ipv4 unicast", - ] - result = self.execute_module(changed=True) - self.assertEqual(sorted(result["commands"]), sorted(commands)) - def test_ios_vrf_address_family_deleted_idempotent(self): """Test the idempotent nature of the ios_vrf_address_family module in deleted state.""" run_cfg = dedent( @@ -357,13 +331,15 @@ def test_ios_vrf_address_family_rendered(self): dict( afi="ipv4", safi="unicast", - bgp=dict(next_hop=dict(loopback=23)), export=dict( map="testing-map", ), import_config=dict( map="import-map", ), + inter_as_hybrid=dict( + csc=dict(next_hop="1.2.3.4"), + ), ), ], ), @@ -374,9 +350,9 @@ def test_ios_vrf_address_family_rendered(self): commands = [ "vrf definition VRF1", "address-family ipv4 unicast", - "bgp next-hop loopback 23", "export map testing-map", "import map import-map", + "inter-as-hybrid csc next-hop 1.2.3.4", ] result = self.execute_module(changed=False) self.assertEqual((result["rendered"]), (commands)) @@ -387,9 +363,10 @@ def test_ios_vrf_address_family_parsed(self): """\ vrf definition test address-family ipv4 unicast - bgp next-hop loopback 23 import map "import-map" export map "testing-map" + inter-as-hybrid csc next-hop 1.2.3.4 + mdt auto-discovery ingress-replication inter-as mdt-hello-enable exit-address-family """, ) @@ -408,7 +385,20 @@ def test_ios_vrf_address_family_parsed(self): "export": { "map": "testing-map", }, - "bgp": {"next_hop": {"loopback": 23}}, + "inter_as_hybrid": { + "csc": { + "next_hop": "1.2.3.4", + }, + }, + "mdt": { + "auto_discovery": { + "ingress_replication": { + "inter_as": { + "mdt_hello_enable": True, + }, + }, + }, + }, }, ], },