diff --git a/changelogs/fragments/bgp_global_evpn_fix_2.yml b/changelogs/fragments/bgp_global_evpn_fix_2.yml new file mode 100644 index 000000000..42b0bbdbd --- /dev/null +++ b/changelogs/fragments/bgp_global_evpn_fix_2.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - ios_bgp_global - Explicitly add neighbor address to every parser. diff --git a/plugins/module_utils/network/ios/facts/bgp_global/bgp_global.py b/plugins/module_utils/network/ios/facts/bgp_global/bgp_global.py index 52299f0b4..37bbfabfd 100644 --- a/plugins/module_utils/network/ios/facts/bgp_global/bgp_global.py +++ b/plugins/module_utils/network/ios/facts/bgp_global/bgp_global.py @@ -51,17 +51,27 @@ def populate_facts(self, connection, ansible_facts, data=None): data = self.get_bgp_global_data(connection) # parse native config using the Bgp_global template - bgp_global_parser = Bgp_globalTemplate(lines=data.splitlines(), module=self._module) + bgp_global_parser = Bgp_globalTemplate( + lines=data.splitlines(), + module=self._module, + ) objs = bgp_global_parser.parse() neighbor_list = objs.get("neighbors", {}) if neighbor_list: - objs["neighbors"] = list(neighbor_list.values()) + objs["neighbors"] = sorted( + list(neighbor_list.values()), + key=lambda k, pk="neighbor_address": k[pk], + ) obj = utils.remove_empties(objs) ansible_facts["ansible_network_resources"].pop("bgp_global", None) params = utils.remove_empties( - bgp_global_parser.validate_config(self.argument_spec, {"config": obj}, redact=True), + bgp_global_parser.validate_config( + self.argument_spec, + {"config": obj}, + redact=True, + ), ) facts["bgp_global"] = params.get("config", {}) 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 477cbc679..39fd548bc 100644 --- a/plugins/module_utils/network/ios/rm_templates/bgp_global.py +++ b/plugins/module_utils/network/ios/rm_templates/bgp_global.py @@ -160,7 +160,9 @@ def __init__(self, lines=None, module=None): "{{ bmp.server_options.address.host }} port-number {{ bmp.server_options.address.port|string }}\nexit-bmp-server-mode", "result": { "bmp": { - "server_options": {"address": {"host": "{{ host }}", "port": "{{ port }}"}}, + "server_options": { + "address": {"host": "{{ host }}", "port": "{{ port }}"}, + }, }, }, }, @@ -449,7 +451,10 @@ def __init__(self, lines=None, module=None): }, { "name": "synchronization", - "getval": re.compile(r"""\s(?Psynchronization)""", re.VERBOSE), + "getval": re.compile( + r"""\s(?Psynchronization)""", + re.VERBOSE, + ), "setval": "synchronization", "result": {"synchronization": "{{ not not synchronization }}"}, }, @@ -466,7 +471,9 @@ def __init__(self, lines=None, module=None): "setval": "table-map" "{{ (' ' + name) if name is defined else '' }}" "{{ (' filter' ) if filter|d(False) else '' }}", - "result": {"table_map": {"name": "{{ name }}", "filter": "{{ not not filter }}"}}, + "result": { + "table_map": {"name": "{{ name }}", "filter": "{{ not not filter }}"}, + }, }, { "name": "timers", @@ -558,19 +565,28 @@ def __init__(self, lines=None, module=None): }, { "name": "bgp.bestpath_options.compare_routerid", - "getval": re.compile(r"""\s(bgp\sbestpath\scompare-routerid)""", re.VERBOSE), + "getval": re.compile( + r"""\s(bgp\sbestpath\scompare-routerid)""", + re.VERBOSE, + ), "setval": "{{ ('bgp bestpath compare-routerid' ) if bgp.bestpath_options.compare_routerid|d(False) else '' }}", "result": {"bgp": {"bestpath_options": {"compare_routerid": True}}}, }, { "name": "bgp.bestpath_options.cost_community", - "getval": re.compile(r"""\s(bgp\sbestpath\scost-community\signore)""", re.VERBOSE), + "getval": re.compile( + r"""\s(bgp\sbestpath\scost-community\signore)""", + re.VERBOSE, + ), "setval": "{{ ('bgp bestpath cost-community ignore' ) if bgp.bestpath_options.cost_community|d(False) else '' }}", "result": {"bgp": {"bestpath_options": {"cost_community": True}}}, }, { "name": "bgp.bestpath_options.igp_metric", - "getval": re.compile(r"""\s(bgp\sbestpath\sigp-metric\signore)""", re.VERBOSE), + "getval": re.compile( + r"""\s(bgp\sbestpath\sigp-metric\signore)""", + re.VERBOSE, + ), "setval": "bgp bestpath igp-metric ignore", "result": {"bgp": {"bestpath_options": {"igp_metric": True}}}, }, @@ -790,7 +806,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp graceful-restart restart-time {{ bgp.graceful_restart.restart_time|string }}", - "result": {"bgp": {"graceful_restart": {"restart_time": "{{ restart_time }}"}}}, + "result": { + "bgp": {"graceful_restart": {"restart_time": "{{ restart_time }}"}}, + }, }, { "name": "bgp.graceful_restart.stalepath_time", @@ -802,7 +820,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp graceful-restart stalepath-time {{ bgp.graceful_restart.stalepath_time|string }}", - "result": {"bgp": {"graceful_restart": {"stalepath_time": "{{ stalepath_time }}"}}}, + "result": { + "bgp": {"graceful_restart": {"stalepath_time": "{{ stalepath_time }}"}}, + }, }, { "name": "bgp.graceful_shutdown.neighbors", @@ -824,7 +844,10 @@ def __init__(self, lines=None, module=None): "result": { "bgp": { "graceful_shutdown": { - "neighbors": {"time": "{{ time }}", "activate": "{{ not not activate }}"}, + "neighbors": { + "time": "{{ time }}", + "activate": "{{ not not activate }}", + }, "community": "{{ community }}", "local_preference": "{{ local_preference }}", }, @@ -851,7 +874,10 @@ def __init__(self, lines=None, module=None): "result": { "bgp": { "graceful_shutdown": { - "vrfs": {"time": "{{ time }}", "activate": "{{ not not activate }}"}, + "vrfs": { + "time": "{{ time }}", + "activate": "{{ not not activate }}", + }, "community": "{{ community }}", "local_preference": "{{ local_preference }}", }, @@ -1008,7 +1034,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp nopeerup-delay cold-boot {{ bgp.nopeerup_delay_options.cold_boot|string }}", - "result": {"bgp": {"nopeerup_delay_options": {"cold_boot": "{{ cold_boot }}"}}}, + "result": { + "bgp": {"nopeerup_delay_options": {"cold_boot": "{{ cold_boot }}"}}, + }, }, { "name": "bgp.nopeerup_delay_options.post_boot", @@ -1020,7 +1048,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp nopeerup-delay post-boot {{ bgp.nopeerup_delay_options.post_boot|string }}", - "result": {"bgp": {"nopeerup_delay_options": {"post_boot": "{{ post_boot }}"}}}, + "result": { + "bgp": {"nopeerup_delay_options": {"post_boot": "{{ post_boot }}"}}, + }, }, { "name": "bgp.nopeerup_delay_options.nsf_switchover", @@ -1033,7 +1063,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp nopeerup-delay nsf-switchover {{ bgp.nopeerup_delay_options.nsf_switchover|string }}", "result": { - "bgp": {"nopeerup_delay_options": {"nsf_switchover": "{{ nsf_switchover }}"}}, + "bgp": { + "nopeerup_delay_options": {"nsf_switchover": "{{ nsf_switchover }}"}, + }, }, }, { @@ -1047,7 +1079,9 @@ def __init__(self, lines=None, module=None): ), "setval": "bgp nopeerup-delay user-initiated {{ bgp.nopeerup_delay_options.user_initiated|string }}", "result": { - "bgp": {"nopeerup_delay_options": {"user_initiated": "{{ user_initiated }}"}}, + "bgp": { + "nopeerup_delay_options": {"user_initiated": "{{ user_initiated }}"}, + }, }, }, { @@ -1165,7 +1199,9 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "bgp slow-peer detection threshold {{ bgp.slow_peer.detection.threshold|string }}", - "result": {"bgp": {"slow_peer": {"detection": {"threshold": "{{ threshold }}"}}}}, + "result": { + "bgp": {"slow_peer": {"detection": {"threshold": "{{ threshold }}"}}}, + }, }, { "name": "bgp.slow_peer.split_update_group", @@ -1356,7 +1392,10 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} bmp-activate", "result": { "neighbors": { - "{{ neighbor_address }}": {"bmp_activate": "{{ not not bmp_activate }}"}, + "{{ neighbor_address }}": { + "bmp_activate": "{{ not not bmp_activate }}", + "neighbor_address": "{{ neighbor_address }}", + }, }, }, }, @@ -1371,7 +1410,12 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }} cluster-id", "result": { - "neighbors": {"{{ neighbor_address }}": {"cluster_id": "{{ not not cluster_id }}"}}, + "neighbors": { + "{{ neighbor_address }}": { + "cluster_id": "{{ not not cluster_id }}", + "neighbor_address": "{{ neighbor_address }}", + }, + }, }, }, { @@ -1408,6 +1452,7 @@ def __init__(self, lines=None, module=None): "neighbors": { "{{ neighbor_address }}": { "disable_connected_check": "{{ not not disable_connected_check }}", + "neighbor_address": "{{ neighbor_address }}", }, }, }, @@ -1431,6 +1476,7 @@ def __init__(self, lines=None, module=None): "enable": "{{ not not enable }}", "hop_count": "{{ hop_count }}", }, + "neighbor_address": "{{ neighbor_address }}", }, }, }, @@ -1460,6 +1506,7 @@ def __init__(self, lines=None, module=None): "single_hop": "{{ not not single_hop }}", }, }, + "neighbor_address": "{{ neighbor_address }}", }, }, }, @@ -1477,7 +1524,10 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { - "fall_over": {"route_map": "{{ not not route_map }}"}, + "fall_over": { + "route_map": "{{ not not route_map }}", + "neighbor_address": "{{ neighbor_address }}", + }, }, }, }, @@ -1498,7 +1548,11 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { - "ha_mode": {"set": "{{ not not set }}", "disable": "{{ not not disable }}"}, + "ha_mode": { + "set": "{{ not not set }}", + "disable": "{{ not not disable }}", + }, + "neighbor_address": "{{ neighbor_address }}", }, }, }, @@ -1514,7 +1568,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }} inherit peer-session" "{{ (' ' + inherit) if inherit is defined else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"inherit": "{{ inherit }}"}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "inherit": "{{ inherit }}", + "neighbor_address": "{{ neighbor_address }}", + }, + }, + }, }, { "name": "local_as", @@ -1536,6 +1597,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "local_as": { "set": "{{ not not local_as }}", "number": "{{ number }}", @@ -1618,6 +1680,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "path_attribute": { "discard": { "type": "{{ type }}", @@ -1648,6 +1711,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "path_attribute": { "treat_as_withdraw": { "type": "{{ type }}", @@ -1678,6 +1742,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "shutdown": { "set": True, "graceful": "{{ graceful }}", @@ -1698,7 +1763,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }}" "{{ (' soft-reconfiguration inbound') if soft_reconfiguration|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"soft_reconfiguration": True}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "soft_reconfiguration": True, + }, + }, + }, }, { "name": "ntimers", @@ -1718,6 +1790,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "timers": { "interval": "{{ interval }}", "holdtime": "{{ holdtime }}", @@ -1743,6 +1816,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "transport": { "connection_mode": { "active": "{{ not not active }}", @@ -1786,8 +1860,12 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "transport": { - "path_mtu_discovery": {"set": True, "disable": "{{ not not disable }}"}, + "path_mtu_discovery": { + "set": True, + "disable": "{{ not not disable }}", + }, }, }, }, @@ -1805,7 +1883,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} ttl-security" "{{ (' hops '+ ttl_security|string) if ttl_security is defined else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"ttl_security": "{{ ttl_security }}"}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "ttl_security": "{{ ttl_security }}", + }, + }, }, }, { @@ -1820,7 +1903,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} unsuppress-map" "{{ (' ' + unsuppress_map) if unsuppress_map is defined else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"unsuppress_map": "{{ unsuppress_map }}"}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "unsuppress_map": "{{ unsuppress_map }}", + }, + }, }, }, { @@ -1874,7 +1962,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }} weight" "{{ (' ' + weight|string) if weight is defined else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"weight": "{{ weight }}"}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "weight": "{{ weight }}", + }, + }, + }, }, # neighbor remote-as ends # neighbor peer-group starts @@ -1915,6 +2010,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "additional_paths": { "disable": "{{ not not disable }}", "receive": "{{ not not receive }}", @@ -1942,6 +2038,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "advertise": { "additional_paths": { "all": "{{ not not all }}", @@ -1964,7 +2061,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }}" "{{ (' advertise best-external') if advertise.best_external|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"advertise": {"best-external": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "advertise": {"best-external": True}, + }, + }, }, }, { @@ -1983,6 +2085,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "advertise": { "diverse_path": { "backup": "{{ not not backup }}", @@ -2011,6 +2114,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "advertise_map": { "name": "{{ name }}", "exist_map": "{{ exist_map }}", @@ -2034,6 +2138,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "advertisement_interval": "{{ advertisement_interval }}", }, }, @@ -2048,7 +2153,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' aigp') if aigp.enable|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"aigp": {"enable": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "aigp": {"enable": True}, + }, + }, + }, }, { "name": "aigp.send.cost_community", @@ -2070,6 +2182,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "aigp": { "send": { "cost_community": { @@ -2096,7 +2209,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }}" "{{ (' aigp send med') if aigp.send.med|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"aigp": {"send": {"med": True}}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "aigp": {"send": {"med": True}}, + }, + }, + }, }, { "name": "allow_policy", @@ -2107,7 +2227,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' allow-policy') if allow_policy|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"allow_policy": True}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "allow_policy": True, + }, + }, + }, }, { "name": "allowas_in", @@ -2120,7 +2247,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }}" "{{ (' allowas-in ' + allowas_in|string) if allowas_in is defined else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"allowas_in": "{{ allowas_in }}"}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "allowas_in": "{{ allowas_in }}", + }, + }, + }, }, { "name": "as_override", @@ -2132,7 +2266,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }}" "{{ (' as-override') if as_override|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"as_override": True}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "as_override": True, + }, + }, + }, }, { "name": "bmp_activate", @@ -2151,7 +2292,10 @@ def __init__(self, lines=None, module=None): "neighbors": { "{{ neighbor_address }}": { "neighbor_address": "{{ neighbor_address }}", - "bmp_activate": {"server": "{{ server }}", "all": "{{ not not all }}"}, + "bmp_activate": { + "server": "{{ server }}", + "all": "{{ not not all }}", + }, }, }, }, @@ -2174,6 +2318,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "capability": { "both": "{{ not not both }}", "receive": "{{ not not receive }}", @@ -2193,7 +2338,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' default-originate') if default_originate.set|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"default_originate": {"set": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "default_originate": {"set": True}, + }, + }, }, }, { @@ -2210,6 +2360,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "default-originate": {"route_map": "{{ route_map }}"}, }, }, @@ -2233,6 +2384,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "distribute_list": { "acl": "{{ acl }}", "in": "{{ not not in }}", @@ -2251,7 +2403,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' dmzlink-bw') if dmzlink_bw|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"dmzlink_bw": True}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "dmzlink_bw": True, + }, + }, + }, }, { "name": "filter_list", @@ -2271,6 +2430,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "filter_list": { "path_acl": "{{ acl }}", "in": "{{ not not in }}", @@ -2300,6 +2460,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "maximum_prefix": { "max_no": "{{ max_no }}", "threshold_val": "{{ threshold_val }}", @@ -2319,7 +2480,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-self') if next_hop_self.set|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"next_hop_self": {"set": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "next_hop_self": {"set": True}, + }, + }, + }, }, { "name": "next_hop_self.all", @@ -2330,7 +2498,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-self all') if next_hop_self.all|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"next_hop_self": {"all": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "next_hop_self": {"all": True}, + }, + }, + }, }, { "name": "next_hop_unchanged.set", @@ -2342,7 +2517,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-unchanged') if next_hop_unchanged.set|d(False) else ''}}", "result": { - "neighbors": {"{{ neighbor_address }}": {"next_hop_unchanged": {"set": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "next_hop_unchanged": {"set": True}, + }, + }, }, }, { @@ -2355,7 +2535,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' next-hop-unchanged allpaths') if next_hop_unchanged.allpaths|d(False) else ''}}", "result": { - "neighbors": {"{{ neighbor_address }}": {"next_hop_unchanged": {"allpaths": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "next_hop_unchanged": {"allpaths": True}, + }, + }, }, }, { @@ -2368,7 +2553,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' remove-private-as') if remove_private_as.set|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"remove_private_as": {"set": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "remove_private_as": {"set": True}, + }, + }, }, }, { @@ -2381,7 +2571,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' remove-private-as all') if remove_private_as.all|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"remove_private_as": {"all": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "remove_private_as": {"all": True}, + }, + }, }, }, { @@ -2395,7 +2590,12 @@ def __init__(self, lines=None, module=None): "setval": "{{ ('neighbor ' + neighbor_address + ' remove-private-as replace-as') if remove_private_as.replace_as|d(False) else ''}}", "result": { "neighbors": { - "{{ neighbor_address }}": {"remove_private_as": {"replace_as": True}}, + "{{ neighbor_address }}": { + "remove_private_as": { + "neighbor_address": "{{ neighbor_address }}", + "replace_as": True, + }, + }, }, }, }, @@ -2456,7 +2656,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' route-server-client') if route_server_client.set|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"route_server_client": {"set": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "route_server_client": {"set": True}, + }, + }, }, }, { @@ -2472,7 +2677,10 @@ def __init__(self, lines=None, module=None): "{{ (' context ' + route_server_client.context) if route_server_client.context is defined else '' }}", "result": { "neighbors": { - "{{ neighbor_address }}": {"route_server_client": {"context": "{{ context }}"}}, + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "route_server_client": {"context": "{{ context }}"}, + }, }, }, }, @@ -2485,7 +2693,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' send-community') if send_community.set|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"send_community": {"set": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_community": {"set": True}, + }, + }, + }, }, { "name": "send_community.both", @@ -2497,7 +2712,14 @@ def __init__(self, lines=None, module=None): ), "setval": "neighbor {{ neighbor_address }} send-community" "{{ (' both') if send_community.both|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"send_community": {"both": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_community": {"both": True}, + }, + }, + }, }, { "name": "send_community.extended", @@ -2510,7 +2732,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} send-community" "{{ (' extended') if send_community.extended|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"send_community": {"extended": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_community": {"extended": True}, + }, + }, }, }, { @@ -2524,7 +2751,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} send-community" "{{ (' standard') if send_community.standard|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"send_community": {"standard": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_community": {"standard": True}, + }, + }, }, }, { @@ -2536,7 +2768,14 @@ def __init__(self, lines=None, module=None): re.VERBOSE, ), "setval": "{{ ('neighbor ' + neighbor_address + ' send-label') if send_label.set|d(False) else '' }}", - "result": {"neighbors": {"{{ neighbor_address }}": {"send_label": {"set": True}}}}, + "result": { + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_label": {"set": True}, + }, + }, + }, }, { "name": "send_label.explicit_null", @@ -2549,7 +2788,12 @@ def __init__(self, lines=None, module=None): "setval": "neighbor {{ neighbor_address }} send-label" "{{ (' explicit-null') if send_label.explicit_null|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"send_label": {"explicit_null": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "send_label": {"explicit_null": True}, + }, + }, }, }, { @@ -2570,6 +2814,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "slow_peer": { "detection": { "enable": "{{ not not enable }}", @@ -2601,6 +2846,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "slow_peer": { "split_update_group": { "static": "{{ not not static }}", @@ -2625,7 +2871,12 @@ def __init__(self, lines=None, module=None): ), "setval": "{{ ('neighbor ' + neighbor_address + ' translate_update') if translate_update.set|d(False) else '' }}", "result": { - "neighbors": {"{{ neighbor_address }}": {"translate_update": {"set": True}}}, + "neighbors": { + "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", + "translate_update": {"set": True}, + }, + }, }, }, { @@ -2644,6 +2895,7 @@ def __init__(self, lines=None, module=None): "result": { "neighbors": { "{{ neighbor_address }}": { + "neighbor_address": "{{ neighbor_address }}", "translate_update": { "nlri": { "multicast": "{{ not not multicast }}", @@ -2806,7 +3058,12 @@ def __init__(self, lines=None, module=None): "remval": "redistribute iso-igrp {{ iso_igrp.area_tag }}", "result": { "redistribute": [ - {"iso_igrp": {"area_tag": "{{ name }}", "route_map": "{{ route_map }}"}}, + { + "iso_igrp": { + "area_tag": "{{ name }}", + "route_map": "{{ route_map }}", + }, + }, ], }, }, @@ -3049,7 +3306,9 @@ def __init__(self, lines=None, module=None): "{{ (' global') if vrf.global|d(False) else '' }}", "remval": "redistribute vrf {{ vrf.name }}", "result": { - "redistribute": [{"vrf": {"name": "{{ name }}", "global": "{{ not not global }}"}}], + "redistribute": [ + {"vrf": {"name": "{{ name }}", "global": "{{ not not global }}"}}, + ], }, }, # redistribute ends