Skip to content

Execute Network Readiness For Use (NRFU) Testing

ANTA provides a set of commands for performing NRFU tests on devices. These commands are under the anta nrfu namespace and offer multiple output format options:

NRFU Command overview

Usage: anta nrfu [OPTIONS] COMMAND [ARGS]...

  Run ANTA tests on selected inventory devices.

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]
  -c, --catalog FILE              Path to the test catalog file  [env var:
                                  ANTA_CATALOG; required]
  --catalog-format [yaml|json]    Format of the catalog file, either 'yaml' or
                                  'json'  [env var: ANTA_CATALOG_FORMAT]
  -d, --device TEXT               Run tests on a specific device. Can be
                                  provided multiple times.
  -t, --test TEXT                 Run a specific test. Can be provided
                                  multiple times.
  --ignore-status                 Exit code will always be 0.  [env var:
                                  ANTA_NRFU_IGNORE_STATUS]
  --ignore-error                  Exit code will be 0 if all tests succeeded
                                  or 1 if any test failed.  [env var:
                                  ANTA_NRFU_IGNORE_ERROR]
  --hide [success|failure|error|skipped]
                                  Hide results by type: success / failure /
                                  error / skipped'.
  --dry-run                       Run anta nrfu command but stop before
                                  starting to execute the tests. Considers all
                                  devices as connected.  [env var:
                                  ANTA_NRFU_DRY_RUN]
  --help                          Show this message and exit.

Commands:
  csv         ANTA command to check network state with CSV report.
  json        ANTA command to check network state with JSON results.
  md-report   ANTA command to check network state with Markdown report.
  table       ANTA command to check network state with table results.
  text        ANTA command to check network state with text results.
  tpl-report  ANTA command to check network state with templated report.

username, password, enable-password, enable, timeout and insecure values are the same for all devices

All commands under the anta nrfu namespace require a catalog yaml file specified with the --catalog option and a device inventory file specified with the --inventory option.

Info

Issuing the command anta nrfu will run anta nrfu table without any option.

Tag management

The --tags option can be used to target specific devices in your inventory and run only tests configured with this specific tags from your catalog. Refer to the dedicated page for more information.

Device and test filtering

Options --device and --test can be used to target one or multiple devices and/or tests to run in your environment. The options can be repeated. Example: anta nrfu --device leaf1a --device leaf1b --test VerifyUptime --test VerifyReloadCause.

Hide results

Option --hide can be used to hide test results in the output or report file based on their status. The option can be repeated. Example: anta nrfu --hide error --hide skipped.

Performing NRFU with text rendering

The text subcommand provides a straightforward text report for each test executed on all devices in your inventory.

Command overview

Usage: anta nrfu text [OPTIONS]

  ANTA command to check network states with text result.

Options:
  --help  Show this message and exit.

Example

anta nrfu --device DC1-LEAF1A text

anta nrfu text results

Performing NRFU with table rendering

The table command under the anta nrfu namespace offers a clear and organized table view of the test results, suitable for filtering. It also has its own set of options for better control over the output.

Command overview

Usage: anta nrfu table [OPTIONS]

  ANTA command to check network states with table result.

Options:
  --group-by [device|test]  Group result by test or device.
  --help                    Show this message and exit.

The --group-by option show a summarized view of the test results per host or per test.

Examples

anta nrfu --tags LEAF table

anta nrfu table results

For larger setups, you can also group the results by host or test to get a summarized view:

anta nrfu table --group-by device

$1anta nrfu table group_by_host_output

anta nrfu table --group-by test

$1anta nrfu table group_by_test_output

To get more specific information, it is possible to filter on a single device or a single test:

anta nrfu --device spine1 table

$1anta nrfu table filter_host_output

anta nrfu --test VerifyZeroTouch table

$1anta nrfu table filter_test_output

Performing NRFU with JSON rendering

The JSON rendering command in NRFU testing will generate an output of all test results in JSON format.

Command overview

anta nrfu json --help
Usage: anta nrfu json [OPTIONS]

  ANTA command to check network state with JSON result.

Options:
  -o, --output FILE  Path to save report as a JSON file  [env var:
                     ANTA_NRFU_JSON_OUTPUT]
  --help             Show this message and exit.

The --output option allows you to save the JSON report as a file. If specified, no output will be displayed in the terminal. This is useful for further processing or integration with other tools.

Example

anta nrfu --tags LEAF json

$1anta nrfu json results

Performing NRFU and saving results in a CSV file

The csv command in NRFU testing is useful for generating a CSV file with all tests result. This file can be easily analyzed and filtered by operator for reporting purposes.

Command overview

anta nrfu csv --help
Usage: anta nrfu csv [OPTIONS]

  ANTA command to check network states with CSV result.

Options:
  --csv-output FILE  Path to save report as a CSV file  [env var:
                     ANTA_NRFU_CSV_CSV_OUTPUT]
  --help             Show this message and exit.

Example

anta nrfu csv results

Performing NRFU and saving results in a Markdown file

The md-report command in NRFU testing generates a comprehensive Markdown report containing various sections, including detailed statistics for devices and test categories.

Command overview

anta nrfu md-report --help

Usage: anta nrfu md-report [OPTIONS]

  ANTA command to check network state with Markdown report.

Options:
  --md-output FILE  Path to save the report as a Markdown file  [env var:
                    ANTA_NRFU_MD_REPORT_MD_OUTPUT; required]
  --help            Show this message and exit.

Example

anta nrfu md-report results

Performing NRFU with custom reports

ANTA offers a CLI option for creating custom reports. This leverages the Jinja2 template system, allowing you to tailor reports to your specific needs.

Command overview

anta nrfu tpl-report --help
Usage: anta nrfu tpl-report [OPTIONS]

  ANTA command to check network state with templated report

Options:
  -tpl, --template FILE  Path to the template to use for the report  [env var:
                         ANTA_NRFU_TPL_REPORT_TEMPLATE; required]
  -o, --output FILE      Path to save report as a file  [env var:
                         ANTA_NRFU_TPL_REPORT_OUTPUT]
  --help                 Show this message and exit.

The --template option is used to specify the Jinja2 template file for generating the custom report.

The --output option allows you to choose the path where the final report will be saved.

Example

anta nrfu --tags LEAF tpl-report --template ./custom_template.j2

$1anta nrfu tpl_results

The template ./custom_template.j2 is a simple Jinja2 template:

{% for d in data %}
* {{ d.test }} is [green]{{ d.result | upper}}[/green] for {{ d.name }}
{% endfor %}

The Jinja2 template has access to all TestResult elements and their values, as described in this documentation.

You can also save the report result to a file using the --output option:

anta nrfu --tags LEAF tpl-report --template ./custom_template.j2 --output nrfu-tpl-report.txt

The resulting output might look like this:

cat nrfu-tpl-report.txt
* VerifyMlagStatus is [green]SUCCESS[/green] for DC1-LEAF1A
* VerifyMlagInterfaces is [green]SUCCESS[/green] for DC1-LEAF1A
* VerifyMlagConfigSanity is [green]SUCCESS[/green] for DC1-LEAF1A
* VerifyMlagReloadDelay is [green]SUCCESS[/green] for DC1-LEAF1A

Dry-run mode

It is possible to run anta nrfu --dry-run to execute ANTA up to the point where it should communicate with the network to execute the tests. When using --dry-run, all inventory devices are assumed to be online. This can be useful to check how many tests would be run using the catalog and inventory.

$1anta nrfu dry_run