Skip to content
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

fix(anta.tests): Clean test descriptions, categories and docstrings #551

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion anta/tests/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class VerifyLLDPNeighbors(AntaTest):
"""

name = "VerifyLLDPNeighbors"
description = "Verifies that the provided LLDP neighbors are present and connected with the correct configuration."
description = "Verifies that the provided LLDP neighbors are connected properly."
categories = ["connectivity"]
commands = [AntaCommand(command="show lldp neighbors detail")]

Expand Down
10 changes: 5 additions & 5 deletions anta/tests/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class VerifyTransceiversManufacturers(AntaTest):
"""

name = "VerifyTransceiversManufacturers"
description = "Verifies the transceiver's manufacturer against a list of approved manufacturers."
description = "Verifies if all transceivers come from approved manufacturers."
categories = ["hardware"]
commands = [AntaCommand(command="show inventory", ofmt="json")]

Expand Down Expand Up @@ -56,7 +56,7 @@ class VerifyTemperature(AntaTest):
"""

name = "VerifyTemperature"
description = "Verifies if the device temperature is within the acceptable range."
description = "Verifies the device temperature."
categories = ["hardware"]
commands = [AntaCommand(command="show system environment temperature", ofmt="json")]

Expand All @@ -81,7 +81,7 @@ class VerifyTransceiversTemperature(AntaTest):
"""

name = "VerifyTransceiversTemperature"
description = "Verifies that all transceivers are operating within the acceptable temperature range."
description = "Verifies the transceivers temperature."
categories = ["hardware"]
commands = [AntaCommand(command="show system environment temperature transceiver", ofmt="json")]

Expand Down Expand Up @@ -138,7 +138,7 @@ class VerifyEnvironmentCooling(AntaTest):
"""

name = "VerifyEnvironmentCooling"
description = "Verifies if the fans status are within the accepted states list."
description = "Verifies the status of power supply fans and all fan trays."
categories = ["hardware"]
commands = [AntaCommand(command="show system environment cooling", ofmt="json")]

Expand Down Expand Up @@ -173,7 +173,7 @@ class VerifyEnvironmentPower(AntaTest):
"""

name = "VerifyEnvironmentPower"
description = "Verifies if the power supplies status are within the accepted states list."
description = "Verifies the power supplies status."
categories = ["hardware"]
commands = [AntaCommand(command="show system environment power", ofmt="json")]

Expand Down
68 changes: 50 additions & 18 deletions anta/tests/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
class VerifyInterfaceUtilization(AntaTest):
"""
Verifies interfaces utilization is below 75%.

Expected Results:
* success: The test will pass if all interfaces have a usage below 75%.
* failure: The test will fail if one or more interfaces have a usage above 75%.
"""

name = "VerifyInterfaceUtilization"
description = "Verifies interfaces utilization is below 75%."
description = "Verifies that all interfaces have a usage below 75%."
categories = ["interfaces"]
# TODO - move from text to json if possible
commands = [AntaCommand(command="show interfaces counters rates", ofmt="text")]
Expand Down Expand Up @@ -60,7 +64,7 @@ class VerifyInterfaceErrors(AntaTest):
"""

name = "VerifyInterfaceErrors"
description = "Verifies that interfaces error counters are equal to zero."
description = "Verifies there are no interface error counters."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces counters errors")]

Expand All @@ -80,10 +84,14 @@ def test(self) -> None:
class VerifyInterfaceDiscards(AntaTest):
"""
Verifies interfaces packet discard counters are equal to zero.

Expected Results:
* success: The test will pass if all interfaces have discard counters equal to zero.
* failure: The test will fail if one or more interfaces have non-zero discard counters.
"""

name = "VerifyInterfaceDiscards"
description = "Verifies interfaces packet discard counters are equal to zero."
description = "Verifies there are no interface discard counters."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces counters discards")]

Expand All @@ -101,11 +109,15 @@ def test(self) -> None:

class VerifyInterfaceErrDisabled(AntaTest):
"""
Verifies there is no interface in error disable state.
Verifies there are no interfaces in errdisabled state.

Expected Results:
* success: The test will pass if there are no interfaces in errdisabled state.
* failure: The test will fail if there is at least one interface in errdisabled state.
"""

name = "VerifyInterfaceErrDisabled"
description = "Verifies there is no interface in error disable state."
description = "Verifies there are no interfaces in the errdisabled state."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces status")]

Expand All @@ -129,7 +141,7 @@ class VerifyInterfacesStatus(AntaTest):
"""

name = "VerifyInterfacesStatus"
description = "Verifies if the provided list of interfaces are all in the expected state."
description = "Verifies the status of the provided interfaces."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces description")]

Expand Down Expand Up @@ -178,10 +190,14 @@ def test(self) -> None:
class VerifyStormControlDrops(AntaTest):
"""
Verifies the device did not drop packets due its to storm-control configuration.

Expected Results:
* success: The test will pass if there are no storm-control drop counters.
* failure: The test will fail if there is at least one storm-control drop counter.
"""

