Retrieving Tests information
anta get tests¶
anta get tests helps you discover tests and render catalog examples from their
documentation. The default, broad anta.tests discovery omits security advisory
tests because they are normally selected from the built-in catalog with
anta psirt. To inspect their catalog examples
explicitly, use --module anta.tests.advisories.
Command overview¶
$ anta get tests --help
Usage: anta get tests [OPTIONS]
Show ANTA tests with catalog examples retrieved from their documentation.
Options:
--module TEXT Filter tests by module name. [default: anta.tests]
--test TEXT Filter by specific test name. If module is specified,
searches only within that module.
--short Display test names without their inputs.
--count Print only the number of tests found.
--help Show this message and exit.
Tip
By default, anta get tests retrieves every non-advisory test available in ANTA. Security advisory tests are rendered only when the requested module is anta.tests.advisories or one of its submodules.
Examples¶
Default usage¶
anta.tests.aaa:
- VerifyAcctConsoleMethods:
# Verifies the AAA accounting console method lists for different accounting types (system, exec, commands, dot1x).
methods:
- local
- none
- logging
types:
- system
- exec
- commands
- dot1x
- VerifyAcctDefaultMethods:
# Verifies the AAA accounting default method lists for different accounting types (system, exec, commands, dot1x).
methods:
- local
- none
- logging
types:
- system
- exec
- commands
- dot1x
[...]
Filtering using --module¶
To retrieve all the tests from anta.tests.stun.
anta.tests.stun:
- VerifyStunClient:
# Verifies STUN client settings, including local IP/port and optionally public IP/port.
stun_clients:
- source_address: 172.18.3.2
public_address: 172.18.3.21
source_port: 4500
public_port: 6006
- source_address: 100.64.3.2
public_address: 100.64.3.21
source_port: 4500
public_port: 6006
- VerifyStunServer:
# Verifies the STUN server status is enabled and running.
Filtering using --test¶
anta.tests.aaa:
- VerifyTacacsSourceIntf:
# Verifies TACACS source-interface for a specified VRF.
intf: Management0
vrf: MGMT
Tip
You can filter tests by providing a prefix - ANTA will return all tests that start with your specified string.
anta.tests.aaa:
- VerifyTacacsServerGroups:
# Verifies if the provided TACACS server group(s) are configured.
groups:
- TACACS-GROUP1
- TACACS-GROUP2
- VerifyTacacsServers:
# Verifies TACACS servers are configured for a specified VRF.
servers:
- 10.10.10.21
- 10.10.10.22
vrf: MGMT
- VerifyTacacsSourceIntf:
# Verifies TACACS source-interface for a specified VRF.
intf: Management0
vrf: MGMT
Count the tests¶
There are 208 tests available in 'anta.tests'.
anta get commands¶
anta get commands returns the EOS commands used by the targeted tests. Unlike
anta get tests, this command includes security advisory tests so operators can
identify every EOS command ANTA may execute.
Command overview¶
$ anta get commands --help
Usage: anta get commands [OPTIONS]
Print all EOS commands used by the selected ANTA tests.
It can be filtered by module, test or using a catalog. If no filter is
given, all built-in ANTA tests commands are retrieved.
Options:
--module TEXT Filter commands by module name. [default:
anta.tests]
--test TEXT Filter by specific test name. If module is
specified, searches only within that module.
-c, --catalog FILE Path to the test catalog file [env var:
ANTA_CATALOG]
--catalog-format [yaml|json] Format of the catalog file, either 'yaml' or
'json' [env var: ANTA_CATALOG_FORMAT]
--unique Print only the unique commands.
--help Show this message and exit.
Tip
By default, anta get commands retrieves commands from all built-in tests, including security advisory tests. Use --module anta.tests.advisories to show only advisory commands.
Examples¶
Default usage¶
anta.tests.aaa:
- VerifyAcctConsoleMethods:
- show aaa methods accounting
- VerifyAcctDefaultMethods:
- show aaa methods accounting
- VerifyAuthenMethods:
- show aaa methods authentication
- VerifyAuthzMethods:
- show aaa methods authorization
- VerifyTacacsServerGroups:
- show tacacs
- VerifyTacacsServers:
- show tacacs
- VerifyTacacsSourceIntf:
- show tacacs
anta.tests.avt:
- VerifyAVTPathHealth:
- show adaptive-virtual-topology path
- VerifyAVTRole:
- show adaptive-virtual-topology path
- VerifyAVTSpecificPath:
- show adaptive-virtual-topology path
[...]
Filtering using --module¶
To retrieve all the commands from the tests in anta.tests.stun.
anta.tests.stun:
- VerifyStunClient:
- show stun client translations {source_address} {source_port}
- VerifyStunClientTranslation:
- show stun client translations {source_address} {source_port}
- VerifyStunServer:
- show stun server status
Filtering using --test¶
anta.tests.routing.bgp:
- VerifyBGPExchangedRoutes:
- show bgp neighbors {peer} advertised-routes vrf {vrf}
- show bgp neighbors {peer} routes vrf {vrf}
vrf: MGMT
Tip
You can filter tests by providing a prefix - ANTA will return all tests that start with your specified string.
anta.tests.aaa:
- VerifyTacacsServerGroups:
- show tacacs
- VerifyTacacsServers:
- show tacacs
- VerifyTacacsSourceIntf:
- show tacacs
Filtering using --catalog¶
To retrieve all the commands from the tests in a catalog:
anta.tests.interfaces:
- VerifyL3MTU:
- show interfaces
anta.tests.mlag:
- VerifyMlagStatus:
- show mlag
anta.tests.system:
- VerifyAgentLogs:
- show agent logs crash
- VerifyCPUUtilization:
- show processes top once
- VerifyCoredump:
- show system coredump
- VerifyFileSystemUtilization:
- bash timeout 10 df -h
- VerifyMemoryUtilization:
- show version
- VerifyNTP:
- show ntp status
- VerifyReloadCause:
- show reload cause
- VerifyUptime:
- show uptime
Output using --unique¶
Using the --unique flag will output only the list of unique commands that will be run which can be useful to configure a AAA system.
For instance with the previous catalog, the output would be:
show processes top once
bash timeout 10 df -h
show system coredump
show agent logs crash
show interfaces
show uptime
show ntp status
show version
show reload cause
show mlag