Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip unnumbered BGP neighbors instead of failing #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ def update_data(self):
neigh_info = self.db_conn[db_index].get_all(mibs.STATE_DB, neigh_key, blocking=False)
if neigh_info:
state = neigh_info['state']
ip = ipaddress.ip_address(neigh_str)
try:
ip = ipaddress.ip_address(neigh_str)
except ValueError:
# In case of unnumbered BGP, the neighbor is an interface.
# That can't be represented here, so just skip the neighbor.
continue

if type(ip) is ipaddress.IPv4Address:
oid_head = (1, 4)
else:
Expand Down
6 changes: 6 additions & 0 deletions tests/mock_tables/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,11 @@
},
"NEIGH_STATE_TABLE|fc00::12": {
"state" : "Deleted"
},
"NEIGH_STATE_TABLE|Ethernet2": {
"state" : "Idle"
},
"NEIGH_STATE_TABLE|PortChannel04": {
"state" : "Established"
}
}