-
Notifications
You must be signed in to change notification settings - Fork 34
feat(anta.tests): Added testcase to validate power voltage and state #1192
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
base: main
Are you sure you want to change the base?
Changes from all commits
13dd3a1
6d35818
b5a05b3
ec79de6
20b42ba
34350b5
c2bc561
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,7 +9,7 @@ | |||||
|
||||||
from typing import TYPE_CHECKING, ClassVar | ||||||
|
||||||
from anta.custom_types import PowerSupplyFanStatus, PowerSupplyStatus | ||||||
from anta.custom_types import PositiveInteger, PowerSupplyFanStatus, PowerSupplyStatus | ||||||
from anta.decorators import skip_on_platforms | ||||||
from anta.models import AntaCommand, AntaTest | ||||||
|
||||||
|
@@ -203,12 +203,12 @@ def test(self) -> None: | |||||
|
||||||
|
||||||
class VerifyEnvironmentPower(AntaTest): | ||||||
"""Verifies the power supplies status. | ||||||
"""Verifies the power supplies status and power voltage details. | ||||||
|
||||||
Expected Results | ||||||
---------------- | ||||||
* Success: The test will pass if the power supplies status are within the accepted states list. | ||||||
* Failure: The test will fail if some power supplies status is not within the accepted states list. | ||||||
* Success: The test will pass if the statuses of all power supplies are in the accepted states list and the power voltage matches the expected value. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
* Failure: The test will fail if the status of any power supply is not in the list of accepted states, or if the power voltage does not match the expected value. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
Examples | ||||||
-------- | ||||||
|
@@ -228,6 +228,8 @@ class Input(AntaTest.Input): | |||||
|
||||||
states: list[PowerSupplyStatus] | ||||||
"""List of accepted states list of power supplies status.""" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
min_input_voltage: PositiveInteger | None = None | ||||||
"""Minimum allowed input power voltage.""" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
@skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab", "vEOS"]) | ||||||
@AntaTest.anta_test | ||||||
|
@@ -240,6 +242,12 @@ def test(self) -> None: | |||||
if (state := value["state"]) not in self.inputs.states: | ||||||
self.result.is_failure(f"Power Slot: {power_supply} - Invalid power supplies state - Expected: {', '.join(self.inputs.states)} Actual: {state}") | ||||||
|
||||||
# Verify if the power supply voltage is greater than the minimum input voltage | ||||||
if self.inputs.min_input_voltage and value["inputVoltage"] < self.inputs.min_input_voltage: | ||||||
self.result.is_failure( | ||||||
f"Powersupply: {power_supply} - Input power voltage mismatch - Expected: > {self.inputs.min_input_voltage} Actual: {value['inputVoltage']}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
) | ||||||
|
||||||
|
||||||
class VerifyAdverseDrops(AntaTest): | ||||||
"""Verifies there are no adverse drops on DCS-7280 and DCS-7500 family switches. | ||||||
|
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.