Skip to content

Commit

Permalink
[bgpmon] Fix dict_keys unsubscriptable error (#5859)
Browse files Browse the repository at this point in the history
Simply looping through `dict_key` object instead of index-subscribing to
fix this.

Signed-off-by: Longxiang Lyu <[email protected]>
  • Loading branch information
lolyu authored Nov 8, 2020
1 parent 9fda295 commit 92704e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sonic-bgpcfgd/bgpmon/bgpmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ def bgp_activity_detected(self):
def update_new_peer_states(self, peer_dict):
peer_l = peer_dict["peers"].keys()
self.new_peer_l.extend(peer_l)
for i in range (0, len(peer_l)):
self.new_peer_state[peer_l[i]] = peer_dict["peers"][peer_l[i]]["state"]
for peer in peer_l:
self.new_peer_state[peer] = peer_dict["peers"][peer]["state"]

# Get a new snapshot of BGP neighbors and store them in the "new" location
def get_all_neigh_states(self):
Expand Down

0 comments on commit 92704e8

Please sign in to comment.