-
Notifications
You must be signed in to change notification settings - Fork 30
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): Added testcase to verify router path-selection paths #583
Conversation
anta/tests/path_selection.py
Outdated
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")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add revision for json
anta/tests/path_selection.py
Outdated
# 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}`.") |
There was a problem hiding this comment.
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
anta/tests/path_selection.py
Outdated
|
||
# 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`.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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`.") |
anta/tests/path_selection.py
Outdated
|
||
Expected Results | ||
---------------- | ||
* Success: The test will pass if all paths under router path-selection have their route state as either 'IPsec established' or 'Resolved' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* 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' |
anta/tests/path_selection.py
Outdated
---------------- | ||
* 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', |
There was a problem hiding this comment.
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:
* 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', |
anta/tests/path_selection.py
Outdated
-------- | ||
```yaml | ||
anta.tests.path_selection: | ||
- VerifyRouterPathsHealth: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- VerifyRouterPathsHealth: | |
- VerifyPathsHealth: |
anta/tests/path_selection.py
Outdated
self.result.is_failure(f"Telemetry state for peer {peer} in group {group} is `inactive`.") | ||
|
||
|
||
class VerifySpecificRouterPath(AntaTest): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class VerifySpecificRouterPath(AntaTest): | |
class VerifySpecificPath(AntaTest): |
There was a problem hiding this 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 :)
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.
"""
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.
"""
Fixes #577
Checklist:
pre-commit run
)tox -e testenv
)