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

Rework eos.get_bgp_neighbor #2116

Merged
merged 7 commits into from
Jul 26, 2024
Merged

Rework eos.get_bgp_neighbor #2116

merged 7 commits into from
Jul 26, 2024

Conversation

bewing
Copy link
Member

@bewing bewing commented Jul 15, 2024

Use all JSON output for get_bgp_neighbor to remove any text-parsing and prevent CLI output updates from breaking the code. Supercedes #2112

Since I'm touching the code and the tests, I'd really love some more eyes on this before a merge.

@bewing bewing requested review from ktbyers and mirceaulinic July 15, 2024 22:12
Since we have dropped support for EOS < 4.23, we can use the JSON output
from `show ip bgp neighbors` and related commands instead of processing
text output.  This eliminates many edge cases in testing, so I have
re-done unit testing as well.
@bewing
Copy link
Member Author

bewing commented Jul 16, 2024

Test cases removed:

  • issue1168 - invalid, 4.23 uses different field that is in seconds natively
  • issue1356 - invalid, 4.23+ has descriptions in show ip bgp neighbors
  • issue1759 - may be valid, will re-add and generate new mock outputs
  • issue58 - not sure what the test was here, can't find a doc

Copy link
Contributor

@ktbyers ktbyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other question, what is the difference between when "global" VRF vs "default" is used on Arista?

napalm/eos/eos.py Show resolved Hide resolved
napalm/eos/eos.py Show resolved Hide resolved
@bewing
Copy link
Member Author

bewing commented Jul 25, 2024

One other question, what is the difference between when "global" VRF vs "default" is used on Arista?

global is specifically called out in the base driver as the "no vrf" key: https://github.com/napalm-automation/napalm/blob/develop/napalm/base/base.py#L446-L447

VRF-aware Arista output uses the the key default for the "no vrf" key, so I do a quick rename via pop

@ktbyers
Copy link
Contributor

ktbyers commented Jul 25, 2024

Everything looks good to me (after fixing the uptime to be -1 for BGP peers that are down/admin down).

One other thing I saw that was odd in the test data was the remote_id of 0.0.0.0.

      "10.0.0.3": {
        "local_as": 65001,
        "remote_as": 65003,
        "remote_id": "0.0.0.0",

Is that just a config error in the BGP setup?

@bewing
Copy link
Member Author

bewing commented Jul 26, 2024

Is that just a config error in the BGP setup?

If a peer is down, you don't know his router ID. Same logic from before this change: https://github.com/napalm-automation/napalm/pull/2116/files#diff-c33f60453329944c74a7bdfb2416f90a5fe0debffbe70a7aefb83a07dc6c81d0L771

Same behavior in other drivers:

@ktbyers
Copy link
Contributor

ktbyers commented Jul 26, 2024

@bewing Ooops, missed that the BGP peer was down...

@ktbyers
Copy link
Contributor

ktbyers commented Jul 26, 2024

LGTM.

@bewing bewing merged commit 72ba65e into develop Jul 26, 2024
12 checks passed
@bewing bewing deleted the eos-bgp-json branch August 7, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants