8000 feat(anta.tests): Added test VerifyInterfacesCounters to support all interface errors with expected threshold by geetanjalimanegslab · Pull Request #1188 · aristanetworks/anta · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(anta.tests): Added test VerifyInterfacesCounters to support all interface errors with expected threshold #1188

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

geetanjalimanegslab
Copy link
Collaborator
@geetanjalimanegslab geetanjalimanegslab commented May 5, 2025

Description

Added test VerifyInterfacesCounters to support all interface errors with expected threshold

Added test changes -
1. interfaces_errors_and_discards_test.py
2. interfaces_mgmt_only_test.py

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)

…aceDiscards to support all interface errors with expected threshold
Copy link
codspeed-hq bot commented May 5, 2025

CodSpeed Performance Report

Merging #1188 will not alter performance

Comparing geetanjalimanegslab:issue_int_erros (18192c0) with main (0b6b9b5)

Summary

✅ 26 untouched benchmarks

Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

Copy link
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Copy link
Contributor

Conflicts have been resolved. A maintainer will review the pull request shortly.

@geetanjalimanegslab geetanjalimanegslab changed the title feat(anta.tests): Updated test VerifyInterfaceErrors and VerifyInterfaceDiscards to support all interface errors with expected threshold feat(anta.tests): Added test VerifyInterfacesCounters to support all interface errors with expected threshold May 20, 2025
Copy link

if interface_time_stamp:
then = datetime.fromtimestamp(interface_time_stamp, tz=timezone.utc)
delta = now - then
return delta.days * 24 if delta.days < 1 else delta.days
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the delta is less than one day, it will be converted to hours. We should update the message accordingly to avoid confusion in the failure messages.

# Verify the interface status
if data["lineProtocolStatus"] == "down" or data["lineProtocolStatus"] == "notPresent":
self.result.is_failure(
f"Interface: {interface} Description: {int_desc} Downtime: {last_state_timestamp} - Incorrect state - Expected: up"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here the downtime

# Verify interface error counter details
self.verify_interface_error_counter_details(interface, error_counters, int_desc, last_state_timestamp)

def verify_interface_error_counter_details(self, interface: str, error_counters: dict[str, Any], int_desc: str | None, last_state_timestamp: int | None) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really need a separate util just to call another util here?

continue

# Verify that link status changes are within the expected range
if error_counters.get("linkStatusChanges") > self.inputs.link_status_changes_threshold:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use assignment expression operator (:=).
Same for other places.

"result": AntaTestStatus.FAILURE,
"messages": [
"Interface: Ethernet52/1 Description: None Downtime: None - Incorrect state - Expected: up Actual: notPresent",
"Interface: Ethernet27 Description: None Downtime: 204 - Incorrect state - Expected: up Actual: down",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we skip the description if it's not available?
Also, the 204 isn't clearly associated with any specific action. Please update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0