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

IOS BGP not active error #987

Closed
bewing opened this issue May 22, 2019 · 0 comments · Fixed by #1019
Closed

IOS BGP not active error #987

bewing opened this issue May 22, 2019 · 0 comments · Fixed by #1019

Comments

@bewing
Copy link
Member

bewing commented May 22, 2019

In [3]: with IOSDriver("ios01", os.environ.get("NAPALM_USERNAME"), os.environ.get("NAPALM_PASSWORD")) as d:
   ...:     d.get_bgp_neighbors()
   ...:
NAPALM didn't catch this exception. Please, fill a bugfix on https://github.com/napalm-automation/napalm/issues
Don't forget to include this traceback.
---------------------------------------------------------------------------
AddrFormatError                           Traceback (most recent call last)
<ipython-input-3-fc2e1223ed9d> in <module>
      1 with IOSDriver("ios01", os.environ.get("NAPALM_USERNAME"), os.environ.get("NAPALM_PASSWORD")) as d:
----> 2     d.get_bgp_neighbors()
      3

/mnt/c/Users/bewing/PycharmProjects/napalm/napalm/ios/ios.py in get_bgp_neighbors(self)
   1697
   1698         # check the router_id looks like an ipv4 address
-> 1699         router_id = napalm.base.helpers.ip(router_id, version=4)
   1700
   1701         # add parsed data to output dict

/mnt/c/Users/bewing/PycharmProjects/napalm/napalm/base/helpers.py in ip(addr, version)
    328         u'2001:db8:85a3::8a2e:370:7334'
    329     """
--> 330     addr_obj = IPAddress(addr)
    331     if version and addr_obj.version != version:
    332         raise ValueError("{} is not an ipv{} address".format(addr, version))

/mnt/c/Users/bewing/.pyenv/versions/3.6.6/envs/napalm/lib/python3.6/site-packages/netaddr/ip/__init__.py in __init__(self, addr, version, flags)
    304                 if self._module is None:
    305                     raise AddrFormatError('failed to detect a valid IP ' \
--> 306                         'address from %r' % addr)
    307             else:
    308                 #   IP version is explicit.

AddrFormatError: failed to detect a valid IP address from None
ios01#show bgp all summary
% BGP not active

ios01#

Looks like we need to detect this in line 1478. Do we really want to raise a CommandErrorException, or just return an empty dictionary?

@ktbyers ktbyers added the bgp label May 22, 2019
bewing added a commit that referenced this issue Jul 15, 2019
If BGP is not active (looking for specific strings in output), just
return an empty dictionary.  Update unit testing to allow for empty
dictionary returns (global key should only exist if the dictionary is
not empty). Closes #987
mirceaulinic pushed a commit that referenced this issue Oct 29, 2019
If BGP is not active (looking for specific strings in output), just
return an empty dictionary.  Update unit testing to allow for empty
dictionary returns (global key should only exist if the dictionary is
not empty). Closes #987
ExaneServerTeam pushed a commit to ExaneServerTeam/napalm that referenced this issue Mar 6, 2020
If BGP is not active (looking for specific strings in output), just
return an empty dictionary.  Update unit testing to allow for empty
dictionary returns (global key should only exist if the dictionary is
not empty). Closes napalm-automation#987
neelimapp pushed a commit to neelimapp/napalm that referenced this issue Mar 20, 2020
If BGP is not active (looking for specific strings in output), just
return an empty dictionary.  Update unit testing to allow for empty
dictionary returns (global key should only exist if the dictionary is
not empty). Closes napalm-automation#987
bharath-ravindranath pushed a commit to bharath-ravindranath/napalm that referenced this issue Apr 19, 2020
If BGP is not active (looking for specific strings in output), just
return an empty dictionary.  Update unit testing to allow for empty
dictionary returns (global key should only exist if the dictionary is
not empty). Closes napalm-automation#987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants