Merging upstream version 1.0.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
256a120fdd
commit
3ccac88507
36 changed files with 2108 additions and 153 deletions
|
@ -6,23 +6,23 @@
|
|||
|
||||
# Arista Network Test Automation (ANTA) Framework
|
||||
|
||||
| **Code** | [](https://github.com/astral-sh/ruff) [](https://numpydoc.readthedocs.io/en/latest/format.html) |
|
||||
| **Code** | [](https://github.com/astral-sh/ruff) [](https://numpydoc.readthedocs.io/en/latest/format.html) [](https://sonarcloud.io/summary/new_code?id=aristanetworks_anta) |
|
||||
| :------------: | :-------|
|
||||
| **License** | [](https://github.com/arista-netdevops-community/anta/blob/main/LICENSE) |
|
||||
| **GitHub** | [](https://github.com/arista-netdevops-community/anta/actions/workflows/code-testing.yml)    [](https://github.com/arista-netdevops-community/anta/releases/) [](https://github.com/arista-netdevops-community/anta/graphs/contributors) |
|
||||
| **License** | [](https://github.com/aristanetworks/anta/blob/main/LICENSE) |
|
||||
| **GitHub** | [](https://github.com/aristanetworks/anta/actions/workflows/code-testing.yml)    [](https://github.com/aristanetworks/anta/releases/) [](https://github.com/aristanetworks/anta/graphs/contributors) |
|
||||
| **PyPi** |     |
|
||||
|
||||
ANTA is Python framework that automates tests for Arista devices.
|
||||
|
||||
- ANTA provides a [set of tests](api/tests.md) to validate the state of your network
|
||||
- ANTA can be used to:
|
||||
- Automate NRFU (Network Ready For Use) test on a preproduction network
|
||||
- Automate tests on a live network (periodically or on demand)
|
||||
- Automate NRFU (Network Ready For Use) test on a preproduction network
|
||||
- Automate tests on a live network (periodically or on demand)
|
||||
- ANTA can be used with:
|
||||
- As a [Python library](advanced_usages/as-python-lib.md) in your own application
|
||||
- The [ANTA CLI](cli/overview.md)
|
||||
- As a [Python library](advanced_usages/as-python-lib.md) in your own application
|
||||
- The [ANTA CLI](cli/overview.md)
|
||||
|
||||

|
||||

|
||||
|
||||
## Install ANTA library
|
||||
|
||||
|
@ -72,12 +72,12 @@ Commands:
|
|||
You can also still choose to install it with directly with `pip`:
|
||||
|
||||
```bash
|
||||
$ pip install anta[cli]
|
||||
pip install anta[cli]
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation is published on [ANTA package website](https://www.anta.ninja). Also, a [demo repository](https://github.com/titom73/atd-anta-demo) is available to facilitate your journey with ANTA.
|
||||
The documentation is published on [ANTA package website](https://anta.arista.com).
|
||||
|
||||
## Contribution guide
|
||||
|
||||
|
|
|
@ -334,10 +334,10 @@ For that, you need to create your own Python package as described in this [hitch
|
|||
|
||||
It is very similar to what is documented in [catalog section](../usage-inventory-catalog.md) but you have to use your own package name.2
|
||||
|
||||
Let say the custom Python package is `anta_titom73` and the test is defined in `anta_titom73.dc_project` Python module, the test catalog would look like:
|
||||
Let say the custom Python package is `anta_custom` and the test is defined in `anta_custom.dc_project` Python module, the test catalog would look like:
|
||||
|
||||
```yaml
|
||||
anta_titom73.dc_project:
|
||||
anta_custom.dc_project:
|
||||
- VerifyFeatureX:
|
||||
minimum: 1
|
||||
```
|
||||
|
|
|
@ -8,21 +8,32 @@
|
|||
|
||||
In large setups, it might be beneficial to construct your inventory based on CloudVision. The `from-cvp` entrypoint of the `get` command enables the user to create an ANTA inventory from CloudVision.
|
||||
|
||||
!!! info
|
||||
The current implementation only works with on-premises CloudVision instances, not with CloudVision as a Service (CVaaS).
|
||||
|
||||
### Command overview
|
||||
|
||||
```bash
|
||||
anta get from-cvp --help
|
||||
Usage: anta get from-cvp [OPTIONS]
|
||||
|
||||
Build ANTA inventory from Cloudvision
|
||||
Build ANTA inventory from CloudVision.
|
||||
|
||||
NOTE: Only username/password authentication is supported for on-premises CloudVision instances.
|
||||
Token authentication for both on-premises and CloudVision as a Service (CVaaS) is not supported.
|
||||
|
||||
Options:
|
||||
-ip, --cvp-ip TEXT CVP IP Address [required]
|
||||
-u, --cvp-username TEXT CVP Username [required]
|
||||
-p, --cvp-password TEXT CVP Password / token [required]
|
||||
-c, --cvp-container TEXT Container where devices are configured
|
||||
-d, --inventory-directory PATH Path to save inventory file
|
||||
--help Show this message and exit.
|
||||
-o, --output FILE Path to save inventory file [env var: ANTA_INVENTORY;
|
||||
required]
|
||||
--overwrite Do not prompt when overriding current inventory [env
|
||||
var: ANTA_GET_FROM_CVP_OVERWRITE]
|
||||
-host, --host TEXT CloudVision instance FQDN or IP [required]
|
||||
-u, --username TEXT CloudVision username [required]
|
||||
-p, --password TEXT CloudVision password [required]
|
||||
-c, --container TEXT CloudVision container where devices are configured
|
||||
--ignore-cert By default connection to CV will use HTTPS
|
||||
certificate, set this flag to disable it [env var:
|
||||
ANTA_GET_FROM_CVP_IGNORE_CERT]
|
||||
--help Show this message and exit.
|
||||
```
|
||||
|
||||
The output is an inventory where the name of the container is added as a tag for each host:
|
||||
|
|
|
@ -67,7 +67,7 @@ Options:
|
|||
```bash
|
||||
anta nrfu --device DC1-LEAF1A text
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-text-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
## Performing NRFU with table rendering
|
||||
|
||||
|
@ -92,31 +92,31 @@ The `--group-by` option show a summarized view of the test results per host or p
|
|||
```bash
|
||||
anta nrfu --tags LEAF table
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-table-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
For larger setups, you can also group the results by host or test to get a summarized view:
|
||||
|
||||
```bash
|
||||
anta nrfu table --group-by device
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-table-group-by-host-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
```bash
|
||||
anta nrfu table --group-by test
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-table-group-by-test-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
To get more specific information, it is possible to filter on a single device or a single test:
|
||||
|
||||
```bash
|
||||
anta nrfu --device spine1 table
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-table-filter-host-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
```bash
|
||||
anta nrfu --test VerifyZeroTouch table
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-table-filter-test-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
## Performing NRFU with JSON rendering
|
||||
|
||||
|
@ -143,7 +143,7 @@ The `--output` option allows you to save the JSON report as a file.
|
|||
```bash
|
||||
anta nrfu --tags LEAF json
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-json-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
## Performing NRFU with custom reports
|
||||
|
||||
|
@ -173,7 +173,7 @@ The `--output` option allows you to choose the path where the final report will
|
|||
```bash
|
||||
anta nrfu --tags LEAF tpl-report --template ./custom_template.j2
|
||||
```
|
||||
[{ loading=lazy width="1600" }](../imgs/anta-nrfu-tpl-report-output.png)
|
||||
{ loading=lazy width="1600" }
|
||||
|
||||
The template `./custom_template.j2` is a simple Jinja2 template:
|
||||
|
||||
|
@ -205,4 +205,4 @@ cat nrfu-tpl-report.txt
|
|||
|
||||
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.
|
||||
|
||||
[{ loading=lazy width="1600" }](../imgs/anta_nrfu___dry_run.svg)
|
||||
{ loading=lazy width="1600" }
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
# How to contribute to ANTA
|
||||
|
||||
Contribution model is based on a fork-model. Don't push to arista-netdevops-community/anta directly. Always do a branch in your forked repository and create a PR.
|
||||
Contribution model is based on a fork-model. Don't push to aristanetworks/anta directly. Always do a branch in your forked repository and create a PR.
|
||||
|
||||
To help development, open your PR as soon as possible even in draft mode. It helps other to know on what you are working on and avoid duplicate PRs.
|
||||
|
||||
|
@ -16,7 +16,7 @@ Run the following commands to create an ANTA development environment:
|
|||
|
||||
```bash
|
||||
# Clone repository
|
||||
$ git clone https://github.com/arista-netdevops-community/anta.git
|
||||
$ git clone https://github.com/aristanetworks/anta.git
|
||||
$ cd anta
|
||||
|
||||
# Install ANTA in editable mode and its development tools
|
||||
|
@ -28,7 +28,7 @@ $ pip install -e .[dev,cli]
|
|||
$ pip list -e
|
||||
Package Version Editable project location
|
||||
------- ------- -------------------------
|
||||
anta 0.15.0 /mnt/lab/projects/anta
|
||||
anta 1.0.0 /mnt/lab/projects/anta
|
||||
```
|
||||
|
||||
Then, [`tox`](https://tox.wiki/) is configured with few environments to run CI locally:
|
||||
|
@ -229,4 +229,4 @@ muffet -c 2 --color=always http://127.0.0.1:8000 -e fonts.gstatic.com -b 8192
|
|||
|
||||
## Continuous Integration
|
||||
|
||||
GitHub actions is used to test git pushes and pull requests. The workflows are defined in this [directory](https://github.com/arista-netdevops-community/anta/tree/main/.github/workflows). We can view the results [here](https://github.com/arista-netdevops-community/anta/actions).
|
||||
GitHub actions is used to test git pushes and pull requests. The workflows are defined in this [directory](https://github.com/aristanetworks/anta/tree/main/.github/workflows). We can view the results [here](https://github.com/aristanetworks/anta/actions).
|
||||
|
|
|
@ -126,4 +126,4 @@ toc_depth: 2
|
|||
|
||||
# Still facing issues?
|
||||
|
||||
If you've tried the above solutions and continue to experience problems, please follow the [troubleshooting](troubleshooting.md) instructions and report the issue in our [GitHub repository](https://github.com/arista-netdevops-community/anta).
|
||||
If you've tried the above solutions and continue to experience problems, please follow the [troubleshooting](troubleshooting.md) instructions and report the issue in our [GitHub repository](https://github.com/aristanetworks/anta).
|
||||
|
|
|
@ -121,12 +121,6 @@ anta.tests.configuration:
|
|||
|
||||
## Test your network
|
||||
|
||||
### Basic usage in a python script
|
||||
|
||||
```python
|
||||
--8<-- "anta_runner.py"
|
||||
```
|
||||
|
||||
### CLI
|
||||
|
||||
ANTA comes with a generic CLI entrypoint to run tests in your network. It requires an inventory file as well as a test catalog.
|
||||
|
@ -264,3 +258,9 @@ $ anta nrfu \
|
|||
```
|
||||
|
||||
You can find more information under the __usage__ section of the website
|
||||
|
||||
### Basic usage in a Python script
|
||||
|
||||
```python
|
||||
--8<-- "anta_runner.py"
|
||||
```
|
||||
|
|
|
@ -15,3 +15,7 @@
|
|||
</script>
|
||||
{{app}}
|
||||
{% endblock %}
|
||||
|
||||
{% block announce %}
|
||||
ANTA code has moved to a new house in aristanetworks organization and so has the documentation. <strong>Please update your bookmark to use <a href="https://anta.arista.com">anta.arista.com<a/></strong>
|
||||
{% endblock %}
|
||||
|
|
|
@ -19,7 +19,7 @@ Python 3.11.8
|
|||
|
||||
This installation will deploy tests collection, scripts and all their Python requirements.
|
||||
|
||||
The ANTA package and the cli require some packages that are not part of the Python standard library. They are indicated in the [pyproject.toml](https://github.com/arista-netdevops-community/anta/blob/main/pyproject.toml) file, under dependencies.
|
||||
The ANTA package and the cli require some packages that are not part of the Python standard library. They are indicated in the [pyproject.toml](https://github.com/aristanetworks/anta/blob/main/pyproject.toml) file, under dependencies.
|
||||
|
||||
|
||||
### Install library from Pypi server
|
||||
|
@ -59,18 +59,18 @@ pip install anta[cli]
|
|||
|
||||
|
||||
```bash
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git#egg=anta[cli]
|
||||
pip install git+https://github.com/aristanetworks/anta.git
|
||||
pip install git+https://github.com/aristanetworks/anta.git#egg=anta[cli]
|
||||
|
||||
# You can even specify the branch, tag or commit:
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<cool-feature-branch>
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<cool-feature-branch>#egg=anta[cli]
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<cool-feature-branch>
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<cool-feature-branch>#egg=anta[cli]
|
||||
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<cool-tag>
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<cool-tag>#egg=anta[cli]
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<cool-tag>
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<cool-tag>#egg=anta[cli]
|
||||
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<more-or-less-cool-hash>
|
||||
pip install git+https://github.com/arista-netdevops-community/anta.git@<more-or-less-cool-hash>#egg=anta[cli]
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<more-or-less-cool-hash>
|
||||
pip install git+https://github.com/aristanetworks/anta.git@<more-or-less-cool-hash>#egg=anta[cli]
|
||||
```
|
||||
|
||||
### Check installation
|
||||
|
@ -93,7 +93,7 @@ which anta
|
|||
```bash
|
||||
# Check ANTA version
|
||||
anta --version
|
||||
anta, version v0.15.0
|
||||
anta, version v1.0.0
|
||||
```
|
||||
|
||||
## EOS Requirements
|
||||
|
|
|
@ -56,7 +56,8 @@ if __name__ == "__main__":
|
|||
# stolen from https://github.com/ewels/rich-click/blob/main/src/rich_click/cli.py
|
||||
args = sys.argv[1:]
|
||||
script_name = args[0]
|
||||
scripts = {script.name: script for script in entry_points().get("console_scripts")}
|
||||
console_scripts = entry_points(group="console_scripts")
|
||||
scripts = {script.name: script for script in console_scripts}
|
||||
|
||||
if script_name in scripts:
|
||||
# A VALID SCRIPT WAS passed
|
||||
|
|
|
@ -61,6 +61,12 @@
|
|||
--md-code-border-color: #aec6db4f;
|
||||
}
|
||||
|
||||
.md-banner {
|
||||
background-color: #f5c842;
|
||||
color: #000000;
|
||||
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 76.25em) {
|
||||
.md-main__inner, .md-header__inner {
|
||||
max-width: 85%;
|
||||
|
@ -128,12 +134,8 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.md-typeset h4::before {
|
||||
content: ">> ";
|
||||
}
|
||||
|
||||
.md-typeset h4 {
|
||||
font-size: 1.1rem;
|
||||
font-size: 0.9rem;
|
||||
margin: 1em 0;
|
||||
font-weight: 700;
|
||||
letter-spacing: -.01em;
|
||||
|
|
|
@ -11,9 +11,9 @@ A couple of things to check when hitting an issue with ANTA:
|
|||
```mermaid
|
||||
flowchart LR
|
||||
A>Hitting an issue with ANTA] --> B{Is my issue <br >listed in the FAQ?}
|
||||
B -- Yes --> C{Does the FAQ solution<<br />works for me?}
|
||||
B -- Yes --> C{Does the FAQ solution<br />works for me?}
|
||||
C -- Yes --> V(((Victory)))
|
||||
B -->|No| E{Is my problem<br />mentioned in one<<br />of the open issues?}
|
||||
B -->|No| E{Is my problem<br />mentioned in one<br />of the open issues?}
|
||||
C -->|No| E
|
||||
E -- Yes --> F{Has the issue been<br />fixed in a newer<br />release or in main?}
|
||||
F -- Yes --> U[Upgrade]
|
||||
|
@ -24,8 +24,8 @@ flowchart LR
|
|||
F -- No ----> G((Add a comment on the <br />issue indicating you<br >are hitting this and<br />describing your setup<br /> and adding your logs.))
|
||||
|
||||
click B "../faq" "FAQ"
|
||||
click E "https://github.com/arista-netdevops-community/anta/issues"
|
||||
click H "https://github.com/arista-netdevops-community/anta/issues"
|
||||
click E "https://github.com/aristanetworks/anta/issues"
|
||||
click H "https://github.com/aristanetworks/anta/issues"
|
||||
style A stroke:#f00,stroke-width:2px
|
||||
```
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ anta.tests:
|
|||
custom_field: "Test run by John Doe"
|
||||
```
|
||||
|
||||
[This test catalog example](https://github.com/arista-netdevops-community/anta/blob/main/examples/tests.yaml) is maintained with all the tests defined in the `anta.tests` Python module.
|
||||
[This test catalog example](https://github.com/aristanetworks/anta/blob/main/examples/tests.yaml) is maintained with all the tests defined in the `anta.tests` Python module.
|
||||
|
||||
### Test tags
|
||||
|
||||
|
@ -205,10 +205,10 @@ anta.tests.configuration:
|
|||
### Catalog with custom tests
|
||||
|
||||
In case you want to leverage your own tests collection, use your own Python package in the test catalog.
|
||||
So for instance, if my custom tests are defined in the `titom73.tests.system` Python module, the test catalog will be:
|
||||
So for instance, if my custom tests are defined in the `custom.tests.system` Python module, the test catalog will be:
|
||||
|
||||
```yaml
|
||||
titom73.tests.system:
|
||||
custom.tests.system:
|
||||
- VerifyPlatform:
|
||||
type: ['cEOS-LAB']
|
||||
```
|
||||
|
@ -269,7 +269,7 @@ if __name__ == "__main__":
|
|||
# Apply filters to all tests for this device
|
||||
for test in c.tests:
|
||||
test.inputs.filters = AntaTest.Input.Filters(tags=[device])
|
||||
catalog.merge(c)
|
||||
catalog = catalog.merge(c)
|
||||
with open(Path('anta-catalog.yml'), "w") as f:
|
||||
f.write(catalog.dump().yaml())
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue