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

refactor(anta.tests)!: Update the pass/fail criteria for testcase VerifyBFD #504

Merged
merged 7 commits into from
Feb 23, 2024

Conversation

MaheshGSLAB
Copy link
Contributor

Description

  1. Moved VerifyBFD testcase from generic to bfd file and rename with VerifyBFDPeersHealth
  2. Added the remote dick verification and an optional input parameter of last down to verify if peer was down more threshold hours.

Fixes #503

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 27, 2023
@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review December 27, 2023 10:52
@gmuloc gmuloc changed the title feat: Update the pass/fail criteria for testcase VerifyBFD feat(anta.tests)!: Update the pass/fail criteria for testcase VerifyBFD Jan 2, 2024
@gmuloc gmuloc changed the title feat(anta.tests)!: Update the pass/fail criteria for testcase VerifyBFD refactor(anta.tests)!: Update the pass/fail criteria for testcase VerifyBFD Jan 3, 2024

class VerifyBFDPeersHealth(AntaTest):
"""
Verifies there is no IPv4 BFD peer in the down state, remote disc is not zero and last down should be above the threshold for all VRF.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does remote disc mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

is it ok to mention discriminator value of the remote system

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes perfect

This class defines the input parameters of the testcase.
"""

last_down: Optional[int] = None
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
last_down: Optional[int] = None
last_down: Optional[int] = Field(default=None, gt=0)

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I am not sure I like last_down as an input. It is not very descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i can update the doc string as
Optional last down threshold in hours to check if a bfd peer was down before those hours or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe down_threshold?

"""

name = "VerifyBFDPeersHealth"
description = "Verifies there is no IPv4 BFD peer in the down state, remote disc is not zero and last down should be above the threshold for all VRF."
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should mention that the last down threshold value is optional somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

description = "Verifies there is no IPv4 BFD peer in the down state and discriminator value of the remote system is not zero for all VRF. BFD peer last down in hours is optional check which should be above the threshold for all VRF."

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good, you can modify depending on how you decide to rename the last_down variable.

"expected": {"result": "success"},
},
{
"name": "success-no-peer",
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we fail the test if there is no peer?

for peer_data in neighbor_data["peerStats"].values():
peer_status = peer_data["status"]
remote_disc = peer_data["remoteDisc"]
peer_l3intf = peer_data.get("l3intf", "")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need that l3intf key?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, earlier it was used in failure message so kept it same. Let me know if need to remove

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you investigate if the test can be refactored with a later revision (see my other comment) and check if this is still needed? Further testing might be required on EOS to check if this is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed removed the l3intf details from failure message.

anta/tests/bfd.py Show resolved Hide resolved
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.

Thanks Mahesh. Since bfd.py is a new module, you need to create the documentation: anta/docs/api/tests.bfd.md and add the section in anta/docs/api/tests.md.

Finally add your newly created MD file to mkdocs.yml. Double check the doc with mkdocs serve.

Thanks

Copy link
Contributor

github-actions bot commented Feb 1, 2024

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

Copy link
Contributor

github-actions bot commented Feb 1, 2024

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

Copy link
Contributor

github-actions bot commented Feb 7, 2024

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

Copy link
Contributor

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

@carl-baillargeon
Copy link
Contributor

LGTM

@carl-baillargeon carl-baillargeon merged commit 4542750 into aristanetworks:main Feb 23, 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.

Update the pass/fail criteria for testcase VerifyBFD
3 participants