name = "VerifyStormControlDrops"
description = "Verifies the device did not drop packets due its to storm-control configuration."
description = "Verifies there are no interface storm-control drop counters."
categories = ["interfaces"]
commands = [AntaCommand(command="show storm-control")]

Expand All @@ -203,11 +219,15 @@ def test(self) -> None:

class VerifyPortChannels(AntaTest):
"""
Verifies there is no inactive port in port channels.
Verifies there are no inactive ports in all port channels.

Expected Results:
* success: The test will pass if there are no inactive ports in all port channels.
* failure: The test will fail if there is at least one inactive port in a port channel.
"""

name = "VerifyPortChannels"
description = "Verifies there is no inactive port in port channels."
description = "Verifies there are no inactive ports in all port channels."
categories = ["interfaces"]
commands = [AntaCommand(command="show port-channel")]

Expand All @@ -227,11 +247,15 @@ def test(self) -> None:

class VerifyIllegalLACP(AntaTest):
"""
Verifies there is no illegal LACP packets received.
Verifies there are no illegal LACP packets received.

Expected Results:
* success: The test will pass if there are no illegal LACP packets received.
* failure: The test will fail if there is at least one illegal LACP packet received.
"""

name = "VerifyIllegalLACP"
description = "Verifies there is no illegal LACP packets received."
description = "Verifies there are no illegal LACP packets in all port channels."
categories = ["interfaces"]
commands = [AntaCommand(command="show lacp counters all-ports")]

Expand All @@ -251,11 +275,15 @@ def test(self) -> None:

class VerifyLoopbackCount(AntaTest):
"""
Verifies the number of loopback interfaces on the device is the one we expect and if none of the loopback is down.
Verifies that the device has the expected number of loopback interfaces and all are operational.

Expected Results:
* success: The test will pass if the device has the correct number of loopback interfaces and none are down.
* failure: The test will fail if the loopback interface count is incorrect or any are non-operational.
"""

name = "VerifyLoopbackCount"
description = "Verifies the number of loopback interfaces on the device is the one we expect and if none of the loopback is down."
description = "Verifies the number of loopback interfaces and their status."
categories = ["interfaces"]
commands = [AntaCommand(command="show ip interface brief")]

Expand Down Expand Up @@ -286,11 +314,15 @@ def test(self) -> None:

class VerifySVI(AntaTest):
"""
Verifies there is no interface vlan down.
Verifies the status of all SVIs.

Expected Results:
* success: The test will pass if all SVIs are up.
* failure: The test will fail if one or many SVIs are not up.
"""

name = "VerifySVI"
description = "Verifies there is no interface vlan down."
description = "Verifies the status of all SVIs."
categories = ["interfaces"]
commands = [AntaCommand(command="show ip interface brief")]

Expand Down Expand Up @@ -322,7 +354,7 @@ class VerifyL3MTU(AntaTest):
"""

name = "VerifyL3MTU"
description = "Verifies the global layer 3 Maximum Transfer Unit (MTU) for all layer 3 interfaces."
description = "Verifies the global L3 MTU of all L3 interfaces."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces")]

Expand Down Expand Up @@ -367,7 +399,7 @@ class VerifyIPProxyARP(AntaTest):
"""

name = "VerifyIPProxyARP"
description = "Verifies if Proxy-ARP is enabled for the provided list of interface(s)."
description = "Verifies if Proxy ARP is enabled."
categories = ["interfaces"]
commands = [AntaTemplate(template="show ip interface {intf}")]

Expand Down Expand Up @@ -405,7 +437,7 @@ class VerifyL2MTU(AntaTest):
"""

name = "VerifyL2MTU"
description = "Verifies the global layer 2 Maximum Transfer Unit (MTU) for all layer 2 interfaces."
description = "Verifies the global L2 MTU of all L2 interfaces."
categories = ["interfaces"]
commands = [AntaCommand(command="show interfaces")]

Expand Down
10 changes: 5 additions & 5 deletions anta/tests/mlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VerifyMlagStatus(AntaTest):
"""

name = "VerifyMlagStatus"
description = "This test verifies the health status of the MLAG configuration."
description = "Verifies the health status of the MLAG configuration."
categories = ["mlag"]
commands = [AntaCommand(command="show mlag", ofmt="json")]

Expand Down Expand Up @@ -61,7 +61,7 @@ class VerifyMlagInterfaces(AntaTest):
"""

name = "VerifyMlagInterfaces"
description = "This test verifies there are no inactive or active-partial MLAG ports."
description = "Verifies there are no inactive or active-partial MLAG ports."
categories = ["mlag"]
commands = [AntaCommand(command="show mlag", ofmt="json")]

Expand Down Expand Up @@ -89,7 +89,7 @@ class VerifyMlagConfigSanity(AntaTest):
"""

name = "VerifyMlagConfigSanity"
description = "This test verifies there are no MLAG config-sanity inconsistencies."
description = "Verifies there are no MLAG config-sanity inconsistencies."
categories = ["mlag"]
commands = [AntaCommand(command="show mlag config-sanity", ofmt="json")]

