Skip to content

Commit

Permalink
fix remote_as bgp_address_family
Browse files Browse the repository at this point in the history
  • Loading branch information
KB-perByte committed Sep 26, 2023
1 parent 2001633 commit 9534d1c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/ios_bgp_address_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions tests/unit/modules/network/ios/test_ios_bgp_address_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")],
),
Expand All @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}],
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit 9534d1c

Please sign in to comment.