-
Notifications
You must be signed in to change notification settings - Fork 31
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): Nicer result failure messages OSPF test module #1040
base: main
Are you sure you want to change the base?
refactor(anta.tests): Nicer result failure messages OSPF test module #1040
Conversation
CodSpeed Performance ReportMerging #1040 will not alter performanceComparing Summary
|
anta/tests/routing/ospf.py
Outdated
f"Instance: {instance} VRF: {vrf} Interface: {interface[0]} - Incorrect adjacency state - Expected: Full Actual: {interface[1]}" | ||
) | ||
|
||
# If OSPF neighbors are not configured on device, test fails. |
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.
# If OSPF neighbors are not configured on device, test fails. | |
# If OSPF neighbors are not configured on device, test is skipped. |
anta/tests/routing/ospf.py
Outdated
no_neighbor = False | ||
interfaces.extend([neighbor["routerId"] for neighbor in neighbors if neighbor["adjacencyState"] == "full"]) | ||
|
||
# If OSPF neighbors are not configured on device, test fails. |
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.
# If OSPF neighbors are not configured on device, test fails. | |
# If OSPF neighbors are not configured on device, test is skipped. |
examples/tests.yaml
Outdated
@@ -661,7 +661,7 @@ anta.tests.routing.isis: | |||
nexthop: 1.1.1.1 | |||
anta.tests.routing.ospf: | |||
- VerifyOSPFMaxLSA: | |||
# Verifies all OSPF instances did not cross the maximum LSA threshold. | |||
# Verifies LSAs present in the OSPF link state database did not cross the maximum LSA Threshold. |
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.
Let's keep the current one.
anta/tests/routing/ospf.py
Outdated
max_lsa = instance_data.get("maxLsaInformation", {}).get("maxLsa") | ||
max_lsa_threshold = instance_data.get("maxLsaInformation", {}).get("maxLsaThreshold") | ||
num_lsa = instance_data.get("lsaInformation", {}).get("numLsa") |
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.
You can use get_value
here.
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.
Also, check in EOS CLI models if these keys could be missing, otherwise we can simply use instance_data["maxLsaThreshold"]
like before.
anta/tests/routing/ospf.py
Outdated
if num_lsa > max_lsa * (max_lsa_threshold / 100): | ||
exceeded_instances.append(instance) | ||
if exceeded_instances: | ||
self.result.is_failure(f"Following OSPF Instances crossed the maximum LSA threshold - {', '.join(exceeded_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.
self.result.is_failure(f"Following OSPF Instances crossed the maximum LSA threshold - {', '.join(exceeded_instances)}") | |
self.result.is_failure(f"Following OSPF instances crossed the maximum LSA threshold - {', '.join(exceeded_instances)}") |
Can we add some numbers here? Expected Actual?
eda29fd
to
76544e2
Compare
|
Description
Nicer result failure messages for following test module.
Fixes #587
Checklist:
pre-commit run
)tox -e testenv
)