Skip to content

Commit

Permalink
doc: Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc committed Jul 24, 2023
1 parent 3abf2a7 commit fac93ec
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 8 deletions.
2 changes: 1 addition & 1 deletion anta/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def anta(ctx: click.Context, inventory: pathlib.Path, ignore_status: bool, ignor
ctx.obj["ignore_error"] = ignore_error


@anta.group()
@anta.group(cls=IgnoreRequiredWithHelp)
@click.pass_context
@click.option(
"--catalog",
Expand Down
4 changes: 4 additions & 0 deletions anta/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def parse_catalog(ctx: click.Context, param: Option, value: str) -> List[Tuple[C
"""
Click option callback to parse an ANTA tests catalog YAML file
"""
if ctx.obj.get("_anta_help"):
# Currently looking for help for a subcommand so no
# need to parse the Catalog - return an empty list
return []
try:
with open(value, "r", encoding="UTF-8") as file:
data = safe_load(file)
Expand Down
35 changes: 28 additions & 7 deletions docs/cli/nrfu.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ Usage: anta nrfu table [OPTIONS]
ANTA command to check network states with table result

Options:
-t, --tags TEXT List of tags using comma as separator: tag1,tag2,tag3
-d, --device TEXT Show a summary for this device
-t, --test TEXT Show a summary for this test
--help Show this message and exit.
--tags TEXT List of tags using comma as separator:
tag1,tag2,tag3
-d, --device TEXT Show a summary for this device
-t, --test TEXT Show a summary for this test
--group-by [device|test] Group result by test or host. default none
--help Show this message and exit.
```

The `--tags` option can be used to target specific devices in your inventory.

The `--device` and `--test` options show a summarized view of the test results for a specific host or test case, respectively.

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

### Examples

```bash
anta nrfu table --tags LEAF
Expand All @@ -95,9 +99,26 @@ anta nrfu table --tags LEAF
For larger setups, you can also group the results by host or test to get a summarized view:

```bash
anta nrfu table --tags LEAF --device DC1-LEAF1A
anta nrfu table --group-by device
```
[![anta nrfu table group_by_host_output](../imgs/anta-nrfu-table-group-by-host-output.png){ loading=lazy width="1600" }](../imgs/anta-nrfu-table-group-by-host-output.png)

```bash
anta nrfu table --group-by test
```
[![anta nrfu table group_by_test_output](../imgs/anta-nrfu-table-group-by-test-output.png){ loading=lazy width="1600" }](../imgs/anta-nrfu-table-group-by-test-output.png)

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

```bash
anta nrfu table --device spine1
```
[![anta nrfu table filter_host_output](../imgs/anta-nrfu-table-filter-host-output.png){ loading=lazy width="1600" }](../imgs/anta-nrfu-table-filter-host-output.png)

```bash
anta nrfu table --test VerifyZeroTouch
```
[![anta nrfu table per host results](../imgs/anta-nrfu-table-per-host-output.png){ loading=lazy width="1600" }](../imgs/anta-nrfu-table-per-host-output.png)
[![anta nrfu table filter_test_output](../imgs/anta-nrfu-table-filter-test-output.png){ loading=lazy width="1600" }](../imgs/anta-nrfu-table-filter-test-output.png)

## Performing NRFU with JSON rendering

Expand Down
Binary file added docs/imgs/anta-nrfu-table-filter-host-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/imgs/anta-nrfu-table-filter-test-output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fac93ec

Please sign in to comment.