Skip to content

Commit

Permalink
Merge pull request mikenowak#6 from mikenowak/down-protocol
Browse files Browse the repository at this point in the history
adding code to handle protocol in a down state
  • Loading branch information
mikenowak authored Mar 26, 2018
2 parents aee6110 + 12ef4f8 commit 2df2849
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions birdagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,18 @@ def getBGPState(self):
match = peerprop_re.search(line)
if match:
if peerprop_name == 'bgpPeerState':
state["bgp-peers"][bgp_proto][peerprop_name] = \
self.bgp_states[match.group(1).lower()]
if not match.group(1).lower() == 'down':
state["bgp-peers"][bgp_proto][peerprop_name] = \
self.bgp_states[match.group(1).lower()]
else:
# handle disabled (down) protocols
state["bgp-peers"][bgp_proto][peerprop_name] = int(
1)
state["bgp-peers"][bgp_proto]["bgpPeerAdminStatus"] = int(
1)
state["bgp-peers"][bgp_proto]["bgpPeerFsmEstablishedTime"] = int(
0)

elif peerprop_name in [
'bgpPeerIdentifier',
'bgpPeerLocalAddr',
Expand Down

0 comments on commit 2df2849

Please sign in to comment.