Debian Codegraph @

docs/cli/nrfu.md

raw symbols SCIP
1 ---
2 title: Execute Network Readiness For Use (NRFU) Testing
3 hide:
4 - tags
5 tags:
6 - CLI
7 - NRFU
8 - Reports
9 ---
10
11 <!--
12 ~ Copyright (c) 2023-2026 Arista Networks, Inc.
13 ~ Use of this source code is governed by the Apache License 2.0
14 ~ that can be found in the LICENSE file.
15 -->
16
17 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:
18
19 - [Text report](#performing-nrfu-with-text-rendering)
20 - [Table report](#performing-nrfu-with-table-rendering)
21 - [JSON report](#performing-nrfu-with-json-rendering)
22 - [Custom template report](#performing-nrfu-with-custom-reports)
23 - [CSV report](#performing-nrfu-and-saving-results-in-a-csv-file)
24 - [Markdown report](#performing-nrfu-and-saving-results-in-a-markdown-file)
25
26 ## NRFU Command overview
27
28 ```bash
29 --8<-- "anta_nrfu_help.txt"
30 ```
31
32 > `username`, `password`, `enable-password`, `enable`, `timeout` and `insecure` values are the same for all devices
33
34 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.
35
36 !!! tip
37 Issuing the command `anta nrfu` will run `anta nrfu table` without any option.
38
39 ### Tag management
40
41 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](tag-management.md) for more information.
42
43 ### Device and test filtering
44
45 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`.
46
47 ### Hide results
48
49 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`.
50
51 ## Performing NRFU with text rendering
52
53 The `text` subcommand provides a straightforward text report for each test executed on all devices in your inventory.
54
55 ### Command overview
56
57 ```bash
58 --8<-- "anta_nrfu_text_help.txt"
59 ```
60
61 ### Example
62
63 ```bash
64 anta nrfu --device DC1-LEAF1A text
65 ```
66
67 ![anta nrfu text results](../imgs/anta_nrfu_device_dc1leaf1a_text.svg){ loading=lazy width="1600" }
68
69 ## Performing NRFU with table rendering
70
71 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.
72
73 ### Command overview
74
75 ```bash
76 --8<-- "anta_nrfu_table_help.txt"
77 ```
78
79 The `--group-by` option shows a summarized view of the test results per host or per test.
80
81 ### Examples
82
83 ```bash
84 anta nrfu --tags LEAF table
85 ```
86
87 ![anta nrfu table results](../imgs/anta_nrfu_tags_LEAF_table.svg){ loading=lazy width="1600" }
88
89 For larger setups, you can also group the results by host or test to get a summarized view:
90
91 ```bash
92 anta nrfu table --group-by device
93 ```
94
95 ![$1anta nrfu table group_by_host_output](../imgs/anta_nrfu_table_groupby_device.svg){ loading=lazy width="1600" }
96
97 ```bash
98 anta nrfu table --group-by test
99 ```
100
101 ![$1anta nrfu table group_by_test_output](../imgs/anta_nrfu_table_groupby_test.svg){ loading=lazy width="1600" }
102
103 To get more specific information, it is possible to filter on a single device or a single test:
104
105 ```bash
106 anta nrfu --device dc1-spine1 table
107 ```
108
109 ![$1anta nrfu table filter_host_output](../imgs/anta_nrfu_device_dc1spine1_table.svg){ loading=lazy width="1600" }
110
111 ```bash
112 anta nrfu --test VerifyZeroTouch table
113 ```
114
115 ![$1anta nrfu table filter_test_output](../imgs/anta_nrfu_test_VerifyZeroTouch_table.svg){ loading=lazy width="1600" }
116
117 ## Performing NRFU with JSON rendering
118
119 The JSON rendering command in NRFU testing will generate an output of all test results in JSON format.
120
121 ### Command overview
122
123 ```bash
124 --8<-- "anta_nrfu_json_help.txt"
125 ```
126
127 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.
128
129 ### Example
130
131 ```bash
132 anta nrfu --tags LEAF json
133 ```
134
135 ![$1anta nrfu json results](../imgs/anta_nrfu_tags_LEAF_json.svg){ loading=lazy width="1600" }
136
137 ## Performing NRFU and saving results in a CSV file
138
139 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.
140
141 ### Command overview
142
143 ```bash
144 --8<-- "anta_nrfu_csv_help.txt"
145 ```
146
147 ### Example
148
149 ![anta nrfu csv results](../imgs/anta_nrfu_csv.png){ loading=lazy width="1600" }
150
151 ## Performing NRFU and saving results in a Markdown file
152
153 The `md-report` command in NRFU testing generates a comprehensive Markdown report containing various sections, including detailed statistics for devices and test categories.
154
155 ### Command overview
156
157 ```bash
158 --8<-- "anta_nrfu_mdreport_help.txt"
159 ```
160
161 ### Example
162
163 ![anta nrfu md-report results](../imgs/anta-nrfu-md-report-output.png){ loading=lazy width="1600" }
164
165 ## Performing NRFU with custom reports
166
167 ANTA offers a CLI option for creating custom reports. This leverages the Jinja2 template system, allowing you to tailor reports to your specific needs.
168
169 ### Command overview
170
171 ```bash
172 --8<-- "anta_nrfu_tplreport_help.txt"
173 ```
174
175 The `--template` option is used to specify the Jinja2 template file for generating the custom report.
176
177 The `--output` option allows you to choose the path where the final report will be saved.
178
179 ### Example
180
181 ```bash
182 anta nrfu --tags LEAF tpl-report --template ./custom_template.j2
183 ```
184
185 ![$1anta nrfu tpl_results](../imgs/anta-nrfu-tpl-report-output.png){ loading=lazy width="1600" }
186
187 The template `./custom_template.j2` is a simple Jinja2 template:
188
189 ```j2
190 {% for d in data %}
191 * {{ d.test }} is [green]{{ d.result | upper}}[/green] for {{ d.name }}
192 {% endfor %}
193 ```
194
195 The Jinja2 template has access to all `TestResult` elements and their values, as described in this [documentation](../api/result.md#anta.result_manager.models.TestResult).
196
197 You can also save the report result to a file using the `--output` option:
198
199 ```bash
200 anta nrfu --tags LEAF tpl-report --template ./custom_template.j2 --output nrfu-tpl-report.txt
201 ```
202
203 The resulting output might look like this:
204
205 ```bash
206 cat nrfu-tpl-report.txt
207 * VerifyMlagStatus is [green]SUCCESS[/green] for DC1-LEAF1A
208 * VerifyMlagInterfaces is [green]SUCCESS[/green] for DC1-LEAF1A
209 * VerifyMlagConfigSanity is [green]SUCCESS[/green] for DC1-LEAF1A
210 * VerifyMlagReloadDelay is [green]SUCCESS[/green] for DC1-LEAF1A
211 ```
212
213 ## Dry-run mode
214
215 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.
216
217 ![$1anta nrfu dry_run](../imgs/anta_nrfu___dry_run.svg){ loading=lazy width="1600" }