Skip to content

Commit

Permalink
Issue_882: Updated test descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Geetanjali Mane authored and Geetanjali Mane committed Jan 3, 2025
1 parent 6f40cfa commit 1dd3e8d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
10 changes: 8 additions & 2 deletions anta/input_models/routing/isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ class ISISInstances(BaseModel):
name: str
"""The instance name or ID to validated the instance specific isis details."""
graceful_restart: bool = True
"""Flag to check if the graceful restart is enabled for isis instance, Defaults to `True`"""
"""Specifies the Graceful Restart,
Options:
- True: Default mode, refer as graceful restart is enabled.
- False: Refer as graceful restart is disabled."""
graceful_helper: bool = True
"""Flag to check if the graceful helper is enabled for isis instance, Defaults to `True`"""
"""Specifies the Graceful Restart Helper,
Options:
- True: Default mode, refer as graceful restart helper is enabled.
- False: Refer as graceful restart helper is disabled."""

def __str__(self) -> str:
"""Return a human-readable string representation of the ISISInstances for reporting."""
Expand Down
20 changes: 13 additions & 7 deletions anta/tests/routing/isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,22 @@ class VerifyISISGracefulRestart(AntaTest):
This test performs the following checks:
1. Verifies that the ISIS is configured.
2. Verifies that the specified VRF is found.
2. Verifies that the specified VRF is configured.
3. Verifies that the specified VRF instance is found.
4. Verifies that the IS-IS graceful restart and graceful helper are set as expected in the inputs.
Expected Results
----------------
* Success: The test will pass if graceful restart and graceful helper are set as expected for a specified VRF instance.
* Failure: The test will fail if graceful restart and graceful helper are not set as expected for a specified VRF instance.
* Success: The test will pass if all of the following conditions are met:
- ISIS is configured on the device.
- Specified VRF is configured.
- Specified VRF instance is found
- Expected and actual IS-IS graceful restart and graceful helper values are matched.
* Failure: The test will fail if any of the following conditions is met:
- ISIS is not configured on the device.
- Specified VRF is not configured.
- Specified VRF instance is not found.
- Expected and actual IS-IS graceful restart and graceful helper values are not matched.
Examples
--------
Expand Down Expand Up @@ -809,10 +817,8 @@ def test(self) -> None:
continue

if instance_details.get("gracefulRestart") != graceful_restart:
self.result.is_failure(
f"{instance} - Incorrect value for Graceful Restart - Expected: {graceful_restart}, Actual: {instance_details.get('gracefulRestart')}"
)
self.result.is_failure(f"{instance} - Graceful Restart disabled")

actual_gr_helper = instance_details.get("gracefulRestartHelper")
if actual_gr_helper != graceful_helper:
self.result.is_failure(f"{instance} - Incorrect value for Graceful Restart Helper - Expected: {graceful_helper}, Actual: {actual_gr_helper}")
self.result.is_failure(f"{instance} - Graceful Restart Helper disabled")
9 changes: 3 additions & 6 deletions tests/units/anta_tests/routing/test_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,8 +1925,8 @@
"expected": {
"result": "failure",
"messages": [
"VRF: default Instance: 1 - Incorrect value for Graceful Restart - Expected: True, Actual: False",
"VRF: test Instance: 1 - Incorrect value for Graceful Restart - Expected: True, Actual: False",
"VRF: default Instance: 1 - Graceful Restart disabled",
"VRF: test Instance: 1 - Graceful Restart disabled",
],
},
},
Expand All @@ -1949,10 +1949,7 @@
},
"expected": {
"result": "failure",
"messages": [
"VRF: default Instance: 1 - Incorrect value for Graceful Restart Helper - Expected: True, Actual: False",
"VRF: test Instance: 1 - Incorrect value for Graceful Restart Helper - Expected: True, Actual: False",
],
"messages": ["VRF: default Instance: 1 - Graceful Restart Helper disabled", "VRF: test Instance: 1 - Graceful Restart Helper disabled"],
},
},
]
Expand Down

0 comments on commit 1dd3e8d

Please sign in to comment.