Skip to content
Closed
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
4 changes: 2 additions & 2 deletions scripts/ipintutil
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ 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']
local_addr = data[neighbor_ip].get('local_addr', "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to just put the whole block inside the for loop inside:

try:
    ...
except KeyError:
  pass

Your current solution adds a blank entry to bgp_peer which doesn't do anything for us...

Should probably also put a comment that this get_bgp_peer is for retrieving manually specified BGP peers only, not BGP Unnumbered peers (like when specifying an interface)

neighbor_name = data[neighbor_ip].get('name', "")
bgp_peer.setdefault(local_addr, [neighbor_name, neighbor_ip])
return bgp_peer

Expand Down