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

feat(anta.tests): Adding the test case to verify BGP neighbor authentication #495

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

MaheshGSLAB
Copy link
Contributor

Description

Add the test case to verify the BGP neighbor authentication.

Run the testcase by adding catalog as below:

anta.tests.routing:
  bgp:
      - VerifyBGPAuthentication:
          bgp_neighbors:
            - neighbor: 172.30.11.1
              vrf: default
            - neighbor: 172.30.11.5
              vrf: default
  1. Testcase pass when details are correct.
                                                        All tests results                                                         
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Device    ┃ Test Name               ┃ Test Status ┃ Message(s) ┃ Test description                               ┃ Test category ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ s1-spine1 │ VerifyBGPAuthentication │ success     │            │ Verifies if BGP neighbors are configured with  │ routing, bgp  │
│           │                         │             │            │ MD5 authentication and state as established in │               │
│           │                         │             │            │ the specified VRF.                             │               │
└───────────┴─────────────────────────┴─────────────┴────────────┴────────────────────────────────────────────────┴───────────────┘
  1. Testcase fails when bgp neighbor not found.
                                                        All tests results                                                         
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Device    ┃ Test Name               ┃ Test Status ┃ Message(s)                   ┃ Test description             ┃ Test category ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ s1-spine1 │ VerifyBGPAuthentication │ failure     │ BGP neighbor 172.30.11.11 is │ Verifies if BGP neighbors    │ routing, bgp  │
│           │                         │             │ not configured for `default` │ are configured with MD5      │               │
│           │                         │             │ VRF.                         │ authentication and state as  │               │
│           │                         │             │                              │ established in the specified │               │
│           │                         │             │                              │ VRF.                         │               │
└───────────┴─────────────────────────┴─────────────┴──────────────────────────────┴──────────────────────────────┴───────────────┘
  1. Testcase fails when MD5 authentication is not enabled and state is not establised
                                                        All tests results                                                         
┏━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Device    ┃ Test Name               ┃ Test Status ┃ Message(s)                   ┃ Test description             ┃ Test category ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ s1-spine1 │ VerifyBGPAuthentication │ failure     │ Following BGP neighbors are  │ Verifies if BGP neighbors    │ routing, bgp  │
│           │                         │             │ not established or MD5       │ are configured with MD5      │               │
│           │                         │             │ authentication not enabled:  │ authentication and state as  │               │
│           │                         │             │ {'bgp_neighbors':            │ established in the specified │               │
│           │                         │             │ {'default': {'172.30.11.11': │ VRF.                         │               │
│           │                         │             │ {'state': 'Idle',            │                              │               │
│           │                         │             │ 'md5_auth_enabled': False},  │                              │               │
│           │                         │             │ '172.30.11.51': {'state':    │                              │               │
│           │                         │             │ 'Idle', 'md5_auth_enabled':  │                              │               │
│           │                         │             │ False}}}}                    │                              │               │
└───────────┴─────────────────────────┴─────────────┴──────────────────────────────┴──────────────────────────────┴───────────────┘

Fixes #493

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have run pre-commit for code linting and typing (pre-commit run)
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes (tox -e testenv)

@MaheshGSLAB MaheshGSLAB self-assigned this Dec 14, 2023
@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review December 14, 2023 10:15
anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
@MaheshGSLAB MaheshGSLAB changed the title feat: Adding the test case to verify BGP neighbor authentication feat(anta.tests)!: Adding the test case to verify BGP neighbor authentication Jan 4, 2024
@gmuloc gmuloc changed the title feat(anta.tests)!: Adding the test case to verify BGP neighbor authentication feat(anta.tests): Adding the test case to verify BGP neighbor authentication Jan 5, 2024
Copy link
Contributor

github-actions bot commented Jan 9, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

github-actions bot commented Jan 9, 2024

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

@carl-baillargeon carl-baillargeon left a comment

Choose a reason for hiding this comment

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

LGTM after small adjustments in docstrings.

anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
anta/tests/routing/bgp.py Outdated Show resolved Hide resolved
issue-493: fix the unit test

issue-493: Improved code

issue-493: updated testcase name and code logic

issue-493: updated show command

issue-493: fixed the black for utils.py

issue-493: fix all liniting in utils.py

issue-493: removed ipv6 support
Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Collaborator

@titom73 titom73 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@titom73 titom73 merged commit 47c3a65 into aristanetworks:main Feb 7, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the test case to verify the BGP neighbor authentication
4 participants