diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py b/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py index 87214707b..46dd68bf3 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/bgp4.py @@ -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: diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index abccdb386..76b6c4365 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -195,5 +195,11 @@ }, "NEIGH_STATE_TABLE|fc00::12": { "state" : "Deleted" + }, + "NEIGH_STATE_TABLE|Ethernet2": { + "state" : "Idle" + }, + "NEIGH_STATE_TABLE|PortChannel04": { + "state" : "Established" } }