1
0
Fork 0
anta/docs/getting-started.md
Daniel Baumann afeccccd6a
Merging upstream version 1.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
2025-02-05 11:55:22 +01:00

3.1 KiB

This section shows how to use ANTA with basic configuration. All examples are based on Arista Test Drive (ATD) topology you can access by reaching out to your preferred SE.

Installation

The easiest way to install ANTA package is to run Python (>=3.9) and its pip package to install:

pip install anta[cli]

For more details about how to install package, please see the requirements and installation section.

Configure Arista EOS devices

For ANTA to be able to connect to your target devices, you need to configure your management interface

vrf instance MGMT
!
interface Management0
   description oob_management
   vrf MGMT
   ip address 192.168.0.10/24
!

Then, configure access to eAPI:

!
management api http-commands
   protocol https port 443
   no shutdown
   vrf MGMT
      no shutdown
   !
!

Create your inventory

ANTA uses an inventory to list the target devices for the tests. You can create a file manually with this format:

--8<-- "getting-started/inventory.yml"

You can read more details about how to build your inventory here

Test Catalog

To test your network, ANTA relies on a test catalog to list all the tests to run against your inventory. A test catalog references python functions into a yaml file.

The structure to follow is like:

<anta_tests_submodule>:
  - <anta_tests_submodule function name>:
      <test function option>:
        <test function option value>

You can read more details about how to build your catalog here

Here is an example for basic tests:

--8<-- "getting-started/catalog.yml"

Test your network

CLI

ANTA comes with a generic CLI entrypoint to run tests in your network. It requires an inventory file as well as a test catalog.

This entrypoint has multiple options to manage test coverage and reporting.

--8<-- "anta_help.txt"
--8<-- "anta_nrfu_help.txt"

To run the NRFU, you need to select an output format amongst ["json", "table", "text", "tpl-report"]. For a first usage, table is recommended. By default all test results for all devices are rendered but it can be changed to a report per test case or per host

!!! Note The following examples shows how to pass all the CLI options.

See how to use environment variables instead in the [CLI overview](cli/overview.md#anta-environment-variables)

Default report using table

--8<-- "getting-started/anta_nrfu_table.sh"
--8<-- "getting-started/anta_nrfu_table.output"

Report in text mode

--8<-- "getting-started/anta_nrfu_text.sh"
--8<-- "getting-started/anta_nrfu_text.output"

Report in JSON format

--8<-- "getting-started/anta_nrfu_json.sh"
--8<-- "getting-started/anta_nrfu_json.output"

Basic usage in a Python script

--8<-- "anta_runner.py"