napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

fix bug when bgp is not active #188

Closed afourmy closed 7 years ago

afourmy commented 7 years ago

Getter get_bgp_neighbors FIX:

When BGP is not active on an IOS device, the output of "'show bgp all summary" is "% BGP not active". router_id is set to None and summary_data is an empty list. None cannot be converted to a netaddr.IPAddress instance and we get the following exception:

edit 2nd commit: when BGP is active, but there are no neighbors configured, summary_output is empty and we get the same exception

File "C:\Users\minto\Desktop\Napalm dev\napalm-ios\napalm_ios\ios.py", line 1330, in get_bgp_neighbors router_id = napalm_base.helpers.ip(router_id, version=4) File "C:\Users\minto\Desktop\Apps\Pyzo\pyzo2015a\lib\site-packages\napalm_base\helpers.py", line 245, in ip addr_obj = IPAddress(addr) File "C:\Users\minto\Desktop\Apps\Pyzo\pyzo2015a\lib\site-packages\netaddr\ip__init.py", line 306, in init__ 'address from %r' % addr) netaddr.core.AddrFormatError: failed to detect a valid IP address from None

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.04%) to 70.164% when pulling 030d2142a8b0005494b2c194a59f59bce7df00ba on afourmy:master into 81a69f88a3f289b9774e238523b4160c1f2e0b26 on napalm-automation:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.1%) to 70.1% when pulling 7b87a0a59d999ac758d58c6a40c5736d694f1587 on afourmy:master into 81a69f88a3f289b9774e238523b4160c1f2e0b26 on napalm-automation:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-0.04%) to 70.164% when pulling 86cbcdc46aef47c6a1aae95d9c464dd1ff17802e on afourmy:master into 81a69f88a3f289b9774e238523b4160c1f2e0b26 on napalm-automation:master.