Merging upstream version 1.4.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-05-15 09:34:30 +02:00
parent a6f5a146cb
commit 3254dea030
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
166 changed files with 13787 additions and 11959 deletions

View file

@ -7,7 +7,7 @@
ANTA is a Python library that can be used in user applications. This section describes how you can leverage ANTA Python modules to help you create your own NRFU solution.
> [!TIP]
> If you are unfamiliar with asyncio, refer to the Python documentation relevant to your Python version - https://docs.python.org/3/library/asyncio.html
> If you are unfamiliar with asyncio, refer to the Python documentation relevant to your Python version - <https://docs.python.org/3/library/asyncio.html>
## [AntaDevice](../api/device.md#anta.device.AntaDevice) Abstract Class
@ -24,7 +24,7 @@ The [copy()](../api/device.md#anta.device.AntaDevice.copy) coroutine is used to
The [AsyncEOSDevice](../api/device.md#anta.device.AsyncEOSDevice) class is an implementation of [AntaDevice](../api/device.md#anta.device.AntaDevice) for Arista EOS.
It uses the [aio-eapi](https://github.com/jeremyschulman/aio-eapi) eAPI client and the [AsyncSSH](https://github.com/ronf/asyncssh) library.
- The [\_collect()](../api/device.md#anta.device.AsyncEOSDevice._collect) coroutine collects [AntaCommand](../api/models.md#anta.models.AntaCommand) outputs using eAPI.
- The [\_collect()](../api/device.md#anta.device.AsyncEOSDevice._collect) coroutine collects [AntaCommand](../api/commands.md#anta.models.AntaCommand) outputs using eAPI.
- The [refresh()](../api/device.md#anta.device.AsyncEOSDevice.refresh) coroutine tries to open a TCP connection on the eAPI port and update the `is_online` attribute accordingly. If the TCP connection succeeds, it sends a `show version` command to gather the hardware model of the device and updates the `established` and `hw_model` attributes.
- The [copy()](../api/device.md#anta.device.AsyncEOSDevice.copy) coroutine copies files to and from the device using the SCP protocol.

13
docs/api/settings.md Normal file
View file

@ -0,0 +1,13 @@
---
anta_title: ANTA Settings
---
<!--
~ 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.
-->
### ::: anta.settings
options:
show_root_full_path: true

View file

@ -19,6 +19,7 @@ Here are the tests that we currently provide:
- [Configuration](tests/configuration.md)
- [Connectivity](tests/connectivity.md)
- [CVX](tests/cvx.md)
- [EVPN](tests/evpn.md)
- [Field Notices](tests/field_notices.md)
- [Flow Tracking](tests/flow_tracking.md)
- [GreenT](tests/greent.md)

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for AAA tests
anta_title: ANTA Tests for AAA
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for AAA tests
::: anta.tests.aaa
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for Adaptive Virtual Topology (AVT) tests
anta_title: ANTA Tests for Adaptive Virtual Topology (AVT)
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for Adaptive Virtual Topology (AVT) tests
::: anta.tests.avt
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for Adaptive Virtual Topology (AVT) tests
::: anta.input_models.avt
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for BFD tests
anta_title: ANTA Tests for BFD
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for BFD tests
::: anta.tests.bfd
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for BFD tests
::: anta.input_models.bfd
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for device configuration tests
anta_title: ANTA Tests for device configuration
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for device configuration tests
::: anta.tests.configuration
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for connectivity tests
anta_title: ANTA Tests for connectivity
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for connectivity tests
::: anta.tests.connectivity
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,9 +31,11 @@ anta_title: ANTA catalog for connectivity tests
::: anta.input_models.connectivity
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
- "!^__init__"
merge_init_into_class: false
show_bases: false
show_labels: true

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for CVX tests
anta_title: ANTA Tests for CVX
---
<!--
@ -8,10 +8,31 @@ anta_title: ANTA catalog for CVX tests
~ that can be found in the LICENSE file.
-->
# Tests
::: anta.tests.cvx
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
merge_init_into_class: false
show_bases: false
show_labels: true
show_root_heading: false
show_root_toc_entry: false
show_symbol_type_heading: false
show_symbol_type_toc: false
# Input models
::: anta.input_models.cvx
options:
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

45
docs/api/tests/evpn.md Normal file
View file

@ -0,0 +1,45 @@
---
anta_title: ANTA Tests for EVPN
---
<!--
~ 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.
-->
# Tests
::: anta.tests.evpn
options:
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
- "!^_[^_]"
merge_init_into_class: false
show_bases: false
show_labels: true
show_root_heading: false
show_root_toc_entry: false
show_symbol_type_heading: false
show_symbol_type_toc: false
# Input models
::: anta.input_models.evpn
options:
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false
show_bases: false
show_labels: true
show_root_heading: false
show_root_toc_entry: false
show_symbol_type_heading: false
show_symbol_type_toc: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for Field Notices tests
anta_title: ANTA Tests for Field Notices
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for Field Notices tests
::: anta.tests.field_notices
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for flow tracking tests
anta_title: ANTA Tests for flow tracking
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for flow tracking tests
::: anta.tests.flow_tracking
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -31,7 +32,8 @@ anta_title: ANTA catalog for flow tracking tests
::: anta.input_models.flow_tracking
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for GreenT tests
anta_title: ANTA Tests for GreenT
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for GreenT tests
::: anta.tests.greent
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for hardware tests
anta_title: ANTA Tests for hardware
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for hardware tests
::: anta.tests.hardware
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for interfaces tests
anta_title: ANTA Tests for interfaces
---
<!--
@ -13,10 +13,12 @@ anta_title: ANTA catalog for interfaces tests
::: anta.tests.interfaces
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
- "!_.*"
merge_init_into_class: false
show_bases: false
show_labels: true
@ -30,9 +32,11 @@ anta_title: ANTA catalog for interfaces tests
::: anta.input_models.interfaces
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
- "!^__init__"
merge_init_into_class: false
show_bases: false
show_labels: true

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for LANZ tests
anta_title: ANTA Tests for LANZ
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for LANZ tests
::: anta.tests.lanz
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for logging tests
anta_title: ANTA Tests for logging
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for logging tests
::: anta.tests.logging
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for logging tests
::: anta.input_models.logging
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for MLAG tests
anta_title: ANTA Tests for MLAG
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for MLAG tests
::: anta.tests.mlag
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for multicast and IGMP tests
anta_title: ANTA Tests for multicast and IGMP
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for multicast and IGMP tests
::: anta.tests.multicast
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for Router path-selection tests
anta_title: ANTA Tests for Router path-selection
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for Router path-selection tests
::: anta.tests.path_selection
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for Router path-selection tests
::: anta.input_models.path_selection
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for profiles tests
anta_title: ANTA Tests for profiles
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for profiles tests
::: anta.tests.profiles
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for PTP tests
anta_title: ANTA Tests for PTP
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for PTP tests
::: anta.tests.ptp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for BGP tests
anta_title: ANTA Tests for BGP
---
<!--
@ -21,7 +21,8 @@ anta_title: ANTA catalog for BGP tests
::: anta.tests.routing.bgp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -39,7 +40,8 @@ anta_title: ANTA catalog for BGP tests
::: anta.input_models.routing.bgp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for generic routing tests
anta_title: ANTA Tests for generic routing
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for generic routing tests
::: anta.tests.routing.generic
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for generic routing tests
::: anta.input_models.routing.generic
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for IS-IS tests
anta_title: ANTA Tests for IS-IS
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for IS-IS tests
::: anta.tests.routing.isis
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -31,7 +32,8 @@ anta_title: ANTA catalog for IS-IS tests
::: anta.input_models.routing.isis
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for OSPF tests
anta_title: ANTA Tests for OSPF
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for OSPF tests
::: anta.tests.routing.ospf
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for security tests
anta_title: ANTA Tests for security
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for security tests
::: anta.tests.security
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for security tests
::: anta.input_models.security
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for services tests
anta_title: ANTA Tests for services
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for services tests
::: anta.tests.services
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for services tests
::: anta.input_models.services
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for SNMP tests
anta_title: ANTA Tests for SNMP
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for SNMP tests
::: anta.tests.snmp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for SNMP tests
::: anta.input_models.snmp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for Software tests
anta_title: ANTA Tests for Software
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for Software tests
::: anta.tests.software
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for STP tests
anta_title: ANTA Tests for STP
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for STP tests
::: anta.tests.stp
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for STUN tests
anta_title: ANTA Tests for STUN
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for STUN tests
::: anta.tests.stun
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for STUN tests
::: anta.input_models.stun
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__init__"
- "!^__str__"

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for System tests
anta_title: ANTA Tests for System
---
<!--
@ -13,7 +13,8 @@ anta_title: ANTA catalog for System tests
::: anta.tests.system
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -30,7 +31,8 @@ anta_title: ANTA catalog for System tests
::: anta.input_models.system
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for VLAN tests
anta_title: ANTA Tests for VLAN
---
<!--
@ -8,10 +8,13 @@ anta_title: ANTA catalog for VLAN tests
~ that can be found in the LICENSE file.
-->
# Tests
::: anta.tests.vlan
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"
@ -22,3 +25,20 @@ anta_title: ANTA catalog for VLAN tests
show_root_toc_entry: false
show_symbol_type_heading: false
show_symbol_type_toc: false
# Input models
::: anta.input_models.vlan
options:
extra:
anta_hide_test_module_description: true
filters:
- "!^__str__"
merge_init_into_class: false
show_bases: false
show_labels: true
show_root_heading: false
show_root_toc_entry: false
show_symbol_type_heading: false
show_symbol_type_toc: false

View file

@ -1,5 +1,5 @@
---
anta_title: ANTA catalog for VXLAN tests
anta_title: ANTA Tests for VXLAN
---
<!--
@ -11,7 +11,8 @@ anta_title: ANTA catalog for VXLAN tests
::: anta.tests.vxlan
options:
anta_hide_test_module_description: true
extra:
anta_hide_test_module_description: true
filters:
- "!test"
- "!render"

View file

@ -16,40 +16,7 @@ This command will list all devices available in the inventory. Using the `--tags
### Command overview
```bash
Usage: anta get inventory [OPTIONS]
Show inventory loaded in ANTA.
Options:
-u, --username TEXT Username to connect to EOS [env var:
ANTA_USERNAME; required]
-p, --password TEXT Password to connect to EOS that must be
provided. It can be prompted using '--prompt'
option. [env var: ANTA_PASSWORD]
--enable-password TEXT Password to access EOS Privileged EXEC mode.
It can be prompted using '--prompt' option.
Requires '--enable' option. [env var:
ANTA_ENABLE_PASSWORD]
--enable Some commands may require EOS Privileged EXEC
mode. This option tries to access this mode
before sending a command to the device. [env
var: ANTA_ENABLE]
-P, --prompt Prompt for passwords if they are not
provided. [env var: ANTA_PROMPT]
--timeout FLOAT Global API timeout. This value will be used
for all devices. [env var: ANTA_TIMEOUT;
default: 30.0]
--insecure Disable SSH Host Key validation. [env var:
ANTA_INSECURE]
--disable-cache Disable cache globally. [env var:
ANTA_DISABLE_CACHE]
-i, --inventory FILE Path to the inventory YAML file. [env var:
ANTA_INVENTORY; required]
--tags TEXT List of tags using comma as separator:
tag1,tag2,tag3. [env var: ANTA_TAGS]
--connected / --not-connected Display inventory after connection has been
created
--help Show this message and exit.
--8<-- "anta_get_inventory_help.txt"
```
> [!TIP]

View file

@ -7,27 +7,18 @@ anta_title: Retrieving Tests information
~ that can be found in the LICENSE file.
-->
`anta get tests` commands help you discover available tests in ANTA.
## `anta get tests`
`anta get tests` commands help you discover the available tests in ANTA.
### Command overview
```bash
Usage: anta get tests [OPTIONS]
Show all builtin ANTA tests with an example output retrieved from each test
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.
--8<-- "anta_get_tests_help.txt"
```
> [!TIP]
> By default, `anta get tests` will retrieve all tests available in ANTA.
> By default, `anta get tests` retrieves all the tests available in ANTA.
### Examples
@ -60,7 +51,7 @@ anta.tests.aaa:
[...]
```
#### Module usage
#### Filtering using `--module`
To retrieve all the tests from `anta.tests.stun`.
@ -81,7 +72,7 @@ anta.tests.stun:
# Verifies the STUN server status is enabled and running.
```
#### Test usage
#### Filtering using `--test`
``` yaml title="anta get tests --test VerifyTacacsSourceIntf"
anta.tests.aaa:
@ -118,3 +109,132 @@ anta.tests.aaa:
```bash title="anta get tests --count"
There are 155 tests available in `anta.tests`.
```
## `anta get commands`
`anta get commands` returns the EOS commands used by the targeted tests, if no filter is provided, the targeted tests are all the built-in ANTA tests.
### Command overview
```bash
--8<-- "anta_get_commands_help.txt"
```
> [!TIP]
> By default, `anta get commands` returns the commands from every tests builtin in ANTA.
### Examples
#### Default usage
``` yaml title="anta get commands"
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`.
``` yaml title="anta get commands --module 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`
``` yaml title="anta get commands --test VerifyBGPExchangedRoutes"
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.
```yaml title="anta get tests --test VerifyTacacs"
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:
``` yaml title="anta get commands --catalog my-catalog.yml"
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:
``` yaml title="anta get commands --catalog my-catalog.yml --unique"
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
```

View file

@ -12,23 +12,7 @@ In large setups, it might be beneficial to construct your inventory based on you
## Command overview
```bash
$ anta get from-ansible --help
Usage: anta get from-ansible [OPTIONS]
Build ANTA inventory from an ansible inventory YAML file.
NOTE: This command does not support inline vaulted variables. Make sure to
comment them out.
Options:
-o, --output FILE Path to save inventory file [env var:
ANTA_INVENTORY; required]
--overwrite Do not prompt when overriding current inventory
[env var: ANTA_GET_FROM_ANSIBLE_OVERWRITE]
-g, --ansible-group TEXT Ansible group to filter
--ansible-inventory FILE Path to your ansible inventory file to read
[required]
--help Show this message and exit.
--8<-- "anta_get_fromansible_help.txt"
```
> [!WARNING]

View file

@ -15,26 +15,7 @@ In large setups, it might be beneficial to construct your inventory based on Clo
## Command overview
```bash
Usage: anta get from-cvp [OPTIONS]
Build ANTA inventory from CloudVision.
NOTE: Only username/password authentication is supported for on-premises CloudVision instances.
Token authentication for both on-premises and CloudVision as a Service (CVaaS) is not supported.
Options:
-o, --output FILE Path to save inventory file [env var: ANTA_INVENTORY;
required]
--overwrite Do not prompt when overriding current inventory [env
var: ANTA_GET_FROM_CVP_OVERWRITE]
-host, --host TEXT CloudVision instance FQDN or IP [required]
-u, --username TEXT CloudVision username [required]
-p, --password TEXT CloudVision password [required]
-c, --container TEXT CloudVision container where devices are configured
--ignore-cert By default connection to CV will use HTTPS
certificate, set this flag to disable it [env var:
ANTA_GET_FROM_CVP_IGNORE_CERT]
--help Show this message and exit.
--8<-- "anta_get_fromcvp_help.txt"
```
The output is an inventory where the name of the container is added as a tag for each host:

View file

@ -29,9 +29,22 @@ $ pip install -e .[dev,cli]
$ pip list -e
Package Version Editable project location
------- ------- -------------------------
anta 1.3.0 /mnt/lab/projects/anta
anta 1.4.0 /mnt/lab/projects/anta
```
!!! info "Installation Note"
1. If you are using a terminal such as zsh, ensure that commands involving shell expansions within editable installs (like specifying development dependencies) are enclosed in double quotes. For example: `pip install -e ."[dev]"`
2. If you do not see any output when running the verification command (`pip list -e`), it is likely because the command needs to be executed from within the inner `anta` directory. Navigate to this directory and then verify the installation:
```
$ cd anta/anta
# Verify installation
$ pip list -e
Package Version Editable project location
------- ------- --------------------------
anta 1.4.0 /mnt/lab/projects/anta
```
Then, [`tox`](https://tox.wiki/) is configured with few environments to run CI locally:
```bash
@ -103,14 +116,19 @@ The `pytest_generate_tests` function will parametrize the generic test function
See https://docs.pytest.org/en/7.3.x/how-to/parametrize.html#basic-pytest-generate-tests-example
The `DATA` structure is a list of dictionaries used to parametrize the test. The list elements have the following keys:
The `DATA` structure is a dictionary where:
- Each key is a tuple of size 2 containing:
- An AntaTest subclass imported in the test module as first element - e.g. VerifyUptime.
- A string used as name displayed by pytest as second element.
- Each value is an instance of AntaUnitTest, which is a Python TypedDict.
And AntaUnitTest have the following keys:
- `name` (str): Test name as displayed by Pytest.
- `test` (AntaTest): An AntaTest subclass imported in the test module - e.g. VerifyUptime.
- `eos_data` (list[dict]): List of data mocking EOS returned data to be passed to the test.
- `inputs` (dict): Dictionary to instantiate the `test` inputs as defined in the class from `test`.
- `expected` (dict): Expected test result structure, a dictionary containing a key
`result` containing one of the allowed status (`Literal['success', 'failure', 'unset', 'skipped', 'error']`) and optionally a key `messages` which is a list(str) and each message is expected to be a substring of one of the actual messages in the TestResult object.
`result` containing one of the allowed status (`Literal[AntaTestStatus.SUCCESS, AntaTestStatus.FAILURE, AntaTestStatus.SKIPPED]`) and optionally a key `messages` which is a list(str) and each message is expected to be a substring of one of the actual messages in the TestResult object.
In order for your unit tests to be correctly collected, you need to import the generic test function even if not used in the Python module.
@ -124,29 +142,24 @@ from tests.units.anta_tests import test
from anta.tests.system import VerifyUptime
# Define test parameters
DATA: list[dict[str, Any]] = [
{
# Arbitrary test name
"name": "success",
# Must be an AntaTest definition
"test": VerifyUptime,
# Data returned by EOS on which the AntaTest is tested
"eos_data": [{"upTime": 1186689.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}],
# Dictionary to instantiate VerifyUptime.Input
"inputs": {"minimum": 666},
# Expected test result
"expected": {"result": "success"},
},
{
"name": "failure",
"test": VerifyUptime,
"eos_data": [{"upTime": 665.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}],
"inputs": {"minimum": 666},
# If the test returns messages, it needs to be expected otherwise test will fail.
# NB: expected messages only needs to be included in messages returned by the test. Exact match is not required.
"expected": {"result": "failure", "messages": ["Device uptime is 665.15 seconds"]},
},
]
DATA: dict[tuple[type[AntaTest], str], AntaUnitTest] = {
(VerifyUptime, "success"): {
# Data returned by EOS on which the AntaTest is tested
"eos_data": [{"upTime": 1186689.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}],
# Dictionary to instantiate VerifyUptime.Input
"inputs": {"minimum": 666},
# Expected test result
"expected": {"result": AntaTestStatus.SUCCESS},
},
(VerifyUptime, "failure"): {
# Data returned by EOS on which the AntaTest is tested
"eos_data": [{"upTime": 665.15, "loadAvg": [0.13, 0.12, 0.09], "users": 1, "currentTime": 1683186659.139859}],
"inputs": {"minimum": 666},
# If the test returns messages, it needs to be expected otherwise test will fail.
# NB: expected messages only needs to be included in messages returned by the test. Exact match is not required.
"expected": {"result": AntaTestStatus.FAILURE, "messages": ["Device uptime is 665.15 seconds"]},
}
}
```
## Git Pre-commit hook

View file

@ -30,7 +30,7 @@ anta_title: Frequently Asked Questions (FAQ)
This usually means that the operating system refused to open a new file descriptor (or socket) for the ANTA process. This might be due to the hard limit for open file descriptors currently set for the ANTA process.
At startup, ANTA sets the soft limit of its process to the hard limit up to 16384. This is because the soft limit is usually 1024 and the hard limit is usually higher (depends on the system). If the hard limit of the ANTA process is still lower than the number of selected tests in ANTA, the ANTA process may request to the operating system too many file descriptors and get an error, a WARNING is displayed at startup if this is the case.
At startup, ANTA sets the soft limit of its process to the hard limit up to 16384. This is because the soft limit is usually 1024 and the hard limit is usually higher (depends on the system). If the hard limit of the ANTA process is still lower than the potential connections of all devices, the ANTA process may request to the operating system too many file descriptors and get an error, a WARNING is displayed at startup if this is the case.
### Solution
@ -43,11 +43,35 @@ anta_title: Frequently Asked Questions (FAQ)
The `user` is the one with which the ANTA process is started.
The `value` is the new hard limit. The maximum value depends on the system. A hard limit of 16384 should be sufficient for ANTA to run in most high scale scenarios. After creating this file, log out the current session and log in again.
## Tests throttling WARNING in the logs
???+ faq "Tests throttling `WARNING` in the logs"
ANTA is designed to execute many tests concurrently while ensuring system stability. If the total test count exceeds the maximum concurrency limit, tests are throttled to avoid overwhelming the asyncio event loop and exhausting system resources. A `WARNING` message is logged at startup when this occurs.
By default, ANTA schedules up to **50000** tests concurrently. This should be sufficient for most use cases, but it may not be optimal for every system. If the number of tests exceeds this value, ANTA executes the first 50000 tests and waits for some tests to complete before executing more.
### Solution
You can adjust the maximum concurrency limit using the `ANTA_MAX_CONCURRENCY` environment variable. The optimal value depends on your system CPU usage, memory consumption, and file descriptor limits.
!!! warning
Increasing the maximum concurrency limit can lead to system instability if the system is not able to handle the increased load. Monitor system resources and adjust the limit accordingly.
!!! info "Device Connection Limits"
Each EOS device is limited to a maximum of **100** concurrent connections. This means that, even if ANTA schedules a high number of tests, it will only attempt to open up to 100 connections at a time towards each device.
!!! tip
If you run ANTA on a large fabric or encounter issues related to resource limits, consider tuning `ANTA_MAX_CONCURRENCY`.
Test different values to find the optimal setting for your environment.
## `Timeout` error in the logs
???+ faq "`Timeout` error in the logs"
When running ANTA, you can receive `<Foo>Timeout` errors in the logs (could be ReadTimeout, WriteTimeout, ConnectTimeout or PoolTimeout). More details on the timeouts of the underlying library are available here: https://www.python-httpx.org/advanced/timeouts.
When running ANTA, you can receive `<Foo>Timeout` errors in the logs (could be `ReadTimeout`, `WriteTimeout`, `ConnectTimeout` or `PoolTimeout`). More details on the timeouts of the underlying library are available here: https://www.python-httpx.org/advanced/timeouts.
This might be due to the time the host on which ANTA is run takes to reach the target devices (for instance if going through firewalls, NATs, ...) or when a lot of tests are being run at the same time on a device (eAPI has a queue mechanism to avoid exhausting EOS resources because of a high number of simultaneous eAPI requests).
@ -59,8 +83,7 @@ anta_title: Frequently Asked Questions (FAQ)
anta nrfu --enable --username username --password arista --inventory inventory.yml -c nrfu.yml --timeout 50 text
```
The previous command set a couple of options for ANTA NRFU, one them being the `timeout` command, by default, when running ANTA from CLI, it is set to 30s.
The timeout is increased to 50s to allow ANTA to wait for API calls a little longer.
In this command, ANTA NRFU is configured with several options. Notably, the `--timeout` parameter is set to 50 seconds (instead of the default 30 seconds) to allow extra time for API calls to complete.
## `ImportError` related to `urllib3`
@ -154,6 +177,8 @@ anta_title: Frequently Asked Questions (FAQ)
```
You can then add other commands if they are required for your test catalog (`ping` for example) and then tighten down the show commands to only those required for your tests.
To figure out the full list of commands used by your catalog or ANTA in general, you can use [`anta get commands`](./cli/get-tests.md#anta-get-commands)
2. Configure the following authorization (You may need to adapt depending on your AAA setup).

View file

@ -84,7 +84,7 @@ which anta
```bash
# Check ANTA version
anta --version
anta, version v1.3.0
anta, version v1.4.0
```
## EOS Requirements

View file

@ -22,6 +22,11 @@ COMMANDS = [
"anta nrfu tpl-report --help",
"anta nrfu md-report --help",
"anta get tags --help",
"anta get inventory --help",
"anta get tests --help",
"anta get from-cvp --help",
"anta get from-ansible --help",
"anta get commands --help",
]
for command in COMMANDS:

View file

@ -0,0 +1,19 @@
$ 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.

View file

@ -0,0 +1,17 @@
$ anta get from-ansible --help
Usage: anta get from-ansible [OPTIONS]
Build ANTA inventory from an ansible inventory YAML file.
NOTE: This command does not support inline vaulted variables. Make sure to
comment them out.
Options:
-o, --output FILE Path to save inventory file [env var:
ANTA_INVENTORY; required]
--overwrite Do not prompt when overriding current inventory
[env var: ANTA_GET_FROM_ANSIBLE_OVERWRITE]
-g, --ansible-group TEXT Ansible group to filter
--ansible-inventory FILE Path to your ansible inventory file to read
[required]
--help Show this message and exit.

View file

@ -0,0 +1,22 @@
$ anta get from-cvp --help
Usage: anta get from-cvp [OPTIONS]
Build ANTA inventory from CloudVision.
NOTE: Only username/password authentication is supported for on-premises
CloudVision instances. Token authentication for both on-premises and
CloudVision as a Service (CVaaS) is not supported.
Options:
-o, --output FILE Path to save inventory file [env var: ANTA_INVENTORY;
required]
--overwrite Do not prompt when overriding current inventory [env
var: ANTA_GET_FROM_CVP_OVERWRITE]
-host, --host TEXT CloudVision instance FQDN or IP [required]
-u, --username TEXT CloudVision username [required]
-p, --password TEXT CloudVision password [required]
-c, --container TEXT CloudVision container where devices are configured
--ignore-cert Ignore verifying the SSL certificate when connecting
to CloudVision [env var:
ANTA_GET_FROM_CVP_IGNORE_CERT]
--help Show this message and exit.

View file

@ -0,0 +1,37 @@
$ anta get inventory --help
Usage: anta get inventory [OPTIONS]
Show inventory loaded in ANTA.
Options:
-u, --username TEXT Username to connect to EOS [env var:
ANTA_USERNAME; required]
-p, --password TEXT Password to connect to EOS that must be
provided. It can be prompted using '--
prompt' option. [env var: ANTA_PASSWORD]
--enable-password TEXT Password to access EOS Privileged EXEC mode.
It can be prompted using '--prompt' option.
Requires '--enable' option. [env var:
ANTA_ENABLE_PASSWORD]
--enable Some commands may require EOS Privileged
EXEC mode. This option tries to access this
mode before sending a command to the device.
[env var: ANTA_ENABLE]
-P, --prompt Prompt for passwords if they are not
provided. [env var: ANTA_PROMPT]
--timeout FLOAT Global API timeout. This value will be used
for all devices. [env var: ANTA_TIMEOUT;
default: 30.0]
--insecure Disable SSH Host Key validation. [env var:
ANTA_INSECURE]
--disable-cache Disable cache globally. [env var:
ANTA_DISABLE_CACHE]
-i, --inventory FILE Path to the inventory YAML file. [env var:
ANTA_INVENTORY; required]
--inventory-format [yaml|json] Format of the inventory file, either 'yaml'
or 'json' [env var: ANTA_INVENTORY_FORMAT]
--tags TEXT List of tags using comma as separator:
tag1,tag2,tag3. [env var: ANTA_TAGS]
--connected / --not-connected Display inventory after connection has been
created
--help Show this message and exit.

View file

@ -0,0 +1,13 @@
$ anta get tests --help
Usage: anta get tests [OPTIONS]
Show all builtin ANTA tests with an example output retrieved from each test
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.