Adding upstream version 1.3.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
6fd6eb426a
commit
dc7df702ea
337 changed files with 16571 additions and 4891 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2023-2024 Arista Networks, Inc.
|
||||
# Copyright (c) 2023-2025 Arista Networks, Inc.
|
||||
# Use of this source code is governed by the Apache License 2.0
|
||||
# that can be found in the LICENSE file.
|
||||
"""Module related to the hardware or environment tests."""
|
||||
|
@ -49,14 +49,14 @@ class VerifyTransceiversManufacturers(AntaTest):
|
|||
@AntaTest.anta_test
|
||||
def test(self) -> None:
|
||||
"""Main test function for VerifyTransceiversManufacturers."""
|
||||
self.result.is_success()
|
||||
command_output = self.instance_commands[0].json_output
|
||||
wrong_manufacturers = {
|
||||
interface: value["mfgName"] for interface, value in command_output["xcvrSlots"].items() if value["mfgName"] not in self.inputs.manufacturers
|
||||
}
|
||||
if not wrong_manufacturers:
|
||||
self.result.is_success()
|
||||
else:
|
||||
self.result.is_failure(f"Some transceivers are from unapproved manufacturers: {wrong_manufacturers}")
|
||||
for interface, value in command_output["xcvrSlots"].items():
|
||||
if value["mfgName"] not in self.inputs.manufacturers:
|
||||
self.result.is_failure(
|
||||
f"Interface: {interface} - Transceiver is from unapproved manufacturers - Expected: {', '.join(self.inputs.manufacturers)}"
|
||||
f" Actual: {value['mfgName']}"
|
||||
)
|
||||
|
||||
|
||||
class VerifyTemperature(AntaTest):
|
||||
|
@ -82,12 +82,11 @@ class VerifyTemperature(AntaTest):
|
|||
@AntaTest.anta_test
|
||||
def test(self) -> None:
|
||||
"""Main test function for VerifyTemperature."""
|
||||
self.result.is_success()
|
||||
command_output = self.instance_commands[0].json_output
|
||||
temperature_status = command_output.get("systemStatus", "")
|
||||
if temperature_status == "temperatureOk":
|
||||
self.result.is_success()
|
||||
else:
|
||||
self.result.is_failure(f"Device temperature exceeds acceptable limits. Current system status: '{temperature_status}'")
|
||||
if temperature_status != "temperatureOk":
|
||||
self.result.is_failure(f"Device temperature exceeds acceptable limits - Expected: temperatureOk Actual: {temperature_status}")
|
||||
|
||||
|
||||
class VerifyTransceiversTemperature(AntaTest):
|
||||
|
@ -113,20 +112,14 @@ class VerifyTransceiversTemperature(AntaTest):
|
|||
@AntaTest.anta_test
|
||||
def test(self) -> None:
|
||||
"""Main test function for VerifyTransceiversTemperature."""
|
||||
self.result.is_success()
|
||||
command_output = self.instance_commands[0].json_output
|
||||
sensors = command_output.get("tempSensors", "")
|
||||
wrong_sensors = {
|
||||
sensor["name"]: {
|
||||
"hwStatus": sensor["hwStatus"],
|
||||
"alertCount": sensor["alertCount"],
|
||||
}
|
||||
for sensor in sensors
|
||||
if sensor["hwStatus"] != "ok" or sensor["alertCount"] != 0
|
||||
}
|
||||
if not wrong_sensors:
|
||||
self.result.is_success()
|
||||
else:
|
||||
self.result.is_failure(f"The following sensors are operating outside the acceptable temperature range or have raised alerts: {wrong_sensors}")
|
||||
for sensor in sensors:
|
||||
if sensor["hwStatus"] != "ok":
|
||||
self.result.is_failure(f"Sensor: {sensor['name']} - Invalid hardware state - Expected: ok Actual: {sensor['hwStatus']}")
|
||||
if sensor["alertCount"] != 0:
|
||||
self.result.is_failure(f"Sensor: {sensor['name']} - Incorrect alert counter - Expected: 0 Actual: {sensor['alertCount']}")
|
||||
|
||||
|
||||
class VerifyEnvironmentSystemCooling(AntaTest):
|
||||
|
@ -156,7 +149,7 @@ class VerifyEnvironmentSystemCooling(AntaTest):
|
|||
sys_status = command_output.get("systemStatus", "")
|
||||
self.result.is_success()
|
||||
if sys_status != "coolingOk":
|
||||
self.result.is_failure(f"Device system cooling is not OK: '{sys_status}'")
|
||||
self.result.is_failure(f"Device system cooling status invalid - Expected: coolingOk Actual: {sys_status}")
|
||||
|
||||
|
||||
class VerifyEnvironmentCooling(AntaTest):
|
||||
|
@ -177,8 +170,6 @@ class VerifyEnvironmentCooling(AntaTest):
|
|||
```
|
||||
"""
|
||||
|
||||
name = "VerifyEnvironmentCooling"
|
||||
description = "Verifies the status of power supply fans and all fan trays."
|
||||
categories: ClassVar[list[str]] = ["hardware"]
|
||||
commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment cooling", revision=1)]
|
||||
|
||||
|
@ -198,12 +189,16 @@ class VerifyEnvironmentCooling(AntaTest):
|
|||
for power_supply in command_output.get("powerSupplySlots", []):
|
||||
for fan in power_supply.get("fans", []):
|
||||
if (state := fan["status"]) not in self.inputs.states:
|
||||
self.result.is_failure(f"Fan {fan['label']} on PowerSupply {power_supply['label']} is: '{state}'")
|
||||
self.result.is_failure(
|
||||
f"Power Slot: {power_supply['label']} Fan: {fan['label']} - Invalid state - Expected: {', '.join(self.inputs.states)} Actual: {state}"
|
||||
)
|
||||
# Then go through fan trays
|
||||
for fan_tray in command_output.get("fanTraySlots", []):
|
||||
for fan in fan_tray.get("fans", []):
|
||||
if (state := fan["status"]) not in self.inputs.states:
|
||||
self.result.is_failure(f"Fan {fan['label']} on Fan Tray {fan_tray['label']} is: '{state}'")
|
||||
self.result.is_failure(
|
||||
f"Fan Tray: {fan_tray['label']} Fan: {fan['label']} - Invalid state - Expected: {', '.join(self.inputs.states)} Actual: {state}"
|
||||
)
|
||||
|
||||
|
||||
class VerifyEnvironmentPower(AntaTest):
|
||||
|
@ -237,19 +232,16 @@ class VerifyEnvironmentPower(AntaTest):
|
|||
@AntaTest.anta_test
|
||||
def test(self) -> None:
|
||||
"""Main test function for VerifyEnvironmentPower."""
|
||||
self.result.is_success()
|
||||
command_output = self.instance_commands[0].json_output
|
||||
power_supplies = command_output.get("powerSupplies", "{}")
|
||||
wrong_power_supplies = {
|
||||
powersupply: {"state": value["state"]} for powersupply, value in dict(power_supplies).items() if value["state"] not in self.inputs.states
|
||||
}
|
||||
if not wrong_power_supplies:
|
||||
self.result.is_success()
|
||||
else:
|
||||
self.result.is_failure(f"The following power supplies status are not in the accepted states list: {wrong_power_supplies}")
|
||||
for power_supply, value in dict(power_supplies).items():
|
||||
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}")
|
||||
|
||||
|
||||
class VerifyAdverseDrops(AntaTest):
|
||||
"""Verifies there are no adverse drops on DCS-7280 and DCS-7500 family switches (Arad/Jericho chips).
|
||||
"""Verifies there are no adverse drops on DCS-7280 and DCS-7500 family switches.
|
||||
|
||||
Expected Results
|
||||
----------------
|
||||
|
@ -264,7 +256,6 @@ class VerifyAdverseDrops(AntaTest):
|
|||
```
|
||||
"""
|
||||
|
||||
description = "Verifies there are no adverse drops on DCS-7280 and DCS-7500 family switches."
|
||||
categories: ClassVar[list[str]] = ["hardware"]
|
||||
commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hardware counter drop", revision=1)]
|
||||
|
||||
|
@ -272,9 +263,8 @@ class VerifyAdverseDrops(AntaTest):
|
|||
@AntaTest.anta_test
|
||||
def test(self) -> None:
|
||||
"""Main test function for VerifyAdverseDrops."""
|
||||
self.result.is_success()
|
||||
command_output = self.instance_commands[0].json_output
|
||||
total_adverse_drop = command_output.get("totalAdverseDrops", "")
|
||||
if total_adverse_drop == 0:
|
||||
self.result.is_success()
|
||||
else:
|
||||
self.result.is_failure(f"Device totalAdverseDrops counter is: '{total_adverse_drop}'")
|
||||
if total_adverse_drop != 0:
|
||||
self.result.is_failure(f"Incorrect total adverse drops counter - Expected: 0 Actual: {total_adverse_drop}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue