diff --git a/scripts/ipintutil b/scripts/ipintutil index 85879972e0..193f44ebde 100755 --- a/scripts/ipintutil +++ b/scripts/ipintutil @@ -48,9 +48,14 @@ def get_bgp_peer(): data = config_db.get_table('BGP_NEIGHBOR') for neighbor_ip in data.keys(): - local_addr = data[neighbor_ip]['local_addr'] - neighbor_name = data[neighbor_ip]['name'] - bgp_peer.setdefault(local_addr, [neighbor_name, neighbor_ip]) + # The data collected here will only work for manually defined neighbors + # so we need to ignore errors when using BGP Unnumbered. + try: + local_addr = data[neighbor_ip]['local_addr'] + neighbor_name = data[neighbor_ip]['name'] + bgp_peer.setdefault(local_addr, [neighbor_name, neighbor_ip]) + except KeyError: + pass return bgp_peer diff --git a/tests/mock_tables/config_db.json b/tests/mock_tables/config_db.json index 3deca74255..8b389c7a26 100644 --- a/tests/mock_tables/config_db.json +++ b/tests/mock_tables/config_db.json @@ -2059,6 +2059,14 @@ "asn": "65200", "keepalive": "3" }, + "BGP_NEIGHBOR|Vlan100": { + "rrclient": "0", + "peer_type": "external", + "nhopself": "0", + "admin_status": "up", + "holdtime": "10", + "keepalive": "3" + }, "SCHEDULER|scheduler.0": { "type": "DWRR", "weight": "14"