napalm-automation/napalm

Shutdown BGP neighbours are not parsed correctly

Open

#461 opened on Oct 24, 2017

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Python (553 forks)batch import
buggood first issueios

Repository metrics

Stars
 (2,145 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description of Issue/Question

If a BGP neighbour is Admin shutdown, the key "is_enabled" has value True instead of False

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

  • [* ] Yes
  • No

napalm-ios version

napalm-ios==0.6.2

IOS version

Cisco IOS Software, s2t54 Software (s2t54-ADVIPSERVICESK9-M), Version 15.2(1)SY1a, RELEASE SOFTWARE (fc6)

Steps to Reproduce the Issue

In case the bgp neighbour 10.1.1.1 is shutdown, the output from "show bgp all summary" is: .. 10.1.1.1 4 65001 0 0 1 0 0 never Idle (Admin) ... but the "Admin" string is not parsed correctly and the result is:

"10.1.1.1": { ... "is_enabled": true, "is_up": false,

The problem is in the line 1198 inside the ios.py which strips the "Admin" string because it is the 11th element inside the list: fields = line.split()[:10]

and so it never gettes into "state_prefix" variable for later check:

if '(Admin)' in state_prefix: is_enabled = False else: is_enabled = True

if I for example remove the [:10] and concatenate last two strings Idle and (Admin), the it works fine:

fields = line.split() if len(fields) > 10: fields[9] = fields[9] + fields[10] fields = fields[:10]

"10.1.1.1": {... "is_enabled": false, "is_up": false,


Moved from https://github.com/napalm-automation/napalm-ios/issues/161

Contributor guide