Skip to content

Conversation

MaheshGSLAB
Copy link
Collaborator

@MaheshGSLAB MaheshGSLAB commented Mar 14, 2024

Description

Added testcase to verify router path-selection paths.

VerifyRouterPathsHealth
"""
Verifies the route and telemetry state of all paths under router path-selection.
The expected states are 'IPsec established', 'Resolved' for route and 'active' for telemetry.

Expected Results
----------------
* Success: The test will pass if all paths under router path-selection have their route state as either 'IPsec established' or 'Resolved'
           and their telemetry state as 'active'.
* Failure: The test will fail if router path-selection is not configured, any path's route state is not 'IPsec established' or 'Resolved',
           or the telemetry state is 'inactive'.

"""

VerifySpecificRouterPath
"""
Verifies the route and telemetry state of a specific path for an IPv4 peer under router path-selection.
The expected states are 'IPsec established', 'Resolved' for route and 'active' for telemetry.

Expected Results
----------------
* Success: The test will pass if the path under router path-selection has its route state as either 'IPsec established' or 'Resolved'
           and telemetry state as 'active'.
* Failure: The test will fail if router path-selection is not configured, the path's route state is not 'IPsec established' or 'Resolved',
           or the telemetry state is 'inactive'.

"""

Fixes #577

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 marked this pull request as ready for review March 14, 2024 09:00
@gmuloc gmuloc added this to the v1.0.0 milestone Apr 12, 2024
name = "VerifyRouterPathsHealth"
description = "Verifies the route and telemetry state of all paths under router path-selection."
categories: ClassVar[list[str]] = ["path-selection"]
commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show path-selection paths")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add revision for json

Comment on lines 64 to 66
# If the route state of any path is not 'ipsecEstablished' or 'routeResolved', the test fails
if route_state not in ["ipsecEstablished", "routeResolved"]:
self.result.is_failure(f"Route state for peer {peer} in group {group} is `{route_state}`.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

so here we could even imagine checking that if IPsec is enabled for the path-group for dynamic peers, we expect ipsecEstablished otherwise routeResolved. It would mean also retrieving the `show running-config path-seleciton


# If the telemetry state of any path is inactive, the test fails
elif not session:
self.result.is_failure(f"Telemetry state for peer {peer} in group {group} is `inactive`.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
self.result.is_failure(f"Telemetry state for peer {peer} in group {group} is `inactive`.")
self.result.is_failure(f"Telemetry state for peer {peer} in path-group {group} is `inactive`.")


Expected Results
----------------
* Success: The test will pass if all paths under router path-selection have their route state as either 'IPsec established' or 'Resolved'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Success: The test will pass if all paths under router path-selection have their route state as either 'IPsec established' or 'Resolved'
* Success: The test will pass if all path states under router path-selection are either 'IPsec established' or 'Resolved'

----------------
* Success: The test will pass if all paths under router path-selection have their route state as either 'IPsec established' or 'Resolved'
and their telemetry state as 'active'.
* Failure: The test will fail if router path-selection is not configured, any path's route state is not 'IPsec established' or 'Resolved',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing telemetry active check in the docstring (to be added) and reword like this:

Suggested change
* Failure: The test will fail if router path-selection is not configured, any path's route state is not 'IPsec established' or 'Resolved',
* Failure: The test will fail if router path-selection is not configured or if any path state is not 'IPsec established' or 'Resolved',

--------
```yaml
anta.tests.path_selection:
- VerifyRouterPathsHealth:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
- VerifyRouterPathsHealth:
- VerifyPathsHealth:

self.result.is_failure(f"Telemetry state for peer {peer} in group {group} is `inactive`.")


class VerifySpecificRouterPath(AntaTest):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
class VerifySpecificRouterPath(AntaTest):
class VerifySpecificPath(AntaTest):

Copy link
Collaborator

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

Tested on a system :)

@gmuloc gmuloc merged commit a2f34a1 into aristanetworks:main Apr 22, 2024
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 support to validate router path-selections paths
3 participants