Skip to content

Commit

Permalink
Merge branch 'devel' into unique-id-regions-and-sites
Browse files Browse the repository at this point in the history
  • Loading branch information
ClausHolbechArista authored Jun 19, 2024
2 parents 80d0ed5 + 35ef6cd commit f424757
Show file tree
Hide file tree
Showing 384 changed files with 782 additions and 164 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/pull-request-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

env:
# Set -vvv is ACTIONS_STEP_DEBUG is set
# Apparently it is set in secrets when running with debug
ANSIBLE_VERBOSITY: ${{ secrets.ACTIONS_STEP_DEBUG && 3 || 0 }}

jobs:
file-changes:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -467,11 +472,14 @@ jobs:
pyavd:
name: Test pyavd
runs-on: ubuntu-latest
needs: [ file-changes ]
needs: [file-changes]
if: |
needs.file-changes.outputs.eos_design == 'true' ||
needs.file-changes.outputs.config_gen == 'true' ||
needs.file-changes.outputs.pyavd == 'true'
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: 'Set environment variables'
run: |
Expand All @@ -480,15 +488,11 @@ jobs:
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.9
3.10
3.11
3.12
python-version: ${{ matrix.python }}
- name: 'Install tox'
run: |
pip install tox --upgrade
- name: 'Run tox'
pip install tox tox-gh-actions --upgrade
- name: "Run pytest via tox for ${{ matrix.python }}"
working-directory: python-avd
run: |
tox
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@ repos:
pass_filenames: false
additional_dependencies: ['deepmerge>=1.1.0', 'PyYAML>=6.0.0', 'pydantic>=2.3.0', 'jsonschema>=4.10.3', 'referencing>=0.35.0']

- id: compile-templates
name: Precompile eos_cli_config_gen Jinja2
# Workaround because pyavd.vendor is still needed for now - this also rebuilds the schemas so it is a bit wasteful
entry: sh -c 'cd python-avd; make dep'
# entry: sh -c 'python-avd/scripts/compile_templates.py'
language: python
files: python-avd/pyavd/_eos_cli_config_gen/j2templates/
pass_filenames: false
additional_dependencies: ['Jinja2>=3.0.0', 'deepmerge>=1.1.0', 'PyYAML>=6.0.0', 'pydantic>=2.3.0', 'jsonschema>=4.10.3', 'referencing>=0.35.0']
# additional_dependencies: ['Jinja2>=3.0.0']

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.41.0
hooks:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
# This title is used for search results
title: arista.avd.eos_cli_config_gen
---
<!--
~ Copyright (c) 2023-2024 Arista Networks, Inc.
~ Use of this source code is governed by the Apache License 2.0
~ that can be found in the LICENSE file.
-->

# eos_cli_config_gen

!!! note
Always use the FQCN (Fully Qualified Collection Name) `arista.avd.eos_cli_config_gen` when using this plugin.

Generate AVD EOS device configurations and documentations

## Synopsis

The `arista.avd.eos_cli_config_gen` module is an Ansible Action Plugin providing the following capabilities:

- Validates input variables according to eos_cli_config_gen schema
- Generates device configuration and saves it to file
- Optionallu generates device documentation and saves it to file

## Parameters

