From 75ec617122631a8d9c2901bc959f059b69a7f2de Mon Sep 17 00:00:00 2001 From: Carl Baillargeon Date: Tue, 26 Mar 2024 20:16:15 -0400 Subject: [PATCH] Add revision to all tests --- anta/tests/aaa.py | 14 ++++++------ anta/tests/bfd.py | 6 ++--- anta/tests/configuration.py | 2 +- anta/tests/connectivity.py | 4 ++-- anta/tests/field_notices.py | 4 ++-- anta/tests/greent.py | 4 ++-- anta/tests/hardware.py | 14 ++++++------ anta/tests/interfaces.py | 33 +++++++++++++++------------ anta/tests/lanz.py | 2 +- anta/tests/logging.py | 8 +++---- anta/tests/mlag.py | 12 +++++----- anta/tests/multicast.py | 4 ++-- anta/tests/profiles.py | 4 ++-- anta/tests/ptp.py | 10 ++++---- anta/tests/routing/bgp.py | 30 ++++++++++++------------ anta/tests/routing/generic.py | 2 +- anta/tests/routing/ospf.py | 6 ++--- anta/tests/security.py | 25 +++++++++++--------- anta/tests/services.py | 6 ++--- anta/tests/snmp.py | 10 ++++---- anta/tests/software.py | 9 +++++--- anta/tests/stp.py | 10 ++++---- anta/tests/system.py | 10 ++++---- anta/tests/vlan.py | 2 +- anta/tests/vxlan.py | 10 ++++---- docs/advanced_usages/as-python-lib.md | 6 ++--- docs/advanced_usages/custom-tests.md | 2 +- 27 files changed, 129 insertions(+), 120 deletions(-) diff --git a/anta/tests/aaa.py b/anta/tests/aaa.py index 3f2fb2ce3..d6d0689e4 100644 --- a/anta/tests/aaa.py +++ b/anta/tests/aaa.py @@ -38,7 +38,7 @@ class VerifyTacacsSourceIntf(AntaTest): name = "VerifyTacacsSourceIntf" description = "Verifies TACACS source-interface for a specified VRF." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyTacacsSourceIntf test.""" @@ -84,7 +84,7 @@ class VerifyTacacsServers(AntaTest): name = "VerifyTacacsServers" description = "Verifies TACACS servers are configured for a specified VRF." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyTacacsServers test.""" @@ -137,7 +137,7 @@ class VerifyTacacsServerGroups(AntaTest): name = "VerifyTacacsServerGroups" description = "Verifies if the provided TACACS server group(s) are configured." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show tacacs", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyTacacsServerGroups test.""" @@ -187,7 +187,7 @@ class VerifyAuthenMethods(AntaTest): name = "VerifyAuthenMethods" description = "Verifies the AAA authentication method lists for different authentication types (login, enable, dot1x)." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods authentication")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods authentication", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyAuthenMethods test.""" @@ -248,7 +248,7 @@ class VerifyAuthzMethods(AntaTest): name = "VerifyAuthzMethods" description = "Verifies the AAA authorization method lists for different authorization types (commands, exec)." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods authorization")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods authorization", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyAuthzMethods test.""" @@ -304,7 +304,7 @@ class VerifyAcctDefaultMethods(AntaTest): name = "VerifyAcctDefaultMethods" description = "Verifies the AAA accounting default method lists for different accounting types (system, exec, commands, dot1x)." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods accounting")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods accounting", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyAcctDefaultMethods test.""" @@ -367,7 +367,7 @@ class VerifyAcctConsoleMethods(AntaTest): name = "VerifyAcctConsoleMethods" description = "Verifies the AAA accounting console method lists for different accounting types (system, exec, commands, dot1x)." categories: ClassVar[list[str]] = ["aaa"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods accounting")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show aaa methods accounting", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyAcctConsoleMethods test.""" diff --git a/anta/tests/bfd.py b/anta/tests/bfd.py index d52871afc..c8fe1fb1e 100644 --- a/anta/tests/bfd.py +++ b/anta/tests/bfd.py @@ -45,7 +45,7 @@ class VerifyBFDSpecificPeers(AntaTest): name = "VerifyBFDSpecificPeers" description = "Verifies the IPv4 BFD peer's sessions and remote disc in the specified VRF." categories: ClassVar[list[str]] = ["bfd"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bfd peers")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bfd peers", revision=4)] class Input(AntaTest.Input): """Input model for the VerifyBFDSpecificPeers test.""" @@ -126,7 +126,7 @@ class VerifyBFDPeersIntervals(AntaTest): name = "VerifyBFDPeersIntervals" description = "Verifies the timers of the IPv4 BFD peers in the specified VRF." categories: ClassVar[list[str]] = ["bfd"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bfd peers detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bfd peers detail", revision=4)] class Input(AntaTest.Input): """Input model for the VerifyBFDPeersIntervals test.""" @@ -224,7 +224,7 @@ class VerifyBFDPeersHealth(AntaTest): # revision 1 as later revision introduces additional nesting for type commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ AntaCommand(command="show bfd peers", revision=1), - AntaCommand(command="show clock"), + AntaCommand(command="show clock", revision=1), ] class Input(AntaTest.Input): diff --git a/anta/tests/configuration.py b/anta/tests/configuration.py index 35d7b2b77..7f3f0bde1 100644 --- a/anta/tests/configuration.py +++ b/anta/tests/configuration.py @@ -34,7 +34,7 @@ class VerifyZeroTouch(AntaTest): name = "VerifyZeroTouch" description = "Verifies ZeroTouch is disabled" categories: ClassVar[list[str]] = ["configuration"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show zerotouch")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show zerotouch", revision=1)] @AntaTest.anta_test def test(self) -> None: diff --git a/anta/tests/connectivity.py b/anta/tests/connectivity.py index 8b383a404..756b45073 100644 --- a/anta/tests/connectivity.py +++ b/anta/tests/connectivity.py @@ -42,7 +42,7 @@ class VerifyReachability(AntaTest): name = "VerifyReachability" description = "Test the network reachability to one or many destination IP(s)." categories: ClassVar[list[str]] = ["connectivity"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="ping vrf {vrf} {destination} source {source} repeat {repeat}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="ping vrf {vrf} {destination} source {source} repeat {repeat}", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyReachability test.""" @@ -116,7 +116,7 @@ class VerifyLLDPNeighbors(AntaTest): name = "VerifyLLDPNeighbors" description = "Verifies that the provided LLDP neighbors are connected properly." categories: ClassVar[list[str]] = ["connectivity"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show lldp neighbors detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show lldp neighbors detail", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyLLDPNeighbors test.""" diff --git a/anta/tests/field_notices.py b/anta/tests/field_notices.py index e2c2d6b2d..34ea1959e 100644 --- a/anta/tests/field_notices.py +++ b/anta/tests/field_notices.py @@ -37,7 +37,7 @@ class VerifyFieldNotice44Resolution(AntaTest): name = "VerifyFieldNotice44Resolution" description = "Verifies that the device is using the correct Aboot version per FN0044." categories: ClassVar[list[str]] = ["field notices"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -141,7 +141,7 @@ class VerifyFieldNotice72Resolution(AntaTest): name = "VerifyFieldNotice72Resolution" description = "Verifies if the device is exposed to FN0072, and if the issue has been mitigated." categories: ClassVar[list[str]] = ["field notices"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test diff --git a/anta/tests/greent.py b/anta/tests/greent.py index b8b700420..b7632422b 100644 --- a/anta/tests/greent.py +++ b/anta/tests/greent.py @@ -32,7 +32,7 @@ class VerifyGreenTCounters(AntaTest): name = "VerifyGreenTCounters" description = "Verifies if the GreenT counters are incremented." categories: ClassVar[list[str]] = ["greent"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show monitor telemetry postcard counters")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show monitor telemetry postcard counters", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -64,7 +64,7 @@ class VerifyGreenT(AntaTest): name = "VerifyGreenT" description = "Verifies if a GreenT policy is created." categories: ClassVar[list[str]] = ["greent"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show monitor telemetry postcard policy profile")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show monitor telemetry postcard policy profile", revision=1)] @AntaTest.anta_test def test(self) -> None: diff --git a/anta/tests/hardware.py b/anta/tests/hardware.py index 86060a715..569c180d7 100644 --- a/anta/tests/hardware.py +++ b/anta/tests/hardware.py @@ -39,7 +39,7 @@ class VerifyTransceiversManufacturers(AntaTest): name = "VerifyTransceiversManufacturers" description = "Verifies if all transceivers come from approved manufacturers." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show inventory", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show inventory", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyTransceiversManufacturers test.""" @@ -80,7 +80,7 @@ class VerifyTemperature(AntaTest): name = "VerifyTemperature" description = "Verifies the device temperature." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -113,7 +113,7 @@ class VerifyTransceiversTemperature(AntaTest): name = "VerifyTransceiversTemperature" description = "Verifies the transceivers temperature." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature transceiver", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature transceiver", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -154,7 +154,7 @@ class VerifyEnvironmentSystemCooling(AntaTest): name = "VerifyEnvironmentSystemCooling" description = "Verifies the system cooling status." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment cooling", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment cooling", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -188,7 +188,7 @@ 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", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment cooling", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyEnvironmentCooling test.""" @@ -235,7 +235,7 @@ class VerifyEnvironmentPower(AntaTest): name = "VerifyEnvironmentPower" description = "Verifies the power supplies status." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment power", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment power", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyEnvironmentPower test.""" @@ -277,7 +277,7 @@ class VerifyAdverseDrops(AntaTest): name = "VerifyAdverseDrops" 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", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hardware counter drop", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test diff --git a/anta/tests/interfaces.py b/anta/tests/interfaces.py index cce17c88a..738fc1e78 100644 --- a/anta/tests/interfaces.py +++ b/anta/tests/interfaces.py @@ -43,7 +43,10 @@ class VerifyInterfaceUtilization(AntaTest): name = "VerifyInterfaceUtilization" description = "Verifies that the utilization of interfaces is below a certain threshold." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces counters rates"), AntaCommand(command="show interfaces")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ + AntaCommand(command="show interfaces counters rates", revision=1), + AntaCommand(command="show interfaces", revision=1), + ] class Input(AntaTest.Input): """Input model for the VerifyInterfaceUtilization test.""" @@ -104,7 +107,7 @@ class VerifyInterfaceErrors(AntaTest): name = "VerifyInterfaceErrors" description = "Verifies there are no interface error counters." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces counters errors")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces counters errors", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -139,7 +142,7 @@ class VerifyInterfaceDiscards(AntaTest): name = "VerifyInterfaceDiscards" description = "Verifies there are no interface discard counters." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces counters discards")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces counters discards", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -173,7 +176,7 @@ class VerifyInterfaceErrDisabled(AntaTest): name = "VerifyInterfaceErrDisabled" description = "Verifies there are no interfaces in the errdisabled state." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces status")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces status", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -218,7 +221,7 @@ class VerifyInterfacesStatus(AntaTest): name = "VerifyInterfacesStatus" description = "Verifies the status of the provided interfaces." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces description")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces description", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyInterfacesStatus test.""" @@ -290,7 +293,7 @@ class VerifyStormControlDrops(AntaTest): name = "VerifyStormControlDrops" description = "Verifies there are no interface storm-control drop counters." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show storm-control")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show storm-control", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -328,7 +331,7 @@ class VerifyPortChannels(AntaTest): name = "VerifyPortChannels" description = "Verifies there are no inactive ports in all port channels." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show port-channel")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show port-channel", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -363,7 +366,7 @@ class VerifyIllegalLACP(AntaTest): name = "VerifyIllegalLACP" description = "Verifies there are no illegal LACP packets in all port channels." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show lacp counters all-ports")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show lacp counters all-ports", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -400,7 +403,7 @@ class VerifyLoopbackCount(AntaTest): name = "VerifyLoopbackCount" description = "Verifies the number of loopback interfaces and their status." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip interface brief")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip interface brief", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyLoopbackCount test.""" @@ -449,7 +452,7 @@ class VerifySVI(AntaTest): name = "VerifySVI" description = "Verifies the status of all SVIs." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip interface brief")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip interface brief", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -494,7 +497,7 @@ class VerifyL3MTU(AntaTest): name = "VerifyL3MTU" description = "Verifies the global L3 MTU of all L3 interfaces." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyL3MTU test.""" @@ -552,7 +555,7 @@ class VerifyIPProxyARP(AntaTest): name = "VerifyIPProxyARP" description = "Verifies if Proxy ARP is enabled." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip interface {intf}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip interface {intf}", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyIPProxyARP test.""" @@ -607,7 +610,7 @@ class VerifyL2MTU(AntaTest): name = "VerifyL2MTU" description = "Verifies the global L2 MTU of all L2 interfaces." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyL2MTU test.""" @@ -669,7 +672,7 @@ class VerifyInterfaceIPv4(AntaTest): name = "VerifyInterfaceIPv4" description = "Verifies the interface IPv4 addresses." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip interface {interface}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip interface {interface}", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyInterfaceIPv4 test.""" @@ -759,7 +762,7 @@ class VerifyIpVirtualRouterMac(AntaTest): name = "VerifyIpVirtualRouterMac" description = "Verifies the IP virtual router MAC address." categories: ClassVar[list[str]] = ["interfaces"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip virtual-router")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip virtual-router", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyIpVirtualRouterMac test.""" diff --git a/anta/tests/lanz.py b/anta/tests/lanz.py index 0c153f61f..dcdab69db 100644 --- a/anta/tests/lanz.py +++ b/anta/tests/lanz.py @@ -33,7 +33,7 @@ class VerifyLANZ(AntaTest): name = "VerifyLANZ" description = "Verifies if LANZ is enabled." categories: ClassVar[list[str]] = ["lanz"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show queue-monitor length status")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show queue-monitor length status", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test diff --git a/anta/tests/logging.py b/anta/tests/logging.py index 77ac2b35a..623aed42e 100644 --- a/anta/tests/logging.py +++ b/anta/tests/logging.py @@ -190,7 +190,7 @@ class VerifyLoggingLogsGeneration(AntaTest): description = "Verifies if logs are generated." categories: ClassVar[list[str]] = ["logging"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaCommand(command="send log level informational message ANTA VerifyLoggingLogsGeneration validation"), + AntaCommand(command="send log level informational message ANTA VerifyLoggingLogsGeneration validation", ofmt="text"), AntaCommand(command="show logging informational last 30 seconds | grep ANTA", ofmt="text", use_cache=False), ] @@ -227,8 +227,8 @@ class VerifyLoggingHostname(AntaTest): description = "Verifies if logs are generated with the device FQDN." categories: ClassVar[list[str]] = ["logging"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaCommand(command="show hostname"), - AntaCommand(command="send log level informational message ANTA VerifyLoggingHostname validation"), + AntaCommand(command="show hostname", revision=1), + AntaCommand(command="send log level informational message ANTA VerifyLoggingHostname validation", ofmt="text"), AntaCommand(command="show logging informational last 30 seconds | grep ANTA", ofmt="text", use_cache=False), ] @@ -271,7 +271,7 @@ class VerifyLoggingTimestamp(AntaTest): description = "Verifies if logs are generated with the appropriate timestamp." categories: ClassVar[list[str]] = ["logging"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaCommand(command="send log level informational message ANTA VerifyLoggingTimestamp validation"), + AntaCommand(command="send log level informational message ANTA VerifyLoggingTimestamp validation", ofmt="text"), AntaCommand(command="show logging informational last 30 seconds | grep ANTA", ofmt="text", use_cache=False), ] diff --git a/anta/tests/mlag.py b/anta/tests/mlag.py index eb5066f15..105fd4350 100644 --- a/anta/tests/mlag.py +++ b/anta/tests/mlag.py @@ -39,7 +39,7 @@ class VerifyMlagStatus(AntaTest): name = "VerifyMlagStatus" description = "Verifies the health status of the MLAG configuration." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", revision=2)] @AntaTest.anta_test def test(self) -> None: @@ -81,7 +81,7 @@ class VerifyMlagInterfaces(AntaTest): name = "VerifyMlagInterfaces" description = "Verifies there are no inactive or active-partial MLAG ports." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", revision=2)] @AntaTest.anta_test def test(self) -> None: @@ -117,7 +117,7 @@ class VerifyMlagConfigSanity(AntaTest): name = "VerifyMlagConfigSanity" description = "Verifies there are no MLAG config-sanity inconsistencies." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag config-sanity", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag config-sanity", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -159,7 +159,7 @@ class VerifyMlagReloadDelay(AntaTest): name = "VerifyMlagReloadDelay" description = "Verifies the MLAG reload-delay parameters." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyMlagReloadDelay test.""" @@ -209,7 +209,7 @@ class VerifyMlagDualPrimary(AntaTest): name = "VerifyMlagDualPrimary" description = "Verifies the MLAG dual-primary detection parameters." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag detail", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag detail", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyMlagDualPrimary test.""" @@ -268,7 +268,7 @@ class VerifyMlagPrimaryPriority(AntaTest): name = "VerifyMlagPrimaryPriority" description = "Verifies the configuration of the MLAG primary priority." categories: ClassVar[list[str]] = ["mlag"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show mlag detail", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyMlagPrimaryPriority test.""" diff --git a/anta/tests/multicast.py b/anta/tests/multicast.py index 35f4d3e68..554bd5759 100644 --- a/anta/tests/multicast.py +++ b/anta/tests/multicast.py @@ -38,7 +38,7 @@ class VerifyIGMPSnoopingVlans(AntaTest): name = "VerifyIGMPSnoopingVlans" description = "Verifies the IGMP snooping status for the provided VLANs." categories: ClassVar[list[str]] = ["multicast"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip igmp snooping")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip igmp snooping", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyIGMPSnoopingVlans test.""" @@ -81,7 +81,7 @@ class VerifyIGMPSnoopingGlobal(AntaTest): name = "VerifyIGMPSnoopingGlobal" description = "Verifies the IGMP snooping global configuration." categories: ClassVar[list[str]] = ["multicast"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip igmp snooping")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip igmp snooping", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyIGMPSnoopingGlobal test.""" diff --git a/anta/tests/profiles.py b/anta/tests/profiles.py index d6b2ad0f9..859c8866c 100644 --- a/anta/tests/profiles.py +++ b/anta/tests/profiles.py @@ -36,7 +36,7 @@ class VerifyUnifiedForwardingTableMode(AntaTest): name = "VerifyUnifiedForwardingTableMode" description = "Verifies the device is using the expected UFT mode." categories: ClassVar[list[str]] = ["profiles"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show platform trident forwarding-table partition", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show platform trident forwarding-table partition", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyUnifiedForwardingTableMode test.""" @@ -75,7 +75,7 @@ class VerifyTcamProfile(AntaTest): name = "VerifyTcamProfile" description = "Verifies the device TCAM profile." categories: ClassVar[list[str]] = ["profiles"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hardware tcam profile", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hardware tcam profile", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyTcamProfile test.""" diff --git a/anta/tests/ptp.py b/anta/tests/ptp.py index 1b6f2a35a..eabda8835 100644 --- a/anta/tests/ptp.py +++ b/anta/tests/ptp.py @@ -36,7 +36,7 @@ class VerifyPtpModeStatus(AntaTest): name = "VerifyPtpModeStatus" description = "Verifies that the device is configured as a PTP Boundary Clock." categories: ClassVar[list[str]] = ["ptp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", revision=2)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -83,7 +83,7 @@ class Input(AntaTest.Input): name = "VerifyPtpGMStatus" description = "Verifies that the device is locked to a valid PTP Grandmaster." categories: ClassVar[list[str]] = ["ptp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", revision=2)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -123,7 +123,7 @@ class VerifyPtpLockStatus(AntaTest): name = "VerifyPtpLockStatus" description = "Verifies that the device was locked to the upstream PTP GM in the last minute." categories: ClassVar[list[str]] = ["ptp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", revision=2)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -164,7 +164,7 @@ class VerifyPtpOffset(AntaTest): name = "VerifyPtpOffset" description = "Verifies that the PTP timing offset is within +/- 1000ns from the master clock." categories: ClassVar[list[str]] = ["ptp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp monitor", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp monitor", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test @@ -209,7 +209,7 @@ class VerifyPtpPortModeStatus(AntaTest): name = "VerifyPtpPortModeStatus" description = "Verifies the PTP interfaces state." categories: ClassVar[list[str]] = ["ptp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ptp", revision=2)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test diff --git a/anta/tests/routing/bgp.py b/anta/tests/routing/bgp.py index 248a9732b..c2e6f880d 100644 --- a/anta/tests/routing/bgp.py +++ b/anta/tests/routing/bgp.py @@ -191,8 +191,8 @@ class VerifyBGPPeerCount(AntaTest): description = "Verifies the count of BGP peers." categories: ClassVar[list[str]] = ["bgp"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"), - AntaTemplate(template="show bgp {afi} summary"), + AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}", revision=3), + AntaTemplate(template="show bgp {afi} summary", revision=3), ] class Input(AntaTest.Input): @@ -328,8 +328,8 @@ class VerifyBGPPeersHealth(AntaTest): description = "Verifies the health of BGP peers" categories: ClassVar[list[str]] = ["bgp"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"), - AntaTemplate(template="show bgp {afi} summary"), + AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}", revision=3), + AntaTemplate(template="show bgp {afi} summary", revision=3), ] class Input(AntaTest.Input): @@ -471,8 +471,8 @@ class VerifyBGPSpecificPeers(AntaTest): description = "Verifies the health of specific BGP peer(s)." categories: ClassVar[list[str]] = ["bgp"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}"), - AntaTemplate(template="show bgp {afi} summary"), + AntaTemplate(template="show bgp {afi} {safi} summary vrf {vrf}", revision=3), + AntaTemplate(template="show bgp {afi} summary", revision=3), ] class Input(AntaTest.Input): @@ -615,8 +615,8 @@ class VerifyBGPExchangedRoutes(AntaTest): description = "Verifies the advertised and received routes of BGP peers." categories: ClassVar[list[str]] = ["bgp"] commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ - AntaTemplate(template="show bgp neighbors {peer} advertised-routes vrf {vrf}"), - AntaTemplate(template="show bgp neighbors {peer} routes vrf {vrf}"), + AntaTemplate(template="show bgp neighbors {peer} advertised-routes vrf {vrf}", revision=3), + AntaTemplate(template="show bgp neighbors {peer} routes vrf {vrf}", revision=3), ] class Input(AntaTest.Input): @@ -703,7 +703,7 @@ class VerifyBGPPeerMPCaps(AntaTest): name = "VerifyBGPPeerMPCaps" description = "Verifies the multiprotocol capabilities of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPPeerMPCaps test.""" @@ -787,7 +787,7 @@ class VerifyBGPPeerASNCap(AntaTest): name = "VerifyBGPPeerASNCap" description = "Verifies the four octet asn capabilities of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPPeerASNCap test.""" @@ -865,7 +865,7 @@ class VerifyBGPPeerRouteRefreshCap(AntaTest): name = "VerifyBGPPeerRouteRefreshCap" description = "Verifies the route refresh capabilities of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPPeerRouteRefreshCap test.""" @@ -945,7 +945,7 @@ class VerifyBGPPeerMD5Auth(AntaTest): name = "VerifyBGPPeerMD5Auth" description = "Verifies the MD5 authentication and state of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPPeerMD5Auth test.""" @@ -1020,7 +1020,7 @@ class VerifyEVPNType2Route(AntaTest): name = "VerifyEVPNType2Route" description = "Verifies the EVPN Type-2 routes for a given IPv4 or MAC address and VNI." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show bgp evpn route-type mac-ip {address} vni {vni}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show bgp evpn route-type mac-ip {address} vni {vni}", revision=2)] class Input(AntaTest.Input): """Input model for the VerifyEVPNType2Route test.""" @@ -1097,7 +1097,7 @@ class VerifyBGPAdvCommunities(AntaTest): name = "VerifyBGPAdvCommunities" description = "Verifies the advertised communities of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPAdvCommunities test.""" @@ -1174,7 +1174,7 @@ class VerifyBGPTimers(AntaTest): name = "VerifyBGPTimers" description = "Verifies the timers of a BGP peer." categories: ClassVar[list[str]] = ["bgp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show bgp neighbors vrf all", revision=3)] class Input(AntaTest.Input): """Input model for the VerifyBGPTimers test.""" diff --git a/anta/tests/routing/generic.py b/anta/tests/routing/generic.py index 220554190..cf930419b 100644 --- a/anta/tests/routing/generic.py +++ b/anta/tests/routing/generic.py @@ -131,7 +131,7 @@ class VerifyRoutingTableEntry(AntaTest): name = "VerifyRoutingTableEntry" description = "Verifies that the provided routes are present in the routing table of a specified VRF." categories: ClassVar[list[str]] = ["routing"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip route vrf {vrf} {route}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip route vrf {vrf} {route}", revision=4)] class Input(AntaTest.Input): """Input model for the VerifyRoutingTableEntry test.""" diff --git a/anta/tests/routing/ospf.py b/anta/tests/routing/ospf.py index d8ebbcd42..d8155a32b 100644 --- a/anta/tests/routing/ospf.py +++ b/anta/tests/routing/ospf.py @@ -106,7 +106,7 @@ class VerifyOSPFNeighborState(AntaTest): name = "VerifyOSPFNeighborState" description = "Verifies all OSPF neighbors are in FULL state." categories: ClassVar[list[str]] = ["ospf"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf neighbor")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf neighbor", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -143,7 +143,7 @@ class VerifyOSPFNeighborCount(AntaTest): name = "VerifyOSPFNeighborCount" description = "Verifies the number of OSPF neighbors in FULL state is the one we expect." categories: ClassVar[list[str]] = ["ospf"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf neighbor")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf neighbor", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyOSPFNeighborCount test.""" @@ -187,7 +187,7 @@ class VerifyOSPFMaxLSA(AntaTest): name = "VerifyOSPFMaxLSA" description = "Verifies all OSPF instances did not cross the maximum LSA threshold." categories: ClassVar[list[str]] = ["ospf"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip ospf", revision=1)] @AntaTest.anta_test def test(self) -> None: diff --git a/anta/tests/security.py b/anta/tests/security.py index be90a2452..ce46b7869 100644 --- a/anta/tests/security.py +++ b/anta/tests/security.py @@ -75,7 +75,7 @@ class VerifySSHIPv4Acl(AntaTest): name = "VerifySSHIPv4Acl" description = "Verifies if the SSHD agent has IPv4 ACL(s) configured." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management ssh ip access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management ssh ip access-list summary", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySSHIPv4Acl test.""" @@ -124,7 +124,7 @@ class VerifySSHIPv6Acl(AntaTest): name = "VerifySSHIPv6Acl" description = "Verifies if the SSHD agent has IPv6 ACL(s) configured." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management ssh ipv6 access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management ssh ipv6 access-list summary", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySSHIPv6Acl test.""" @@ -171,7 +171,7 @@ class VerifyTelnetStatus(AntaTest): name = "VerifyTelnetStatus" description = "Verifies if Telnet is disabled in the default VRF." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management telnet")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management telnet", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -202,7 +202,7 @@ class VerifyAPIHttpStatus(AntaTest): name = "VerifyAPIHttpStatus" description = "Verifies if eAPI HTTP server is disabled globally." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -234,7 +234,7 @@ class VerifyAPIHttpsSSL(AntaTest): name = "VerifyAPIHttpsSSL" description = "Verifies if the eAPI has a valid SSL profile." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyAPIHttpsSSL test.""" @@ -277,7 +277,7 @@ class VerifyAPIIPv4Acl(AntaTest): name = "VerifyAPIIPv4Acl" description = "Verifies if eAPI has the right number IPv4 ACL(s) configured for a specified VRF." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands ip access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands ip access-list summary", revision=1)] class Input(AntaTest.Input): """Input parameters for the VerifyAPIIPv4Acl test.""" @@ -327,7 +327,7 @@ class VerifyAPIIPv6Acl(AntaTest): name = "VerifyAPIIPv6Acl" description = "Verifies if eAPI has the right number IPv6 ACL(s) configured for a specified VRF." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands ipv6 access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management api http-commands ipv6 access-list summary", revision=1)] class Input(AntaTest.Input): """Input parameters for the VerifyAPIIPv6Acl test.""" @@ -387,7 +387,10 @@ class VerifyAPISSLCertificate(AntaTest): name = "VerifyAPISSLCertificate" description = "Verifies the eAPI SSL certificate expiry, common subject name, encryption algorithm and key size." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show management security ssl certificate"), AntaCommand(command="show clock")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ + AntaCommand(command="show management security ssl certificate", revision=1), + AntaCommand(command="show clock", revision=1), + ] class Input(AntaTest.Input): """Input parameters for the VerifyAPISSLCertificate test.""" @@ -494,7 +497,7 @@ class VerifyBannerLogin(AntaTest): name = "VerifyBannerLogin" description = "Verifies the login banner of a device." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show banner login")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show banner login", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyBannerLogin test.""" @@ -538,7 +541,7 @@ class VerifyBannerMotd(AntaTest): name = "VerifyBannerMotd" description = "Verifies the motd banner of a device." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show banner motd")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show banner motd", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyBannerMotd test.""" @@ -593,7 +596,7 @@ class VerifyIPv4ACL(AntaTest): name = "VerifyIPv4ACL" description = "Verifies the configuration of IPv4 ACLs." categories: ClassVar[list[str]] = ["security"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip access-lists {acl}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show ip access-lists {acl}", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyIPv4ACL test.""" diff --git a/anta/tests/services.py b/anta/tests/services.py index a5d2afaf8..ef8637eb9 100644 --- a/anta/tests/services.py +++ b/anta/tests/services.py @@ -39,7 +39,7 @@ class VerifyHostname(AntaTest): name = "VerifyHostname" description = "Verifies the hostname of a device." categories: ClassVar[list[str]] = ["services"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hostname")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show hostname", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyHostname test.""" @@ -82,7 +82,7 @@ class VerifyDNSLookup(AntaTest): name = "VerifyDNSLookup" description = "Verifies the DNS name to IP address resolution." categories: ClassVar[list[str]] = ["services"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="bash timeout 10 nslookup {domain}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="bash timeout 10 nslookup {domain}", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyDNSLookup test.""" @@ -134,7 +134,7 @@ class VerifyDNSServers(AntaTest): name = "VerifyDNSServers" description = "Verifies if the DNS servers are correctly configured." categories: ClassVar[list[str]] = ["services"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip name-server")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show ip name-server", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyDNSServers test.""" diff --git a/anta/tests/snmp.py b/anta/tests/snmp.py index 09cc5310b..ac98bfd2f 100644 --- a/anta/tests/snmp.py +++ b/anta/tests/snmp.py @@ -36,7 +36,7 @@ class VerifySnmpStatus(AntaTest): name = "VerifySnmpStatus" description = "Verifies if the SNMP agent is enabled." categories: ClassVar[list[str]] = ["snmp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySnmpStatus test.""" @@ -75,7 +75,7 @@ class VerifySnmpIPv4Acl(AntaTest): name = "VerifySnmpIPv4Acl" description = "Verifies if the SNMP agent has IPv4 ACL(s) configured." categories: ClassVar[list[str]] = ["snmp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp ipv4 access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp ipv4 access-list summary", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySnmpIPv4Acl test.""" @@ -124,7 +124,7 @@ class VerifySnmpIPv6Acl(AntaTest): name = "VerifySnmpIPv6Acl" description = "Verifies if the SNMP agent has IPv6 ACL(s) configured." categories: ClassVar[list[str]] = ["snmp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp ipv6 access-list summary")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp ipv6 access-list summary", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySnmpIPv6Acl test.""" @@ -172,7 +172,7 @@ class VerifySnmpLocation(AntaTest): name = "VerifySnmpLocation" description = "Verifies the SNMP location of a device." categories: ClassVar[list[str]] = ["snmp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySnmpLocation test.""" @@ -211,7 +211,7 @@ class VerifySnmpContact(AntaTest): name = "VerifySnmpContact" description = "Verifies the SNMP contact of a device." categories: ClassVar[list[str]] = ["snmp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show snmp", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySnmpContact test.""" diff --git a/anta/tests/software.py b/anta/tests/software.py index 3cc77322f..4028dd963 100644 --- a/anta/tests/software.py +++ b/anta/tests/software.py @@ -37,7 +37,7 @@ class VerifyEOSVersion(AntaTest): name = "VerifyEOSVersion" description = "Verifies the EOS version of the device." categories: ClassVar[list[str]] = ["software"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyEOSVersion test.""" @@ -77,7 +77,7 @@ class VerifyTerminAttrVersion(AntaTest): name = "VerifyTerminAttrVersion" description = "Verifies the TerminAttr version of the device." categories: ClassVar[list[str]] = ["software"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version detail", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyTerminAttrVersion test.""" @@ -115,7 +115,10 @@ class VerifyEOSExtensions(AntaTest): name = "VerifyEOSExtensions" description = "Verifies that all EOS extensions installed on the device are enabled for boot persistence." categories: ClassVar[list[str]] = ["software"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show extensions"), AntaCommand(command="show boot-extensions")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [ + AntaCommand(command="show extensions", revision=2), + AntaCommand(command="show boot-extensions", revision=1), + ] @AntaTest.anta_test def test(self) -> None: diff --git a/anta/tests/stp.py b/anta/tests/stp.py index b2496d663..2688eb3b6 100644 --- a/anta/tests/stp.py +++ b/anta/tests/stp.py @@ -39,7 +39,7 @@ class VerifySTPMode(AntaTest): name = "VerifySTPMode" description = "Verifies the configured STP mode for a provided list of VLAN(s)." categories: ClassVar[list[str]] = ["stp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show spanning-tree vlan {vlan}")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show spanning-tree vlan {vlan}", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySTPMode test.""" @@ -97,7 +97,7 @@ class VerifySTPBlockedPorts(AntaTest): name = "VerifySTPBlockedPorts" description = "Verifies there is no STP blocked ports." categories: ClassVar[list[str]] = ["stp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree blockedports")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree blockedports", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -130,7 +130,7 @@ class VerifySTPCounters(AntaTest): name = "VerifySTPCounters" description = "Verifies there is no errors in STP BPDU packets." categories: ClassVar[list[str]] = ["stp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree counters")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree counters", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -167,7 +167,7 @@ class VerifySTPForwardingPorts(AntaTest): name = "VerifySTPForwardingPorts" description = "Verifies that all interfaces are forwarding for a provided list of VLAN(s)." categories: ClassVar[list[str]] = ["stp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show spanning-tree topology vlan {vlan} status")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaTemplate(template="show spanning-tree topology vlan {vlan} status", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySTPForwardingPorts test.""" @@ -226,7 +226,7 @@ class VerifySTPRootPriority(AntaTest): name = "VerifySTPRootPriority" description = "Verifies the STP root priority for a provided list of VLAN or MST instance ID(s)." categories: ClassVar[list[str]] = ["stp"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree root detail")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show spanning-tree root detail", revision=1)] class Input(AntaTest.Input): """Input model for the VerifySTPRootPriority test.""" diff --git a/anta/tests/system.py b/anta/tests/system.py index 223dcc953..49d2dd25d 100644 --- a/anta/tests/system.py +++ b/anta/tests/system.py @@ -41,7 +41,7 @@ class VerifyUptime(AntaTest): name = "VerifyUptime" description = "Verifies the device uptime." categories: ClassVar[list[str]] = ["system"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show uptime")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show uptime", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyUptime test.""" @@ -79,7 +79,7 @@ class VerifyReloadCause(AntaTest): name = "VerifyReloadCause" description = "Verifies the last reload cause of the device." categories: ClassVar[list[str]] = ["system"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show reload cause")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show reload cause", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -126,7 +126,7 @@ class VerifyCoredump(AntaTest): name = "VerifyCoredump" description = "Verifies there are no core dump files." categories: ClassVar[list[str]] = ["system"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system coredump", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system coredump", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -193,7 +193,7 @@ class VerifyCPUUtilization(AntaTest): name = "VerifyCPUUtilization" description = "Verifies whether the CPU utilization is below 75%." categories: ClassVar[list[str]] = ["system"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show processes top once")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show processes top once", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -225,7 +225,7 @@ class VerifyMemoryUtilization(AntaTest): name = "VerifyMemoryUtilization" description = "Verifies whether the memory utilization is below 75%." categories: ClassVar[list[str]] = ["system"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show version", revision=1)] @AntaTest.anta_test def test(self) -> None: diff --git a/anta/tests/vlan.py b/anta/tests/vlan.py index 4054eb55c..479f5083a 100644 --- a/anta/tests/vlan.py +++ b/anta/tests/vlan.py @@ -42,7 +42,7 @@ class VerifyVlanInternalPolicy(AntaTest): name = "VerifyVlanInternalPolicy" description = "Verifies the VLAN internal allocation policy and the range of VLANs." categories: ClassVar[list[str]] = ["vlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vlan internal allocation policy")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vlan internal allocation policy", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyVlanInternalPolicy test.""" diff --git a/anta/tests/vxlan.py b/anta/tests/vxlan.py index 3f083262c..481a7a1bb 100644 --- a/anta/tests/vxlan.py +++ b/anta/tests/vxlan.py @@ -44,7 +44,7 @@ class VerifyVxlan1Interface(AntaTest): name = "VerifyVxlan1Interface" description = "Verifies the Vxlan1 interface status." categories: ClassVar[list[str]] = ["vxlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces description", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces description", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -84,7 +84,7 @@ class VerifyVxlanConfigSanity(AntaTest): name = "VerifyVxlanConfigSanity" description = "Verifies there are no VXLAN config-sanity inconsistencies." categories: ClassVar[list[str]] = ["vxlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan config-sanity", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan config-sanity", revision=1)] @AntaTest.anta_test def test(self) -> None: @@ -127,7 +127,7 @@ class VerifyVxlanVniBinding(AntaTest): name = "VerifyVxlanVniBinding" description = "Verifies the VNI-VLAN bindings of the Vxlan1 interface." categories: ClassVar[list[str]] = ["vxlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan vni", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan vni", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyVxlanVniBinding test.""" @@ -190,7 +190,7 @@ class VerifyVxlanVtep(AntaTest): name = "VerifyVxlanVtep" description = "Verifies the VTEP peers of the Vxlan1 interface" categories: ClassVar[list[str]] = ["vxlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan vtep", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show vxlan vtep", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyVxlanVtep test.""" @@ -241,7 +241,7 @@ class VerifyVxlan1ConnSettings(AntaTest): name = "VerifyVxlan1ConnSettings" description = "Verifies the interface vxlan1 source interface and UDP port." categories: ClassVar[list[str]] = ["vxlan"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show interfaces", revision=1)] class Input(AntaTest.Input): """Input model for the VerifyVxlan1ConnSettings test.""" diff --git a/docs/advanced_usages/as-python-lib.md b/docs/advanced_usages/as-python-lib.md index b4ce654e4..edf50022b 100644 --- a/docs/advanced_usages/as-python-lib.md +++ b/docs/advanced_usages/as-python-lib.md @@ -274,11 +274,11 @@ cmd2 = AntaCommand(command="show running-config diffs", ofmt="text") * The model can change across time (adding feature, ... ) and when the model is changed in a non backward-compatible way, the __revision__ number is bumped. The initial model starts with __revision__ 1. * A __revision__ applies to a particular CLI command whereas a __version__ is global to an eAPI call. The __version__ is internally translated to a specific __revision__ for each CLI command in the RPC call. The currently supported __version__ vaues are `1` and `latest`. * A __revision takes precedence over a version__ (e.g. if a command is run with version="latest" and revision=1, the first revision of the model is returned) - * By default eAPI returns the first revision of each model to ensure that when upgrading, intergation with existing tools is not broken. This is done by using by default `version=1` in eAPI calls. + * By default, eAPI returns the first revision of each model to ensure that when upgrading, integrations with existing tools are not broken. This is done by using by default `version=1` in eAPI calls. - ANTA uses by default `version="latest"` in AntaCommand. For some commands, you may want to run them with a different revision or version. + By default, ANTA uses `version="latest"` in AntaCommand, but when developing tests, the revision MUST be provided when the outformat of the command is `json`. As explained earlier, this is to ensure that the eAPI always returns the same output model and that the test remains always valid from the day it was created. For some commands, you may also want to run them with a different revision or version. - For instance the `VerifyRoutingTableSize` test leverages the first revision of `show bfd peers`: + For instance, the `VerifyBFDPeersHealth` test leverages the first revision of `show bfd peers`: ``` # revision 1 as later revision introduce additional nesting for type diff --git a/docs/advanced_usages/custom-tests.md b/docs/advanced_usages/custom-tests.md index a07f1ef4a..a3ef035d9 100644 --- a/docs/advanced_usages/custom-tests.md +++ b/docs/advanced_usages/custom-tests.md @@ -39,7 +39,7 @@ class VerifyTemperature(AntaTest): name = "VerifyTemperature" description = "Verifies the device temperature." categories: ClassVar[list[str]] = ["hardware"] - commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature", ofmt="json")] + commands: ClassVar[list[AntaCommand | AntaTemplate]] = [AntaCommand(command="show system environment temperature", revision=1)] @skip_on_platforms(["cEOSLab", "vEOS-lab", "cEOSCloudLab"]) @AntaTest.anta_test