eos_validate_state_runner¶
Note
Always use the FQCN (Fully Qualified Collection Name) arista.avd.eos_validate_state_runner
when using this plugin.
Uses ANTA for eos_validate_state role
Synopsis¶
The arista.avd.eos_validate_state_runner
module is an Ansible Action Plugin leveraging the ANTA test framework to validate that the generated structured configurations by AVD are applied to the devices and that the deployed network is working correctly.
This plugin requires a valid structured configuration for each device in the hostvars; otherwise, some tests will not be generated.
The plugin offers the following capabilities:
- Generating a per-device test catalog based on the AVD structured_config.
- Running generated tests against each device, saving the results in a single JSON file per-device.
- In check_mode, only the test catalog is generated, and a report is created to preview the tests that would be run against each device.
- Saving per-device test catalogs and results in specified directories for use by the eos_validate_state_reports
plugin.
- Maintaining backward compatibility with existing ansible tags for eos_validate_state to filter test categories.
Parameters¶
Argument | Type | Required | Default | Value Restrictions | Description |
---|---|---|---|---|---|
logging_level | str | optional | WARNING | Valid values: - CRITICAL - ERROR - WARNING - INFO - DEBUG |
Sets the log level for the ANTA library. Defaults to "WARNING" if not specified. |
save_catalog | bool | optional | False | Indicates whether to save the test catalog for each device. | |
device_catalog_path | str | optional | None | The absolute path where the device test catalog will be saved. Required if save_catalog is set to True . |
|
test_results_dir | str | optional | None | The directory where the test results JSON file for each host will be saved. | |
custom_anta_catalogs_dir | any | optional | None | The directory where custom ANTA test catalogs are stored. Files must be named after the device hostname or the Ansible group name and have a .yml or .yaml extension. |
|
skip_tests | list | optional | None | A list of dictionaries specifying categories and, optionally, tests to skip. Each dictionary must have a key category and can optionally include a tests key. |
|
category | str | optional | None | The name of an AvdTest category (e.g., AvdTestHardware ). |
|
tests | list | optional | None | An optional list of specific tests in the category to skip (e.g., VerifyRoutingProtocolModel in AvdTestBGP ).If not specified, all tests in the category are considered. For a complete list of available tests, see link to the test list. |
|
cprofile_file | any | optional | None | The filename for storing cProfile data, useful for debugging performance issues. Be aware that enabling cProfile can affect performance, so use it only for troubleshooting. |
Notes¶
- Enabling the cProfile feature for performance profiling may impact the plugin's performance, especially in production environments.
- The plugin manages the creation of JSON files, which are used for storing test results. For each device, one JSON file containing all results is saved in the test results directory.
- The file naming convention is hard coded as "<inventory_hostname>-results.json" and cannot be changed. This ensures that the report plugin can properly retrieve the files.
- This module supports
check_mode
, allowing the generation of test reports without executing the tests. - Regardless of whether they are running in
check_mode
or not, the reports are generated by theeos_validate_state_reports
plugin.
See Also¶
- ANTA website: https://anta.arista.com
Documentation for the ANTA test framework
Examples¶
- name: Execute eos_validate_state_runner leveraging ANTA
arista.avd.eos_validate_state_runner:
logging_level: ERROR
save_catalog: true
device_catalog_path: "/my_avd_project/intended/test_catalogs/{{ inventory_hostname }}-catalog.yml"
test_results_dir: "/my_avd_project/reports/test_results"
custom_anta_catalogs_dir: "/my_avd_project/custom_anta_catalogs"
skip_tests:
- category: AvdTestHardware
- category: AvdTestBGP
tests:
- VerifyRoutingProtocolModel
register: anta_results
Authors¶
- Arista Ansible Team (@aristanetworks)