| Argument | Type | Required | Default | Value Restrictions | Description |
| -------- | ---- | -------- | ------- | ------------------ | ----------- |
| <samp>structured_config_filename</samp> | str | True | None | | The path of the structured config to load if read_structured_config_from_file is true. |
| <samp>config_filename</samp> | str | True | None | | The path to save the generated config to. |
| <samp>documentation_filename</samp> | str | True | None | | The path to save the generated documentation to if generate_device_doc is true. |
| <samp>read_structured_config_from_file</samp> | bool | optional | True | | Flag to indicate if the structured config should be read from a file or not. |
| <samp>generate_device_doc</samp> | bool | optional | True | | Flag to generate the device documentation. |
| <samp>device_doc_toc</samp> | bool | optional | True | | Flag to generate the table of content for the device documentation. |
| <samp>conversion_mode</samp> | str | False | debug | Valid values:<br>- <code>error</code><br>- <code>warning</code><br>- <code>info</code><br>- <code>debug</code><br>- <code>quiet</code><br>- <code>disabled</code> | Run data conversion in either &#34;error&#34;, &#34;warning&#34;, &#34;info&#34;, &#34;debug&#34;, &#34;quiet&#34; or &#34;disabled&#34; mode.<br>Conversion will perform type conversion of input variables as defined in the schema.<br>Conversion is intended to help the user to identify minor issues with the input data, while still allowing the data to be validated.<br>During conversion, messages will be generated with information about the host(s) and key(s) which required conversion.<br>conversion_mode:disabled means that conversion will not run.<br>conversion_mode:error will produce error messages and fail the task.<br>conversion_mode:warning will produce warning messages.<br>conversion_mode:info will produce regular log messages.<br>conversion_mode:debug will produce hidden messages viewable with -v.<br>conversion_mode:quiet will not produce any messages. |
| <samp>validation_mode</samp> | str | False | warning | Valid values:<br>- <code>error</code><br>- <code>warning</code><br>- <code>info</code><br>- <code>debug</code><br>- <code>disabled</code> | Run validation in either &#34;error&#34;, &#34;warning&#34;, &#34;info&#34;, &#34;debug&#34; or &#34;disabled&#34; mode.<br>Validation will validate the input variables according to the schema.<br>During validation, messages will be generated with information about the host(s) and key(s) which failed validation.<br>validation_mode:disabled means that validation will not run.<br>validation_mode:error will produce error messages and fail the task.<br>validation_mode:warning will produce warning messages.<br>validation_mode:info will produce regular log messages.<br>validation_mode:debug will produce hidden messages viewable with -v. |
| <samp>cprofile_file</samp> | str | False | None | | Filename for storing cprofile data used to debug performance issues.<br>Running cprofile will slow down performance in it self, so only set this while troubleshooting. |

## Examples

```yaml
---
- name: Generate eos intended configuration and device documentation
arista.avd.eos_cli_config_gen:
structured_config_filename: "{{ structured_config_filename }}"
config_filename: "{{ eos_config_dir }}/{{ inventory_hostname }}.cfg"
documentation_filename: "{{ devices_dir }}/{{ inventory_hostname }}.md"
read_structured_config_from_file: true
delegate_to: localhost
vars:
structured_config_filename: "{{ structured_dir }}/{{ inventory_hostname }}.{{ avd_structured_config_file_format }}"
- name: Generate device documentation only
arista.avd.eos_cli_config_gen:
structured_config_filename: "{{ structured_config_filename }}"
config_filename: "{{ eos_config_dir }}/{{ inventory_hostname }}.cfg"
documentation_filename: "{{ devices_dir }}/{{ inventory_hostname }}.md"
read_structured_config_from_file: true
generate_device_config: false
device_doc_toc: true
delegate_to: localhost
vars:
structured_config_filename: "{{ structured_dir }}/{{ inventory_hostname }}.{{ avd_structured_config_file_format }}"
```
## Authors
- Arista Ansible Team (@aristanetworks)
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ hardware_counters:
features:
- qos: in

expected_error_message: "The data model 'hardware_counters' changed in AVD4.0.0. 'hardware_counters.features.name' was expected but not set!"
expected_error_message: "The data model 'hardware_counters' changed in AVD4.0.0. 'hardware_counters.features.name' was expected but not set."
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ router_bfd:
session_snapshot_interval: 6
session_snapshot_interval_dangerous: false

expected_error_message: "router_bfd.session_snapshot_interval_dangerous was set to False but we expected True!"
expected_error_message: "Error during plugin execution: router_bfd.session_snapshot_interval_dangerous was set to False but we expected True!"
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
router_bfd:
session_snapshot_interval: 3

expected_error_message: "router_bfd.session_snapshot_interval_dangerous was expected but not set!"
expected_error_message: "Error during plugin execution: router_bfd.session_snapshot_interval_dangerous was expected but not set!"

This file was deleted.

Loading

0 comments on commit f424757

Please sign in to comment.