Expand Down Expand Up @@ -121,7 +121,7 @@ class VerifyMlagReloadDelay(AntaTest):
"""

name = "VerifyMlagReloadDelay"
description = "This test verifies the reload-delay parameters of the MLAG configuration."
description = "Verifies the MLAG reload-delay parameters."
categories = ["mlag"]
commands = [AntaCommand(command="show mlag", ofmt="json")]

Expand Down Expand Up @@ -157,7 +157,7 @@ class VerifyMlagDualPrimary(AntaTest):
"""

name = "VerifyMlagDualPrimary"
description = "This test verifies the dual-primary detection and its parameters of the MLAG configuration."
description = "Verifies the MLAG dual-primary detection parameters."
categories = ["mlag"]
commands = [AntaCommand(command="show mlag detail", ofmt="json")]

Expand Down
14 changes: 7 additions & 7 deletions anta/tests/routing/bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class VerifyBGPPeerCount(AntaTest):

name = "VerifyBGPPeerCount"
description = "Verifies the count of BGP peers."
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [
AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"),
AntaTemplate(template="show bgp {afi} summary"),
Expand Down Expand Up @@ -298,7 +298,7 @@ class VerifyBGPPeersHealth(AntaTest):

name = "VerifyBGPPeersHealth"
description = "Verifies the health of BGP peers"
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [
AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"),
AntaTemplate(template="show bgp {afi} summary"),
Expand Down Expand Up @@ -404,7 +404,7 @@ class VerifyBGPSpecificPeers(AntaTest):

name = "VerifyBGPSpecificPeers"
description = "Verifies the health of specific BGP peer(s)."
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [
AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"),
AntaTemplate(template="show bgp {afi} summary"),
Expand Down Expand Up @@ -509,7 +509,7 @@ class VerifyBGPExchangedRoutes(AntaTest):

name = "VerifyBGPExchangedRoutes"
description = "Verifies if BGP peers have correctly advertised/received routes with type as valid and active for a specified VRF."
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [
AntaTemplate(template="show bgp neighbors {peer} advertised-routes vrf {vrf}"),
AntaTemplate(template="show bgp neighbors {peer} routes vrf {vrf}"),
Expand Down Expand Up @@ -588,7 +588,7 @@ class VerifyBGPPeerMPCaps(AntaTest):

name = "VerifyBGPPeerMPCaps"
description = "Verifies the multiprotocol capabilities of a BGP peer in a specified VRF"
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [AntaCommand(command="show bgp neighbors vrf all")]

class Input(AntaTest.Input):
Expand Down Expand Up @@ -663,7 +663,7 @@ class VerifyBGPPeerASNCap(AntaTest):

name = "VerifyBGPPeerASNCap"
description = "Verifies the four octet asn capabilities of a BGP peer in a specified VRF."
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [AntaCommand(command="show bgp neighbors vrf all")]

class Input(AntaTest.Input):
Expand Down Expand Up @@ -732,7 +732,7 @@ class VerifyBGPPeerRouteRefreshCap(AntaTest):

name = "VerifyBGPPeerRouteRefreshCap"
description = "Verifies the route refresh capabilities of a BGP peer in a specified VRF."
categories = ["routing", "bgp"]
categories = ["bgp"]
commands = [AntaCommand(command="show bgp neighbors vrf all")]

class Input(AntaTest.Input):
Expand Down
12 changes: 5 additions & 7 deletions anta/tests/routing/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ class VerifyRoutingProtocolModel(AntaTest):
"""

name = "VerifyRoutingProtocolModel"
description = (
"Verifies the configured routing protocol model is the expected one and if there is no mismatch between the configured and operating routing protocol model."
)
categories = ["routing", "generic"]
description = "Verifies the configured routing protocol model."
categories = ["routing"]
commands = [AntaCommand(command="show ip route summary", revision=3)]

class Input(AntaTest.Input): # pylint: disable=missing-class-docstring
Expand All @@ -55,7 +53,7 @@ class VerifyRoutingTableSize(AntaTest):

name = "VerifyRoutingTableSize"
description = "Verifies the size of the IP routing table (default VRF). Should be between the two provided thresholds."
categories = ["routing", "generic"]
categories = ["routing"]
commands = [AntaCommand(command="show ip route summary", revision=3)]

class Input(AntaTest.Input): # pylint: disable=missing-class-docstring
Expand Down Expand Up @@ -88,7 +86,7 @@ class VerifyBFD(AntaTest):

name = "VerifyBFD"
description = "Verifies there is no BFD peer in down state (all VRF, IPv4 neighbors)."
categories = ["routing", "generic"]
categories = ["bfd"]
# revision 1 as later revision introduce additional nesting for type
commands = [AntaCommand(command="show bfd peers", revision=1)]

Expand Down Expand Up @@ -117,7 +115,7 @@ class VerifyRoutingTableEntry(AntaTest):

name = "VerifyRoutingTableEntry"
description = "Verifies that the provided routes are present in the routing table of a specified VRF."
categories = ["routing", "generic"]
categories = ["routing"]
commands = [AntaTemplate(template="show ip route vrf {vrf} {route}")]

class Input(AntaTest.Input): # pylint: disable=missing-class-docstring
Expand Down
Loading
Loading