From b642575c4784882ddb919b493f741c4151845d47 Mon Sep 17 00:00:00 2001 From: Ruchi Pakhle Date: Thu, 26 Dec 2024 09:11:58 +0530 Subject: [PATCH] fixes --- .../vrf_address_family/vrf_address_family.py | 1065 +++++++++- .../vrf_address_family/vrf_address_family.py | 61 +- .../vrf_address_family/vrf_address_family.py | 23 +- .../ios/rm_templates/vrf_address_family.py | 1707 ++++++++++++++++- plugins/modules/ios_vrf_address_family.py | 374 +++- 5 files changed, 3173 insertions(+), 57 deletions(-) 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 dfc2c09d4..8c6990d57 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 @@ -119,7 +119,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "reinstall": { "type": "dict", "options": { - "threshold": {"type": "int"} + "threshold_val": {"type": "int"} }, }, "warning_only": {"type": "bool"}, @@ -137,6 +137,1069 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "next_hop": {"type": "str"}, }, }, + "mdt": { + "type": "dict", + "options": { + "auto_discovery": { + "type": "dict", + "options": { + "ingress_replication": { + "type": "dict", + "options": { + "inter_as": { + "type": "dict", + "options": { + "mdt_hello_enable": { + "type": "bool" + } + }, + }, + "mdt_hello_enable": { + "type": "bool" + }, + }, + }, + "pim": { + "type": "dict", + "options": { + "inter_as": { + "type": "dict", + "options": { + "mdt_hello_enable": { + "type": "bool" + }, + "pim_tlv_announce": { + "type": "dict", + "options": { + "mdt_hello_enable": { + "type": "bool" + } + }, + }, + }, + }, + "mdt_hello_enable": { + "type": "bool" + }, + "pim_tlv_announce": { + "type": "dict", + "options": { + "mdt_hello_enable": { + "type": "bool" + } + }, + }, + }, + }, + "receiver_site": {"type": "bool"}, + }, + }, + "data": { + "type": "dict", + "options": { + "ingress_replication": { + "type": "dict", + "options": { + "number": {"type": "int"}, + "immediate_switch": { + "type": "bool" + }, + "list": { + "type": "dict", + "options": { + "access_list_number": { + "type": "int" + }, + "access_list_name": { + "type": "str" + }, + }, + }, + }, + }, + "list": { + "type": "dict", + "options": { + "access_list_number": { + "type": "int" + }, + "access_list_name": { + "type": "str" + }, + }, + }, + "threshold": {"type": "int"}, + }, + }, + "default": { + "type": "dict", + "options": { + "ingress_replication": {"type": "bool"} + }, + }, + "direct": {"type": "bool"}, + "log_reuse": {"type": "bool"}, + "mode": { + "type": "dict", + "options": {"gre": {"type": "bool"}}, + }, + "mtu": {"type": "int"}, + "overlay": { + "type": "dict", + "options": { + "bgp": { + "type": "dict", + "options": { + "shared_tree_prune_delay": { + "type": "int" + }, + "source_tree_prune_delay": { + "type": "int" + }, + }, + }, + "use_bgp": { + "type": "dict", + "options": { + "spt_only": {"type": "bool"} + }, + }, + }, + }, + "partitioned": { + "type": "dict", + "options": { + "ingress_replication": {"type": "bool"} + }, + }, + "strict_rpf": { + "type": "dict", + "options": {"interface": {"type": "bool"}}, + }, + }, + }, + "protection": { + "type": "dict", + "options": {"local_prefixes": {"type": "bool"}}, + }, + "route_replicate": { + "type": "dict", + "options": { + "recursion_policy": { + "type": "dict", + "options": {"destination": {"type": "bool"}}, + }, + "from_config": { + "type": "dict", + "options": { + "multicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": {"type": "str"}, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "topology": { + "type": "dict", + "options": { + "base": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + } + }, + }, + }, + }, + "unicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "connected": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": {"type": "str"}, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + }, + "vrf": { + "type": "dict", + "options": { + "name": {"type": "str"}, + "multicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "topology": { + "type": "dict", + "options": { + "base": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + } + }, + }, + }, + }, + "unicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "connected": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + }, + "global": { + "type": "dict", + "options": { + "multicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "topology": { + "type": "dict", + "options": { + "base": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + } + }, + }, + }, + }, + "unicast": { + "type": "dict", + "options": { + "all": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "bgp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "connected": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "eigrp": { + "type": "dict", + "options": { + "as_number": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "isis": { + "type": "dict", + "options": { + "iso_tag": { + "type": "str" + }, + "route_map": { + "type": "str" + }, + }, + }, + "mobile": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "odr": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "ospf": { + "type": "dict", + "options": { + "process_id": { + "type": "int" + }, + "route_map": { + "type": "str" + }, + }, + }, + "rip": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + "static": { + "type": "dict", + "options": { + "route_map": { + "type": "str" + } + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "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 3d668b489..f82eeb389 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 @@ -50,12 +50,61 @@ def __init__(self, module): "bgp.next_hop.loopback", "export.map", "import_config.map", - # "export.ipv4.multicast", - # "export.ipv4.unicast.allow_evpn", - # "import_config.ipv4.multicast", - # "import_config.ipv4.unicast", - # "inter_as_hybrid.csc.next_hop", - # "inter_as_hybrid.next_hop", + "export.ipv4.multicast", + "export.ipv4.unicast.allow_evpn", + "import_config.ipv4.multicast", + "import_config.ipv4.unicast", + "inter_as_hybrid.csc.next_hop", + "inter_as_hybrid.next_hop", + "mdt.auto_discovery.ingress_replication.inter_as.mdt_hello_enable", + "mdt.auto_discovery.pim.inter_as.mdt_hello_enable", + "mdt.auto_discovery.pim.inter_as.pim_tlv_announce.mdt_hello_enable", + "mdt.auto_discovery.ingress_replication.mdt_hello_enable", + "mdt.auto_discovery.pim.mdt_hello_enable", + "mdt.auto_discovery.pim.pim_tlv_announce.mdt_hello_enable", + "mdt.auto_discovery.receiver_site", + "mdt.data.ingress_replication.number", + "mdt.data.ingress_replication.immediate_switch", + "mdt.data.ingress_replication.number.immediate_switch", + "mdt.data.list.access_list", + "mdt.data.list.access_list_name", + "mdt.data.threshold", + "mdt.default_ingress_replication", + "mdt.direct", + "mdt.log_reuse", + "mdt.mode.gre", + "mdt.mtu.value", + "mdt.overlay.bgp.shared_tree_prune_delay", + "mdt.overlay.bgp.source_tree_prune_delay", + "mdt.overlay.use_bgp_spt_only", + "mdt.partitioned.ingress_replication", + "mdt.strict_rpf_interface", + "protection.local_prefixes", + "route_replicate.recursion_policy.destination", + "route_replicate.from.unicast.all.route_map", + "route_replicate.from.unicast.bgp.asn.route_map", + "route_replicate.from.unicast.connected.route_map", + "route_replicate.from.unicast.eigrp.asn.route_map", + "route_replicate.from.unicast.isis.route_map", + "route_replicate.from.unicast.mobile.route_map", + "route_replicate.from.unicast.odr.route_map", + "route_replicate.from.unicast.ospf.id.route_map", + "route_replicate.from.unicast.rip.route_map", + "route_replicate.from.unicast.static.route_map", + "route_replicate.from.vrf.vrf_name.unicast.all.route_map", + "route_replicate.from.vrf.vrf_name.unicast.bgp.asn.route_map", + "route_replicate.from.vrf.vrf_name.unicast.connected.route_map", + "route_replicate.from.vrf.vrf_name.unicast.eigrp.asn.route_map", + "route_replicate.from.vrf.vrf_name.unicast.isis.route_map", + "route_replicate.from.vrf.vrf_name.unicast.mobile.route_map", + "route_replicate.from.vrf.vrf_name.unicast.odr.route_map", + "route_replicate.from.vrf.vrf_name.unicast.ospf.id.route_map", + "route_replicate.from.vrf.vrf_name.unicast.rip.route_map", + "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/facts/vrf_address_family/vrf_address_family.py b/plugins/module_utils/network/ios/facts/vrf_address_family/vrf_address_family.py index 2309bcb5f..1fa43cea2 100644 --- a/plugins/module_utils/network/ios/facts/vrf_address_family/vrf_address_family.py +++ b/plugins/module_utils/network/ios/facts/vrf_address_family/vrf_address_family.py @@ -28,6 +28,10 @@ flatten_config, ) +# import debugpy +# debugpy.listen(3000) +# debugpy.wait_for_client() + class Vrf_address_familyFacts(object): """ The ios vrf_address_family facts class @@ -42,6 +46,16 @@ def get_config(self, connection): return connection.get("show running-config | section ^vrf") + def _flatten_config(self, config): + dataLines = config.split("\n") + finalConfig = [] + + for line in dataLines: + if "address-family" in line and "exit-address-family" not in line: + finalConfig.append(line) + + return "\n".join(finalConfig) + def populate_facts(self, connection, ansible_facts, data=None): """ Populate the facts for Vrf_address_family network resource @@ -59,13 +73,14 @@ def populate_facts(self, connection, ansible_facts, data=None): if not data: data = self.get_config(connection) - export_data = flatten_config(data, "export") - import_data = flatten_config(export_data, "import") - address_data = flatten_config(import_data, "address-family") + # export_data = flatten_config(data, "export") + # import_data = flatten_config(export_data, "import") + address_data = flatten_config(data, "address-family") data = flatten_config(address_data, "vrf") + finalConfig = self._flatten_config(data) # parse native config using the Vrf_address_family template - vrf_address_family_parser = Vrf_address_familyTemplate(lines=data.splitlines(), module=self._module) + vrf_address_family_parser = Vrf_address_familyTemplate(lines=finalConfig.splitlines(), module=self._module) obj = vrf_address_family_parser.parse() objs = list(obj.values()) 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 77389b010..ce4cec90f 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 @@ -30,27 +30,14 @@ def __init__(self, lines=None, module=None): # fmt: off PARSERS = [ - { - "name": "name", - "getval": re.compile( - r""" - ^vrf\sdefinition\s(?P\S+) - $""", re.VERBOSE, - ), - "setval": "vrf definition {{ name }}", - "result": { - '{{ name }}': { - 'name': '{{ name }}', - }, - }, - "shared": True, - }, { "name": "address_family", "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? $""", re.VERBOSE, ), "setval": "address-family {{ afi }} {{ safi }}", @@ -58,20 +45,23 @@ def __init__(self, lines=None, module=None): '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{"address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", }, }, }, }, + "shared": True, }, { "name": "export.map", "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+export\smap\s(?P\S+) $""", re.VERBOSE, ), @@ -80,9 +70,9 @@ def __init__(self, lines=None, module=None): '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{"address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "export": { "map": "{{ export_map }}", }, @@ -96,7 +86,9 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+import\smap\s(?P\S+) $""", re.VERBOSE, ), @@ -105,9 +97,9 @@ def __init__(self, lines=None, module=None): '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{"address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "import_config": { "map": "{{ import_config_map }}", }, @@ -121,7 +113,9 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+export\sipv4\smulticast\s(?P\d+)\smap\s(?P\S+) $""", re.VERBOSE, ), @@ -130,9 +124,9 @@ def __init__(self, lines=None, module=None): '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{ "address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "export": { "ipv4": { "multicast": { @@ -151,18 +145,20 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+export\sipv4\sunicast\s(?P\d+)\smap\s(?P\S+)\s(?Pallow-evpn) $""", re.VERBOSE, ), - "setval": "export ipv4 unicast {{ export.prefix }} map {{ export.map }} allow-evpn", + "setval": "export ipv4 unicast {{ export.ipv4.unicast.prefix }} map {{ export.ipv4.unicast.map }} allow-evpn", "result": { '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{ "address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "export": { "ipv4": { "unicast": { @@ -182,18 +178,20 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+import\sipv4\smulticast\s(?P\d+)\smap\s(?P\S+) $""", re.VERBOSE, ), - "setval": "import ipv4 multicast {{ import.prefix }} map {{ import.map }}", + "setval": "import ipv4 multicast {{ import.ipv4.multicast.prefix }} map {{ import.ipv4.multicast.map }}", "result": { '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{ "address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "import_config": { "ipv4": { "multicast": { @@ -212,18 +210,20 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? \s+import\sipv4\sunicast\s(?P\d+)\smap\s(?P\S+)\s(?Pallow-evpn) $""", re.VERBOSE, ), - "setval": "import ipv4 unicast {{ import.limit }} map {{ import.map }} allow-evpn", + "setval": "import ipv4 unicast {{ import.ipv4.unicast.limit }} map {{ import.ipv4.unicast.map }} allow-evpn", "result": { '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{ "address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "import_config": { "ipv4": { "unicast": { @@ -243,18 +243,20 @@ def __init__(self, lines=None, module=None): "getval": re.compile( r""" ^vrf\sdefinition\s(?P\S+) - (?P\s+address-family\s(?P\S+)\s(?P\S+)) - \s+bgp\snext-hop\sloopback\s(?P\d+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+bgp\snext-hop\sLoopback(?P\d+) $""", re.VERBOSE, ), - "setval": "bgp next-hop loopback {{ bgp.next_hop.loopback }}", + "setval": "bgp next-hop Loopback {{ loopback }}", "result": { '{{ name }}': { 'name': '{{ name }}', "address_families": { - '{{"address_families_" + afi + "_" + safi }}': { + '{{ "address_families_" + afi + ("_" + safi if safi is defined else "_unicast") }}': { "afi": "{{ afi }}", - "safi": "{{ safi }}", + "safi": "{{ safi if safi is defined else 'unicast' }}", "bgp": { "next_hop": { "loopback": "{{ loopback }}", @@ -265,5 +267,1622 @@ def __init__(self, lines=None, module=None): }, }, }, + { + "name": "inter_as_hybrid.csc.next_hop", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+inter-as-hybrid\scsc\snext-hop\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "inter-as-hybrid csc next-hop {{ inter_as_hybrid.csc.next_hop }}", + "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' }}", + "inter_as_hybrid": { + "csc": { + "next_hop": "{{ inter_as_hybrid_csc_next_hop }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "inter_as_hybrid.next_hop", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+inter-as-hybrid\snext-hop\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "inter-as-hybrid next-hop {{ inter_as_hybrid.next_hop }}", + "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' }}", + "inter_as_hybrid": { + "next_hop": "{{ inter_as_hybrid_next_hop }}", + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.ingress_replication.inter_as.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\singress-replication\sinter-as\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery ingress-replication inter-as mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "ingress_replication": { + "inter_as": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.pim.inter_as.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\spim\sinter-as\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery pim inter-as mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "pim": { + "inter_as": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.pim.inter_as.pim_tlv_announce.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\spim\sinter-as\spim-tlv-announce\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery pim inter-as pim-tlv-announce mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "pim": { + "inter_as": { + "pim_tlv_announce": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.ingress_replication.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\singress-replication\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery ingress-replication mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "ingress_replication": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.pim.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\spim\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery pim mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "pim": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.pim.pim_tlv_announce.mdt_hello_enable", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\spim\spim-tlv-announce\smdt-hello-enable + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery pim pim-tlv-announce mdt-hello-enable", + "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' }}", + "mdt": { + "auto_discovery": { + "pim": { + "pim_tlv_announce": { + "mdt_hello_enable": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.auto_discovery.receiver_site", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sauto-discovery\sreceiver-site + $""", re.VERBOSE, + ), + "setval": "mdt auto-discovery receiver-site", + "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' }}", + "mdt": { + "auto_discovery": { + "receiver_site": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.ingress_replication.number", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\singress-replication\s(?P\d+) + $""", re.VERBOSE, + ), + "setval": "mdt data ingress-replication {{ mdt.data.ingress_replication.number }}", + "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' }}", + "mdt": { + "data": { + "ingress_replication": { + "number": "{{ mdt_data_ingress_replication_number }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.ingress_replication.immediate_switch", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\singress-replication\simmediate-switch + $""", re.VERBOSE, + ), + "setval": "mdt data ingress-replication immediate-switch", + "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' }}", + "mdt": { + "data": { + "ingress_replication": { + "immediate_switch": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.ingress_replication.number.immediate_switch", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\singress-replication\s(?P\d+)\simmediate-switch + $""", re.VERBOSE, + ), + "setval": "mdt data ingress-replication {{ mdt.data.ingress_replication.number }} immediate-switch", + "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' }}", + "mdt": { + "data": { + "ingress_replication": { + "number": "{{ mdt_data_ingress_replication_number }}", + "immediate_switch": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.list.access_list", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\slist\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "mdt data list {{ mdt.data.list.access_list }}", + "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' }}", + "mdt": { + "data": { + "list": { + "access_list": "{{ mdt_data_list_access_list }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.list.access_list_name", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\slist\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "mdt data list {{ mdt.data.list.access_list_name }}", + "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' }}", + "mdt": { + "data": { + "list": { + "access_list_name": "{{ mdt_data_list_access_list_name }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.data.threshold", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdata\sthreshold\s(?P\d+) + $""", re.VERBOSE, + ), + "setval": "mdt data threshold {{ mdt.data.threshold }}", + "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' }}", + "mdt": { + "data": { + "threshold": "{{ mdt_data_threshold }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.default_ingress_replication", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdefault\singress-replication + $""", re.VERBOSE, + ), + "setval": "mdt default ingress-replication", + "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' }}", + "mdt": { + "default": { + "ingress_replication": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.direct", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sdirect + $""", re.VERBOSE, + ), + "setval": "mdt direct", + "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' }}", + "mdt": { + "direct": "{{ true }}", + }, + }, + }, + }, + }, + }, + { + "name": "mdt.log_reuse", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\slog-reuse + $""", re.VERBOSE, + ), + "setval": "mdt log-reuse", + "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' }}", + "mdt": { + "log_reuse": "{{ true }}", + }, + }, + }, + }, + }, + }, + { + "name": "mdt.mode.gre", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\smode\sgre + $""", re.VERBOSE, + ), + "setval": "mdt mode gre", + "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' }}", + "mdt": { + "mode": { + "gre": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.mtu.value", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\smtu\s(?P\d+) + $""", re.VERBOSE, + ), + "setval": "mdt mtu {{ mdt.mtu.value }}", + "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' }}", + "mdt": { + "mtu": "{{ mdt_value }}", + }, + }, + }, + }, + }, + }, + { + "name": "mdt.overlay.bgp.shared_tree_prune_delay", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\soverlay\sbgp\sshared-tree-prune-delay\s(?P\d+) + $""", re.VERBOSE, + ), + "setval": "mdt overlay bgp shared-tree-prune-delay {{ mdt.overlay.bgp.shared_tree_prune_delay }}", + "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' }}", + "mdt": { + "overlay": { + "bgp": { + "shared_tree_prune_delay": "{{ shared_tree_prune_delay }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.overlay.bgp.source_tree_prune_delay", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\soverlay\sbgp\ssource-tree-prune-delay\s(?P\d+) + $""", re.VERBOSE, + ), + "setval": "mdt overlay bgp source-tree-prune-delay {{ mdt.overlay.bgp.source_tree_prune_delay }}", + "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' }}", + "mdt": { + "overlay": { + "bgp": { + "source_tree_prune_delay": "{{ source_tree_prune_delay }}", + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.overlay.use_bgp_spt_only", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\soverlay\suse-bgp\sspt-only + $""", re.VERBOSE, + ), + "setval": "mdt overlay use-bgp spt-only", + "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' }}", + "mdt": { + "overlay": { + "use_bgp_spt_only": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.partitioned.ingress_replication", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\spartitioned\singress-replication + $""", re.VERBOSE, + ), + "setval": "mdt partitioned ingress-replication", + "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' }}", + "mdt": { + "partitioned": { + "ingress_replication": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "mdt.strict_rpf_interface", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+mdt\sstrict-rpf\sinterface + $""", re.VERBOSE, + ), + "setval": "mdt strict-rpf interface", + "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' }}", + "mdt": { + "strict_rpf": { + "interface": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "protection.local_prefixes", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + $""", re.VERBOSE, + ), + "setval": "protection local-prefixes", + "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' }}", + "protection": { + "local_prefixes": "{{ true }}", + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.recursion_policy.destination", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\srecursion-policy\sdestination + $""", re.VERBOSE, + ), + "setval": "route-replicate recursion-policy destination", + "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_replicate": { + "recursion_policy": { + "destination": "{{ true }}", + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.all.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \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 }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "all": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.bgp.asn.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sbgp\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast bgp {{ route_replicate.from.vrf.vrf_name.unicast.bgp.asn }} route-map {{ route_replicate.from.vrf.vrf_name.unicast.bgp.asn.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "bgp": { + "as_number": "{{ asn }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.connected.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sconnected\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast connected route-map {{ route_replicate.from.vrf.vrf_name.unicast.connected.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "connected": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.eigrp.asn.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\seigrp\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast eigrp {{ route_replicate.from.vrf.vrf_name.unicast.eigrp.asn }} route-map {{ route_replicate.from.vrf.vrf_name.unicast.eigrp.asn.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "eigrp": { + "as_number": "{{ asn }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.isis.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sisis\s(?P\S+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast isis {{ route_replicate.from.vrf.vrf_name.unicast.isis.tag }} route-map {{ route_replicate.from.vrf.vrf_name.unicast.isis.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "isis": { + "tag": "{{ tag }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.mobile.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\smobile\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast mobile route-map {{ route_replicate.from.vrf.vrf_name.unicast.mobile.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "mobile": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.odr.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sodr\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast odr route-map {{ route_replicate.from.vrf.vrf_name.unicast.odr.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "odr": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.ospf.id.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sospf\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast ospf {{ route_replicate.from.vrf.vrf_name.unicast.ospf.id }} route-map {{ route_replicate.from.vrf.vrf_name.unicast.ospf.id.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "ospf": { + "process_id": "{{ process_id }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.rip.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\srip\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast rip route-map {{ route_replicate.from.vrf.vrf_name.unicast.rip.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "rip": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.vrf.vrf_name.unicast.static.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\svrf\s(?P\S+)\sunicast\sstatic\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from vrf {{ route_replicate.from.vrf.vrf_name }} unicast static route-map {{ route_replicate.from.vrf.vrf_name.unicast.static.route_map }}", + "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_replicate": { + "from_config": { + "vrf": { + "name": "{{ vrf_name }}", + "unicast": { + "static": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.all.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sall\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast all route-map {{ route_replicate.from.unicast.all.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "all": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.bgp.asn.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sbgp\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast bgp {{ route_replicate.from.unicast.bgp.asn }} route-map {{ route_replicate.from.unicast.bgp.asn.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "bgp": { + "as_number": "{{ asn }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.connected.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sconnected\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast connected route-map {{ route_replicate.from.unicast.connected.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "connected": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.eigrp.asn.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\seigrp\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast eigrp {{ route_replicate.from.unicast.eigrp.asn }} route-map {{ route_replicate.from.unicast.eigrp.asn.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "eigrp": { + "as_number": "{{ asn }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.isis.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sisis\s(?P\S+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast isis {{ route_replicate.from.unicast.isis.tag }} route-map {{ route_replicate.from.unicast.isis.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "isis": { + "tag": "{{ tag }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.mobile.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\smobile\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast mobile route-map {{ route_replicate.from.unicast.mobile.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "mobile": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.odr.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sodr\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast odr route-map {{ route_replicate.from.unicast.odr.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "odr": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.ospf.id.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sospf\s(?P\d+)\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast ospf {{ route_replicate.from.unicast.ospf.id }} route-map {{ route_replicate.from.unicast.ospf.id.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "ospf": { + "process_id": "{{ process_id }}", + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.rip.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\srip\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast rip route-map {{ route_replicate.from.unicast.rip.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "rip": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_replicate.from.unicast.static.route_map", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-replicate\sfrom\sunicast\sstatic\sroute-map\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-replicate from unicast static route-map {{ route_replicate.from.unicast.static.route_map }}", + "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_replicate": { + "from_config": { + "unicast": { + "static": { + "route_map": "{{ route_map }}", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + "name": "route_target.export", + "getval": re.compile( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-target\sexport\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-target export {{ route_target.export }}", + "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 }}", + }, + }, + }, + }, + }, + }, + { + "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( + r""" + ^vrf\sdefinition\s(?P\S+) + \saddress-family + \s(?P\S+) + (\s(?P\S+))? + \s+route-target\simport\s(?P\S+) + $""", re.VERBOSE, + ), + "setval": "route-target import {{ route_target.import_config }}", + "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 }}", + }, + }, + }, + }, + }, + }, + { + "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 f1d8d87c3..51fb88634 100644 --- a/plugins/modules/ios_vrf_address_family.py +++ b/plugins/modules/ios_vrf_address_family.py @@ -16,7 +16,7 @@ module: ios_vrf_address_family short_description: Resource module to configure VRF definitions. description: This module provides declarative management of VRF definitions on Cisco IOS. -version_added: 10.0.0 +version_added: 7.0.0 author: Ruchi Pakhle (@Ruchip16) notes: - Tested against Cisco IOSXE version 17.3 on CML. @@ -142,7 +142,7 @@ description: Reinstall previous rejected route due to over maximum route limit type: dict suboptions: - threshold: + threshold_val: description: Threshold value (%) at which to reinstall routes back to VRF type: int warning_only: @@ -160,6 +160,376 @@ description: Next-hop for the routes of a VRF in the backbone. type: str next_hop: *next_hop + mdt: + description: Backbone Multicast Distribution Tree + type: dict + suboptions: + auto_discovery: + description: BGP auto-discovery for MVPN + type: dict + suboptions: + ingress_replication: + description: BGP auto-discovery for Ingress-Replication + type: dict + suboptions: + inter_as: + description: Enable Inter-AS BGP auto-discovery + type: dict + suboptions: + mdt_hello_enable: &mdt_hello_enable + description: Enable PIM Hellos over MDT interface + type: bool + mdt_hello_enable: *mdt_hello_enable + pim: + description: BGP auto-discovery for PIM + type: dict + suboptions: + inter_as: + description: Enable Inter-AS BGP auto-discovery + type: dict + suboptions: + mdt_hello_enable: *mdt_hello_enable + pim_tlv_announce: &pim_tlv_announce + description: Announce PIM TLV for data MDT + type: dict + suboptions: + mdt_hello_enable: *mdt_hello_enable + mdt_hello_enable: *mdt_hello_enable + pim_tlv_announce: *pim_tlv_announce + receiver_site: + description: BGP receiver only site for MVPN + type: bool + data: + description: MDT data trees + type: dict + suboptions: + ingress_replication: + description: Use Ingress-Replication to create the data MDT + type: dict + suboptions: + number: + description: Number of data MDT + type: int + immediate_switch: + description: Switch immediately to Data MDT tree + type: bool + list: &list + description: Access-list + type: dict + suboptions: + access_list_number: + description: Access-list number + type: int + access_list_name: + description: IP Named Extended Access list + type: str + list: *list + threshold: + description: MDT switching threshold + type: int + default: + description: Default MDT configuration + type: dict + suboptions: + ingress_replication: + description: Use Ingress-Replication for the default MDT + type: bool + direct: + description: Direct MDT's + type: bool + log_reuse: + description: Event logging for data MDT reuse + type: bool + mode: + description: The type of encapsulation + type: dict + suboptions: + gre: + description: GRE encapsulation + type: bool + mtu: + description: The MTU + type: int + overlay: + description: MDT overlay Protocol + type: dict + suboptions: + bgp: + description: BGP Overlay signalling + type: dict + suboptions: + shared_tree_prune_delay: + description: Delay before shared tree is pruned at C-RP PE + type: int + source_tree_prune_delay: + description: Delay before source tree is pruned at C-S PE + type: int + use_bgp: + description: Use BGP for MDT overlay signaling + type: dict + suboptions: + spt_only: + description: Enable SPT-only ASM mode + type: bool + partitioned: + description: Partitioned Multicast Distribution Tree + type: dict + suboptions: + ingress_replication: + description: Use Ingress-Replication for the partitioned MDT + type: bool + strict_rpf: + description: Enable strict RPF check + type: dict + suboptions: + interface: + description: Interface based strict RPF check + type: bool + protection: + description: Configure local repair + type: dict + suboptions: + local_prefixes: + description: Enable protection for local prefixes + type: bool + route_replicate: &route_replicate + description: Replicate (import) routes from another topology (and another VRF) + type: dict + suboptions: + recursion_policy: + description: Route replication recursion policy + type: dict + suboptions: + destination: + description: Recurse in destination topology + type: bool + from_config: + description: Replicate routes from another VRF + type: dict + suboptions: + multicast: + description: Multicast SAFI + type: dict + suboptions: + all: &all + description: All routes + type: dict + suboptions: + route_map: &route_map + description: Route-map reference + type: str + bgp: &bgp + description: Border Gateway Protocol (BGP) + type: dict + suboptions: + as_number: + description: Autonomous System Number + type: int + route_map: *route_map + eigrp: &eigrp + description: Enhanced Interior Gateway Routing Protocol (EIGRP) + type: dict + suboptions: + as_number: + description: Autonomous System Number + type: int + route_map: *route_map + isis: &isis + description: Intermediate System-to-Intermediate System (ISIS) + type: dict + suboptions: + iso_tag: + description: ISO routing area tag + type: str + route_map: *route_map + mobile: &mobile + description: Mobile routes + type: dict + suboptions: + route_map: *route_map + odr: &odr + description: On-Demand Stub routes + type: dict + suboptions: + route_map: *route_map + ospf: &ospf + description: Open Shortest Path First (OSPF) + type: dict + suboptions: + process_id: + description: OSPF process ID + type: int + route_map: *route_map + rip: &rip + description: Routing Information Protocol (RIP) + type: dict + suboptions: + route_map: *route_map + static: &static + description: Static routes + type: dict + suboptions: + route_map: *route_map + topology: &topology + description: Topology name + type: dict + suboptions: + base: + description: Base topology + type: dict + suboptions: + all: *all + bgp: *bgp + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + ospf: *ospf + rip: *rip + static: *static + unicast: + description: Unicast SAFI + type: dict + suboptions: + all: *all + bgp: *bgp + connected: + description: Connected routes + type: dict + suboptions: + route_map: *route_map + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + ospf: *ospf + rip: *rip + static: *static + vrf: + description: Specify a source VRF + type: dict + suboptions: + name: + description: Source VRF name + type: str + multicast: + description: Multicast SAFI + type: dict + suboptions: + all: *all + bgp: *bgp + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + ospf: *ospf + rip: *rip + static: *static + topology: *topology + unicast: + description: Unicast SAFI + type: dict + suboptions: + all: *all + bgp: *bgp + connected: + description: Connected routes + type: dict + suboptions: + route_map: *route_map + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + ospf: *ospf + rip: *rip + static: *static + global: + description: global VRF + type: dict + suboptions: + multicast: + description: Multicast SAFI + type: dict + suboptions: + all: *all + bgp: *bgp + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + ospf: *ospf + rip: *rip + static: *static + topology: *topology + unicast: + description: Unicast SAFI + type: dict + suboptions: + all: *all + bgp: *bgp + connected: + description: Connected routes + type: dict + suboptions: + route_map: *route_map + eigrp: *eigrp + isis: *isis + mobile: *mobile + odr: *odr + 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 + suboptions: + 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 + both: + description: Both export and import Target-VPN community + type: str running_config: description: - This option is used only with state I(parsed).