diff --git a/plugins/module_utils/network/ios/argspec/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/ios/argspec/bgp_address_family/bgp_address_family.py index 0ccb3b0dd..c49d4f007 100644 --- a/plugins/module_utils/network/ios/argspec/bgp_address_family/bgp_address_family.py +++ b/plugins/module_utils/network/ios/argspec/bgp_address_family/bgp_address_family.py @@ -340,7 +340,7 @@ class Bgp_address_familyArgs(object): # pylint: disable=R0903 "type": "dict", "options": { "set": {"type": "bool"}, - "number": {"type": "int"}, + "number": {"type": "str"}, "dual_as": {"type": "bool"}, "no_prepend": { "type": "dict", @@ -439,7 +439,7 @@ class Bgp_address_familyArgs(object): # pylint: disable=R0903 "out": {"type": "bool"}, }, }, - "remote_as": {"type": "int"}, + "remote_as": {"type": "str"}, "remove_private_as": { "type": "dict", "options": { diff --git a/plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py b/plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py index b4ee6e241..f464a5a9f 100644 --- a/plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py +++ b/plugins/module_utils/network/ios/config/bgp_address_family/bgp_address_family.py @@ -353,6 +353,12 @@ def _bgp_add_fam_list_to_dict(self, tmp_data): # slow_peer to slow_peer_options if neib.get("slow_peer"): # only one slow_peer is allowed neib["slow_peer_options"] = neib.pop("slow_peer")[0] + # we can skip deprecating these by handling the int to str conversion here + # int to float is not considered considering the size of as numbers + if neib.get("remote_as"): + neib["remote_as"] = str(neib.get("remote_as")) + if neib.get("local_as") and neib.get("local_as", {}).get("number"): + neib["local_as"]["number"] = str(neib["local_as"]["number"]) # make dict neighbors dict tmp[neib[p_key[k]]] = neib _af["neighbors"] = tmp diff --git a/plugins/modules/ios_bgp_address_family.py b/plugins/modules/ios_bgp_address_family.py index 9c1b49fcc..d0de4c70f 100644 --- a/plugins/modules/ios_bgp_address_family.py +++ b/plugins/modules/ios_bgp_address_family.py @@ -591,7 +591,7 @@ description: - AS number used as local AS - Please refer vendor documentation for valid values - type: int + type: str dual_as: description: Accept either real AS or local AS from the ebgp peer type: bool @@ -769,7 +769,7 @@ description: - Specify a BGP neighbor - AS of remote neighbor - type: int + type: str remove_private_as: description: Remove private AS number from outbound updates type: dict diff --git a/tests/unit/modules/network/ios/test_ios_bgp_address_family.py b/tests/unit/modules/network/ios/test_ios_bgp_address_family.py index ce88f0e72..259da5ece 100644 --- a/tests/unit/modules/network/ios/test_ios_bgp_address_family.py +++ b/tests/unit/modules/network/ios/test_ios_bgp_address_family.py @@ -118,7 +118,7 @@ def test_ios_bgp_address_family_merged(self): neighbors=[ dict( neighbor_address="198.51.100.1", - remote_as=65100, + remote_as="65.11", route_maps=[dict(name="test-route-out", out="true")], prefix_lists=[dict(name="AS65100-PREFIX-OUT", out="true")], ), @@ -144,7 +144,7 @@ def test_ios_bgp_address_family_merged(self): "bgp aggregate-timer 20", "bgp dmzlink-bw", "bgp scan-time 10", - "neighbor 198.51.100.1 remote-as 65100", + "neighbor 198.51.100.1 remote-as 65.11", "neighbor 198.51.100.1 route-map test-route-out out", "network 192.0.1.1 route-map test_route", "default-metric 10", @@ -228,7 +228,7 @@ def test_ios_bgp_address_family_merged_idempotent(self): network 198.51.110.10 mask 255.255.255.255 backdoor aggregate-address 192.0.2.1 255.255.255.255 as-confed-set neighbor 198.51.100.1 remote-as 10 - neighbor 198.51.100.1 local-as 20 + neighbor 198.51.100.1 local-as 10.64760 neighbor 198.51.100.1 activate neighbor 198.51.100.1 next-hop-self all neighbor 198.51.100.1 aigp send cost-community 100 poi igp-cost transitive @@ -321,7 +321,7 @@ def test_ios_bgp_address_family_merged_idempotent(self): }, }, }, - "local_as": {"number": 20, "set": True}, + "local_as": {"number": "10.64760", "set": True}, "neighbor_address": "198.51.100.1", "nexthop_self": {"all": True}, "prefix_lists": [{"name": "AS65100-PREFIX-OUT", "out": True}], @@ -1163,8 +1163,8 @@ def test_ios_bgp_address_family_parsed(self): ], "neighbors": [ { - "remote_as": 10, - "local_as": {"set": True, "number": 20}, + "remote_as": "10", + "local_as": {"set": True, "number": "20"}, "activate": True, "neighbor_address": "198.51.100.1", "nexthop_self": {"all": True},