-
Notifications
You must be signed in to change notification settings - Fork 32
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): Added test case to verify isis interface authentication mode #1064
base: main
Are you sure you want to change the base?
feat(anta): Added test case to verify isis interface authentication mode #1064
Conversation
CodSpeed Performance ReportMerging #1064 will not alter performanceComparing Summary
|
|
interfaces: list[ISISInterface] | None = None | ||
"""IS-IS interfaces detail. Required field in the `VerifyISISInterfaceAuthMode` test.""" | ||
|
||
# TODO: Need to review this in ANTA 2.0 as VRF is used in both ISISInterface model. |
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.
# TODO: Need to review this in ANTA 2.0 as VRF is used in both ISISInterface model. | |
# TODO: Need to review this model in ANTA 2.0 as VRF is used in ISISInterface model as well. |
@@ -64,6 +68,12 @@ class ISISInterface(BaseModel): | |||
"""Expected number of IS-IS neighbors on this interface. Required field in the `VerifyISISNeighborCount` test.""" | |||
mode: Literal["point-to-point", "broadcast", "passive"] | None = None | |||
"""IS-IS network type of the interface. Required field in the `VerifyISISInterfaceMode` test.""" | |||
authentication_mode: Literal["MD5", "Text", "SHA", "shared-secret"] | None = None | |||
"""IS-IS authentication mode. Required field in the `VerifyISISInterfaceAuthMode` test.""" | |||
auth_key_id: int | None = None |
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.
This should be constrained.
anta.tests.routing: | ||
isis: | ||
- VerifyISISInterfaceAuthMode: | ||
instances: |
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.
It will not affect but please take care of indentation
raise ValueError(msg) | ||
return instances | ||
|
||
def _validate_isis_auth_mode(self, instance_data: str, act_interface_detail: dict[str, Any], interface_data: dict[str, Any]) -> str | None: |
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.
def _validate_isis_auth_mode(self, instance_data: str, act_interface_detail: dict[str, Any], interface_data: dict[str, Any]) -> str | None: | |
def _validate_isis_auth_mode(self, instance_data: ISISInstance, interface_data: ISISInterface, act_interface_detail: dict[str, Any]) -> str | None: |
|
||
# If authentication mode is not configured, test fails. | ||
if not (act_interface_detail.get("authenticationMode") or act_interface_detail["sharedSecretProfile"]): | ||
return f"{instance_data} Interface: {interface_data.name} Level: {interface_data.level} - Authentication mode not configured" |
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.
We may have this details in str()
Applicable to all this place
{ | ||
"name": "success", | ||
"test": VerifyISISInterfaceAuthMode, | ||
"eos_data": [ |
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.
We don't want these details in eos date.
}, | ||
}, | ||
{ | ||
"name": "failure-is-is-not-configured", |
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.
"name": "failure-is-is-not-configured", | |
"name": "skipped-ISIS-not-configured", |
Description
Verifies IS-IS interfaces are running in the correct authentication mode.
Expected Results
Fixes #881
Checklist:
pre-commit run
)tox -e testenv
)