diff --git a/README.md b/README.md index 58187e9ec..4c3094111 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,7 @@ Name | Description [cisco.ios.ios_user](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_user_module.rst)|Module to manage the aggregates of local users. [cisco.ios.ios_vlans](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vlans_module.rst)|Resource module to configure VLANs. [cisco.ios.ios_vrf](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vrf_module.rst)|Module to configure VRF definitions. +[cisco.ios.ios_vrf_address_family](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vrf_address_family_module.rst)|Resource module to configure VRF definitions. [cisco.ios.ios_vrf_global](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vrf_global_module.rst)|Resource module to configure global VRF definitions. [cisco.ios.ios_vrf_interfaces](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vrf_interfaces_module.rst)|Manages VRF configuration on interfaces. [cisco.ios.ios_vxlan_vtep](https://github.com/ansible-collections/cisco.ios/blob/main/docs/cisco.ios.ios_vxlan_vtep_module.rst)|Resource module to configure VXLAN VTEP interface. diff --git a/changelogs/fragments/add_vrf_address_family.yaml b/changelogs/fragments/add_vrf_address_family.yaml index b001b048a..ccab55287 100644 --- a/changelogs/fragments/add_vrf_address_family.yaml +++ b/changelogs/fragments/add_vrf_address_family.yaml @@ -1,3 +1,3 @@ --- minor_changes: - - Adds a new module `ios_vrf_address_family` to manage VRFs address families on Cisco IOS devices. \ No newline at end of file + - Adds a new module `ios_vrf_address_family` to manage VRFs address families on Cisco IOS devices. 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..9124a98b5 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 @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type ############################################# @@ -29,8 +30,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 - """The arg spec for the ios_vrf_address_family module - """ + """The arg spec for the ios_vrf_address_family module""" argument_spec = { "config": { @@ -53,7 +53,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "next_hop": { "type": "dict", "options": {"loopback": {"type": "int"}}, - } + }, }, }, "export": { @@ -119,12 +119,12 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "reinstall": { "type": "dict", "options": { - "threshold_val": {"type": "int"} + "threshold_val": {"type": "int"}, }, }, "warning_only": {"type": "bool"}, }, - } + }, }, }, "inter_as_hybrid": { @@ -150,12 +150,12 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "mdt_hello_enable": { - "type": "bool" - } + "type": "bool", + }, }, }, "mdt_hello_enable": { - "type": "bool" + "type": "bool", }, }, }, @@ -166,27 +166,27 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "mdt_hello_enable": { - "type": "bool" + "type": "bool", }, "pim_tlv_announce": { "type": "dict", "options": { "mdt_hello_enable": { - "type": "bool" - } + "type": "bool", + }, }, }, }, }, "mdt_hello_enable": { - "type": "bool" + "type": "bool", }, "pim_tlv_announce": { "type": "dict", "options": { "mdt_hello_enable": { - "type": "bool" - } + "type": "bool", + }, }, }, }, @@ -202,16 +202,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "options": { "number": {"type": "int"}, "immediate_switch": { - "type": "bool" + "type": "bool", }, "list": { "type": "dict", "options": { "access_list_number": { - "type": "int" + "type": "int", }, "access_list_name": { - "type": "str" + "type": "str", }, }, }, @@ -221,10 +221,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "access_list_number": { - "type": "int" + "type": "int", }, "access_list_name": { - "type": "str" + "type": "str", }, }, }, @@ -234,7 +234,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "default": { "type": "dict", "options": { - "ingress_replication": {"type": "bool"} + "ingress_replication": {"type": "bool"}, }, }, "direct": {"type": "bool"}, @@ -251,17 +251,17 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "shared_tree_prune_delay": { - "type": "int" + "type": "int", }, "source_tree_prune_delay": { - "type": "int" + "type": "int", }, }, }, "use_bgp": { "type": "dict", "options": { - "spt_only": {"type": "bool"} + "spt_only": {"type": "bool"}, }, }, }, @@ -269,7 +269,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "partitioned": { "type": "dict", "options": { - "ingress_replication": {"type": "bool"} + "ingress_replication": {"type": "bool"}, }, }, "strict_rpf": { @@ -299,18 +299,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -318,10 +318,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -330,7 +330,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "options": { "iso_tag": {"type": "str"}, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -338,26 +338,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -365,16 +365,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "topology": { @@ -387,18 +387,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -406,10 +406,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -417,10 +417,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -428,26 +428,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -455,20 +455,20 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, - } + }, }, }, }, @@ -480,18 +480,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -499,18 +499,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "eigrp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -519,7 +519,7 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "options": { "iso_tag": {"type": "str"}, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -527,26 +527,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -554,16 +554,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, @@ -579,18 +579,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -598,10 +598,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -609,10 +609,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -620,26 +620,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -647,16 +647,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "topology": { @@ -669,18 +669,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -688,10 +688,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -699,10 +699,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -710,26 +710,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -737,20 +737,20 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, - } + }, }, }, }, @@ -762,18 +762,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -781,18 +781,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "eigrp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -800,10 +800,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -811,26 +811,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -838,16 +838,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, @@ -862,18 +862,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -881,10 +881,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -892,10 +892,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -903,26 +903,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -930,16 +930,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "topology": { @@ -952,18 +952,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -971,10 +971,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -982,10 +982,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -993,26 +993,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -1020,20 +1020,20 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, - } + }, }, }, }, @@ -1045,18 +1045,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "bgp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -1064,18 +1064,18 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "eigrp": { "type": "dict", "options": { "as_number": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -1083,10 +1083,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "iso_tag": { - "type": "str" + "type": "str", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -1094,26 +1094,26 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "odr": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "ospf": { "type": "dict", "options": { "process_id": { - "type": "int" + "type": "int", }, "route_map": { - "type": "str" + "type": "str", }, }, }, @@ -1121,16 +1121,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, "static": { "type": "dict", "options": { "route_map": { - "type": "str" - } + "type": "str", + }, }, }, }, @@ -1160,10 +1160,10 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "distance": { - "type": "int" - } + "type": "int", + }, }, - } + }, }, }, }, @@ -1179,16 +1179,16 @@ class Vrf_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "distance": { - "type": "int" - } + "type": "int", + }, }, - } + }, }, }, }, }, }, - } + }, }, }, "route_target": { 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..5d2bab132 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 @@ -7,6 +7,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type """ @@ -18,15 +19,14 @@ """ from ansible.module_utils.six import iteritems -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( - dict_merge, -) from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.resource_module import ( ResourceModule, ) -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.facts import ( - Facts, +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( + dict_merge, ) + +from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.facts import Facts from ansible_collections.cisco.ios.plugins.module_utils.network.ios.rm_templates.vrf_address_family import ( Vrf_address_familyTemplate, ) @@ -104,12 +104,11 @@ def __init__(self, module): "route_target.export", "route_target.import_config", "route_target.import_config.stitching", - "route_target.export.stitching" - + "route_target.export.stitching", ] def execute_module(self): - """ Execute the module + """Execute the module :rtype: A dictionary :returns: The result from module execution @@ -120,8 +119,8 @@ def execute_module(self): return self.result def generate_commands(self): - """ Generate configuration commands to send based on - want, have and desired state. + """Generate configuration commands to send based on + want, have and desired state. """ wantd = self.want haved = self.have diff --git a/plugins/module_utils/network/ios/facts/facts.py b/plugins/module_utils/network/ios/facts/facts.py index fb326ca1b..57c03e639 100644 --- a/plugins/module_utils/network/ios/facts/facts.py +++ b/plugins/module_utils/network/ios/facts/facts.py @@ -99,6 +99,9 @@ from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vlans.vlans import ( VlansFacts, ) +from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vrf_address_family.vrf_address_family import ( + Vrf_address_familyFacts, +) from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vrf_global.vrf_global import ( Vrf_globalFacts, ) @@ -108,9 +111,6 @@ from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vxlan_vtep.vxlan_vtep import ( Vxlan_vtepFacts, ) -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.facts.vrf_address_family.vrf_address_family import ( - Vrf_address_familyFacts, -) FACT_LEGACY_SUBSETS = dict( 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 1fa43cea2..86a6c3893 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 @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type """ @@ -15,29 +16,28 @@ """ -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils + +from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.vrf_address_family.vrf_address_family import ( + Vrf_address_familyArgs, ) from ansible_collections.cisco.ios.plugins.module_utils.network.ios.rm_templates.vrf_address_family import ( Vrf_address_familyTemplate, ) -from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.vrf_address_family.vrf_address_family import ( - Vrf_address_familyArgs, -) from ansible_collections.cisco.ios.plugins.module_utils.network.ios.utils.utils import ( flatten_config, ) + # import debugpy # debugpy.listen(3000) # debugpy.wait_for_client() class Vrf_address_familyFacts(object): - """ The ios vrf_address_family facts class - """ + """The ios vrf_address_family facts class""" - def __init__(self, module, subspec='config', options='options'): + def __init__(self, module, subspec="config", options="options"): self._module = module self.argument_spec = Vrf_address_familyArgs.argument_spec @@ -57,7 +57,7 @@ def _flatten_config(self, config): return "\n".join(finalConfig) def populate_facts(self, connection, ansible_facts, data=None): - """ Populate the facts for Vrf_address_family network resource + """Populate the facts for Vrf_address_family network resource :param connection: the device connection :param ansible_facts: Facts dictionary @@ -80,7 +80,9 @@ def populate_facts(self, connection, ansible_facts, data=None): finalConfig = self._flatten_config(data) # parse native config using the Vrf_address_family template - vrf_address_family_parser = Vrf_address_familyTemplate(lines=finalConfig.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()) @@ -91,14 +93,16 @@ def populate_facts(self, connection, ansible_facts, data=None): else: vrf["address_families"] = [] - ansible_facts['ansible_network_resources'].pop('vrf_address_family', None) + ansible_facts["ansible_network_resources"].pop("vrf_address_family", None) params = utils.remove_empties( - vrf_address_family_parser.validate_config(self.argument_spec, {"config": objs}, redact=True) + vrf_address_family_parser.validate_config( + self.argument_spec, {"config": objs}, redact=True + ), ) - facts['vrf_address_family'] = params.get("config", []) - ansible_facts['ansible_network_resources'].update(facts) + facts["vrf_address_family"] = params.get("config", []) + ansible_facts["ansible_network_resources"].update(facts) return ansible_facts 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..82e51f811 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 @@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type """ @@ -15,6 +16,7 @@ """ import re + from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.network_template import ( NetworkTemplate, ) diff --git a/plugins/modules/ios_vrf_address_family.py b/plugins/modules/ios_vrf_address_family.py index 51fb88634..abaf26a21 100644 --- a/plugins/modules/ios_vrf_address_family.py +++ b/plugins/modules/ios_vrf_address_family.py @@ -10,6 +10,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type DOCUMENTATION = """ @@ -1207,6 +1208,7 @@ """ from ansible.module_utils.basic import AnsibleModule + from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.vrf_address_family.vrf_address_family import ( Vrf_address_familyArgs, ) diff --git a/tests/integration/targets/ios_vrf_address_family/tests/common/_parsed.cfg b/tests/integration/targets/ios_vrf_address_family/tests/common/_parsed.cfg index 9284311c3..40f020743 100644 --- a/tests/integration/targets/ios_vrf_address_family/tests/common/_parsed.cfg +++ b/tests/integration/targets/ios_vrf_address_family/tests/common/_parsed.cfg @@ -7,4 +7,4 @@ vrf definition test export map "testing-map" export ipv4 multicast 345 map "single" export ipv4 unicast 67 map "test-map" allow-evpn - exit-address-family \ No newline at end of file + exit-address-family