[bgpmon] Fix dict_keys unsubscriptable error (#5859)

Simply looping through `dict_key` object instead of index-subscribing to
fix this.

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
This commit is contained in:
Longxiang Lyu 2020-11-09 05:42:38 +08:00 committed by GitHub
parent 9fda295cd0
commit 92704e8a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -68,8 +68,8 @@ class BgpStateGet:
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):