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

NX-OS using nx-api fails on get_bgp_neighbors if peer is admin down #870

Closed
ktbyers opened this issue Nov 24, 2018 · 4 comments · Fixed by #1980
Closed

NX-OS using nx-api fails on get_bgp_neighbors if peer is admin down #870

ktbyers opened this issue Nov 24, 2018 · 4 comments · Fixed by #1980

Comments

@ktbyers
Copy link
Contributor

ktbyers commented Nov 24, 2018

No description provided.

@ktbyers ktbyers added the nxos label Nov 24, 2018
@ktbyers
Copy link
Contributor Author

ktbyers commented May 22, 2019

@carl Can you see if you can reproduce this? If so, then we should add a unit test for it and correct the behavior.

Probably should also sanity check the same thing on NX-OS SSH

@robobeaver6
Copy link

I am hitting this issue. It seems to occur on Line894
on neighbors where the state resolves to Shut (Admin), which is not in the bgp_state_dict lookup dict.

@deep-blue-pulsar
Copy link

deep-blue-pulsar commented Aug 26, 2022

Currently hitting this issue with napalm 4.0.0


Traceback (most recent call last):
  File "/home/[REDACTED]/myvenv/bgp_test.py", line 14, in <module>
    output = device.get_bgp_neighbors()
  File "/home/[REDACTED]/myvenv/lib/python3.9/site-packages/napalm/nxos/nxos.py", line 1100, in get_bgp_neighbors
    bgp_state = bgp_state_dict[state]
KeyError: 'Shut (Admin)'

@rich9474
Copy link

I think this has a pretty simple fix. The nxos.py file just needs an extra state to match the different format of the device response.

    def get_bgp_neighbors(self) -> Dict[str, models.BGPStateNeighborsPerVRFDict]:
        results = {}
        bgp_state_dict = {
            "Idle": {"is_up": False, "is_enabled": True},
            "Active": {"is_up": False, "is_enabled": True},
            "Open": {"is_up": False, "is_enabled": True},
            "Established": {"is_up": True, "is_enabled": True},
            "Closing": {"is_up": True, "is_enabled": True},
            "Shutdown": {"is_up": False, "is_enabled": False},
            "Shut (Admin)": {"is_up": False, "is_enabled": False},

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.

4 participants