Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track BGP state to report is_up #684

Merged
merged 6 commits into from
Apr 8, 2018
Merged
Show file tree
Hide file tree
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
8 changes: 6 additions & 2 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ def get_bgp_neighbors(self):
{'regexp': re.compile(r'^\s+BGP version \d+, remote router ID '
r'(?P<remote_id>{})'.format(IPV4_ADDR_REGEX)),
'record': False},
# Capture state
{'regexp': re.compile(r'^\s+BGP state = (?P<state>\w+)'),
'record': False},
# Capture AFI and SAFI names, e.g.:
# For address family: IPv4 Unicast
{'regexp': re.compile(r'^\s+For address family: (?P<afi>\S+) '),
Expand Down Expand Up @@ -1397,8 +1400,8 @@ def get_bgp_neighbors(self):
# parse uptime value
uptime = self.bgp_time_conversion(entry['uptime'])

# Uptime should be -1 if BGP session not up
is_up = True if uptime >= 0 else False
# BGP is up if state is Established
is_up = 'Established' in neighbor_entry['state']

# check whether session is up for address family and get prefix count
try:
Expand All @@ -1422,6 +1425,7 @@ def get_bgp_neighbors(self):
else:
received_prefixes = -1
sent_prefixes = -1
uptime = -1

# get description
try:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading