Skip to content

Commit

Permalink
add no peers test for eos.get_bgp_neighbors
Browse files Browse the repository at this point in the history
  • Loading branch information
bewing committed Jul 16, 2024
1 parent 5bb8d0e commit b7a2c13
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 1 deletion.
9 changes: 8 additions & 1 deletion napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ def get_bgp_neighbors(self) -> Dict[str, models.BGPStateNeighborsPerVRFDict]:
),
"sent_prefixes": peer["v6PrefixesSent"],
}
vrf["router_id"] = napalm.base.helpers.ip(peer["localRouterId"])
peer_data: models.BGPStateNeighborDict = {
"local_as": local_as,
"remote_as": remote_as,
Expand All @@ -744,6 +743,14 @@ def get_bgp_neighbors(self) -> Dict[str, models.BGPStateNeighborsPerVRFDict]:
},
}
vrf["peers"][peer_ip] = peer_data

# Iterate IPv4 and IPv6 summary details for router-id assignment
for cmd in cmd_outputs[:2]:
for vrf_name, vrf_data in cmd["vrfs"].items():
bgp_counters[vrf_name]["router_id"] = napalm.base.helpers.ip(
vrf_data["routerId"]
)

bgp_counters["global"] = bgp_counters.pop("default")
return dict(bgp_counters)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"global": {
"peers": {},
"router_id": "192.168.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"vrfs": {
"default": {
"peerList": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vrfs": {
"default": {
"vrf": "default",
"routerId": "192.168.0.0",
"asn": "65001",
"peers": {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"vrfs": {
"default": {
"peerList": []
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"vrfs": {
"default": {
"vrf": "default",
"routerId": "192.168.0.0",
"asn": "65001",
"peers": {}
}
}
}

0 comments on commit b7a2c13

Please sign in to comment.