From c54670a0f210d63b91c1b116b3d2e74aefdb46f7 Mon Sep 17 00:00:00 2001 From: gellis713 Date: Wed, 24 Jan 2024 18:03:14 -0600 Subject: [PATCH 1/7] Values such as 5j return as complex, cast to string --- plugins/module_utils/network/ios/rm_templates/interfaces.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 }}'", }, }, }, From 72e26580e2378d6e764235a318ae6eca8098022a Mon Sep 17 00:00:00 2001 From: KB-perByte Date: Wed, 27 Mar 2024 11:23:11 +0530 Subject: [PATCH 2/7] update changes --- .../fragments/json_serializable_issue.yaml | 7 + .../ios/rm_templates/bgp_address_family.py | 207 ++++++++++++++---- .../network/ios/rm_templates/bgp_global.py | 4 +- .../network/ios/rm_templates/prefix_lists.py | 2 +- .../network/ios/rm_templates/route_maps.py | 57 +++-- .../ios_interfaces/tests/cli/merged.yaml | 2 +- .../targets/ios_interfaces/vars/main.yaml | 4 +- 7 files changed, 208 insertions(+), 75 deletions(-) create mode 100644 changelogs/fragments/json_serializable_issue.yaml diff --git a/changelogs/fragments/json_serializable_issue.yaml b/changelogs/fragments/json_serializable_issue.yaml new file mode 100644 index 000000000..fb4050038 --- /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..8785a4977 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,9 @@ 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 +63,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 +142,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 +158,9 @@ 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 +173,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 +249,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 +263,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 +277,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 +337,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 +353,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 +367,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 +392,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 +407,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 +462,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 +482,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 +501,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 +521,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 +588,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 +739,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 +841,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 +899,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 +918,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 +938,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 +1032,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 +1050,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 +1094,7 @@ def __init__(self, lines=None, module=None): "neighbors": { UNIQUE_NEIB_ADD: { "neighbor_address": UNIQUE_NEIB_ADD, - "description": "{{ description }}", + "description": "'{{ description }}'", }, }, }, @@ -1260,7 +1323,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 +1341,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 +1421,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 +1438,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 +1456,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 +1475,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 +1535,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 +1571,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 +1662,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 +1681,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 +1700,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 +1762,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 +1783,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 +1803,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 +1823,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 +1937,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 +2085,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 +2106,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 +2150,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 +2235,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 +2771,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/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..660a6856e 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,9 @@ 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 +251,9 @@ 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 +263,9 @@ 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 +421,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 +431,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) @@ -452,16 +466,12 @@ def _tmplt_route_map_set(config_data): cmd += " {metric_value}".format(**set["metric"]) if set["metric"].get("deviation"): if set["metric"]["deviation"] == "plus": - cmd += ( - " +{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( - **set["metric"], - ) + cmd += " +{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( + **set["metric"], ) elif set["metric"]["deviation"] == "minus": - cmd += ( - " -{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( - **set["metric"], - ) + cmd += " -{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( + **set["metric"], ) if set["metric"].get("deviation") and not set["metric"].get("eigrp_delay"): if set["metric"]["deviation"] == "plus": @@ -525,7 +535,9 @@ 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)) @@ -620,10 +632,8 @@ def _tmplt_route_map_set_ipv6(config_data): if set_ipv6.get("precedence"): cmd += " precedence {precedence}".format(**set_ipv6) if set_ipv6.get("vrf"): - cmd += ( - " vrf {vrf} next-hop verify-availability {address} {sequence} track {track}".format( - **set_ipv6["vrf"]["verify_availability"], - ) + cmd += " vrf {vrf} next-hop verify-availability {address} {sequence} track {track}".format( + **set_ipv6["vrf"]["verify_availability"], ) return cmd @@ -649,7 +659,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 +704,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..112871759 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 # test to tackle - Object of type complex is not JSON serializable 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" From aeb6d49a3ce77da2f4780373981f0e88b239d119 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 05:53:44 +0000 Subject: [PATCH 3/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../ios/rm_templates/bgp_address_family.py | 97 ++++++++++--------- .../network/ios/rm_templates/route_maps.py | 38 +++++--- .../ios_interfaces/tests/cli/merged.yaml | 2 +- 3 files changed, 75 insertions(+), 62 deletions(-) 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 8785a4977..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 @@ -29,7 +29,9 @@ class Bgp_address_familyTemplate(NetworkTemplate): def __init__(self, lines=None, module=None): super(Bgp_address_familyTemplate, self).__init__( - lines=lines, tmplt=self, module=module + lines=lines, + tmplt=self, + module=module, ) PARSERS = [ @@ -159,7 +161,8 @@ def __init__(self, lines=None, module=None): { "name": "default_information", "getval": re.compile( - r"""\s\sdefault-information\soriginate$""", re.VERBOSE + r"""\s\sdefault-information\soriginate$""", + re.VERBOSE, ), "setval": "default-information originate", "result": {"address_family": {UNIQUE_AFI: {"default_information": True}}}, @@ -175,8 +178,8 @@ def __init__(self, lines=None, module=None): "setval": "default-metric {{ default_metric|string }}", "result": { "address_family": { - UNIQUE_AFI: {"default_metric": "{{ default_metric }}"} - } + UNIQUE_AFI: {"default_metric": "{{ default_metric }}"}, + }, }, }, { @@ -250,7 +253,7 @@ def __init__(self, lines=None, module=None): "setval": "bgp additional-paths select install", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"additional_paths": {"install": True}}} + UNIQUE_AFI: {"bgp": {"additional_paths": {"install": True}}}, }, }, }, @@ -264,7 +267,7 @@ def __init__(self, lines=None, module=None): "setval": "bgp additional-paths select receive", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"additional_paths": {"receive": True}}} + UNIQUE_AFI: {"bgp": {"additional_paths": {"receive": True}}}, }, }, }, @@ -278,7 +281,7 @@ def __init__(self, lines=None, module=None): "setval": "bgp additional-paths select send", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"additional_paths": {"send": True}}} + UNIQUE_AFI: {"bgp": {"additional_paths": {"send": True}}}, }, }, }, @@ -338,7 +341,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "bgp": {"nexthop": {"trigger": {"delay": "{{ delay }}"}}} + "bgp": {"nexthop": {"trigger": {"delay": "{{ delay }}"}}}, }, }, }, @@ -354,7 +357,7 @@ def __init__(self, lines=None, module=None): "setval": "bgp nexthop trigger delay enable", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"nexthop": {"trigger": {"enable": True}}}} + UNIQUE_AFI: {"bgp": {"nexthop": {"trigger": {"enable": True}}}}, }, }, }, @@ -368,7 +371,7 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp redistribute-internal", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"redistribute_internal": True}}} + "address_family": {UNIQUE_AFI: {"bgp": {"redistribute_internal": True}}}, }, }, { @@ -394,8 +397,8 @@ def __init__(self, lines=None, module=None): "setval": "bgp scan-time {{ bgp.scan_time }}", "result": { "address_family": { - UNIQUE_AFI: {"bgp": {"scan_time": "{{ scan_time }}"}} - } + UNIQUE_AFI: {"bgp": {"scan_time": "{{ scan_time }}"}}, + }, }, }, { @@ -408,7 +411,7 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp soft-reconfig-backup", "result": { - "address_family": {UNIQUE_AFI: {"bgp": {"soft_reconfig_backup": True}}} + "address_family": {UNIQUE_AFI: {"bgp": {"soft_reconfig_backup": True}}}, }, }, { @@ -463,7 +466,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "bgp": {"slow_peer_options": {"detection": {"enable": True}}} + "bgp": {"slow_peer_options": {"detection": {"enable": True}}}, }, }, }, @@ -483,7 +486,7 @@ def __init__(self, lines=None, module=None): UNIQUE_AFI: { "bgp": { "slow_peer_options": { - "detection": {"threshold": "{{ threshold }}"} + "detection": {"threshold": "{{ threshold }}"}, }, }, }, @@ -503,8 +506,8 @@ def __init__(self, lines=None, module=None): UNIQUE_AFI: { "bgp": { "slow_peer_options": { - "split_update_group": {"dynamic": True} - } + "split_update_group": {"dynamic": True}, + }, }, }, }, @@ -523,8 +526,8 @@ def __init__(self, lines=None, module=None): UNIQUE_AFI: { "bgp": { "slow_peer_options": { - "split_update_group": {"permanent": True} - } + "split_update_group": {"permanent": True}, + }, }, }, }, @@ -589,7 +592,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"remote_as": "{{ number }}"}} + "neighbors": {UNIQUE_NEIB_ADD: {"remote_as": "{{ number }}"}}, }, }, }, @@ -740,7 +743,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"advertises": {"best-external": True}} + UNIQUE_NEIB_ADD: {"advertises": {"best-external": True}}, }, }, }, @@ -842,7 +845,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"aigp": {"enable": True}}} + "neighbors": {UNIQUE_NEIB_ADD: {"aigp": {"enable": True}}}, }, }, }, @@ -901,8 +904,8 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"aigp": {"send": {"med": True}}} - } + UNIQUE_NEIB_ADD: {"aigp": {"send": {"med": True}}}, + }, }, }, }, @@ -919,7 +922,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"allow_policy": True}} + "neighbors": {UNIQUE_NEIB_ADD: {"allow_policy": True}}, }, }, }, @@ -939,7 +942,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"allowas_in": "{{ allowas_in }}"} + UNIQUE_NEIB_ADD: {"allowas_in": "{{ allowas_in }}"}, }, }, }, @@ -1033,7 +1036,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"cluster_id": "{{ cluster_id }}"} + UNIQUE_NEIB_ADD: {"cluster_id": "{{ cluster_id }}"}, }, }, }, @@ -1051,7 +1054,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"default_originate": {"set": True}} + UNIQUE_NEIB_ADD: {"default_originate": {"set": True}}, }, }, }, @@ -1324,7 +1327,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"inherit": "{{ inherit }}"}} + "neighbors": {UNIQUE_NEIB_ADD: {"inherit": "{{ inherit }}"}}, }, }, }, @@ -1342,7 +1345,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"internal_vpn_client": True}} + "neighbors": {UNIQUE_NEIB_ADD: {"internal_vpn_client": True}}, }, }, }, @@ -1422,7 +1425,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"set": True}}} + "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"set": True}}}, }, }, }, @@ -1439,7 +1442,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"all": True}}} + "neighbors": {UNIQUE_NEIB_ADD: {"nexthop_self": {"all": True}}}, }, }, }, @@ -1457,7 +1460,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"set": True}} + UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"set": True}}, }, }, }, @@ -1476,7 +1479,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"allpaths": True}} + UNIQUE_NEIB_ADD: {"next_hop_unchanged": {"allpaths": True}}, }, }, }, @@ -1663,7 +1666,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"remove_private_as": {"set": True}} + UNIQUE_NEIB_ADD: {"remove_private_as": {"set": True}}, }, }, }, @@ -1682,7 +1685,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"remove_private_as": {"all": True}} + UNIQUE_NEIB_ADD: {"remove_private_as": {"all": True}}, }, }, }, @@ -1701,7 +1704,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"remove_private_as": {"replace_as": True}} + UNIQUE_NEIB_ADD: {"remove_private_as": {"replace_as": True}}, }, }, }, @@ -1764,8 +1767,8 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"send_community": {"set": True}} - } + UNIQUE_NEIB_ADD: {"send_community": {"set": True}}, + }, }, }, }, @@ -1784,7 +1787,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"send_community": {"both": True}} + UNIQUE_NEIB_ADD: {"send_community": {"both": True}}, }, }, }, @@ -1804,7 +1807,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"send_community": {"extended": True}} + UNIQUE_NEIB_ADD: {"send_community": {"extended": True}}, }, }, }, @@ -1824,7 +1827,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"send_community": {"standard": True}} + UNIQUE_NEIB_ADD: {"send_community": {"standard": True}}, }, }, }, @@ -1938,7 +1941,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"soft_reconfiguration": True}} + "neighbors": {UNIQUE_NEIB_ADD: {"soft_reconfiguration": True}}, }, }, }, @@ -2086,7 +2089,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"ttl_security": "{{ ttl_security }}"} + UNIQUE_NEIB_ADD: {"ttl_security": "{{ ttl_security }}"}, }, }, }, @@ -2107,7 +2110,7 @@ def __init__(self, lines=None, module=None): "address_family": { UNIQUE_AFI: { "neighbors": { - UNIQUE_NEIB_ADD: {"unsuppress_map": "{{ unsuppress_map }}"} + UNIQUE_NEIB_ADD: {"unsuppress_map": "{{ unsuppress_map }}"}, }, }, }, @@ -2151,7 +2154,7 @@ def __init__(self, lines=None, module=None): "result": { "address_family": { UNIQUE_AFI: { - "neighbors": {UNIQUE_NEIB_ADD: {"weight": "{{ weight }}"}} + "neighbors": {UNIQUE_NEIB_ADD: {"weight": "{{ weight }}"}}, }, }, }, @@ -2775,7 +2778,7 @@ def __init__(self, lines=None, module=None): "vrf": { "name": "{{ name }}", "global": "{{ not not global }}", - } + }, }, ], }, 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 660a6856e..580987069 100644 --- a/plugins/module_utils/network/ios/rm_templates/route_maps.py +++ b/plugins/module_utils/network/ios/rm_templates/route_maps.py @@ -40,13 +40,13 @@ def _tmplt_route_map_match(config_data): if config_data["match"]["additional_paths"].get("best_range"): cmd += " best-range" if config_data["match"]["additional_paths"]["best_range"].get( - "lower_limit" + "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" + "upper_limit", ): cmd += " upper-limit {upper_limit}".format( **config_data["match"]["additional_paths"]["best_range"], @@ -236,7 +236,8 @@ def construct_cmd_from_list(cmd, config): ) elif config_data["match"]["ip"]["address"].get("acls"): cmd = construct_cmd_from_list( - cmd, config_data["match"]["ip"]["address"]["acls"] + cmd, + config_data["match"]["ip"]["address"]["acls"], ) if config_data["match"]["ip"].get("flowspec"): cmd += " flowspec" @@ -252,7 +253,8 @@ def construct_cmd_from_list(cmd, config): ) elif config_data["match"]["ip"]["flowspec"].get("acls"): cmd = construct_cmd_from_list( - cmd, config_data["match"]["ip"]["flowspec"]["acls"] + cmd, + config_data["match"]["ip"]["flowspec"]["acls"], ) if config_data["match"]["ip"].get("next_hop"): cmd += " next-hop" @@ -264,7 +266,8 @@ def construct_cmd_from_list(cmd, config): ) elif config_data["match"]["ip"]["next_hop"].get("acls"): cmd = construct_cmd_from_list( - cmd, config_data["match"]["ip"]["next_hop"]["acls"] + cmd, + config_data["match"]["ip"]["next_hop"]["acls"], ) if config_data["match"]["ip"].get("redistribution_source"): cmd += " redistribution-source" @@ -422,7 +425,7 @@ def _tmplt_route_map_set(config_data): command.append(cmd) if set["extcommunity"].get("soo"): command.append( - "set extcommunity soo {soo}".format(**set["extcommunity"]) + "set extcommunity soo {soo}".format(**set["extcommunity"]), ) if set["extcommunity"].get("vpn_distinguisher"): cmd = "set extcommunity vpn-distinguisher" @@ -432,7 +435,7 @@ def _tmplt_route_map_set(config_data): ) elif set["extcommunity"]["vpn_distinguisher"].get("address"): cmd += " {address}".format( - **set["extcommunity"]["vpn_distinguisher"] + **set["extcommunity"]["vpn_distinguisher"], ) if set["extcommunity"]["vpn_distinguisher"].get("additive"): cmd += " additive" @@ -466,12 +469,16 @@ def _tmplt_route_map_set(config_data): cmd += " {metric_value}".format(**set["metric"]) if set["metric"].get("deviation"): if set["metric"]["deviation"] == "plus": - cmd += " +{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( - **set["metric"], + cmd += ( + " +{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( + **set["metric"], + ) ) elif set["metric"]["deviation"] == "minus": - cmd += " -{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( - **set["metric"], + cmd += ( + " -{eigrp_delay} {metric_reliability} {metric_bandwidth} {mtu}".format( + **set["metric"], + ) ) if set["metric"].get("deviation") and not set["metric"].get("eigrp_delay"): if set["metric"]["deviation"] == "plus": @@ -536,7 +543,8 @@ def _tmplt_route_map_set_ip(config_data): if set_ip["next_hop"].get("encapsulate"): command.append( "{0} encapsulate l3vpn {encapsulate}".format( - cmd, **set_ip["next_hop"] + cmd, + **set_ip["next_hop"], ), ) if set_ip["next_hop"].get("peer_address"): @@ -632,8 +640,10 @@ def _tmplt_route_map_set_ipv6(config_data): if set_ipv6.get("precedence"): cmd += " precedence {precedence}".format(**set_ipv6) if set_ipv6.get("vrf"): - cmd += " vrf {vrf} next-hop verify-availability {address} {sequence} track {track}".format( - **set_ipv6["vrf"]["verify_availability"], + cmd += ( + " vrf {vrf} next-hop verify-availability {address} {sequence} track {track}".format( + **set_ipv6["vrf"]["verify_availability"], + ) ) return cmd diff --git a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml index 112871759..4167bdcd0 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: 04j # test to tackle - Object of type complex is not JSON serializable + description: 04j # test to tackle - Object of type complex is not JSON serializable enabled: false state: merged From f972662a5d9f648c5014f6793776fa9870a2bf39 Mon Sep 17 00:00:00 2001 From: KB-perByte Date: Wed, 27 Mar 2024 11:26:31 +0530 Subject: [PATCH 4/7] lint --- tests/integration/targets/ios_interfaces/tests/cli/merged.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml index 4167bdcd0..112871759 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: 04j # test to tackle - Object of type complex is not JSON serializable + description: 04j # test to tackle - Object of type complex is not JSON serializable enabled: false state: merged From 8e2705354f49eb7ebeba758196172e819afdab00 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 05:57:02 +0000 Subject: [PATCH 5/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/integration/targets/ios_interfaces/tests/cli/merged.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml index 112871759..4167bdcd0 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: 04j # test to tackle - Object of type complex is not JSON serializable + description: 04j # test to tackle - Object of type complex is not JSON serializable enabled: false state: merged From d718a78164afd28676e2510646c4da9cfc97cc47 Mon Sep 17 00:00:00 2001 From: KB-perByte Date: Wed, 27 Mar 2024 11:27:49 +0530 Subject: [PATCH 6/7] remove comment --- tests/integration/targets/ios_interfaces/tests/cli/merged.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml b/tests/integration/targets/ios_interfaces/tests/cli/merged.yaml index 4167bdcd0..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: 04j # test to tackle - Object of type complex is not JSON serializable + description: 04j enabled: false state: merged From 9a3f09527d10a61e87e9d9bbe823348d50ad82ad Mon Sep 17 00:00:00 2001 From: KB-perByte Date: Wed, 27 Mar 2024 11:31:24 +0530 Subject: [PATCH 7/7] space --- changelogs/fragments/json_serializable_issue.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelogs/fragments/json_serializable_issue.yaml b/changelogs/fragments/json_serializable_issue.yaml index fb4050038..3e0b67931 100644 --- a/changelogs/fragments/json_serializable_issue.yaml +++ b/changelogs/fragments/json_serializable_issue.yaml @@ -4,4 +4,4 @@ bugfixes: - 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. + - ios_bgp_global - description attribute, evalutated as complex object casted to string.