8000 feat(anta): Implement Result manager for Jinja2 rendering by titom73 · Pull Request #197 · aristanetworks/anta · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(anta): Implement Result manager for Jinja2 rendering #197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 9, 2023
Merged

feat(anta): Implement Result manager for Jinja2 rendering #197

merged 4 commits into from
Jun 9, 2023

Conversation

titom73
Copy link
Contributor
@titom73 titom73 commented May 15, 2023

Implement option to render result using jinja2 template so it can be fully customised by the user.

Usage example

anta nrfu tpl-report -c .personal/catalog-class.yml -tpl .personal/test_template.j2 -o .personal/demo.txt
╭───────────────────────── Settings ─────────────────────────╮
│ Running check-devices with:                                │
│               - Inventory: .personal/inventory_atd.yml     │
│               - Tests catalog: .personal/catalog-class.yml │
│               - Template: .personal/test_template.j2       │
╰────────────────────────────────────────────────────────────╯
* verify_zerotouch is SUCCESS for spine01
* verify_running_config_diffs is SUCCESS for spine01
* verify_interface_utilization is SUCCESS for spine01

❯ cat .personal/demo.txt
* verify_zerotouch is [green]SUCCESS[/green] for spine01
* verify_running_config_diffs is [green]SUCCESS[/green] for spine01
* verify_interface_utilization is [green]SUCCESS[/green] for spine01

Template example

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

Todo

  • Add option to save report
  • Build documentation to use with CLI

@titom73 titom73 added framework-enhancement New feature or request Anta CLI All things around CLI labels May 15, 2023
@titom73 titom73 marked this pull request as ready for review June 8, 2023 06:51
titom73 added 4 commits June 8, 2023 13:53
IMplement option to render result using jinja2 template so it can be
fully customized by the user.

```bash
❯ anta nrfu tpl-report -c .personal/catalog-class.yml -tpl .personal/test_template.j2
[16:34:32] WARNING  Using Python 3.9.9 < 3.10 - patching aioeapi.Device.jsoncrpc_command to support 'latest' version                                                                                                                                                                                                                                                                            models.py:60
╭───────────────────────── Settings ─────────────────────────╮
│ Running check-devices with:                                │
│               - Inventory: .personal/inventory_atd.yml     │
│               - Tests catalog: .personal/catalog-class.yml │
│               - Template: .personal/test_template.j2       │
╰────────────────────────────────────────────────────────────╯
* verify_zerotouch is SUCCESS for spine01
* verify_running_config_diffs is SUCCESS for spine01
* verify_interface_utilization is SUCCESS for spine01
```
Copy link
Contributor
@carl-baillargeon carl-baillargeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@carl-baillargeon carl-baillargeon self-requested a review June 8, 2023 18:04
@titom73 titom73 merged commit c8db777 into aristanetworks:master Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anta CLI All things around CLI framework-enhancement New feature or request rn: feat(anta)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0