diff --git a/changelogs/fragments/json_serializable_issue.yaml b/changelogs/fragments/json_serializable_issue.yaml new file mode 100644 index 000000000..3e0b67931 --- /dev/null +++ b/changelogs/fragments/json_serializable_issue.yaml @@ -0,0 +1,7 @@ +--- +bugfixes: + - ios_interfaces - description attribute, evalutated as complex object casted to string. + - ios_prefix_lists - description attribute, evalutated as complex object casted to string. + - ios_route_maps - description attribute, evalutated as complex object casted to string. + - ios_bgp_address_family - description attribute, evalutated as complex object casted to string. + - ios_bgp_global - description attribute, evalutated as complex object casted to string. diff --git a/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py b/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py index ca85440b2..eb5a08a37 100644 --- a/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py +++ b/plugins/module_utils/network/ios/rm_templates/bgp_address_family.py @@ -28,7 +28,11 @@ class Bgp_address_familyTemplate(NetworkTemplate): def __init__(self, lines=None, module=None): - super(Bgp_address_familyTemplate, self).__init__(lines=lines, tmplt=self, module=module) + super(Bgp_address_familyTemplate, self).__init__( + lines=lines, + tmplt=self, + module=module, + ) PARSERS = [ { @@ -61,7 +65,11 @@ def __init__(self, lines=None, module=None): "{{ (' vrf ' + vrf) if vrf is defined else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"afi": "{{ afi }}", "safi": "{{ safi }}", "vrf": "{{ vrf }}"}, + UNIQUE_AFI: { + "afi": "{{ afi }}", + "safi": "{{ safi }}", + "vrf": "{{ vrf }}", + }, }, }, "shared": True, @@ -136,7 +144,10 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "table_map": {"name": "{{ name }}", "filter": "{{ not not filter }}"}, + "table_map": { + "name": "{{ name }}", + "filter": "{{ not not filter }}", + }, }, }, }, @@ -149,7 +160,10 @@ def __init__(self, lines=None, module=None): }, { "name": "default_information", - "getval": re.compile(r"""\s\sdefault-information\soriginate$""", re.VERBOSE), + "getval": re.compile( + r"""\s\sdefault-information\soriginate$""", + re.VERBOSE, + ), "setval": "default-information originate", "result": {"address_family": {UNIQUE_AFI: {"default_information": True}}}, }, @@ -162,7 +176,11 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "default-metric {{ default_metric|string }}", - "result": {"address_family": {UNIQUE_AFI: {"default_metric": "{{ default_metric }}"}}}, + "result": { + "address_family": { + UNIQUE_AFI: {"default_metric": "{{ default_metric }}"}, + }, + }, }, { "name": "distance", @@ -234,7 +252,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp additional-paths select install", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"additional_paths": {"install": True}}}}, + "address_family": { + UNIQUE_AFI: {"bgp": {"additional_paths": {"install": True}}}, + }, }, }, { @@ -246,7 +266,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp additional-paths select receive", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"additional_paths": {"receive": True}}}}, + "address_family": { + UNIQUE_AFI: {"bgp": {"additional_paths": {"receive": True}}}, + }, }, }, { @@ -258,7 +280,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp additional-paths select send", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"additional_paths": {"send": True}}}}, + "address_family": { + UNIQUE_AFI: {"bgp": {"additional_paths": {"send": True}}}, + }, }, }, { @@ -316,7 +340,9 @@ def __init__(self, lines=None, module=None): "setval": "bgp nexthop trigger delay {{ bgp.nexthop.trigger.delay|string }}", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"nexthop": {"trigger": {"delay": "{{ delay }}"}}}}, + UNIQUE_AFI: { + "bgp": {"nexthop": {"trigger": {"delay": "{{ delay }}"}}}, + }, }, }, }, @@ -330,7 +356,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp nexthop trigger delay enable", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"nexthop": {"trigger": {"enable": True}}}}}, + "address_family": { + UNIQUE_AFI: {"bgp": {"nexthop": {"trigger": {"enable": True}}}}, + }, }, }, { @@ -342,7 +370,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp redistribute-internal", - "result": {"address_family": {UNIQUE_AFI: {"bgp": {"redistribute_internal": True}}}}, + "result": { + "address_family": {UNIQUE_AFI: {"bgp": {"redistribute_internal": True}}}, + }, }, { "name": "bgp.route_map", @@ -365,7 +395,11 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp scan-time {{ bgp.scan_time }}", - "result": {"address_family": {UNIQUE_AFI: {"bgp": {"scan_time": "{{ scan_time }}"}}}}, + "result": { + "address_family": { + UNIQUE_AFI: {"bgp": {"scan_time": "{{ scan_time }}"}}, + }, + }, }, { "name": "bgp.soft_reconfig_backup", @@ -376,7 +410,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp soft-reconfig-backup", - "result": {"address_family": {UNIQUE_AFI: {"bgp": {"soft_reconfig_backup": True}}}}, + "result": { + "address_family": {UNIQUE_AFI: {"bgp": {"soft_reconfig_backup": True}}}, + }, }, { "name": "bgp.update_group", @@ -429,7 +465,9 @@ def __init__(self, lines=None, module=None): "setval": "bgp slow-peer detection", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"slow_peer_options": {"detection": {"enable": True}}}}, + UNIQUE_AFI: { + "bgp": {"slow_peer_options": {"detection": {"enable": True}}}, + }, }, }, }, @@ -447,7 +485,9 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "bgp": { - "slow_peer_options": {"detection": {"threshold": "{{ threshold }}"}}, + "slow_peer_options": { + "detection": {"threshold": "{{ threshold }}"}, + }, }, }, }, @@ -464,7 +504,11 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "bgp": {"slow_peer_options": {"split_update_group": {"dynamic": True}}}, + "bgp": { + "slow_peer_options": { + "split_update_group": {"dynamic": True}, + }, + }, }, }, }, @@ -480,7 +524,11 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "bgp": {"slow_peer_options": {"split_update_group": {"permanent": True}}}, + "bgp": { + "slow_peer_options": { + "split_update_group": {"permanent": True}, + }, + }, }, }, }, @@ -543,7 +591,9 @@ def __init__(self, lines=None, module=None): "{{ (' ' + remote_as|string) if remote_as is defined else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"remote_as": "{{ number }}"}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"remote_as": "{{ number }}"}}, + }, }, }, }, @@ -692,7 +742,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"advertises": {"best-external": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"advertises": {"best-external": True}}, + }, }, }, }, @@ -792,7 +844,9 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' aigp') if aigp.enable|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"aigp": {"enable": True}}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"aigp": {"enable": True}}}, + }, }, }, }, @@ -848,7 +902,11 @@ def __init__(self, lines=None, module=None): "{{ (' aigp send med') if aigp.send.med|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"aigp": {"send": {"med": True}}}}}, + UNIQUE_AFI: { + "neighbors": { + UNIQUE_NEIB_ADD: {"aigp": {"send": {"med": True}}}, + }, + }, }, }, }, @@ -863,7 +921,9 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' allow-policy') if allow_policy|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"allow_policy": True}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"allow_policy": True}}, + }, }, }, }, @@ -881,7 +941,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"allowas_in": "{{ allowas_in }}"}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"allowas_in": "{{ allowas_in }}"}, + }, }, }, }, @@ -973,7 +1035,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"cluster_id": "{{ cluster_id }}"}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"cluster_id": "{{ cluster_id }}"}, + }, }, }, }, @@ -989,7 +1053,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"default_originate": {"set": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"default_originate": {"set": True}}, + }, }, }, }, @@ -1031,7 +1097,7 @@ def __init__(self, lines=None, module=None): "neighbors": { UNIQUE_NEIB_ADD: { "neighbor_address": UNIQUE_NEIB_ADD, - "description": "{{ description }}", + "description": "'{{ description }}'", }, }, }, @@ -1260,7 +1326,9 @@ def __init__(self, lines=None, module=None): "{{ (' ' + inherit) if inherit is defined else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"inherit": "{{ inherit }}"}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"inherit": "{{ inherit }}"}}, + }, }, }, }, @@ -1276,7 +1344,9 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} internal-vpn-client", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"internal_vpn_client": True}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"internal_vpn_client": True}}, + }, }, }, }, @@ -1354,7 +1424,9 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-self') if nexthop_self.set|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"set": True}}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"set": True}}}, + }, }, }, }, @@ -1369,7 +1441,9 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-self all') if nexthop_self.all|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"all": True}}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"all": True}}}, + }, }, }, }, @@ -1385,7 +1459,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"set": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"set": True}}, + }, }, }, }, @@ -1402,7 +1478,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"allpaths": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"allpaths": True}}, + }, }, }, }, @@ -1460,7 +1538,10 @@ def __init__(self, lines=None, module=None): "path_attribute": { "discard": { "type": "{{ type }}", - "range": {"start": "{{ start }}", "end": "{{ end }}"}, + "range": { + "start": "{{ start }}", + "end": "{{ end }}", + }, "in": "{{ not not in }}", }, }, @@ -1493,7 +1574,10 @@ def __init__(self, lines=None, module=None): "path_attribute": { "treat_as_withdraw": { "type": "{{ type }}", - "range": {"start": "{{ start }}", "end": "{{ end }}"}, + "range": { + "start": "{{ start }}", + "end": "{{ end }}", + }, "in": "{{ not not in }}", }, }, @@ -1581,7 +1665,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"remove_private_as": {"set": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"remove_private_as": {"set": True}}, + }, }, }, }, @@ -1598,7 +1684,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"remove_private_as": {"all": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"remove_private_as": {"all": True}}, + }, }, }, }, @@ -1615,7 +1703,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"remove_private_as": {"replace_as": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"remove_private_as": {"replace_as": True}}, + }, }, }, }, @@ -1675,7 +1765,11 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' send-community') if send_community.set|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"send_community": {"set": True}}}}, + UNIQUE_AFI: { + "neighbors": { + UNIQUE_NEIB_ADD: {"send_community": {"set": True}}, + }, + }, }, }, }, @@ -1692,7 +1786,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"send_community": {"both": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"send_community": {"both": True}}, + }, }, }, }, @@ -1710,7 +1806,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"send_community": {"extended": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"send_community": {"extended": True}}, + }, }, }, }, @@ -1728,7 +1826,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"send_community": {"standard": True}}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"send_community": {"standard": True}}, + }, }, }, }, @@ -1840,7 +1940,9 @@ def __init__(self, lines=None, module=None): "{{ (' soft-reconfiguration inbound') if soft_reconfiguration|d(False) else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"soft_reconfiguration": True}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"soft_reconfiguration": True}}, + }, }, }, }, @@ -1986,7 +2088,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"ttl_security": "{{ ttl_security }}"}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"ttl_security": "{{ ttl_security }}"}, + }, }, }, }, @@ -2005,7 +2109,9 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"unsuppress_map": "{{ unsuppress_map }}"}}, + "neighbors": { + UNIQUE_NEIB_ADD: {"unsuppress_map": "{{ unsuppress_map }}"}, + }, }, }, }, @@ -2047,7 +2153,9 @@ def __init__(self, lines=None, module=None): "{{ (' ' + weight|string) if weight is defined else '' }}", "result": { "address_family": { - UNIQUE_AFI: {"neighbors": {UNIQUE_NEIB_ADD: {"weight": "{{ weight }}"}}}, + UNIQUE_AFI: { + "neighbors": {UNIQUE_NEIB_ADD: {"weight": "{{ weight }}"}}, + }, }, }, }, @@ -2130,7 +2238,10 @@ def __init__(self, lines=None, module=None): "name": "{{ context }}", "user": { "name": "{{ user }}", - "access": {"acl": "{{ acl }}", "ipv6": "{{ aclv6 }}"}, + "access": { + "acl": "{{ acl }}", + "ipv6": "{{ aclv6 }}", + }, "auth": {"md5": "{{ md5 }}", "sha": "{{ sha }}"}, "priv": { "des56": "{{ des56 }}", @@ -2663,7 +2774,12 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "redistribute": [ - {"vrf": {"name": "{{ name }}", "global": "{{ not not global }}"}}, + { + "vrf": { + "name": "{{ name }}", + "global": "{{ not not global }}", + }, + }, ], }, }, diff --git a/plugins/module_utils/network/ios/rm_templates/bgp_global.py b/plugins/module_utils/network/ios/rm_templates/bgp_global.py index 5c8c69779..2ce959fcd 100644 --- a/plugins/module_utils/network/ios/rm_templates/bgp_global.py +++ b/plugins/module_utils/network/ios/rm_templates/bgp_global.py @@ -447,7 +447,7 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "description {{ route_server_context.description }}", - "result": {"route_server_context": {"description": "{{ description }}"}}, + "result": {"route_server_context": {"description": "'{{ description }}'"}}, }, { "name": "synchronization", @@ -1482,7 +1482,7 @@ def __init__(self, lines=None, module=None): "neighbors": { "{{ neighbor_address }}": { "neighbor_address": "{{ neighbor_address }}", - "description": "{{ description }}", + "description": "'{{ description }}'", }, }, }, diff --git a/plugins/module_utils/network/ios/rm_templates/interfaces.py b/plugins/module_utils/network/ios/rm_templates/interfaces.py index 084945143..6cd1eb84c 100644 --- a/plugins/module_utils/network/ios/rm_templates/interfaces.py +++ b/plugins/module_utils/network/ios/rm_templates/interfaces.py @@ -53,7 +53,7 @@ def __init__(self, lines=None, module=None): "setval": "description {{ description }}", "result": { '{{ name }}': { - 'description': '{{ description }}', + 'description': "'{{ description }}'", }, }, }, diff --git a/plugins/module_utils/network/ios/rm_templates/prefix_lists.py b/plugins/module_utils/network/ios/rm_templates/prefix_lists.py index 43d163c5d..f19e58e27 100644 --- a/plugins/module_utils/network/ios/rm_templates/prefix_lists.py +++ b/plugins/module_utils/network/ios/rm_templates/prefix_lists.py @@ -80,7 +80,7 @@ def __init__(self, lines=None): "{{ afi + name }}": { "name": "{{ name }}", "afi": "{{ 'ipv4' if afi is defined and afi=='ip' else 'ipv6' }}", - "description": "{{ description }}", + "description": "'{{ description }}'", }, }, }, diff --git a/plugins/module_utils/network/ios/rm_templates/route_maps.py b/plugins/module_utils/network/ios/rm_templates/route_maps.py index 1e569ccca..580987069 100644 --- a/plugins/module_utils/network/ios/rm_templates/route_maps.py +++ b/plugins/module_utils/network/ios/rm_templates/route_maps.py @@ -39,11 +39,15 @@ def _tmplt_route_map_match(config_data): cmd += " best {best}".format(**config_data["match"]["additional_paths"]) if config_data["match"]["additional_paths"].get("best_range"): cmd += " best-range" - if config_data["match"]["additional_paths"]["best_range"].get("lower_limit"): + if config_data["match"]["additional_paths"]["best_range"].get( + "lower_limit", + ): cmd += " lower-limit {lower_limit}".format( **config_data["match"]["additional_paths"]["best_range"], ) - if config_data["match"]["additional_paths"]["best_range"].get("upper_limit"): + if config_data["match"]["additional_paths"]["best_range"].get( + "upper_limit", + ): cmd += " upper-limit {upper_limit}".format( **config_data["match"]["additional_paths"]["best_range"], ) @@ -231,7 +235,10 @@ def construct_cmd_from_list(cmd, config): config_data["match"]["ip"]["address"]["prefix_lists"], ) elif config_data["match"]["ip"]["address"].get("acls"): - cmd = construct_cmd_from_list(cmd, config_data["match"]["ip"]["address"]["acls"]) + cmd = construct_cmd_from_list( + cmd, + config_data["match"]["ip"]["address"]["acls"], + ) if config_data["match"]["ip"].get("flowspec"): cmd += " flowspec" if config_data["match"]["ip"]["flowspec"].get("dest_pfx"): @@ -245,7 +252,10 @@ def construct_cmd_from_list(cmd, config): config_data["match"]["ip"]["flowspec"]["prefix_lists"], ) elif config_data["match"]["ip"]["flowspec"].get("acls"): - cmd = construct_cmd_from_list(cmd, config_data["match"]["ip"]["flowspec"]["acls"]) + cmd = construct_cmd_from_list( + cmd, + config_data["match"]["ip"]["flowspec"]["acls"], + ) if config_data["match"]["ip"].get("next_hop"): cmd += " next-hop" if config_data["match"]["ip"]["next_hop"].get("prefix_lists"): @@ -255,7 +265,10 @@ def construct_cmd_from_list(cmd, config): config_data["match"]["ip"]["next_hop"]["prefix_lists"], ) elif config_data["match"]["ip"]["next_hop"].get("acls"): - cmd = construct_cmd_from_list(cmd, config_data["match"]["ip"]["next_hop"]["acls"]) + cmd = construct_cmd_from_list( + cmd, + config_data["match"]["ip"]["next_hop"]["acls"], + ) if config_data["match"]["ip"].get("redistribution_source"): cmd += " redistribution-source" if config_data["match"]["ip"]["redistribution_source"].get("prefix_lists"): @@ -411,7 +424,9 @@ def _tmplt_route_map_set(config_data): cmd += " additive" command.append(cmd) if set["extcommunity"].get("soo"): - command.append("set extcommunity soo {soo}".format(**set["extcommunity"])) + command.append( + "set extcommunity soo {soo}".format(**set["extcommunity"]), + ) if set["extcommunity"].get("vpn_distinguisher"): cmd = "set extcommunity vpn-distinguisher" if set["extcommunity"]["vpn_distinguisher"].get("range"): @@ -419,7 +434,9 @@ def _tmplt_route_map_set(config_data): **set["extcommunity"]["vpn_distinguisher"]["range"], ) elif set["extcommunity"]["vpn_distinguisher"].get("address"): - cmd += " {address}".format(**set["extcommunity"]["vpn_distinguisher"]) + cmd += " {address}".format( + **set["extcommunity"]["vpn_distinguisher"], + ) if set["extcommunity"]["vpn_distinguisher"].get("additive"): cmd += " additive" command.append(cmd) @@ -525,7 +542,10 @@ def _tmplt_route_map_set_ip(config_data): command.append("{0} dynamic dhcp".format(cmd)) if set_ip["next_hop"].get("encapsulate"): command.append( - "{0} encapsulate l3vpn {encapsulate}".format(cmd, **set_ip["next_hop"]), + "{0} encapsulate l3vpn {encapsulate}".format( + cmd, + **set_ip["next_hop"], + ), ) if set_ip["next_hop"].get("peer_address"): command.append("{0} peer-address".format(cmd)) @@ -649,7 +669,10 @@ def __init__(self, lines=None): "{{ route_map }}": { "route_map": "{{ route_map }}", "{{ action|d() + '_' + sequence|d() }}": { - "entries": {"action": "{{ action }}", "sequence": "{{ sequence }}"}, + "entries": { + "action": "{{ action }}", + "sequence": "{{ sequence }}", + }, }, }, }, @@ -691,7 +714,7 @@ def __init__(self, lines=None): "result": { "{{ route_map }}": { "{{ action|d() + '_' + sequence|d() }}": { - "entries": {"description": "{{ description }}"}, + "entries": {"description": "'{{ description }}'"}, }, }, }, diff --git a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml index c73dd0b11..3db4a1fb6 100644 --- a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml +++ b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml @@ -14,7 +14,7 @@ enabled: true - name: GigabitEthernet3 - description: Configured and Merged by Ansible-Network + description: 04j enabled: false state: merged diff --git a/tests/integration/targets/ios_interfaces/vars/main.yaml b/tests/integration/targets/ios_interfaces/vars/main.yaml index 84b8afb22..bf89b4b37 100644 --- a/tests/integration/targets/ios_interfaces/vars/main.yaml +++ b/tests/integration/targets/ios_interfaces/vars/main.yaml @@ -20,7 +20,7 @@ merged: - interface GigabitEthernet2 - description Configured and Merged by Ansible-Network - interface GigabitEthernet3 - - description Configured and Merged by Ansible-Network + - description 04j - shutdown after: - enabled: true @@ -30,7 +30,7 @@ merged: enabled: true name: GigabitEthernet2 speed: "1000" - - description: Configured and Merged by Ansible-Network + - description: 04j enabled: false name: GigabitEthernet3 speed: "1000"