diff --git a/.github/workflows/pull-request-management.yml b/.github/workflows/pull-request-management.yml index 3eb75b30b..49628c1e0 100644 --- a/.github/workflows/pull-request-management.yml +++ b/.github/workflows/pull-request-management.yml @@ -138,7 +138,7 @@ jobs: - name: 'Execute pytest validation' run: | cd tests/ - make test + make unit-tests - uses: actions/upload-artifact@v2 with: name: pytest-report @@ -270,3 +270,26 @@ jobs: run: | cd ansible_collections/arista/cvp/ ansible-test sanity -v --requirements --docker --python ${{ matrix.python_version }} + + ansible_lint: + name: Run ansible-lint test case + runs-on: ubuntu-latest + needs: [ file-changes ] + steps: + - name: 'Set environment variables' + run: | + echo "PY_COLORS=1" >> $GITHUB_ENV + - uses: actions/checkout@v4 + - name: Set up Python 3 + uses: actions/setup-python@v5 + with: + python-version: | + 3.10 + - name: 'Install Python & Ansible requirements' + run: | + pip install -r ansible_collections/arista/cvp/requirements.txt -r ansible_collections/arista/cvp/requirements-dev.txt --upgrade + ansible-galaxy collection install -r ansible_collections/arista/cvp/collections.yml + - name: 'Run ansible-test integration test cases' + run: | + cd ansible_collections/arista/cvp/ + ansible-lint --force-color --strict -v diff --git a/.github/yamllintrc b/.github/yamllintrc index 556f8afc1..a8c0d80c0 100644 --- a/.github/yamllintrc +++ b/.github/yamllintrc @@ -24,7 +24,7 @@ rules: level: warning indent-sequences: consistent line-length: - max: 140 + max: 350 level: warning allow-non-breakable-inline-mappings: true truthy: disable diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c79757e45..d960d26b5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,14 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.4.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-added-large-files - id: check-merge-conflict - repo: https://github.com/Lucas-C/pre-commit-hooks - rev: v1.5.4 + rev: v1.5.5 hooks: - name: Check and insert license on Python files id: insert-license @@ -62,7 +62,7 @@ repos: - '' - repo: https://github.com/pycqa/pylint - rev: "v2.16.1" + rev: "v3.1.1" hooks: - id: pylint # Use pylintrc file in repository name: Check for Linting errors on Python files @@ -73,7 +73,7 @@ repos: - -d duplicate-code - repo: https://github.com/adrienverge/yamllint.git - rev: 'v1.23.0' + rev: 'v1.35.1' hooks: - id: yamllint name: Check for Linting error on YAML files @@ -83,16 +83,8 @@ repos: types: [file, yaml] args: [-c=.github/yamllintrc] - - repo: https://github.com/ansible/ansible-lint.git - rev: v4.2.0 - hooks: - - id: ansible-lint - name: Check for ansible-lint errors - files: \.(yaml|yml)$ - exclude: ansible_collections/arista/cvp/docs - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.32.1 + rev: v0.41.0 hooks: - id: markdownlint args: diff --git a/README.md b/README.md index d5202a8a3..ddfabba57 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/.ansible-lint b/ansible_collections/arista/cvp/.ansible-lint new file mode 100644 index 000000000..36bf8a6e1 --- /dev/null +++ b/ansible_collections/arista/cvp/.ansible-lint @@ -0,0 +1,14 @@ +--- +profile: production + +skip_list: + - name[template] # Remove warnings on task names where Jinja template is not at the end + - run-once[task] # Remove warnings on using run_once with other strategies + - meta-no-info # Ansible-lint does not honor meta-schema with standalone: false + - var-naming[no-role-prefix] + - var-naming[pattern] +# kinds: +# - yaml: "**/molecule/**/inventory/host_vars/roles.yml" +exclude_paths: + - molecule/ + - examples/ diff --git a/ansible_collections/arista/cvp/.yamllint b/ansible_collections/arista/cvp/.yamllint new file mode 100644 index 000000000..882767605 --- /dev/null +++ b/ansible_collections/arista/cvp/.yamllint @@ -0,0 +1,33 @@ +--- +# Based on ansible-lint config +extends: default + +rules: + braces: + max-spaces-inside: 1 + level: error + brackets: + max-spaces-inside: 1 + level: error + colons: + max-spaces-after: -1 + level: error + commas: + max-spaces-after: -1 + level: error + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 3 + level: error + hyphens: + level: error + indentation: disable + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: + type: unix + trailing-spaces: disable + truthy: disable diff --git a/ansible_collections/arista/cvp/README.md b/ansible_collections/arista/cvp/README.md index f7ee50496..745c1da93 100644 --- a/ansible_collections/arista/cvp/README.md +++ b/ansible_collections/arista/cvp/README.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/build-md/doc.py b/ansible_collections/arista/cvp/docs/build-md/doc.py index e9fae74bb..394b26d66 100644 --- a/ansible_collections/arista/cvp/docs/build-md/doc.py +++ b/ansible_collections/arista/cvp/docs/build-md/doc.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. import os diff --git a/ansible_collections/arista/cvp/docs/build-md/templates/md.j2 b/ansible_collections/arista/cvp/docs/build-md/templates/md.j2 index ac10ef23f..f69c3f898 100644 --- a/ansible_collections/arista/cvp/docs/build-md/templates/md.j2 +++ b/ansible_collections/arista/cvp/docs/build-md/templates/md.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/docs/contributing.md b/ansible_collections/arista/cvp/docs/contributing.md index c70ac87c3..a1023344c 100644 --- a/ansible_collections/arista/cvp/docs/contributing.md +++ b/ansible_collections/arista/cvp/docs/contributing.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/faq/containers.md b/ansible_collections/arista/cvp/docs/faq/containers.md index 79d7d3b80..8a92eecc0 100644 --- a/ansible_collections/arista/cvp/docs/faq/containers.md +++ b/ansible_collections/arista/cvp/docs/faq/containers.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/faq/errors.md b/ansible_collections/arista/cvp/docs/faq/errors.md index 67608b1aa..23cdb2d67 100644 --- a/ansible_collections/arista/cvp/docs/faq/errors.md +++ b/ansible_collections/arista/cvp/docs/faq/errors.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/getting-started.md b/ansible_collections/arista/cvp/docs/getting-started.md index 28db51e75..8a7e563b5 100644 --- a/ansible_collections/arista/cvp/docs/getting-started.md +++ b/ansible_collections/arista/cvp/docs/getting-started.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/how-to/cvp-authentication.md b/ansible_collections/arista/cvp/docs/how-to/cvp-authentication.md index 793a0f3df..600301f12 100644 --- a/ansible_collections/arista/cvp/docs/how-to/cvp-authentication.md +++ b/ansible_collections/arista/cvp/docs/how-to/cvp-authentication.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/how-to/debug.md b/ansible_collections/arista/cvp/docs/how-to/debug.md index c3383bbfa..d9344c747 100644 --- a/ansible_collections/arista/cvp/docs/how-to/debug.md +++ b/ansible_collections/arista/cvp/docs/how-to/debug.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/installation/collection-installation.md b/ansible_collections/arista/cvp/docs/installation/collection-installation.md index 9f7756245..6bff2e5fe 100644 --- a/ansible_collections/arista/cvp/docs/installation/collection-installation.md +++ b/ansible_collections/arista/cvp/docs/installation/collection-installation.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/installation/requirements.md b/ansible_collections/arista/cvp/docs/installation/requirements.md index 29ce10b6e..44324ccb0 100644 --- a/ansible_collections/arista/cvp/docs/installation/requirements.md +++ b/ansible_collections/arista/cvp/docs/installation/requirements.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_change_control_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_change_control_v3.md index 026196cf2..5d7078ad9 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_change_control_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_change_control_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_configlet.md b/ansible_collections/arista/cvp/docs/modules/cv_configlet.md index 27a4046c3..c36801b86 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_configlet.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_configlet.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_configlet_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_configlet_v3.md index 5906662a1..228681372 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_configlet_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_configlet_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_container.md b/ansible_collections/arista/cvp/docs/modules/cv_container.md index d4506d3f3..a59edb8ae 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_container.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_container.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_container_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_container_v3.md index 6eefe79bc..61871381d 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_container_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_container_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_device.md b/ansible_collections/arista/cvp/docs/modules/cv_device.md index 207f8a33b..1b26d1665 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_device.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_device.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_device_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_device_v3.md index 2eeae38fa..b0fdc6fc3 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_device_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_device_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_facts.md b/ansible_collections/arista/cvp/docs/modules/cv_facts.md index 44c2f7b6b..d97c6d675 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_facts.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_facts.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_facts_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_facts_v3.md index aa140af24..9060e89c7 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_facts_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_facts_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_image_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_image_v3.md index 7b538076d..db31dc296 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_image_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_image_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_tag_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_tag_v3.md index 46fa0401b..1a2680466 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_tag_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_tag_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_task.md b/ansible_collections/arista/cvp/docs/modules/cv_task.md index 00f69d512..bd2c4339e 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_task.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_task.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_task_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_task_v3.md index 3623c76bf..687222b68 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_task_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_task_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/modules/cv_validate_v3.md b/ansible_collections/arista/cvp/docs/modules/cv_validate_v3.md index 4b2fa7b8b..2c2ebf8a2 100644 --- a/ansible_collections/arista/cvp/docs/modules/cv_validate_v3.md +++ b/ansible_collections/arista/cvp/docs/modules/cv_validate_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/release-notes/v1.x.md b/ansible_collections/arista/cvp/docs/release-notes/v1.x.md index 2ee33dcb8..f7857b38c 100644 --- a/ansible_collections/arista/cvp/docs/release-notes/v1.x.md +++ b/ansible_collections/arista/cvp/docs/release-notes/v1.x.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/release-notes/v2.x.md b/ansible_collections/arista/cvp/docs/release-notes/v2.x.md index 658589752..0ad70b9c6 100644 --- a/ansible_collections/arista/cvp/docs/release-notes/v2.x.md +++ b/ansible_collections/arista/cvp/docs/release-notes/v2.x.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/release-notes/v3.x.md b/ansible_collections/arista/cvp/docs/release-notes/v3.x.md index 7d9f35967..cc353d8d7 100644 --- a/ansible_collections/arista/cvp/docs/release-notes/v3.x.md +++ b/ansible_collections/arista/cvp/docs/release-notes/v3.x.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/schema/cv_change_control_v3.md b/ansible_collections/arista/cvp/docs/schema/cv_change_control_v3.md index 4d3812dc5..089e58525 100644 --- a/ansible_collections/arista/cvp/docs/schema/cv_change_control_v3.md +++ b/ansible_collections/arista/cvp/docs/schema/cv_change_control_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/schema/cv_container_v3.md b/ansible_collections/arista/cvp/docs/schema/cv_container_v3.md index 57c793007..ccdef2fdb 100644 --- a/ansible_collections/arista/cvp/docs/schema/cv_container_v3.md +++ b/ansible_collections/arista/cvp/docs/schema/cv_container_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/schema/cv_device_v3.md b/ansible_collections/arista/cvp/docs/schema/cv_device_v3.md index bfdc10ff9..b608d1b25 100644 --- a/ansible_collections/arista/cvp/docs/schema/cv_device_v3.md +++ b/ansible_collections/arista/cvp/docs/schema/cv_device_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/schema/cv_tag_v3.md b/ansible_collections/arista/cvp/docs/schema/cv_tag_v3.md index 20d16ac8d..ac2af0435 100644 --- a/ansible_collections/arista/cvp/docs/schema/cv_tag_v3.md +++ b/ansible_collections/arista/cvp/docs/schema/cv_tag_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/docs/schema/cv_validate_v3.md b/ansible_collections/arista/cvp/docs/schema/cv_validate_v3.md index 9fa9569f8..90d160b6b 100644 --- a/ansible_collections/arista/cvp/docs/schema/cv_validate_v3.md +++ b/ansible_collections/arista/cvp/docs/schema/cv_validate_v3.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_and_execute.yml b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_and_execute.yml index 88bd6a65f..3a43f17b1 100644 --- a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_and_execute.yml +++ b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_and_execute.yml @@ -34,13 +34,13 @@ parent: Leaf Upgrades tasks: - - name: "Create a change control on {{inventory_hostname}}" + - name: "Create a change control on {{ inventory_hostname }}" arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Approve and Execute a change control on {{inventory_hostname}} using change_id field" + - name: "Approve and Execute a change control using change_id field on {{ inventory_hostname }}" arista.cvp.cv_change_control_v3: state: approve_and_execute change_id: ["{{ cv_change_control_test.data.id }}"] diff --git a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_execute.yml b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_execute.yml index e1d71956e..b9217a226 100644 --- a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_execute.yml +++ b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_approve_execute.yml @@ -18,18 +18,18 @@ mode: parallel tasks: - - name: "Create a change control on {{inventory_hostname}}" + - name: "Create a change control on {{ inventory_hostname }}" arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Approve a change control on {{inventory_hostname}} using change_id field" + - name: "Approve a change control using change_id field on {{ inventory_hostname }}" arista.cvp.cv_change_control_v3: state: approve change_id: ["{{ cv_change_control_test.data.id }}"] - - name: "Execute a change control on {{inventory_hostname}} using change_id field" + - name: "Execute a change control using change_id field on {{ inventory_hostname }} " arista.cvp.cv_change_control_v3: state: execute change_id: ["{{ cv_change_control_test.data.id }}"] diff --git a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_mlag_device_upgrades_with_healthchecks.yml b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_mlag_device_upgrades_with_healthchecks.yml index cb4fd7e00..590186eeb 100644 --- a/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_mlag_device_upgrades_with_healthchecks.yml +++ b/ansible_collections/arista/cvp/examples/cv_change_control_v3/change_control_v3_create_mlag_device_upgrades_with_healthchecks.yml @@ -1,39 +1,36 @@ --- - name: Create Compute and Storage Leaf Upgrade Change Control hosts: cv_server - gather_facts: no + gather_facts: false tasks: - - name: "Gather CVP facts {{inventory_hostname}}" + - name: Gather CVP facts {{ inventory_hostname }} arista.cvp.cv_facts: - facts: - tasks + facts: tasks register: cv_facts -# -# This playbook assumes that we want to filter the tasks to those with "leaf" or "storage" in their name -# The device naming schema also splits them into a/b MLAG pairs e.g. leaf-01a and leaf-01b -# - - name: "Get filtered tasks from {{inventory_hostname}}" - set_fact: - task_list: "{{ task_list|default([]) + [ item.workOrderId ] }}" - device_names: "{{ device_names|default([]) + [ item.workOrderDetails.netElementHostName ]}}" + # + # This playbook assumes that we want to filter the tasks to those with "leaf" or "storage" in their name + # The device naming schema also splits them into a/b MLAG pairs e.g. leaf-01a and leaf-01b + # + - name: Get filtered tasks from {{ inventory_hostname }} + ansible.builtin.set_fact: + task_list: "{{ task_list | default([]) + [item.workOrderId] }}" + device_names: "{{ device_names | default([]) + [item.workOrderDetails.netElementHostName] }}" when: - - item.workOrderDetails.netElementHostName.find("leaf") != -1 or - item.workOrderDetails.netElementHostName.find("storage") != -1 + - item.workOrderDetails.netElementHostName.find("leaf") != -1 or item.workOrderDetails.netElementHostName.find("storage") != -1 - item.data.WORKFLOW_ACTION == "Image Push" - item.taskStatus == "ACTIVE" - loop: "{{cv_facts.ansible_facts.tasks}}" - + loop: "{{ cv_facts.ansible_facts.tasks }}" - - name: "Show tasks to be used in CC" - debug: - var=task_list + - name: Show tasks to be used in CC + ansible.builtin.debug: + var: task_list - - name: "Devices in change scope" - debug: - var=device_names + - name: Devices in change scope + ansible.builtin.debug: + var: device_names - - name: "Get device info" + - name: Get device info arista.cvp.cv_facts_v3: facts: - devices @@ -41,102 +38,101 @@ register: device_facts loop: "{{ device_names }}" + - name: Extracting device serial numbers + ansible.builtin.set_fact: + device_serial: "{{ device_serial | default([]) + [item.data.cvp_devices[0].serialNumber] }}" + loop: "{{ device_facts.results }}" - - name: "Extracting device serial numbers" - set_fact: - device_serial: "{{ device_serial|default([]) + [ item.data.cvp_devices[0].serialNumber ]}}" - loop: "{{ device_facts.results}}" - - - name: "Collected serial number" - debug: - var=device_serial + - name: Collected serial number + ansible.builtin.debug: + var: device_serial - - name: "Adding pre-checks stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'Pre-Checks','mode':'parallel'} ] }}" + - name: Adding pre-checks stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'Pre-Checks', 'mode': 'parallel'}] }}" - - name: "Add upgrade parent stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'Upgrades','mode':'series'} ] }}" + - name: Add upgrade parent stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'Upgrades', 'mode': 'series'}] }}" -# This stage uses a CVP Custom Action whose ActionID == Action Name, which in this case is "Switch Healthcheck" - - name: "Creating pre-upgrade health checks" - set_fact: - task_register: "{{ task_register|default([]) + [ { 'action': 'Switch Healthcheck', 'name': device_names[action_index].split('.')[0] + '_precheck', 'arguments': [ { 'name':'DeviceID', 'value':device_serial[action_index] } ], 'stage':'Pre-Checks' } ] }}" + # This stage uses a CVP Custom Action whose ActionID == Action Name, which in this case is "Switch Healthcheck" + - name: Creating pre-upgrade health checks + ansible.builtin.set_fact: + task_register: "{{ task_register | default([]) + [{'action': 'Switch Healthcheck', 'name': device_names[action_index].split('.')[0] + '_precheck', 'arguments': + [{'name': 'DeviceID', 'value': device_serial[action_index]}], 'stage': 'Pre-Checks'}] }}" loop_control: index_var: action_index - loop: "{{task_list}}" + loop: "{{ task_list }}" - - name: "Creating B Leaf Upgrade Stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'B-Leaf Upgrade','mode':'parallel','parent':'Upgrades'} ] }}" + - name: Creating B Leaf Upgrade Stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'B-Leaf Upgrade', 'mode': 'parallel', 'parent': 'Upgrades'}] }}" - - name: "Creating upgrades for B compute leafs" - set_fact: - task_register: "{{ task_register|default([]) + [ { 'task_id': task_list[action_index], 'stage':'B-Leaf Upgrade'} ] }}" + - name: Creating upgrades for B compute leafs + ansible.builtin.set_fact: + task_register: "{{ task_register | default([]) + [{'task_id': task_list[action_index], 'stage': 'B-Leaf Upgrade'}] }}" when: - item.endswith("b") - loop: "{{device_names}}" + loop: "{{ device_names }}" loop_control: index_var: action_index - - name: "Creating B Leaf Post-Upgrade Check Stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'B-Leaf Post Checks','mode':'parallel','parent':'Upgrades'} ] }}" + - name: Creating B Leaf Post-Upgrade Check Stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'B-Leaf Post Checks', 'mode': 'parallel', 'parent': 'Upgrades'}] }}" - - name: "Creating B Leaf post-upgrade health checks" - set_fact: - task_register: "{{ task_register|default([]) + [ { 'action': 'Switch Healthcheck', 'name': item.split('.')[0] + '_precheck', 'arguments': [ { 'name':'DeviceID', 'value':device_serial[action_index] } ], 'stage':'B-Leaf Post Checks' } ] }}" + - name: Creating B Leaf post-upgrade health checks + ansible.builtin.set_fact: + task_register: "{{ task_register | default([]) + [{'action': 'Switch Healthcheck', 'name': item.split('.')[0] + '_precheck', 'arguments': [{'name': 'DeviceID', + 'value': device_serial[action_index]}], 'stage': 'B-Leaf Post Checks'}] }}" when: - item.endswith("b") loop_control: index_var: action_index - loop: "{{device_names}}" - + loop: "{{ device_names }}" - - name: "Creating A Leaf Upgrade Stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'A-Leaf Upgrade','mode':'parallel','parent':'Upgrades'} ] }}" + - name: Creating A Leaf Upgrade Stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'A-Leaf Upgrade', 'mode': 'parallel', 'parent': 'Upgrades'}] }}" - - name: "Creating upgrades for A compute leafs" - set_fact: - task_register: "{{ task_register|default([]) + [ { 'task_id': task_list[action_index], 'stage':'A-Leaf Upgrade'} ] }}" + - name: Creating upgrades for A compute leafs + ansible.builtin.set_fact: + task_register: "{{ task_register | default([]) + [{'task_id': task_list[action_index], 'stage': 'A-Leaf Upgrade'}] }}" when: - item.endswith("a") - loop: "{{device_names}}" + loop: "{{ device_names }}" loop_control: index_var: action_index - - name: "Creating A Leaf Post-Upgrade Check Stage" - set_fact: - stage_register: "{{ stage_register|default([]) + [ {'name':'A-Leaf Post Checks','mode':'parallel','parent':'Upgrades'} ] }}" - + - name: Creating A Leaf Post-Upgrade Check Stage + ansible.builtin.set_fact: + stage_register: "{{ stage_register | default([]) + [{'name': 'A-Leaf Post Checks', 'mode': 'parallel', 'parent': 'Upgrades'}] }}" - - name: "Creating A Leaf post-upgrade health checks" - set_fact: - task_register: "{{ task_register|default([]) + [ { 'action': 'Switch Healthcheck', 'name': item.split('.')[0] + '_precheck', 'arguments': [ { 'name':'DeviceID', 'value':device_serial[action_index] } ], 'stage':'A-Leaf Post Checks' } ] }}" + - name: Creating A Leaf post-upgrade health checks + ansible.builtin.set_fact: + task_register: "{{ task_register | default([]) + [{'action': 'Switch Healthcheck', 'name': item.split('.')[0] + '_precheck', 'arguments': [{'name': 'DeviceID', + 'value': device_serial[action_index]}], 'stage': 'A-Leaf Post Checks'}] }}" when: - item.endswith("a") loop_control: index_var: action_index - loop: "{{device_names}}" - - - - name: "Finalising change control" - set_fact: - change: "{{ change | default( {'name': 'Compute Leaf Upgrade','notes':'generated by ansible-cvp', 'activities': task_register, 'stages': stage_register } ) }}" + loop: "{{ device_names }}" - - name: "Change control ready" - debug: - var=change + - name: Finalising change control + ansible.builtin.set_fact: + change: "{{ change | default({'name': 'Compute Leaf Upgrade', 'notes': 'generated by ansible-cvp', 'activities': task_register, 'stages': stage_register}) + }}" + - name: Change control ready + ansible.builtin.debug: + var: change - - name: "Creating change control on {{inventory_hostname}}" + - name: Creating change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set - change: "{{change}}" + change: "{{ change }}" register: cv_change - name: "Change created with change id:" - debug: + ansible.builtin.debug: msg: "{{ cv_change }}" diff --git a/ansible_collections/arista/cvp/galaxy.yml b/ansible_collections/arista/cvp/galaxy.yml index 601cd44f4..630cfac7d 100644 --- a/ansible_collections/arista/cvp/galaxy.yml +++ b/ansible_collections/arista/cvp/galaxy.yml @@ -1,3 +1,4 @@ +--- # The namespace of the collection. This can be a company/brand/organization or product namespace under which all # content lives. May only contain alphanumeric characters and underscores. Additionally namespaces cannot start with # underscores or numbers and cannot contain consecutive underscores @@ -15,7 +16,7 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Ansible Arista Team (@aristanetworks) + - Ansible Arista Team (@aristanetworks) ### OPTIONAL but strongly recommended @@ -29,18 +30,16 @@ description: Ansible Modules for CloudVision Platform (CVP) # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' -license_file: 'LICENSE' +license_file: LICENSE # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' -tags: ['arista', 'network', 'networking', 'cloudvision', 'cvp'] - +tags: [arista, network, networking, cloudvision, cvp] # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' dependencies: {} - # The URL of the originating SCM repository repository: https://github.com/aristanetworks/ansible-cvp diff --git a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_create_approve_execute_cc.yml b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_create_approve_execute_cc.yml index 67957006b..d58c6f381 100644 --- a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_create_approve_execute_cc.yml +++ b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_create_approve_execute_cc.yml @@ -2,13 +2,13 @@ - name: Test cv_change_control_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: change: name: s1-leaf1A Change Control notes: Initiated from Ansible Playbook activities: - - action: "mlaghealthcheck" + - action: mlaghealthcheck name: Check_LEAF1A_MLAG_Health arguments: - name: DeviceID @@ -19,118 +19,118 @@ mode: parallel tasks: -###################################### -## CREATE,APPROVE AND EXECUTE ## -###################################### - - name: "Create a change control on {{inventory_hostname}}" + ###################################### + ## CREATE,APPROVE AND EXECUTE ## + ###################################### + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - name: Check change control create - assert: + ansible.builtin.assert: that: - cv_change_control_test.changed == true - cv_change_control_test.data.id is defined - cv_change_control_test.failed == false - - name: "Approve a change control on {{inventory_hostname}} using change_id field" + - name: Approve a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_change_control_approve - name: Check change control approve - assert: + ansible.builtin.assert: that: - cv_change_control_approve.changed == true - cv_change_control_approve.data.time is defined - cv_change_control_approve.data.value.approve.notes == "Initiated from Ansible Playbook" - cv_change_control_approve.data.value.approve.value == true - - cv_change_control_approve.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_change_control_approve.data.value.key.id == cv_change_control_test.data.id - cv_change_control_approve.data.value.version is defined - cv_change_control_approve.failed == false - - name: "Execute a change control on {{inventory_hostname}} using change_id field" + - name: Execute a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: execute - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_control_execute - name: Check change control execute - assert: + ansible.builtin.assert: that: - cv_control_execute.changed == true - cv_control_execute.data.time is defined - - cv_control_execute.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_control_execute.data.value.key.id == cv_change_control_test.data.id - cv_control_execute.data.value.start.value == true - cv_control_execute.failed == false # negative test for approve - - name: "Approve an unknown change control on {{inventory_hostname}} using change_id field" + - name: Approve an unknown change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve - change_id: [ "1234567890" ] # unknown cc id, does not exist on CV - ignore_errors: yes + change_id: ["1234567890"] # unknown cc id, does not exist on CV + ignore_errors: true register: cv_change_control_approve - name: Check cv_change_control_approve - assert: + ansible.builtin.assert: that: - cv_change_control_approve.changed == false - cv_change_control_approve.failed == true - cv_change_control_approve.msg == "Change control 1234567890 id not found" - - name: "Create a change control on {{inventory_hostname}}" + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test # negative test for execute - - name: "Execute a change control on {{inventory_hostname}} before approve" + - name: Execute a change control on {{ inventory_hostname }} before approve arista.cvp.cv_change_control_v3: state: execute - change_id: [ "{{ cv_change_control_test.data.id }}" ] - ignore_errors: yes + change_id: ["{{ cv_change_control_test.data.id }}"] + ignore_errors: true register: cv_change_control_execute - name: Check cv_change_control_execute - assert: + ansible.builtin.assert: that: - cv_change_control_execute.changed == false - cv_change_control_execute.failed == true - cv_change_control_execute.msg == "Request Error: Bad Request - {"code":9, "message":"not approved"}" -################################################ -### APPROVE AND EXECUTE TOGETHER ## -################################################ - - name: "Approve and Execute a change control on {{inventory_hostname}} using change_id field" + ################################################ + ### APPROVE AND EXECUTE TOGETHER ## + ################################################ + - name: Approve and Execute a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve_and_execute - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_control_approve_and_execute - name: Check change control execute - assert: + ansible.builtin.assert: that: - cv_control_approve_and_execute.changed == true - cv_control_approve_and_execute.data.time is defined - - cv_control_approve_and_execute.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_control_approve_and_execute.data.value.key.id == cv_change_control_test.data.id - cv_control_approve_and_execute.data.value.start.value == true - cv_control_approve_and_execute.failed == false # negative test for approve_and_execute - - name: "Approve and execute unknown change control on {{inventory_hostname}} using change_id field" + - name: Approve and execute unknown change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve_and_execute - change_id: [ "1234567890" ] # unknown cc id, does not exist on CV - ignore_errors: yes + change_id: ["1234567890"] # unknown cc id, does not exist on CV + ignore_errors: true register: cv_change_control_approve_and_Execute - name: Check cv_change_control_approve - assert: + ansible.builtin.assert: that: - cv_change_control_approve_and_Execute.changed == false - cv_change_control_approve_and_Execute.failed == true diff --git a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_schedule_and_approve_cc.yml b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_schedule_and_approve_cc.yml index 0ef72f621..ef1a07b4c 100644 --- a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_schedule_and_approve_cc.yml +++ b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_schedule_and_approve_cc.yml @@ -2,14 +2,14 @@ - name: Test cv_change_control_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: - scheduled_time: "2024-06-15T15:47:00.0Z" + scheduled_time: "2025-07-01T15:20:00.0Z" change: name: Leaf 1A Change Control notes: Initiated from Ansible Playbook activities: - - action: "mlaghealthcheck" + - action: mlaghealthcheck name: Check_LEAF1A_MLAG_Health arguments: - name: DeviceID @@ -20,80 +20,85 @@ mode: parallel tasks: -###################################### -## SCHEDULE AND APPROVE ## -###################################### + ###################################### + ## SCHEDULE AND APPROVE ## + ###################################### - - name: "Create a change control on {{inventory_hostname}}" + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Schedule a change control on {{inventory_hostname}} using change_id field" + - name: Schedule a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: schedule - change_id: [ "{{ cv_change_control_test.data.id }}" ] - schedule_time: "{{scheduled_time}}" + change_id: ["{{ cv_change_control_test.data.id }}"] + schedule_time: "{{ scheduled_time }}" register: cv_schedule_change_control + - name: Display result + run_once: true + ansible.builtin.debug: + msg: "{{ cv_schedule_change_control }}" + - name: Check schedule change control - assert: + ansible.builtin.assert: that: - cv_schedule_change_control.changed == true - cv_schedule_change_control.data.time is defined - - cv_schedule_change_control.data.value.key.id == "{{cv_change_control_test.data.id}}" - - cv_schedule_change_control.data.value.schedule.value == "2024-06-15T15:47:00Z" + - cv_schedule_change_control.data.value.key.id == cv_change_control_test.data.id + - cv_schedule_change_control.data.value.schedule.value == "2025-07-01T15:20:00Z" - - name: "Approve a change control on {{inventory_hostname}} using change_id field" + - name: Approve a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_change_control_approve - name: Check change control approve - assert: + ansible.builtin.assert: that: - cv_change_control_approve.changed == true - cv_change_control_approve.data.time is defined - cv_change_control_approve.data.value.approve.notes == "Initiated from Ansible Playbook" - cv_change_control_approve.data.value.approve.value == true - - cv_change_control_approve.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_change_control_approve.data.value.key.id == cv_change_control_test.data.id - cv_change_control_approve.data.value.version is defined - cv_change_control_approve.failed == false - - name: "Remove a change control on {{inventory_hostname}} using change_id field" + - name: Remove a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: remove - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] # SCHEDULE AND APPROVE TOGETHER - - name: "Create a change control on {{inventory_hostname}}" + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Schedule and Approve a change control on {{inventory_hostname}} using change_id field" + - name: Schedule and Approve a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: schedule_and_approve - change_id: [ "{{ cv_change_control_test.data.id }}" ] - schedule_time: "{{scheduled_time}}" + change_id: ["{{ cv_change_control_test.data.id }}"] + schedule_time: "{{ scheduled_time }}" register: cv_cc_schedule_and_approve - name: Check change control schedule and approve # the response doesn't contain any data for schedule - assert: + ansible.builtin.assert: that: - cv_cc_schedule_and_approve.changed == true - cv_cc_schedule_and_approve.data.time is defined - cv_cc_schedule_and_approve.data.value.approve.notes == "Initiated from Ansible Playbook" - cv_cc_schedule_and_approve.data.value.approve.value == true - - cv_cc_schedule_and_approve.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_cc_schedule_and_approve.data.value.key.id == cv_change_control_test.data.id - cv_cc_schedule_and_approve.data.value.version is defined - cv_cc_schedule_and_approve.failed == false - - name: "Remove a change control on {{inventory_hostname}} using change_id field" + - name: Remove a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: remove - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] diff --git a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_show_and_remove_cc.yml b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_show_and_remove_cc.yml index 0992abd50..add94066c 100644 --- a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_show_and_remove_cc.yml +++ b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_show_and_remove_cc.yml @@ -1,13 +1,14 @@ +--- - name: Test cv_change_control_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: change: name: Leaf 2A Change Control notes: Initiated from Ansible Playbook activities: - - action: "mlaghealthcheck" + - action: mlaghealthcheck name: Check_LEAF2A_MLAG_Health arguments: - name: DeviceID @@ -18,101 +19,102 @@ mode: parallel tasks: -###################################### -## SHOW CHANGE CONTROL ## -###################################### - - name: "Create a change control on {{inventory_hostname}}" + ###################################### + ## SHOW CHANGE CONTROL ## + ###################################### + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Show a change control on {{inventory_hostname}} using change_id field" + - name: Show a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: show - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_show_cc_by_id - name: Check change control - assert: + ansible.builtin.assert: that: - cv_show_cc_by_id.changed == false - - cv_show_cc_by_id.data.change_controls[0].value.change.name == "{{ change.name }}" - - cv_show_cc_by_id.data.change_controls[0].value.change.notes == "{{ change.notes }}" - - cv_show_cc_by_id.data.change_controls[0].value.key.id == "{{cv_change_control_test.data.id}}" + - cv_show_cc_by_id.data.change_controls[0].value.change.name == change.name + - cv_show_cc_by_id.data.change_controls[0].value.change.notes == change.notes + - cv_show_cc_by_id.data.change_controls[0].value.key.id == cv_change_control_test.data.id - cv_show_cc_by_id.data.change_controls[0].value.change.stages.values != {} - - name: "Show a change control on {{inventory_hostname}} using CC name" + - name: Show a change control on {{ inventory_hostname }} using CC name arista.cvp.cv_change_control_v3: state: show name: "{{ change.name }}" register: cv_show_cc_by_name - - name: Check change control + - name: Set change control name vars: query: "[?value.change.name=='{{ change.name }}']" - set_fact: + ansible.builtin.set_fact: show_cc_by_name: "{{ cv_show_cc_by_name.data.change_controls | json_query(query) | first }}" - - assert: + - name: Check change control approve + ansible.builtin.assert: that: - cv_show_cc_by_name.changed == false - show_cc_by_name.value.change.name == "{{ change.name }}" - show_cc_by_name.value.change.notes == "{{ change.notes }}" - show_cc_by_name.value.change.stages.values != {} - - name: "Show an unknown change control on {{inventory_hostname}} using CC name" + - name: Show an unknown change control on {{ inventory_hostname }} using CC name arista.cvp.cv_change_control_v3: state: show - name: "Unknown-CC-1234567890" # unknown cc name, does not exist on CV + name: Unknown-CC-1234567890 # unknown cc name, does not exist on CV register: cv_show_cc_by_name - name: Check change control - assert: + ansible.builtin.assert: that: - cv_show_cc_by_name.changed == false - cv_show_cc_by_name.data.change_controls == [] - cv_show_cc_by_name.failed == false - - name: "Show an unknown change control on {{inventory_hostname}} using change_id field" + - name: Show an unknown change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: show - change_id: [ "1234567890" ] + change_id: ["1234567890"] register: cv_show_unknown_id - name: Check change control - assert: + ansible.builtin.assert: that: - cv_show_unknown_id.changed == false - cv_show_unknown_id.data.change_controls == [None] - cv_show_unknown_id.failed == false -###################################### -## REMOVE CHANGE CONTROL ## -###################################### + ###################################### + ## REMOVE CHANGE CONTROL ## + ###################################### - - name: "Remove a change control on {{inventory_hostname}} using change_id field" + - name: Remove a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: remove - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_remove_change_control - name: Check remove change control - assert: + ansible.builtin.assert: that: - cv_remove_change_control.changed == true - cv_remove_change_control.failed == false - cv_remove_change_control.data.remove == [] - - name: "Remove an unknown change control on {{inventory_hostname}} using change_id field" + - name: Remove an unknown change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: remove - change_id: [ "Unknown-1234567890" ] - ignore_errors: yes + change_id: [Unknown-1234567890] + ignore_errors: true register: cv_remove_unknown_cc - name: Check remove unknown change control - assert: + ansible.builtin.assert: that: - cv_remove_unknown_cc.changed == false - cv_remove_unknown_cc.failed == true diff --git a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_unapprove_and_execute_cc.yml b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_unapprove_and_execute_cc.yml index db3cf1451..0e09da257 100644 --- a/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_unapprove_and_execute_cc.yml +++ b/ansible_collections/arista/cvp/molecule/cv_change_control_v3/test_unapprove_and_execute_cc.yml @@ -2,13 +2,13 @@ - name: Test cv_change_control_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: change: name: Leaf 1A Change Control notes: Initiated from Ansible Playbook activities: - - action: "mlaghealthcheck" + - action: mlaghealthcheck name: Check_LEAF1A_MLAG_Health arguments: - name: DeviceID @@ -19,52 +19,52 @@ mode: parallel tasks: -###################################### -## UNAPPROVE AND EXECUTE ## -###################################### + ###################################### + ## UNAPPROVE AND EXECUTE ## + ###################################### - - name: "Create a change control on {{inventory_hostname}}" + - name: Create a change control on {{ inventory_hostname }} arista.cvp.cv_change_control_v3: state: set change: "{{ change }}" register: cv_change_control_test - - name: "Approve a change control on {{inventory_hostname}} using change_id field" + - name: Approve a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: approve - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] - - name: "Unapprove a change control on {{inventory_hostname}} using change_id field" + - name: Unapprove a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: unapprove - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] register: cv_change_control_unapprove - name: Check change control unapprove - assert: + ansible.builtin.assert: that: - cv_change_control_unapprove.changed == true - cv_change_control_unapprove.data.time is defined - cv_change_control_unapprove.data.value.approve.notes == "Initiated from Ansible Playbook" - cv_change_control_unapprove.data.value.approve.value == false - - cv_change_control_unapprove.data.value.key.id == "{{ cv_change_control_test.data.id }}" + - cv_change_control_unapprove.data.value.key.id == cv_change_control_test.data.id - cv_change_control_unapprove.failed == false - - name: "Execute a change control on {{inventory_hostname}} using change_id field - this should fail" + - name: Execute a change control on {{ inventory_hostname }} using change_id field - this should fail arista.cvp.cv_change_control_v3: state: execute - change_id: [ "{{ cv_change_control_test.data.id }}" ] - ignore_errors: yes + change_id: ["{{ cv_change_control_test.data.id }}"] + ignore_errors: true register: cv_cc_execute_unapprove - name: Check execute unapproved change control - assert: + ansible.builtin.assert: that: - cv_cc_execute_unapprove.changed == false - cv_cc_execute_unapprove.failed == true - cv_cc_execute_unapprove.msg == "Request Error: Bad Request - {"code":9, "message":"not approved"}" - - name: "Remove a change control on {{inventory_hostname}} using change_id field" + - name: Remove a change control on {{ inventory_hostname }} using change_id field arista.cvp.cv_change_control_v3: state: remove - change_id: [ "{{ cv_change_control_test.data.id }}" ] + change_id: ["{{ cv_change_control_test.data.id }}"] diff --git a/ansible_collections/arista/cvp/molecule/cv_configlet_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_configlet_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_configlet_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_configlet_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_configlet_v3/test_cv_configlet_v3.yaml b/ansible_collections/arista/cvp/molecule/cv_configlet_v3/test_cv_configlet_v3.yaml index 061f64597..f49433344 100644 --- a/ansible_collections/arista/cvp/molecule/cv_configlet_v3/test_cv_configlet_v3.yaml +++ b/ansible_collections/arista/cvp/molecule/cv_configlet_v3/test_cv_configlet_v3.yaml @@ -2,108 +2,108 @@ - name: Test cv_configlet_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: CVP_CONFIGLETS: - configlet1: 'alias a{{ 999 | random }} show lldp' - configlet2: '! This is second configlet' + configlet1: alias a{{ 999 | random }} show lldp + configlet2: "! This is second configlet" tasks: - - name: "Push config" + - name: Push config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: present register: CV_CONFIGLET_V3_RESULT - - name: "Check configlet creation process" - assert: + - name: Check configlet creation process + ansible.builtin.assert: that: - CV_CONFIGLET_V3_RESULT.changed == true - CV_CONFIGLET_V3_RESULT.configlets_created.configlets_created_count == 2 - CV_CONFIGLET_V3_RESULT.configlets_created.configlets_created_list == ['configlet1', 'configlet2'] - CV_CONFIGLET_V3_RESULT.configlets_created.success == true - - name: "Update configlets" + - name: Update configlets arista.cvp.cv_configlet_v3: configlets: - configlet1: "{{CVP_CONFIGLETS.configlet1}}" + configlet1: "{{ CVP_CONFIGLETS.configlet1 }}" state: present register: CV_CONFIGLET_V3_RESULT - - name: "Check configlet updation process" - assert: + - name: Check configlet updation process + ansible.builtin.assert: that: - CV_CONFIGLET_V3_RESULT.changed == true - CV_CONFIGLET_V3_RESULT.configlets_updated.configlets_updated_count == 1 - CV_CONFIGLET_V3_RESULT.configlets_updated.configlets_updated_list == ['configlet1'] - CV_CONFIGLET_V3_RESULT.configlets_updated.success == true - - name: "Push same config again" + - name: Push same config again arista.cvp.cv_configlet_v3: configlets: - configlet2: "{{CVP_CONFIGLETS.configlet2}}" + configlet2: "{{ CVP_CONFIGLETS.configlet2 }}" state: present register: CV_CONFIGLET_V3_RESULT - - name: "Check same config push" - assert: + - name: Check same config push + ansible.builtin.assert: that: - CV_CONFIGLET_V3_RESULT.changed == false - CV_CONFIGLET_V3_RESULT.success == false - CV_CONFIGLET_V3_RESULT.failed == false - - name: 'Collect configlets facts from {{inventory_hostname}}' + - name: Collect configlets facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - configlets - regexp_filter: "configlet[1-2]" + regexp_filter: configlet[1-2] register: FACTS_CONFIGLET - - name: "Check device facts" - assert: + - name: Check device facts + ansible.builtin.assert: that: - FACTS_CONFIGLET.changed == false - FACTS_CONFIGLET.data.cvp_configlets.configlet1 is defined - FACTS_CONFIGLET.data.cvp_configlets.configlet2 is defined - FACTS_CONFIGLET.failed == false - - name: "Delete config" + - name: Delete config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: absent register: DELETE_CONFIGLET_RESULT - - name: "Check configlet deletion process" - assert: + - name: Check configlet deletion process + ansible.builtin.assert: that: - DELETE_CONFIGLET_RESULT.changed == true - DELETE_CONFIGLET_RESULT.configlets_deleted.configlets_deleted_count == 2 - DELETE_CONFIGLET_RESULT.configlets_deleted.configlets_deleted_list == ['configlet1', 'configlet2'] - DELETE_CONFIGLET_RESULT.configlets_deleted.success == true - - name: "Delete non-existing config" + - name: Delete non-existing config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: absent register: DELETE_CONFIGLET_RESULT - - name: "Check configlet deletion process" - assert: + - name: Check configlet deletion process + ansible.builtin.assert: that: - DELETE_CONFIGLET_RESULT.changed == false - DELETE_CONFIGLET_RESULT.configlets_deleted.configlets_deleted_count == 0 - DELETE_CONFIGLET_RESULT.configlets_deleted.configlets_deleted_list == [] - DELETE_CONFIGLET_RESULT.configlets_deleted.success == false - - name: 'Collect configlets facts from {{inventory_hostname}}' + - name: Collect configlets facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - configlets - regexp_filter: "configlet[1-2]" + regexp_filter: configlet[1-2] register: FACTS_CONFIGLET - - name: "Check configlets facts" - assert: + - name: Check configlets facts + ansible.builtin.assert: that: - FACTS_CONFIGLET.changed == false - FACTS_CONFIGLET.data.cvp_configlets == {} diff --git a/ansible_collections/arista/cvp/molecule/cv_container_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_container_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_container_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_container_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_container_v3/test_cv_container_v3_configlet.yaml b/ansible_collections/arista/cvp/molecule/cv_container_v3/test_cv_container_v3_configlet.yaml index 9eb50ca44..47f2c3f92 100644 --- a/ansible_collections/arista/cvp/molecule/cv_container_v3/test_cv_container_v3_configlet.yaml +++ b/ansible_collections/arista/cvp/molecule/cv_container_v3/test_cv_container_v3_configlet.yaml @@ -3,16 +3,14 @@ hosts: CloudVision connection: local gather_facts: false - collections: - - arista.cvp vars: ansible_command_timeout: 1200 ansible_connect_timeout: 600 CVP_CONFIGLETS: - configlet1: '! This is first configlet' - configlet2: '! This is second configlet' + configlet1: "! This is first configlet" + configlet2: "! This is second configlet" TOPOLOGY_3_TIER: TEAM01: @@ -24,7 +22,7 @@ configlets: - configlet1 - CONTAINER_NAME: "TEAM01_LEAFS" + CONTAINER_NAME: TEAM01_LEAFS CHANGE_CONFIGLET_LOOSE: TEAM01_LEAFS: @@ -45,36 +43,36 @@ tasks: # Create configlet - - name: "Push config" + - name: Push config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" - state: present + configlets: "{{ CVP_CONFIGLETS }}" + state: present register: CV_CONFIGLET # TC1 - Create and delete 3 tier topology. # Testing: Removal of entire topology. - - name: Build Container Topology On {{inventory_hostname}} + - name: Build Container Topology On {{ inventory_hostname }} arista.cvp.cv_container_v3: - topology: '{{TOPOLOGY_3_TIER}}' + topology: "{{ TOPOLOGY_3_TIER }}" register: Build_TOPO_3_TIER - name: Testing Build Container - assert: + ansible.builtin.assert: that: - Build_TOPO_3_TIER.container_added.changed == true - Build_TOPO_3_TIER.container_added.container_added_count == 3 - Build_TOPO_3_TIER.container_added.container_added_list == ["TEAM01", "TEAM01_DC", "TEAM01_LEAFS"] - Build_TOPO_3_TIER.container_added.success == true - - name: Remove Container Topology On {{inventory_hostname}} + - name: Remove Container Topology On {{ inventory_hostname }} arista.cvp.cv_container_v3: - topology: '{{TOPOLOGY_3_TIER}}' + topology: "{{ TOPOLOGY_3_TIER }}" state: absent register: REMOVE_TOPO_3_TIER - name: Testing Remove Container - assert: + ansible.builtin.assert: that: - REMOVE_TOPO_3_TIER.container_deleted.changed == true - REMOVE_TOPO_3_TIER.container_deleted.container_deleted_count == 3 @@ -89,19 +87,19 @@ # 4. Remove configlet using apply_mode: strict # 5. Removal of container which contains configlet. - - name: Build Container Topology On {{inventory_hostname}} With Configlet + - name: Build Container Topology On {{ inventory_hostname }} With Configlet arista.cvp.cv_container_v3: - topology: '{{TOPOLOGY_3_TIER}}' + topology: "{{ TOPOLOGY_3_TIER }}" register: CONFIGLET_ADD - - name: Collect containers facts from {{inventory_hostname}} + - name: Collect containers facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - containers register: CONTAINER_RESULT - name: Testing Added Configlet - assert: + ansible.builtin.assert: that: - CONFIGLET_ADD.configlets_attached.changed == true - CONFIGLET_ADD.configlets_attached.configlets_attached_count == 1 @@ -111,12 +109,12 @@ - name: Change Configlet With apply_mode loose arista.cvp.cv_container_v3: - topology: '{{CHANGE_CONFIGLET_LOOSE}}' + topology: "{{ CHANGE_CONFIGLET_LOOSE }}" apply_mode: loose register: CONFIGLET_CHANGE_LOOSE - name: Testing Changed Configlet with apply_mode loose - assert: + ansible.builtin.assert: that: - CONFIGLET_CHANGE_LOOSE.configlets_attached.changed == true - CONFIGLET_CHANGE_LOOSE.configlets_attached.configlets_attached_count == 1 @@ -129,12 +127,12 @@ - name: Change Configlet With apply_mode strict arista.cvp.cv_container_v3: - topology: '{{CHANGE_CONFIGLET_STRICT}}' + topology: "{{ CHANGE_CONFIGLET_STRICT }}" apply_mode: strict register: CONFIGLET_CHANGE_STRICT - name: Testing Changed Configlet with apply_mode strict - assert: + ansible.builtin.assert: that: - CONFIGLET_CHANGE_STRICT.configlets_attached.changed == true - CONFIGLET_CHANGE_STRICT.configlets_attached.configlets_attached_count == 1 @@ -147,12 +145,12 @@ - name: Remove Configlet with apply_mode strict arista.cvp.cv_container_v3: - topology: '{{REMOVE_CONFIGLET}}' + topology: "{{ REMOVE_CONFIGLET }}" apply_mode: strict register: CONFIGLET_REMOVE - name: Testing Remove Configlet with apply_mode strict - assert: + ansible.builtin.assert: that: - CONFIGLET_REMOVE.configlets_detached.changed == true - CONFIGLET_REMOVE.configlets_detached.configlets_detached_count == 1 @@ -161,38 +159,39 @@ - name: Add Configlet arista.cvp.cv_container_v3: - topology: '{{CHANGE_CONFIGLET_LOOSE}}' + topology: "{{ CHANGE_CONFIGLET_LOOSE }}" - name: Remove Container With Configlet arista.cvp.cv_container_v3: - topology: '{{REMOVE_CONFIGLET}}' + topology: "{{ REMOVE_CONFIGLET }}" state: absent register: REMOVE_CONTAINER_WITH_CONFIGLET - name: Testing Remove Container With Configlet - assert: + ansible.builtin.assert: that: - REMOVE_CONTAINER_WITH_CONFIGLET.container_deleted.changed == true - REMOVE_CONTAINER_WITH_CONFIGLET.container_deleted.container_deleted_count == 1 - REMOVE_CONTAINER_WITH_CONFIGLET.container_deleted.container_deleted_list == ["TEAM01_LEAFS"] - REMOVE_CONTAINER_WITH_CONFIGLET.container_deleted.success == true - - arista.cvp.cv_container_v3: - topology: '{{REMOVE_CONFIGLET}}' + - name: Remove Configlet + arista.cvp.cv_container_v3: + topology: "{{ REMOVE_CONFIGLET }}" - - name: "Delete configlet" + - name: Delete configlet arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: absent - name: Clean-up Topology for CONFIGLET arista.cvp.cv_container_v3: - topology: '{{TOPOLOGY_3_TIER}}' + topology: "{{ TOPOLOGY_3_TIER }}" state: absent register: DELETE_TOPOLOGY - name: Testing Clean-up for CONFIGLET - assert: + ansible.builtin.assert: that: - DELETE_TOPOLOGY.container_deleted.changed == true - DELETE_TOPOLOGY.container_deleted.container_deleted_count == 3 diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_device_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/reconcile.py b/ansible_collections/arista/cvp/molecule/cv_device_v3/reconcile.py index 087975583..22de20ab0 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/reconcile.py +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/reconcile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. from cvprac.cvp_client import CvpClient diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_bundle.yml b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_bundle.yml index 7946da1a9..1c844dc23 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_bundle.yml +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_bundle.yml @@ -2,16 +2,16 @@ - name: Test cv_device_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: ansible_command_timeout: 1200 ansible_connect_timeout: 600 DEVICE_NAME: s1-leaf1 - IMAGE_NAME: "vEOS-lab-4.30.1F.swi" + IMAGE_NAME: vEOS-lab-4.30.1F.swi - BUNDLE_NAME: "Test_bundle" + BUNDLE_NAME: Test_bundle CVP_DEVICES_BUNDLE_ATTACHED: - fqdn: "{{DEVICE_NAME }}" @@ -32,28 +32,28 @@ regexp_filter: "{{ DEVICE_NAME }}" register: CV_FACTS_V3_RESULT - - name: "Upload EOS image to {{ inventory_hostname }}" + - name: Upload EOS image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{IMAGE_NAME}}" + image: "{{ IMAGE_NAME }}" - - name: "Create bundle {{ inventory_hostname }}" + - name: Create bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: add - bundle_name: "{{BUNDLE_NAME}}" + bundle_name: "{{ BUNDLE_NAME }}" image_list: - - "{{IMAGE_NAME}}" + - "{{ IMAGE_NAME }}" - - name: "Attach bundle on {{ inventory_hostname }}" + - name: Attach bundle on {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_BUNDLE_ATTACHED }}' + devices: "{{ CVP_DEVICES_BUNDLE_ATTACHED }}" state: present apply_mode: strict register: ATTACH_BUNDLE - - name: "Check attach bundle" + - name: Check attach bundle ansible.builtin.assert: that: - ATTACH_BUNDLE.bundle_attached.changed == true @@ -72,14 +72,14 @@ ansible.builtin.pause: seconds: 20 - - name: "Detach bundle on {{ inventory_hostname }}" + - name: Detach bundle on {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_BUNDLE_DETACHED }}' + devices: "{{ CVP_DEVICES_BUNDLE_DETACHED }}" state: present apply_mode: strict register: DETACH_BUNDLE - - name: "Check detach bundle" + - name: Check detach bundle ansible.builtin.assert: that: - DETACH_BUNDLE.bundle_detached.changed == true @@ -87,10 +87,10 @@ - DETACH_BUNDLE.bundle_detached.bundle_detached_list != [] - DETACH_BUNDLE.bundle_detached.success == true - - name: "Delete bundle {{ inventory_hostname }}" + - name: Delete bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: remove - bundle_name: "{{BUNDLE_NAME}}" + bundle_name: "{{ BUNDLE_NAME }}" image_list: - - "{{IMAGE_NAME}}" + - "{{ IMAGE_NAME }}" diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_configlet.yml b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_configlet.yml index ac582a049..4b4f4d188 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_configlet.yml +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_apply_detach_configlet.yml @@ -2,20 +2,20 @@ - name: Test cv_device_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: DEVICE_NAME: s1-leaf1 CVP_CONFIGLETS: - configlet1: '! This is first configlet' - configlet2: '! This is second configlet' + configlet1: "! This is first configlet" + configlet2: "! This is second configlet" CVP_DEVICES_APPLY_CONFIGLET: - fqdn: "{{DEVICE_NAME}}" parentContainerName: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].parentContainerName}}" configlets: - - 'configlet1' - - 'configlet2' + - configlet1 + - configlet2 CVP_DEVICES_DETACH_CONFIGLET: - fqdn: "{{DEVICE_NAME}}" @@ -23,7 +23,7 @@ configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" CVP_DEVICES_DEPLOY: - - fqdn: "{{DEVICE_NAME}}" # device must be in undefined container + - fqdn: "{{DEVICE_NAME}}" # device must be in undefined container parentContainerName: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].parentContainerName}}" configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" @@ -32,21 +32,21 @@ arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE_NAME}}" + regexp_filter: "{{ DEVICE_NAME }}" register: CV_FACTS_V3_RESULT - - name: "Push config" + - name: Push config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: present - - name: "Apply configlet on {{ inventory_hostname }}" + - name: Apply configlet on {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_APPLY_CONFIGLET}}' + devices: "{{ CVP_DEVICES_APPLY_CONFIGLET }}" state: present register: CV_DEVICE_V3_RESULT - - name: "Check apply_configlet with apply_mode loose" + - name: Check apply_configlet with apply_mode loose ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == true @@ -56,13 +56,13 @@ - CV_DEVICE_V3_RESULT.configlets_attached.success == true - CV_DEVICE_V3_RESULT.configlets_attached.taskIds != [] - - name: "Apply same configlet again on {{ inventory_hostname }}" + - name: Apply same configlet again on {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_APPLY_CONFIGLET}}' + devices: "{{ CVP_DEVICES_APPLY_CONFIGLET }}" state: present register: CV_DEVICE_V3_RESULT - - name: "Check apply_configlet with same configlets" + - name: Check apply_configlet with same configlets ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == false @@ -72,9 +72,9 @@ - CV_DEVICE_V3_RESULT.configlets_attached.success == false - CV_DEVICE_V3_RESULT.configlets_attached.taskIds == [] - - name: "Detach configlet from {{ inventory_hostname }}" + - name: Detach configlet from {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_DETACH_CONFIGLET}}' + devices: "{{ CVP_DEVICES_DETACH_CONFIGLET }}" state: present apply_mode: strict register: CV_DEVICE_V3_RESULT @@ -82,9 +82,9 @@ - name: Execute Task for detach configlet arista.cvp.cv_task_v3: tasks: - - "{{CV_DEVICE_V3_RESULT.taskIds[0]}}" + - "{{ CV_DEVICE_V3_RESULT.taskIds[0] }}" - - name: "Check detach_configlet with apply_mode strict" + - name: Check detach_configlet with apply_mode strict ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == true @@ -94,18 +94,18 @@ - CV_DEVICE_V3_RESULT.configlets_detached.success == true - CV_DEVICE_V3_RESULT.configlets_detached.taskIds != [] - - name: "Delete config" + - name: Delete config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: absent - name: "Resetting original state on device: {{ inventory_hostname }}" arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_DEPLOY}}' + devices: "{{ CVP_DEVICES_DEPLOY }}" state: present register: CV_DEVICE_V3_RESULT - - name: "Checking if the reset was successful" + - name: Checking if the reset was successful ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == true @@ -118,5 +118,5 @@ - name: Execute the task to reset the device back to its original state arista.cvp.cv_task_v3: tasks: - - "{{CV_DEVICE_V3_RESULT.configlets_attached.taskIds[0]}}" + - "{{ CV_DEVICE_V3_RESULT.configlets_attached.taskIds[0] }}" when: CV_DEVICE_V3_RESULT.success is true diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_decommission_factory_reset_provisioning_reset.yml b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_decommission_factory_reset_provisioning_reset.yml index 2c9a22267..2574edbb3 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_decommission_factory_reset_provisioning_reset.yml +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_decommission_factory_reset_provisioning_reset.yml @@ -2,10 +2,10 @@ - name: Test cv_device_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: cvp_device_api: https://{{ ansible_host }}/api/resources/inventory/v1/DeviceOnboardingConfig - onboarding_status_api: "https://{{ ansible_host }}/api/resources/inventory/v1/DeviceOnboarding?key.requestId={{ generated_uuid }}" + onboarding_status_api: https://{{ ansible_host }}/api/resources/inventory/v1/DeviceOnboarding?key.requestId={{ generated_uuid }} cvp_login_api: https://{{ ansible_host }}/cvpservice/login/authenticate.do DEVICE_NAME: s1-leaf2 @@ -22,12 +22,12 @@ parentContainerName: "" CVP_DEVICES_VALIDATE_CONFIG: - - device_name: "{{DEVICE_NAME}}" + - device_name: "{{ DEVICE_NAME }}" search_type: serialNumber cvp_configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" CVP_DEVICES_DEPLOY: - - fqdn: "{{DEVICE_NAME}}" + - fqdn: "{{ DEVICE_NAME }}" parentContainerName: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].parentContainerName}}" configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" @@ -39,18 +39,18 @@ arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE_NAME}}" + regexp_filter: "{{ DEVICE_NAME }}" register: CV_FACTS_V3_RESULT - name: Run CV_DEVICE_V3 With State Provisioning Reset arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_PROVISIONING_RESET}}' + devices: "{{ CVP_DEVICES_PROVISIONING_RESET }}" state: provisioning_reset register: PROVISIONING_RESET_RESULT - # if we try to delete the same device again(already in undefined container), it does not raise any error and gives the same result + # if we try to delete the same device again(already in undefined container), it does falset raise any error and gives the same result - - name: check provisioning reset + - name: Check provisioning reset ansible.builtin.assert: that: - PROVISIONING_RESET_RESULT.devices_removed.changed == true @@ -63,20 +63,20 @@ - name: Validate configurations arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALIDATE_CONFIG}}" + devices: "{{ CVP_DEVICES_VALIDATE_CONFIG }}" validate_mode: stop_on_error register: CVP_DEVICES_RESULTS - - name: "Deploy device on {{ inventory_hostname }}" + - name: Deploy device on {{ inventory_hostname }} arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_DEPLOY}}' + devices: "{{ CVP_DEVICES_DEPLOY }}" state: present register: CV_DEVICE_V3_RESULT - name: Execute Task for deploy_Device arista.cvp.cv_task_v3: tasks: - - "{{CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0]}}" + - "{{ CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0] }}" when: CV_DEVICE_V3_RESULT.success is true - name: Pause for 20 seconds to Execute Task @@ -86,41 +86,43 @@ ###################################### ## STATE FACTORY RESET ## ###################################### -# XXX: This test will fail with cEOS devices. Uncomment if running on vEOS devices -# - name: Run CV_DEVICE_V3 With State Factory reset -# arista.cvp.cv_device_v3: -# devices: '{{CVP_DEVICES_FACT0RY_RESET}}' -# state: factory_reset -# register: FACTORY_RESET_RESULT -# -# # it does not move device to undefined container, just creates a task on CVP -# -# - name: Check State Factory reset -# ansible.builtin.assert: -# that: -# - FACTORY_RESET_RESULT.devices_reset.changed == true -# - FACTORY_RESET_RESULT.devices_reset.devices_reset_count == 1 -# - FACTORY_RESET_RESULT.devices_reset.devices_reset_list == ['s1-leaf1_reset'] -# - FACTORY_RESET_RESULT.devices_reset.success == true -# - FACTORY_RESET_RESULT.devices_reset.taskIds is defined -# - FACTORY_RESET_RESULT.failed == false -# - FACTORY_RESET_RESULT.success == true -# -# - name: Execute Task for deploy_Device -# arista.cvp.cv_task_v3: -# tasks: -# - "{{FACTORY_RESET_RESULT.taskIds[0]}}" -# state: cancelled + # XXX: This test will fail with cEOS devices. Uncomment if running on vEOS devices + # - name: Run CV_DEVICE_V3 With State Factory reset + # arista.cvp.cv_device_v3: + # devices: '{{CVP_DEVICES_FACT0RY_RESET}}' + # state: factory_reset + # register: FACTORY_RESET_RESULT + # + # # it does not move device to undefined container, just creates a task on CVP + # + # - name: Check State Factory reset + # ansible.builtin.assert: + # that: + # - FACTORY_RESET_RESULT.devices_reset.changed == true + # - FACTORY_RESET_RESULT.devices_reset.devices_reset_count == 1 + # - FACTORY_RESET_RESULT.devices_reset.devices_reset_list == ['s1-leaf1_reset'] + # - FACTORY_RESET_RESULT.devices_reset.success == true + # - FACTORY_RESET_RESULT.devices_reset.taskIds is defined + # - FACTORY_RESET_RESULT.failed == false + # - FACTORY_RESET_RESULT.success == true + # + # - name: Execute Task for deploy_Device + # arista.cvp.cv_task_v3: + # tasks: + # - "{{FACTORY_RESET_RESULT.taskIds[0]}}" + # state: cancelled ###################################### ## STATE ABSENT (DECOMMISSION) ## ###################################### - name: Run CV_DEVICE_V3 With State Absent arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_STATE_ABSENT}}' + devices: "{{ CVP_DEVICES_STATE_ABSENT }}" state: absent register: DECOMMISSION_DEVICE - - ansible.builtin.assert: + + - name: Assert CV_DEVICE_V3 With State Absent + ansible.builtin.assert: that: - DECOMMISSION_DEVICE.devices_decommissioned.changed == true - DECOMMISSION_DEVICE.devices_decommissioned.devices_decommissioned_count == 1 @@ -129,27 +131,29 @@ - DECOMMISSION_DEVICE.devices_decommissioned.taskIds == [] - DECOMMISSION_DEVICE.failed == false - - name: Run CV_DEVICE_V3 With State Absent # when device does not exist in CVP + - name: Run CV_DEVICE_V3 With State Absent when device does falset exist in CVP arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_STATE_ABSENT}}' + devices: "{{ CVP_DEVICES_STATE_ABSENT }}" state: absent - ignore_errors: yes + ignore_errors: true register: DECOMMISSION_DEVICE_ABSENT - - ansible.builtin.assert: + - name: Assert CV_DEVICE_V3 With State Absent when device does falset exist in CVP + ansible.builtin.assert: that: - DECOMMISSION_DEVICE_ABSENT.changed == false - DECOMMISSION_DEVICE_ABSENT.failed == true - - DECOMMISSION_DEVICE_ABSENT.msg == "Error - the following devices do not exist in CVP ['s1-leaf2'] but are defined in the playbook. Make sure that the devices are provisioned and defined with the full fqdn name (including the domain name) if needed." + - DECOMMISSION_DEVICE_ABSENT.msg == "Error - the following devices do falset exist in CVP ['s1-leaf2'] but are defined in the playbook. Make + sure that the devices are provisioned and defined with the full fqdn name (including the domain name) if needed." - - name: get session cookie + - name: Get session cookie ansible.builtin.uri: url: "{{ cvp_login_api }}" method: POST headers: - Accept: "application/json" - Content-Type: "application/json" - validate_certs: no - return_content: yes + Accept: application/json + Content-Type: application/json + validate_certs: false + return_content: true body_format: json body: userId: "{{ ansible_user }}" @@ -161,18 +165,18 @@ delay: 2 - name: Generate UUID - set_fact: + ansible.builtin.set_fact: generated_uuid: "{{ 'requestId' | to_uuid }}" - - name: "Re-onboarding decommissioned device" + - name: Re-onboarding decommissioned device ansible.builtin.uri: url: "{{ cvp_device_api }}" method: POST headers: - Accept: "application/json" - Cookie: "access_token={{ cvp_token.cookies.access_token }}" - validate_certs: no - return_content: yes + Accept: application/json + Cookie: access_token={{ cvp_token.cookies.access_token }} + validate_certs: false + return_content: true body_format: json body: '{"key":{"requestId":"{{ generated_uuid }}"},"hostnameOrIp":"{{ CV_FACTS_V3_RESULT.data.cvp_devices[0].ipAddress }}","device_type":"eos"}' register: _result @@ -180,35 +184,35 @@ retries: 10 delay: 2 - - name: "Checking onboarding status" + - name: Checking onboarding status ansible.builtin.uri: url: "{{ onboarding_status_api }}" method: GET headers: - Accept: "application/json" - Cookie: "access_token={{ cvp_token.cookies.access_token }}" - validate_certs: no - return_content: yes + Accept: application/json + Cookie: access_token={{ cvp_token.cookies.access_token }} + validate_certs: false + return_content: true body_format: json - body: '{}' + body: "{}" register: onboarding_status until: onboarding_status.json.value.status == "ONBOARDING_STATUS_SUCCESS" retries: 10 delay: 2 - - name: "Adding the device back to the original container" + - name: Adding the device back to the original container arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_DEPLOY}}' + devices: "{{ CVP_DEVICES_DEPLOY }}" state: present register: CV_DEVICE_V3_RESULT - name: Execute Add Device task arista.cvp.cv_task_v3: tasks: - - "{{CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0]}}" + - "{{ CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0] }}" when: CV_DEVICE_V3_RESULT.success is true - - name: "Checking if Add Device was successful" + - name: Checking if Add Device was successful ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == true diff --git a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_move_and_deploy_device.yml b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_move_and_deploy_device.yml index fefdf17db..6ccc259d5 100644 --- a/ansible_collections/arista/cvp/molecule/cv_device_v3/test_move_and_deploy_device.yml +++ b/ansible_collections/arista/cvp/molecule/cv_device_v3/test_move_and_deploy_device.yml @@ -2,7 +2,7 @@ - name: Test cv_device_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: ansible_command_timeout: 1200 ansible_connect_timeout: 600 @@ -15,7 +15,7 @@ CVP_DEVICES_MOVE_DEVICE: - fqdn: "{{DEVICE_NAME}}" - parentContainerName: "Test_Leaf" + parentContainerName: Test_Leaf CVP_DEVICES_PARENT_CONTAINER_NONE: - fqdn: "{{DEVICE_NAME}}" @@ -23,11 +23,11 @@ CVP_DEVICES_PROVISIONING_RESET: - fqdn: "{{DEVICE_NAME}}" - parentContainerName: "Test_Leaf" + parentContainerName: Test_Leaf CVP_DEVICES_APPLY_CONFIGLET: - fqdn: "{{DEVICE_NAME}}" - parentContainerName: "Undefined" + parentContainerName: Undefined configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" CVP_DEVICES_VALIDATE_CONFIG: @@ -36,7 +36,7 @@ cvp_configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" CVP_DEVICES_DEPLOY: - - fqdn: "{{DEVICE_NAME}}" # device must be in undefined container + - fqdn: "{{DEVICE_NAME}}" # device must be in undefined container parentContainerName: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].parentContainerName}}" configlets: "{{CV_FACTS_V3_RESULT.data.cvp_devices[0].configlets}}" @@ -48,7 +48,7 @@ # Creating a container - name: Build Container On {{ inventory_hostname }} arista.cvp.cv_container_v3: - topology: '{{CONTAINER}}' + topology: "{{ CONTAINER }}" - name: Collect devices facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: @@ -59,7 +59,7 @@ - name: Run CV_DEVICE_V3 To Move Device arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_MOVE_DEVICE }}' + devices: "{{ CVP_DEVICES_MOVE_DEVICE }}" state: present register: MOVE_DEVICE_RUN @@ -69,26 +69,26 @@ - name: Execute Task for deploy_Device arista.cvp.cv_task_v3: - tasks: "{{MOVE_DEVICE_RUN.taskIds}}" + tasks: "{{ MOVE_DEVICE_RUN.taskIds }}" - name: Check Move Device - assert: + ansible.builtin.assert: that: - - "MOVE_DEVICE_RUN.devices_moved.changed == true" - - "MOVE_DEVICE_RUN.devices_moved.devices_moved_count == 1" - - "MOVE_DEVICE_RUN.devices_moved.devices_moved_list == ['s1-leaf1_to_Test_Leaf']" - - "MOVE_DEVICE_RUN.devices_moved.success == true" - - "MOVE_DEVICE_RUN.failed == false" + - MOVE_DEVICE_RUN.devices_moved.changed == true + - MOVE_DEVICE_RUN.devices_moved.devices_moved_count == 1 + - MOVE_DEVICE_RUN.devices_moved.devices_moved_list == ['s1-leaf1_to_Test_Leaf'] + - MOVE_DEVICE_RUN.devices_moved.success == true + - MOVE_DEVICE_RUN.failed == false - name: Run CV_DEVICE_V3 To Move Device With Parent Container None arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_PARENT_CONTAINER_NONE }}' + devices: "{{ CVP_DEVICES_PARENT_CONTAINER_NONE }}" state: present - ignore_errors: yes + ignore_errors: true register: MOVE_DEVICE_NONE - name: Negative Test Check Move Device With Parent Container None - assert: + ansible.builtin.assert: that: - MOVE_DEVICE_NONE.msg == "The target container 'None' for the device 's1-leaf1' does not exist on CVP." - MOVE_DEVICE_NONE.changed == false @@ -96,13 +96,13 @@ - name: Run CV_DEVICE_V3 To Move Device With Parent Container Same arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_MOVE_DEVICE }}' + devices: "{{ CVP_DEVICES_MOVE_DEVICE }}" state: present - ignore_errors: yes + ignore_errors: true register: MOVE_DEVICE - name: Negative Test Check Move Device With Same Parent Container - assert: + ansible.builtin.assert: that: - MOVE_DEVICE.devices_moved.changed == false - MOVE_DEVICE.devices_moved.devices_moved_count == 0 @@ -118,7 +118,7 @@ # moving device to undefined container - name: Run CV_DEVICE_V3 With State Provisioning Reset arista.cvp.cv_device_v3: - devices: '{{ CVP_DEVICES_PROVISIONING_RESET }}' + devices: "{{ CVP_DEVICES_PROVISIONING_RESET }}" state: provisioning_reset register: PROVISIONING_RESET_RESULT @@ -132,14 +132,14 @@ validate_mode: stop_on_error register: CVP_DEVICES_RESULTS - - name: "Resetting original state for device {{ DEVICE_NAME }}" + - name: Resetting original state for device {{ DEVICE_NAME }} arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_DEPLOY}}' + devices: "{{ CVP_DEVICES_DEPLOY }}" state: present register: CV_DEVICE_V3_RESULT - - name: "Checking if the reset was successful" - assert: + - name: Checking if the reset was successful + ansible.builtin.assert: that: - CV_DEVICE_V3_RESULT.changed == true - CV_DEVICE_V3_RESULT.devices_deployed.changed == true @@ -151,10 +151,10 @@ - name: Execute Task for deploy_Device arista.cvp.cv_task_v3: tasks: - - "{{CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0]}}" + - "{{ CV_DEVICE_V3_RESULT.devices_deployed.taskIds[0] }}" when: CVP_DEVICES_RESULTS.success is true - name: Remove Container arista.cvp.cv_container_v3: - topology: '{{ CONTAINER }}' + topology: "{{ CONTAINER }}" state: absent diff --git a/ansible_collections/arista/cvp/molecule/cv_facts_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_facts_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_facts_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_facts_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_cv_facts_v3.yml b/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_cv_facts_v3.yml index f7175437d..7714c5d66 100644 --- a/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_cv_facts_v3.yml +++ b/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_cv_facts_v3.yml @@ -2,18 +2,18 @@ - name: Test cv_facts_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: - DEVICE_NAME: "s1-leaf1" + DEVICE_NAME: s1-leaf1 CONTAINER: Test_Leafs: parentContainerName: Tenant - CONTAINER_NAME: "Test_Leafs" + CONTAINER_NAME: Test_Leafs CVP_CONFIGLETS: - configlet1: 'alias a{{ 999 | random }} show lldp' + configlet1: alias a{{ 999 | random }} show lldp CVP_DEVICES_MOVE_DEVICE: - fqdn: s1-leaf1 @@ -23,42 +23,46 @@ - fqdn: s1-leaf1 parentContainerName: "{{CV_FACTS_V3_RESULT_ORG.data.cvp_devices[0].parentContainerName}}" - TASK_STATUS: "Pending" + TASK_STATUS: Pending - CONFIGLET_NAME: "configlet1" + CONFIGLET_NAME: configlet1 tasks: - - name: Collect devices facts from {{inventory_hostname}} + - name: Collect devices facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE_NAME}}" + regexp_filter: "{{ DEVICE_NAME }}" register: CV_FACTS_V3_RESULT_ORG # push configlet to be used in verifying configlet facts - - name: "Push config" + - name: Push config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: present # Creating a container - - name: Build Container On {{inventory_hostname}} + - name: Build Container On {{ inventory_hostname }} arista.cvp.cv_container_v3: - topology: '{{CONTAINER}}' + topology: "{{ CONTAINER }}" # Running move_device to create a task - name: Run Move Device to create a task arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_MOVE_DEVICE}}' + devices: "{{ CVP_DEVICES_MOVE_DEVICE }}" state: present register: MOVE_DEVICE_RESULT - - name: Collect facts from {{inventory_hostname}} + - name: Print + ansible.builtin.debug: + msg: "{{ MOVE_DEVICE_RESULT }}" + + - name: Collect facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -68,15 +72,15 @@ - CV_FACTS_V3_RESULT.data.cvp_images != [] - CV_FACTS_V3_RESULT.data.cvp_tasks != [] - - name: Collect facts for a specific configlet from {{inventory_hostname}} + - name: Collect facts for a specific configlet from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - configlets - regexp_filter: "{{CONFIGLET_NAME}}" # using regexp_filter + regexp_filter: "{{ CONFIGLET_NAME }}" # using regexp_filter register: CV_FACTS_V3_RESULT - name: Check cv_facts for a specific configlet - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -86,14 +90,14 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_configlets.configlet1 is defined - - name: Collect facts for containers from {{inventory_hostname}} + - name: Collect facts for containers from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - containers register: CV_FACTS_V3_RESULT - name: Check cv_facts for containers - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -103,28 +107,28 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_containers != [] - - name: Collect facts for specific container from {{inventory_hostname}} + - name: Collect facts for specific container from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - containers - regexp_filter: "{{CONTAINER_NAME}}" + regexp_filter: "{{ CONTAINER_NAME }}" register: CV_FACTS_V3_RESULT - name: Check cv_facts for containers - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.data.cvp_containers.Test_Leafs is defined - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false - - name: Collect devices facts from {{inventory_hostname}} + - name: Collect devices facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - devices register: CV_FACTS_V3_RESULT - name: Check cv_facts for devices - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -134,15 +138,15 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_devices != [] - - name: Collect devices facts from {{inventory_hostname}} with verbose short + - name: Collect devices facts from {{ inventory_hostname }} with verbose short arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE_NAME}}" + regexp_filter: "{{ DEVICE_NAME }}" register: CV_FACTS_V3_RESULT - name: Check cv_facts for device with verbose short - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -152,16 +156,16 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_devices[0].hostname == "s1-leaf1" - - name: Collect devices facts from {{inventory_hostname}} with verbose long + - name: Collect devices facts from {{ inventory_hostname }} with verbose long arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE_NAME}}" + regexp_filter: "{{ DEVICE_NAME }}" verbose: long register: CV_FACTS_V3_RESULT - name: Check cv_facts for device with verbose long - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.failed == false @@ -172,14 +176,14 @@ - CV_FACTS_V3_RESULT.data.cvp_devices[0].hostname == "s1-leaf1" - CV_FACTS_V3_RESULT.data.cvp_devices[0].deviceStatus == "Registered" # we get this key only with verbose long - - name: Collect images facts from {{inventory_hostname}} + - name: Collect images facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - - images # collects all images facts + - images # collects all images facts register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 result - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.data.cvp_configlets == [] @@ -188,14 +192,14 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_images != [] - - name: Collect task facts from {{inventory_hostname}} + - name: Collect task facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - tasks register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 result - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.data.cvp_configlets == [] @@ -205,16 +209,16 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks != [] - CV_FACTS_V3_RESULT.data.cvp_tasks.total_tasks is defined - - name: Collect task facts from {{inventory_hostname}} + - name: Collect task facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - tasks - regexp_filter: "{{TASK_STATUS}}" # filtered by status + regexp_filter: "{{ TASK_STATUS }}" # filtered by status verbose: long register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 result - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.data.cvp_configlets == [] @@ -224,15 +228,15 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks != [] - CV_FACTS_V3_RESULT.data.cvp_tasks.total_tasks is defined - - name: Collect task facts from {{inventory_hostname}} + - name: Collect task facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - tasks - regexp_filter: "{{MOVE_DEVICE_RESULT.devices_moved.taskIds[0]}}" # filtered by task id + regexp_filter: "{{ MOVE_DEVICE_RESULT.devices_deployed.taskIds[0] }}" # filtered by task id register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 result - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.data.cvp_configlets == [] @@ -244,27 +248,27 @@ - name: Delete config arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLETS}}" + configlets: "{{ CVP_CONFIGLETS }}" state: absent - name: Cancel Pending Tasks arista.cvp.cv_task_v3: - tasks: "{{MOVE_DEVICE_RESULT.devices_moved.taskIds[0]}}" + tasks: "{{ MOVE_DEVICE_RESULT.devices_deployed.taskIds[0] }}" state: cancelled # Running move_device to empty the container - name: Run Move Device to empty the container arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_MOVE_DEVICE_BACK}}' + devices: "{{ CVP_DEVICES_MOVE_DEVICE_BACK }}" state: present register: MOVE_DEVICE_RESULT - name: Remove Container arista.cvp.cv_container_v3: - topology: '{{CONTAINER}}' + topology: "{{ CONTAINER }}" state: absent - name: Cancel Pending Tasks arista.cvp.cv_task_v3: - tasks: "{{MOVE_DEVICE_RESULT.devices_moved.taskIds[0]}}" + tasks: "{{ MOVE_DEVICE_RESULT.devices_deployed.taskIds[0] }}" state: cancelled diff --git a/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_image_facts.yml b/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_image_facts.yml index 3360bad6d..d8b9f7d35 100644 --- a/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_image_facts.yml +++ b/ansible_collections/arista/cvp/molecule/cv_facts_v3/test_image_facts.yml @@ -2,39 +2,39 @@ - name: Test cv_facts_v3 hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: ansible_command_timeout: 1200 ansible_connect_timeout: 600 - image_name: "vEOS-lab-4.30.1F.swi" # image file should be present - bundle_name: "Test_bundle" + image_name: vEOS-lab-4.30.1F.swi # image file should be present + bundle_name: Test_bundle tasks: - #Upload image - - name: "Upload EOS image to {{inventory_hostname}}" + # Upload image + - name: Upload EOS image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{image_name}}" + image: "{{ image_name }}" - #Create bundle - - name: "Create bundle {{inventory_hostname}}" + # Create bundle + - name: Create bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: add - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" + - "{{ image_name }}" - - name: Collect images facts from {{inventory_hostname}} filtered by name + - name: Collect images facts from {{ inventory_hostname }} filtered by name arista.cvp.cv_facts_v3: facts: - images - regexp_filter: "{{image_name}}" # collects specific image facts + regexp_filter: "{{ image_name }}" # collects specific image facts register: CV_FACTS_V3_RESULT - name: Check cv_facts_v3 result - assert: + ansible.builtin.assert: that: - CV_FACTS_V3_RESULT.changed == false - CV_FACTS_V3_RESULT.data.cvp_configlets == [] @@ -43,10 +43,10 @@ - CV_FACTS_V3_RESULT.data.cvp_tasks == [] - CV_FACTS_V3_RESULT.data.cvp_images['vEOS-lab-4.30.1F.swi'] is defined - - name: "Delete bundle {{inventory_hostname}}" + - name: Delete bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: remove - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" + - "{{ image_name }}" diff --git a/ansible_collections/arista/cvp/molecule/cv_image_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_image_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_image_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_image_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_bundle_upload.yml b/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_bundle_upload.yml index f2b069d5f..58fb0c695 100644 --- a/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_bundle_upload.yml +++ b/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_bundle_upload.yml @@ -2,155 +2,155 @@ - name: Test cv_image_v3_bundle_upload hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: # Make sure given image does not exist on CVP - image_name: "vEOS-lab-4.25.5M.swi" - extension_name: "TerminAttr-1.25.1-1.swix" - extension_name_2: "TerminAttr-1.26.0-1.swix" - bundle_name: "Test_bundle" + image_name: vEOS-lab-4.25.5M.swi + extension_name: TerminAttr-1.25.1-1.swix + extension_name_2: TerminAttr-1.26.0-1.swix + bundle_name: Test_bundle ansible_command_timeout: 1200 ansible_connect_timeout: 600 bundle_query: "[?name=='{{bundle_name}}']" delete_bundle_query: "[?name!='{{bundle_name}}']" tasks: - - #Upload image and extension - - name: "Upload EOS image to {{inventory_hostname}}" + # Upload image and extension + - name: Upload EOS image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{image_name}}" + image: "{{ image_name }}" - - name: "Upload TerminAttr image to {{inventory_hostname}}" + - name: Upload TerminAttr image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{extension_name}}" + image: "{{ extension_name }}" - - name: "Upload Second TerminAttr image to {{inventory_hostname}}" + - name: Upload Second TerminAttr image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{extension_name_2}}" + image: "{{ extension_name_2 }}" - #Create bundle - - name: "Create bundle {{inventory_hostname}}" + # Create bundle + - name: Create bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: add - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" - - "{{extension_name}}" - - "{{extension_name_2}}" + - "{{ image_name }}" + - "{{ extension_name }}" + - "{{ extension_name_2 }}" register: CREATE_BUNDLE_DATA - - name: "Check create bundle" + - name: Check create bundle vars: - bundle_data_check: "Bundle : {{bundle_name}} successfully created" - assert: + bundle_data_check: "Bundle : {{ bundle_name }} successfully created" + ansible.builtin.assert: that: - CREATE_BUNDLE_DATA.changed == true - - CREATE_BUNDLE_DATA.data.data == "{{bundle_data_check}}" + - CREATE_BUNDLE_DATA.data.data == "{{ bundle_data_check }}" - CREATE_BUNDLE_DATA.failed == false - - name: "Gather CVP bundle information facts {{inventory_hostname}} for create bundle" + - name: Gather CVP bundle information facts {{ inventory_hostname }} for create bundle arista.cvp.cv_image_v3: mode: bundle action: get register: BUNDLE_DATA - name: Fetch the tested bundle information for create bundle - set_fact: + ansible.builtin.set_fact: test_bundle: "{{ BUNDLE_DATA.data.bundles | json_query(bundle_query) | first }}" - - name: "Check create bundle with images and extensions" - assert: + - name: Check create bundle with images and extensions + ansible.builtin.assert: that: - BUNDLE_DATA.changed == false - - test_bundle.name == "{{bundle_name}}" - - test_bundle.imageIds == ["{{image_name}}", "{{extension_name}}", "{{extension_name_2}}"] + - test_bundle.name == "{{ bundle_name }}" + - test_bundle.imageIds == ["{{ image_name }}", "{{ extension_name }}", "{{ extension_name_2 }}"] - - name: "Update bundle {{inventory_hostname}}" + - name: Update bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: add - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" - - "{{extension_name}}" + - "{{ image_name }}" + - "{{ extension_name }}" register: UPDATE_BUNDLE_DATA - - name: "Check update bundle" - assert: + - name: Check update bundle + ansible.builtin.assert: that: - UPDATE_BUNDLE_DATA.changed == true - UPDATE_BUNDLE_DATA.data.data == "Image bundle updated successfully." - UPDATE_BUNDLE_DATA.failed == false - - name: "Gather CVP bundle information facts {{inventory_hostname}} for update bundle" + - name: Gather CVP bundle information facts {{ inventory_hostname }} for update bundle arista.cvp.cv_image_v3: mode: bundle action: get register: BUNDLE_DATA_UPDATE - name: Fetch the tested bundle information - set_fact: + ansible.builtin.set_fact: test_bundle_update: "{{ BUNDLE_DATA_UPDATE.data.bundles | json_query(bundle_query) | first }}" - - name: "Check update bundle with images and extension" - assert: + - name: Check update bundle with images and extension + ansible.builtin.assert: that: - BUNDLE_DATA_UPDATE.changed == false - - test_bundle_update.name == "{{bundle_name}}" - - test_bundle_update.imageIds == ["{{image_name}}", "{{extension_name}}"] + - test_bundle_update.name == "{{ bundle_name }}" + - test_bundle_update.imageIds == ["{{ image_name }}", "{{ extension_name }}"] - - name: "Delete bundle {{inventory_hostname}}" + - name: Delete bundle {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: remove - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" - - "{{extension_name}}" + - "{{ image_name }}" + - "{{ extension_name }}" register: DELETE_BUNDLE - - name: "Check delete bundle" - assert: + - name: Check delete bundle + ansible.builtin.assert: that: - DELETE_BUNDLE.changed == true - DELETE_BUNDLE.data.data == "success" - DELETE_BUNDLE.failed == false - - name: "Gather CVP bundle information facts {{inventory_hostname}} for delete bundle" + - name: Gather CVP bundle information facts {{ inventory_hostname }} for delete bundle arista.cvp.cv_image_v3: mode: bundle action: get register: DELETED_BUNDLE_DATA - name: Fetch the deleted bundle information - set_fact: + ansible.builtin.set_fact: delete_bundle: "{{ DELETED_BUNDLE_DATA.data.bundles | json_query(delete_bundle_query) | first }}" - - name: "Check delete bundle with images and extensions" - assert: + - name: Check delete bundle with images and extensions + ansible.builtin.assert: that: - - delete_bundle.name != "{{bundle_name}}" - - delete_bundle.imageIds != ["{{image_name}}", "{{extension_name}}"] + - delete_bundle.name != "{{ bundle_name }}" + - delete_bundle.imageIds != ["{{ image_name }}", "{{ extension_name }}"] - - name: "Negative test: Create bundle with multiple images {{inventory_hostname}}" + - name: Negative test - Create bundle with multiple images {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: bundle action: add - bundle_name: "{{bundle_name}}" + bundle_name: "{{ bundle_name }}" image_list: - - "{{image_name}}" - - "{{image_name}}" - ignore_errors: yes + - "{{ image_name }}" + - "{{ image_name }}" + ignore_errors: true register: NEGATIVE_BUNDLE_DATA - - assert: + - name: Assert Negative test - Create bundle with multiple images {{ inventory_hostname }} + ansible.builtin.assert: that: - NEGATIVE_BUNDLE_DATA.changed == false - NEGATIVE_BUNDLE_DATA.msg == "Request Error: Failure - Only one swi image can be uploaded per bundle." diff --git a/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_image_upload.yml b/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_image_upload.yml index fe828f5db..4c788aef0 100644 --- a/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_image_upload.yml +++ b/ansible_collections/arista/cvp/molecule/cv_image_v3/test_cv_image_v3_image_upload.yml @@ -2,95 +2,97 @@ - name: Test cv_image_v3_image_upload hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: # Make sure given image does not exist on CVP - image1_name: "vEOS-lab-4.25.5M.swi" - image2_name: "vEOS-lab-4.26.0F.swi" - extension1_name: "TerminAttr-1.25.1-1.swix" - extension2_name: "TerminAttr-1.26.0-1.swix" + image1_name: vEOS-lab-4.25.5M.swi + image2_name: vEOS-lab-4.26.0F.swi + extension1_name: TerminAttr-1.25.1-1.swix + extension2_name: TerminAttr-1.26.0-1.swix ansible_command_timeout: 1200 ansible_connect_timeout: 600 image1_query: "[?name=='{{image1_name}}']" tasks: - #Upload image1 - - name: "Upload EOS image to {{inventory_hostname}}" + # Upload image1 + - name: Upload EOS image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{image1_name}}" + image: "{{ image1_name }}" register: ADD_IMAGE - - name: "Check Adding an image" - assert: + - name: Check Adding an image + ansible.builtin.assert: that: - ADD_IMAGE.changed == true - ADD_IMAGE.data.result == "success" - - ADD_IMAGE.data.imageId == "{{image1_name}}" - - ADD_IMAGE.data.name == "{{image1_name}}" + - ADD_IMAGE.data.imageId == "{{ image1_name }}" + - ADD_IMAGE.data.name == "{{ image1_name }}" - ADD_IMAGE.failed == false - - name: "Gather CVP image information facts {{inventory_hostname}} for add image" + - name: Gather CVP image information facts {{ inventory_hostname }} for add image arista.cvp.cv_image_v3: mode: image action: get register: IMAGE_DATA - name: Fetch the tested image information - set_fact: - image_data: "{{ IMAGE_DATA.data.images | json_query(image1_query) | first}}" + ansible.builtin.set_fact: + image_data: "{{ IMAGE_DATA.data.images | json_query(image1_query) | first }}" - - name: "Check adding an image with parameters" - assert: + - name: Check adding an image with parameters + ansible.builtin.assert: that: - - image_data.imageFileName == "{{image1_name}}" - - image_data.imageId == "{{image1_name}}" - - image_data.name == "{{image1_name}}" + - image_data.imageFileName == "{{ image1_name }}" + - image_data.imageId == "{{ image1_name }}" + - image_data.name == "{{ image1_name }}" - - name: "Upload EOS image2 to {{inventory_hostname}}" + - name: Upload EOS image2 to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{image2_name}}" + image: "{{ image2_name }}" - - name: "Upload TerminAttr image to {{inventory_hostname}}" + - name: Upload TerminAttr image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{extension1_name}}" + image: "{{ extension1_name }}" - - name: "Upload Second TerminAttr image to {{inventory_hostname}}" + - name: Upload Second TerminAttr image to {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{extension2_name}}" + image: "{{ extension2_name }}" - - name: "Negative test: Add image already exists {{inventory_hostname}}" + - name: Negative test - Add image already exists {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: add - image: "{{image1_name}}" - ignore_errors: yes + image: "{{ image1_name }}" + ignore_errors: true register: NEGATIVE_ADD_IMAGE - - assert: + - name: Assert negative test - Add image already exists {{ inventory_hostname }} + ansible.builtin.assert: that: - NEGATIVE_ADD_IMAGE.changed == false - NEGATIVE_ADD_IMAGE.data == {} - NEGATIVE_ADD_IMAGE.failed == false -# ##################################################################### -# ##### Deletion of images through API is not supported currently ##### -# ##################################################################### + # ##################################################################### + # ##### Deletion of images through API is not supported currently ##### + # ##################################################################### - - name: "Negative test: Delete an image {{inventory_hostname}}" + - name: Negative test - Delete an image {{ inventory_hostname }} arista.cvp.cv_image_v3: mode: image action: remove - image: "{{image1_name}}" - ignore_errors: yes + image: "{{ image1_name }}" + ignore_errors: true register: DELETE_IMAGE - - assert: + - name: Assert Negative test - Delete an image {{ inventory_hostname }} + ansible.builtin.assert: that: - DELETE_IMAGE.changed == false - DELETE_IMAGE.msg == "Deletion of images through API is not currently supported" diff --git a/ansible_collections/arista/cvp/molecule/cv_tag_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_tag_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_tag_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_tag_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_device.yml b/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_device.yml index e1a76b70e..2880b82f9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_device.yml +++ b/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_device.yml @@ -2,7 +2,7 @@ - name: Test cv_tag_v3 for device tags hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: DEVICE1: s1-leaf3 DEVICE2: s1-leaf4 @@ -43,13 +43,13 @@ tasks: - name: Assign non-existing device tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: assign auto_create: true register: AUTO_CREATE_ASSIGN_TAGS - name: Check assign non-existing device tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_ASSIGN_TAGS.changed == true - AUTO_CREATE_ASSIGN_TAGS.failed == false @@ -59,12 +59,12 @@ - name: Unassign auto-create device tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: unassign register: AUTO_CREATE_UNASSIGN_TAGS - name: Check unassign auto-create device tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_UNASSIGN_TAGS.changed == true - AUTO_CREATE_UNASSIGN_TAGS.failed == false @@ -74,12 +74,12 @@ - name: Delete auto_create device tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: delete register: AUTO_CREATE_TAGS_DELETE - name: Check delete auto_create device tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_TAGS_DELETE.changed == true - AUTO_CREATE_TAGS_DELETE.failed == false @@ -87,16 +87,16 @@ - AUTO_CREATE_TAGS_DELETE.tags_manager.tags_manager_list != [] - AUTO_CREATE_TAGS_DELETE.tags_manager.tags_manager_count == 1 -# Create -> assign -> unassign -> delete + # Create -> assign -> unassign -> delete - name: Create device tags (part of CREATE -> assign -> unassign -> delete) arista.cvp.cv_tag_v3: - tags: "{{CREATE_TAGS}}" + tags: "{{ CREATE_TAGS }}" mode: create register: TAGS_CREATE - name: Check create device tags - assert: + ansible.builtin.assert: that: - TAGS_CREATE.changed == true - TAGS_CREATE.failed == false @@ -106,12 +106,12 @@ - name: Assign existing device tags (part of create -> ASSIGN -> unassign -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: assign register: ASSIGN_EXISTING - name: Check assign existing device tags - assert: + ansible.builtin.assert: that: - ASSIGN_EXISTING.changed == true - ASSIGN_EXISTING.failed == false @@ -121,12 +121,12 @@ - name: Unassign existing device tags (part of create -> assign -> UNASSIGN -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: unassign register: UNASSIGN_EXISTING - name: Check unassign existing device tags - assert: + ansible.builtin.assert: that: - UNASSIGN_EXISTING.changed == true - UNASSIGN_EXISTING.failed == false @@ -136,12 +136,12 @@ - name: Delete device tags (part of create -> assign -> unassign -> DELETE) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: delete register: TAGS_DELETE - name: Check delete device tags - assert: + ansible.builtin.assert: that: - TAGS_DELETE.changed == true - TAGS_DELETE.failed == false @@ -149,16 +149,16 @@ - TAGS_DELETE.tags_manager.tags_manager_list != [] - TAGS_DELETE.tags_manager.tags_manager_count == 1 -# Create -> assign -> delete + # Create -> assign -> delete - name: Create device tags (part of CREATE -> assign -> delete) arista.cvp.cv_tag_v3: - tags: "{{CREATE_TAGS}}" + tags: "{{ CREATE_TAGS }}" mode: create register: TAGS_CREATE - name: Check create device tags - assert: + ansible.builtin.assert: that: - TAGS_CREATE.changed == true - TAGS_CREATE.failed == false @@ -168,12 +168,12 @@ - name: Assign existing device tags (part of create -> ASSIGN -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: assign register: ASSIGN_EXISTING - name: Check assign existing device tags - assert: + ansible.builtin.assert: that: - ASSIGN_EXISTING.changed == true - ASSIGN_EXISTING.failed == false @@ -183,12 +183,12 @@ - name: Delete device tags (part of create -> assign -> DELETE) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: delete register: TAGS_DELETE - name: Check delete device tags - assert: + ansible.builtin.assert: that: - TAGS_DELETE.changed == true - TAGS_DELETE.failed == false diff --git a/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_interface.yml b/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_interface.yml index ad1de20f6..187045407 100644 --- a/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_interface.yml +++ b/ansible_collections/arista/cvp/molecule/cv_tag_v3/test_cv_tag_v3_interface.yml @@ -2,7 +2,7 @@ - name: Test cv_tag_v3 for interface tags hosts: CloudVision connection: local - gather_facts: no + gather_facts: false vars: DEVICE1: s1-leaf3 DEVICE2: s1-leaf4 @@ -11,18 +11,18 @@ - device: "{{DEVICE1}}" interface_tags: - tags: - - name: s1-leaf3AutoAssignEth1 - value: s1-leaf3AutoAssignEth1 + - name: s1-leaf3AutoAssignEth1 + value: s1-leaf3AutoAssignEth1 interface: Ethernet1 - tags: - - name: s1-leaf3AutoAssignEth2 - value: s1-leaf3AutoAssignEth2 + - name: s1-leaf3AutoAssignEth2 + value: s1-leaf3AutoAssignEth2 interface: Ethernet2 - device: "{{DEVICE2}}" interface_tags: - tags: - - name: s1-leaf4IntfAutoAssignEth1 - value: s1-leaf4IntfAutoAssignEth1 + - name: s1-leaf4IntfAutoAssignEth1 + value: s1-leaf4IntfAutoAssignEth1 interface: Ethernet1 CREATE_TAGS: @@ -39,38 +39,38 @@ - device: "{{DEVICE1}}" interface_tags: - tags: - - name: s1-leaf3CreateTagEth1 - value: s1-leaf3CreateTagEth1 + - name: s1-leaf3CreateTagEth1 + value: s1-leaf3CreateTagEth1 interface: Ethernet1 - tags: - - name: s1-leaf3CreateTagEth2 - value: s1-leaf3CreateTagEth2 + - name: s1-leaf3CreateTagEth2 + value: s1-leaf3CreateTagEth2 interface: Ethernet2 - device: "{{DEVICE2}}" interface_tags: - tags: - - name: s1-leaf4CreateTagEth1 - value: s1-leaf4CreateTagEth1 + - name: s1-leaf4CreateTagEth1 + value: s1-leaf4CreateTagEth1 interface: Ethernet1 - # ASSIGN_DELETE_NON_EXISTING_TAGS: - # - device: leaf1.atd.lab - # interface_tags: - # - tags: - # - name: leaf1NegativeEth1 - # value: leaf1NegativeEth1 - # interface: Ethernet1 + # ASSIGN_DELETE_NON_EXISTING_TAGS: + # - device: leaf1.atd.lab + # interface_tags: + # - tags: + # - name: leaf1NegativeEth1 + # value: leaf1NegativeEth1 + # interface: Ethernet1 tasks: - name: Assign non-existing interface tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: assign auto_create: true register: AUTO_CREATE_ASSIGN_TAGS - name: Check assign non-existing interface tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_ASSIGN_TAGS.changed == true - AUTO_CREATE_ASSIGN_TAGS.failed == false @@ -80,12 +80,12 @@ - name: Unassign non-existing interface tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: unassign register: AUTO_CREATE_UNASSIGN_TAGS - name: Check unassign non-existing interface tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_UNASSIGN_TAGS.changed == true - AUTO_CREATE_UNASSIGN_TAGS.failed == false @@ -95,12 +95,12 @@ - name: Delete auto_create interface tags arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_DELETE_TAGS_AUTO_CREATE}}" + tags: "{{ ASSIGN_DELETE_TAGS_AUTO_CREATE }}" mode: delete register: AUTO_CREATE_TAGS_DELETE - name: Check auto_create delete interface tags - assert: + ansible.builtin.assert: that: - AUTO_CREATE_TAGS_DELETE.changed == true - AUTO_CREATE_TAGS_DELETE.failed == false @@ -108,16 +108,16 @@ - AUTO_CREATE_TAGS_DELETE.tags_manager.tags_manager_list != [] - AUTO_CREATE_TAGS_DELETE.tags_manager.tags_manager_count == 1 -# Create -> assign -> unassign -> delete + # Create -> assign -> unassign -> delete - name: Create interface tags (part of CREATE -> assign -> unassign -> delete) arista.cvp.cv_tag_v3: - tags: "{{CREATE_TAGS}}" + tags: "{{ CREATE_TAGS }}" mode: create register: TAGS_CREATE - name: Check create interface tags - assert: + ansible.builtin.assert: that: - TAGS_CREATE.changed == true - TAGS_CREATE.failed == false @@ -127,12 +127,12 @@ - name: Assign existing interface tags (part of create -> ASSIGN -> unassign -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: assign register: ASSIGN_EXISTING - name: Check assign existing interface tags - assert: + ansible.builtin.assert: that: - ASSIGN_EXISTING.changed == true - ASSIGN_EXISTING.failed == false @@ -142,12 +142,12 @@ - name: Unassign existing interface tags (part of create -> assign -> UNASSIGN -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: unassign register: UNASSIGN_EXISTING - name: Check unassign existing interface tags - assert: + ansible.builtin.assert: that: - UNASSIGN_EXISTING.changed == true - UNASSIGN_EXISTING.failed == false @@ -157,12 +157,12 @@ - name: Delete interface tags (part of create -> assign -> unassign -> DELETE) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: delete register: TAGS_DELETE - name: Check delete interface tags - assert: + ansible.builtin.assert: that: - TAGS_DELETE.changed == true - TAGS_DELETE.failed == false @@ -170,16 +170,16 @@ - TAGS_DELETE.tags_manager.tags_manager_list != [] - TAGS_DELETE.tags_manager.tags_manager_count == 1 -# Create -> assign -> delete + # Create -> assign -> delete - name: Create interface tags (part of CREATE -> assign -> delete) arista.cvp.cv_tag_v3: - tags: "{{CREATE_TAGS}}" + tags: "{{ CREATE_TAGS }}" mode: create register: TAGS_CREATE - name: Check create interface tags - assert: + ansible.builtin.assert: that: - TAGS_CREATE.changed == true - TAGS_CREATE.failed == false @@ -189,12 +189,12 @@ - name: Assign existing interface tags (part of create -> ASSIGN -> delete) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: assign register: ASSIGN_EXISTING - name: Check assign existing interface tags - assert: + ansible.builtin.assert: that: - ASSIGN_EXISTING.changed == true - ASSIGN_EXISTING.failed == false @@ -204,12 +204,12 @@ - name: Delete interface tags (part of create -> assign -> DELETE) arista.cvp.cv_tag_v3: - tags: "{{ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS}}" + tags: "{{ ASSIGN_UNASSIGN_DELETE_EXISTING_TAGS }}" mode: delete register: TAGS_DELETE - name: Check delete interface tags - assert: + ansible.builtin.assert: that: - TAGS_DELETE.changed == true - TAGS_DELETE.failed == false diff --git a/ansible_collections/arista/cvp/molecule/cv_task_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_task_v3/molecule.yml index 79248ffed..6aea1ecb9 100644 --- a/ansible_collections/arista/cvp/molecule/cv_task_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_task_v3/molecule.yml @@ -11,9 +11,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/cv_task_v3/test_cv_task_v3.yml b/ansible_collections/arista/cvp/molecule/cv_task_v3/test_cv_task_v3.yml index ab0831cea..68d0cb238 100644 --- a/ansible_collections/arista/cvp/molecule/cv_task_v3/test_cv_task_v3.yml +++ b/ansible_collections/arista/cvp/molecule/cv_task_v3/test_cv_task_v3.yml @@ -3,27 +3,25 @@ hosts: CloudVision connection: local gather_facts: false - collections: - - arista.cvp vars: - DEVICE1: "s1-leaf1" + DEVICE1: s1-leaf1 - DEVICE2: "s1-leaf2" + DEVICE2: s1-leaf2 CVP_DEVICES_MOVE_DEVICE_EXECUTE: - - fqdn: "{{DEVICE1}}" - parentContainerName: "Temp_Leafs" + - fqdn: "{{ DEVICE1 }}" + parentContainerName: Temp_Leafs CVP_DEVICES_MOVE_DEVICE_CANCEL: - - fqdn: "{{DEVICE2}}" - parentContainerName: "Temp_Leafs" + - fqdn: "{{ DEVICE2 }}" + parentContainerName: Temp_Leafs CVP_DEVICES_MOVE_ORIGINAL_LOCATION: - - fqdn: "{{DEVICE1}}" + - fqdn: "{{ DEVICE1 }}" parentContainerName: "{{CV_FACTS_V3_RESULT1.data.cvp_devices[0].parentContainerName}}" - - fqdn: "{{DEVICE2}}" + - fqdn: "{{ DEVICE2 }}" parentContainerName: "{{CV_FACTS_V3_RESULT2.data.cvp_devices[0].parentContainerName}}" containers: @@ -31,54 +29,58 @@ parentContainerName: Tenant tasks: - - name: Collect devices facts from {{inventory_hostname}} + - name: Collect devices facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE1}}" + regexp_filter: "{{ DEVICE1 }}" register: CV_FACTS_V3_RESULT1 - - name: Collect devices facts from {{inventory_hostname}} + - name: Collect devices facts from {{ inventory_hostname }} arista.cvp.cv_facts_v3: facts: - devices - regexp_filter: "{{DEVICE2}}" + regexp_filter: "{{ DEVICE2 }}" register: CV_FACTS_V3_RESULT2 # Create test container - name: Create test container arista.cvp.cv_container_v3: - topology: "{{containers}}" + topology: "{{ containers }}" state: present # Running move_device to create task list - name: Run CV_DEVICE_V3 To Move Device For Execute Task arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_MOVE_DEVICE_EXECUTE}}' - state: present + devices: "{{ CVP_DEVICES_MOVE_DEVICE_EXECUTE }}" + state: present register: MOVE_DEVICE_DATA_EXECUTE + - name: Print + ansible.builtin.debug: + msg: "{{ MOVE_DEVICE_DATA_EXECUTE }}" + - name: Execute Task arista.cvp.cv_task_v3: tasks: - - "{{MOVE_DEVICE_DATA_EXECUTE.devices_moved.taskIds[0]}}" + - "{{ MOVE_DEVICE_DATA_EXECUTE.devices_moved.taskIds[0] }}" register: EXECUTE_TASK_DATA - name: Pause for 20 seconds to Execute Task ansible.builtin.pause: seconds: 20 - - name: Collect task facts from {{inventory_hostname}} filtered by task_id + - name: Collect task facts from {{ inventory_hostname }} filtered by task_id arista.cvp.cv_facts_v3: facts: - tasks - regexp_filter: "{{MOVE_DEVICE_DATA_EXECUTE.devices_moved.taskIds[0]}}" + regexp_filter: "{{ MOVE_DEVICE_DATA_EXECUTE.devices_moved.taskIds[0] }}" register: CV_FACTS_V3_RESULT - name: Testing Execute Task vars: CV_FACTS_ORDER_STATUS: "{{ CV_FACTS_V3_RESULT['data']['cvp_tasks'][MOVE_DEVICE_DATA_EXECUTE.devices_moved.taskIds[0]]['workOrderUserDefinedStatus'] }}" - assert: + ansible.builtin.assert: that: - EXECUTE_TASK_DATA.actions_manager.changed == true - EXECUTE_TASK_DATA.actions_manager.actions_manager_count == 1 @@ -87,13 +89,13 @@ - name: Run CV_DEVICE_V3 To Move Device For Cancel Task arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_MOVE_DEVICE_CANCEL}}' - state: present + devices: "{{ CVP_DEVICES_MOVE_DEVICE_CANCEL }}" + state: present register: MOVE_DEVICE_DATA_CANCEL - name: Cancel Pending Tasks arista.cvp.cv_task_v3: - tasks: "{{MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0]}}" + tasks: "{{ MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0] }}" state: cancelled register: CANCEL_TASK_DATA @@ -101,17 +103,18 @@ ansible.builtin.pause: seconds: 5 - - name: Collect task facts from {{inventory_hostname}} filtered by task_id + - name: Collect task facts from {{ inventory_hostname }} filtered by task_id arista.cvp.cv_facts_v3: facts: - tasks - regexp_filter: "{{MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0]}}" + regexp_filter: "{{ MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0] }}" register: CV_FACTS_V3_RESULT_CANCEL - name: Testing Cancel Task vars: - CV_FACTS_ORDER_STATUS_CANCEL: "{{ CV_FACTS_V3_RESULT_CANCEL['data']['cvp_tasks'][MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0]]['workOrderUserDefinedStatus'] }}" - assert: + CV_FACTS_ORDER_STATUS_CANCEL: "{{ CV_FACTS_V3_RESULT_CANCEL['data']['cvp_tasks'][MOVE_DEVICE_DATA_CANCEL.devices_moved.taskIds[0]]['workOrderUserDefinedStatus'] + }}" + ansible.builtin.assert: that: - CANCEL_TASK_DATA.actions_manager.changed == true - CANCEL_TASK_DATA.actions_manager.actions_manager_count == 1 @@ -119,32 +122,32 @@ - CV_FACTS_ORDER_STATUS_CANCEL == "Cancelled" # Running move_device to create task list - - name: move devices back to their original location + - name: Move devices back to their original location arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES_MOVE_ORIGINAL_LOCATION}}' - state: present + devices: "{{ CVP_DEVICES_MOVE_ORIGINAL_LOCATION }}" + state: present register: MOVE_DEVICE_OG_LOC - name: Execute Task arista.cvp.cv_task_v3: - tasks: "{{MOVE_DEVICE_OG_LOC.devices_moved.taskIds}}" + tasks: "{{ MOVE_DEVICE_OG_LOC.devices_moved.taskIds }}" register: EXECUTE_TASK_DATA - name: Pause for 20 seconds to Execute Task ansible.builtin.pause: seconds: 20 - - name: Collect task facts from {{inventory_hostname}} filtered by task_id + - name: Collect task facts from {{ inventory_hostname }} filtered by task_id arista.cvp.cv_facts_v3: facts: - tasks - regexp_filter: "{{MOVE_DEVICE_OG_LOC.devices_moved.taskIds[0]}}" + regexp_filter: "{{ MOVE_DEVICE_OG_LOC.devices_moved.taskIds[0] }}" register: CV_FACTS_V3_RESULT_OG - name: Executing tasks and testing results vars: CV_FACTS_ORDER_STATUS: "{{ CV_FACTS_V3_RESULT_OG['data']['cvp_tasks'][MOVE_DEVICE_OG_LOC.devices_moved.taskIds[0]]['workOrderUserDefinedStatus'] }}" - assert: + ansible.builtin.assert: that: - EXECUTE_TASK_DATA.actions_manager.changed == true - EXECUTE_TASK_DATA.actions_manager.actions_manager_count == 2 @@ -154,5 +157,5 @@ # Remove test container - name: Delete test container arista.cvp.cv_container_v3: - topology: "{{containers}}" + topology: "{{ containers }}" state: absent diff --git a/ansible_collections/arista/cvp/molecule/cv_validate_v3/device_validate_config.yaml b/ansible_collections/arista/cvp/molecule/cv_validate_v3/device_validate_config.yaml index 5107ced88..5b8cda504 100644 --- a/ansible_collections/arista/cvp/molecule/cv_validate_v3/device_validate_config.yaml +++ b/ansible_collections/arista/cvp/molecule/cv_validate_v3/device_validate_config.yaml @@ -6,60 +6,61 @@ vars: CVP_DEVICES_WARNING_CVP: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] cvp_configlets: - validate_warning CVP_DEVICES_WARNING_LOCAL: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: validate_warning_local: "interface Ethernet1\n spanning-tree portfast" CVP_DEVICES_ERROR_CVP: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] cvp_configlets: - validate_error CVP_DEVICES_ERROR_LOCAL: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: validate_error_local: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" CVP_DEVICES_VALID_CVP: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] cvp_configlets: - validate_valid CVP_DEVICES_VALID_LOCAL: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: validate_valid_local: "interface Ethernet1\n description test_validate" CVP_DEVICES_MULTILINE_CVP: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] cvp_configlets: - validate_error_multiline CVP_DEVICES_MULTILINE_LOCAL: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: - validate_error_multiline_LOCAL: "interface Ethernet1\n description test\n!\n\nruter bgp 1111\n neighbor 1.1.1.1 remote-bs 10\n!\ninterface Ethernet1\n spanning-tree portfast\n!" + validate_error_multiline_LOCAL: "interface Ethernet1\n description test\n!\n\nruter bgp 1111\n neighbor 1.1.1.1 remote-bs 10\n!\ninterface Ethernet1\n\ + \ spanning-tree portfast\n!" CVP_DEVICES_MULTIPLE_CVP: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] cvp_configlets: - - validate_error - - validate_valid - - validate_warning + - validate_error + - validate_valid + - validate_warning CVP_DEVICES_MULTIPLE_LOCAL: - device_name: s1-leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: validate_warning_local: "interface Ethernet1\n spanning-tree portfast" validate_valid_local: "interface Ethernet1\n description test_validate" @@ -67,24 +68,24 @@ CVP_MULTIDEVICE_WARNING_IGNORE_CVP: - device_name: s1-leaf1 - search_type: serialNumber #[hostname | serialNumber | fqdn] + search_type: serialNumber # [hostname | serialNumber | fqdn] cvp_configlets: - configlet1_warning - configlet2_error - device_name: s1-leaf2 - search_type: serialNumber #[hostname | serialNumber | fqdn] + search_type: serialNumber # [hostname | serialNumber | fqdn] cvp_configlets: - configlet1_warning - configlet2_error CVP_MULTIDEVICE_WARNING_IGNORE_LOCAL: - device_name: s1-leaf1 - search_type: serialNumber #[hostname | serialNumber | fqdn] + search_type: serialNumber # [hostname | serialNumber | fqdn] local_configlets: configlet1_warning: "interface Ethernet1\n spanning-tree portfast" configlet2_error: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" - device_name: s1-leaf2 - search_type: serialNumber #[hostname | serialNumber | fqdn] + search_type: serialNumber # [hostname | serialNumber | fqdn] local_configlets: configlet1_warning: "interface Ethernet2\n spanning-tree portfast" configlet2_error: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" @@ -93,441 +94,563 @@ validate_warning: "interface Ethernet1\n spanning-tree portfast" validate_valid: "interface Ethernet1\n description test_validate" validate_error: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" - validate_error_multiline: "interface Ethernet1\n description test\n!\n\nruter bgp 1111\n neighbor 1.1.1.1 remote-bs 10\n!\ninterface Ethernet1\n spanning-tree portfast\n!" + validate_error_multiline: "interface Ethernet1\n description test\n!\n\nruter bgp 1111\n neighbor 1.1.1.1 remote-bs 10\n!\ninterface Ethernet1\n spanning-tree + portfast\n!" configlet1_warning: "interface Ethernet1\n spanning-tree portfast" configlet2_error: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" tasks: - - name: "Push configlet" - arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLET}}" - state: present - -##################################### -# WARNING CONFIGLET # -##################################### - - - name: Validate CVP warning configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_CVP}}" - validate_mode: stop_on_error - register: STOP_ON_ERROR_WARNING_CONFIG_CVP - - assert: - that: - - "STOP_ON_ERROR_WARNING_CONFIG_CVP.failed == false" - - "STOP_ON_ERROR_WARNING_CONFIG_CVP.success == true" - - "STOP_ON_ERROR_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_ERROR_WARNING_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_ERROR - - - name: Validate LOCAL warning configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_LOCAL}}" - validate_mode: stop_on_error - register: STOP_ON_ERROR_WARNING_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_ERROR_WARNING_CONFIG_LOCAL.failed == false" - - "STOP_ON_ERROR_WARNING_CONFIG_LOCAL.success == true" - - "STOP_ON_ERROR_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_ERROR_WARNING_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_ERROR - - - name: Validate CVP warning configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_CVP}}" - validate_mode: stop_on_warning - ignore_errors: yes # ignoring errors so assertions can be done - register: STOP_ON_WARNING_WARNING_CONFIG_CVP - - assert: - that: - - "STOP_ON_WARNING_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_WARNING_WARNING_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_WARNING - - - name: Validate LOCAL warning configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_LOCAL}}" - validate_mode: stop_on_warning - ignore_errors: yes # ignoring errors so assertions can be done - register: STOP_ON_WARNING_WARNING_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_WARNING_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_WARNING_WARNING_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_WARNING - - - name: Validate CVP warning configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_CVP}}" - validate_mode: ignore - register: IGNORE_WARNING_CONFIG_CVP - - assert: - that: - - "IGNORE_WARNING_CONFIG_CVP.failed == false" - - "IGNORE_WARNING_CONFIG_CVP.success == true" - - "IGNORE_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_WARNING_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_IGNORE - - - name: Validate LOCAL warning configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_WARNING_LOCAL}}" - validate_mode: ignore - register: IGNORE_WARNING_CONFIG_LOCAL - - assert: - that: - - "IGNORE_WARNING_CONFIG_LOCAL.failed == false" - - "IGNORE_WARNING_CONFIG_LOCAL.success == true" - - "IGNORE_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_WARNING_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_IGNORE - -##################################### -# ERROR CONFIGLET # -##################################### - - - name: Validate CVP error configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_CVP}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_ERROR_CONFIG_CVP - - assert: - that: - - "STOP_ON_ERROR_ERROR_CONFIG_CVP.configlets_validated.warnings == []" - - "STOP_ON_ERROR_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_ERROR - - - name: Validate LOCAL error configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_LOCAL}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_ERROR_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_ERROR_ERROR_CONFIG_LOCAL.configlets_validated.warnings == []" - - "STOP_ON_ERROR_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_ERROR - - - name: Validate CVP error configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_CVP}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNING_ERROR_CONFIG_CVP - - assert: - that: - - "STOP_ON_WARNING_ERROR_CONFIG_CVP.configlets_validated.warnings == []" - - "STOP_ON_WARNING_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_WARNING - - - name: Validate LOCAL error configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_LOCAL}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNING_ERROR_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_WARNING_ERROR_CONFIG_LOCAL.configlets_validated.warnings == []" - - "STOP_ON_WARNING_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_WARNING - - - name: Validate CVP error configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_CVP}}" - validate_mode: ignore - register: IGNORE_ERROR_CONFIG_CVP - - assert: - that: - - "IGNORE_ERROR_CONFIG_CVP.failed == false" - - "IGNORE_ERROR_CONFIG_CVP.success == true" - - "IGNORE_ERROR_CONFIG_CVP.configlets_validated.warnings == []" - - "IGNORE_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_IGNORE - - - name: Validate LOCAL error configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_ERROR_LOCAL}}" - validate_mode: ignore - register: IGNORE_ERROR_CONFIG_LOCAL - - assert: - that: - - "IGNORE_ERROR_CONFIG_LOCAL.failed == false" - - "IGNORE_ERROR_CONFIG_LOCAL.success == true" - - "IGNORE_ERROR_CONFIG_LOCAL.configlets_validated.warnings == []" - - "IGNORE_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_IGNORE - -##################################### -# VALID CONFIGLET # -##################################### - - - name: Validate CVP valid configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_CVP}}" - validate_mode: stop_on_error - register: STOP_ON_ERROR_VALID_CONFIG_CVP - - assert: - that: - - "STOP_ON_ERROR_VALID_CONFIG_CVP.failed == false" - - "STOP_ON_ERROR_VALID_CONFIG_CVP.success == true" - - "STOP_ON_ERROR_VALID_CONFIG_CVP.configlets_validated.warnings == []" - - "STOP_ON_ERROR_VALID_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_CVP_ASSERT_ERROR - - - name: Validate LOCAL valid configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_LOCAL}}" - validate_mode: stop_on_error - register: STOP_ON_ERROR_VALID_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_ERROR_VALID_CONFIG_LOCAL.failed == false" - - "STOP_ON_ERROR_VALID_CONFIG_LOCAL.success == true" - - "STOP_ON_ERROR_VALID_CONFIG_LOCAL.configlets_validated.warnings == []" - - "STOP_ON_ERROR_VALID_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_ERROR - - - name: Validate CVP valid configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_CVP}}" - validate_mode: stop_on_warning - register: STOP_ON_WARNING_VALID_CONFIG_CVP - - assert: - that: - - "STOP_ON_WARNING_VALID_CONFIG_CVP.failed == false" - - "STOP_ON_WARNING_VALID_CONFIG_CVP.success == true" - - "STOP_ON_WARNING_VALID_CONFIG_CVP.configlets_validated.warnings == []" - - "STOP_ON_WARNING_VALID_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_CVP_ASSERT_WARNING - - - name: Validate LOCAL valid configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_LOCAL}}" - validate_mode: stop_on_warning - register: STOP_ON_WARNING_VALID_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_WARNING_VALID_CONFIG_LOCAL.failed == false" - - "STOP_ON_WARNING_VALID_CONFIG_LOCAL.success == true" - - "STOP_ON_WARNING_VALID_CONFIG_LOCAL.configlets_validated.warnings == []" - - "STOP_ON_WARNING_VALID_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_WARNING - - - name: Validate CVP valid configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_CVP}}" - validate_mode: ignore - register: IGNORE_VALID_CONFIG_CVP - - assert: - that: - - "IGNORE_VALID_CONFIG_CVP.failed == false" - - "IGNORE_VALID_CONFIG_CVP.success == true" - - "IGNORE_VALID_CONFIG_CVP.configlets_validated.warnings == []" - - "IGNORE_VALID_CONFIG_CVP.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_CVP_ASSERT_IGNORE - - - name: Validate LOCAL valid configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_VALID_LOCAL}}" - validate_mode: ignore - register: IGNORE_VALID_CONFIG_LOCAL - - assert: - that: - - "IGNORE_VALID_CONFIG_LOCAL.failed == false" - - "IGNORE_VALID_CONFIG_LOCAL.success == true" - - "IGNORE_VALID_CONFIG_LOCAL.configlets_validated.warnings == []" - - "IGNORE_VALID_CONFIG_LOCAL.configlets_validated.errors == []" - register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_IGNORE - -##################################### -# MULTILINE CONFIGLET # -#################################### - - - name: Validate CVP multiline configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_CVP}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_MULTILINE_CONFIG_CVP - - - assert: - that: - - "STOP_ON_ERROR_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "STOP_ON_ERROR_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_ERROR - - - name: Validate LOCAL multiline configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_LOCAL}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_ERROR - - - name: Validate CVP multiline configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_CVP}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNING_MULTILINE_CONFIG_CVP - - assert: - that: - - "STOP_ON_WARNING_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "STOP_ON_WARNING_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_WARNING - - - name: Validate LOCAL multiline configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_LOCAL}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_WARNING - - - name: Validate CVP multiline configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_CVP}}" - validate_mode: ignore - register: IGNORE_MULTILINE_CONFIG_CVP - - - assert: - that: - - "IGNORE_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "IGNORE_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_IGNORE - - - name: Validate LOCAL multiline configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTILINE_LOCAL}}" - validate_mode: ignore - register: IGNORE_MULTILINE_CONFIG_LOCAL - - assert: - that: - - "IGNORE_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" - - "IGNORE_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" - register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_IGNORE - -###################################### -## MULTIPLE CONFIGLET # -###################################### - - name: Validate CVP multiple configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_CVP}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_MULTIPLE_CONFIG_CVP - - assert: - that: - - "STOP_ON_ERROR_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_ERROR_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_ERROR - - - name: Validate LOCAL multiple configlet with stop_on_error - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_LOCAL}}" - validate_mode: stop_on_error - ignore_errors: yes - register: STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_ERROR - - - name: Validate CVP multiple configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_CVP}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNING_MULTIPLE_CONFIG_CVP - - assert: - that: - - "STOP_ON_WARNING_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_WARNING_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_WARNING - - - name: Validate LOCAL multiple configlet with stop_on_warning - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_LOCAL}}" - validate_mode: stop_on_warning - ignore_errors: yes - register: STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL - - assert: - that: - - "STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_WARNING - - - name: Validate CVP multiple configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_CVP}}" - validate_mode: ignore - register: IGNORE_MULTIPLE_CONFIG_CVP - - assert: - that: - - "IGNORE_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_IGNORE - - - name: Validate LOCAL multiple configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES_MULTIPLE_LOCAL}}" - validate_mode: ignore - register: IGNORE_MULTIPLE_CONFIG_LOCAL - - assert: - that: - - "IGNORE_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_IGNORE - -#################################################### -# MULTIPLE DEVICE WARNING CONFIGLET # -#################################################### - - - name: Validate LOCAL multiple device mutliple configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_MULTIDEVICE_WARNING_IGNORE_LOCAL}}" - validate_mode: ignore - register: IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL - - assert: - that: - - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.failed == false" - - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.success == true" - - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'configlet1_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}, {'device': 's1-leaf2', 'configlet_name': 'configlet1_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}, {'device': 's1-leaf2', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: WARNING_CONFIG_MULTIPLE_DEVICE_LOCAL_ASSERT_IGNORE - - - name: Validate CVP multiple device mutliple configlet with ignore - arista.cvp.cv_validate_v3: - devices: "{{CVP_MULTIDEVICE_WARNING_IGNORE_CVP}}" - validate_mode: ignore - register: IGNORE_MULTIPLE_DEVICE_WARNING_CVP - - assert: - that: - - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.failed == false" - - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.success == true" - - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'configlet1_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}, {'device': 's1-leaf2', 'configlet_name': 'configlet1_warning', 'warnings': ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" - - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}, {'device': 's1-leaf2', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" - register: WARNING_CONFIG_MULTIPLE_DEVICE_CVP_ASSERT_IGNORE - - - name: write log file - template: - src: log.j2 - dest: "{{ playbook_dir }}/device_validate_config_LOG.log" - - - name: "Delete config" - arista.cvp.cv_configlet_v3: - configlets: "{{CVP_CONFIGLET}}" - state: absent + - name: Push configlet + arista.cvp.cv_configlet_v3: + configlets: "{{ CVP_CONFIGLET }}" + state: present + + ##################################### + # WARNING CONFIGLET # + ##################################### + + - name: Validate CVP warning configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_CVP }}" + validate_mode: stop_on_error + register: STOP_ON_ERROR_WARNING_CONFIG_CVP + - name: Assert - Validate CVP warning configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_WARNING_CONFIG_CVP.failed == false + - STOP_ON_ERROR_WARNING_CONFIG_CVP.success == true + - "STOP_ON_ERROR_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - STOP_ON_ERROR_WARNING_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_ERROR + + - name: Validate LOCAL warning configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_LOCAL }}" + validate_mode: stop_on_error + register: STOP_ON_ERROR_WARNING_CONFIG_LOCAL + - name: Assert - Validate LOCAL warning configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_WARNING_CONFIG_LOCAL.failed == false + - STOP_ON_ERROR_WARNING_CONFIG_LOCAL.success == true + - "STOP_ON_ERROR_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! + portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast + is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - STOP_ON_ERROR_WARNING_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_ERROR + + - name: Validate CVP warning configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_CVP }}" + validate_mode: stop_on_warning + ignore_errors: true # ignoring errors so assertions can be done + register: STOP_ON_WARNING_WARNING_CONFIG_CVP + - name: Assert - Validate CVP warning configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNING_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - STOP_ON_WARNING_WARNING_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_WARNING + + - name: Validate LOCAL warning configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_LOCAL }}" + validate_mode: stop_on_warning + ignore_errors: true # ignoring errors so assertions can be done + register: STOP_ON_WARNING_WARNING_CONFIG_LOCAL + - name: Assert - Validate LOCAL warning configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNING_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - STOP_ON_WARNING_WARNING_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_WARNING + + - name: Validate CVP warning configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_CVP }}" + validate_mode: ignore + register: IGNORE_WARNING_CONFIG_CVP + - name: Assert - Validate CVP warning configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_WARNING_CONFIG_CVP.failed == false + - IGNORE_WARNING_CONFIG_CVP.success == true + - "IGNORE_WARNING_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should + only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled + can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - IGNORE_WARNING_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_CVP_ASSERT_IGNORE + + - name: Validate LOCAL warning configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_WARNING_LOCAL }}" + validate_mode: ignore + register: IGNORE_WARNING_CONFIG_LOCAL + - name: Assert - Validate LOCAL warning configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_WARNING_CONFIG_LOCAL.failed == false + - IGNORE_WARNING_CONFIG_LOCAL.success == true + - "IGNORE_WARNING_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - IGNORE_WARNING_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_WARNING_LOCAL_ASSERT_IGNORE + + ##################################### + # ERROR CONFIGLET # + ##################################### + + - name: Validate CVP error configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_CVP }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_ERROR_CONFIG_CVP + - name: Assert - Validate CVP error configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_ERROR_CONFIG_CVP.configlets_validated.warnings == [] + - "STOP_ON_ERROR_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter + bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: + '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_ERROR + + - name: Validate LOCAL error configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_LOCAL }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_ERROR_CONFIG_LOCAL + - name: Assert - Validate LOCAL error configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_ERROR_CONFIG_LOCAL.configlets_validated.warnings == [] + - "STOP_ON_ERROR_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_ERROR + + - name: Validate CVP error configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_CVP }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNING_ERROR_CONFIG_CVP + - name: Assert - Validate CVP error configlet with stop_on_warning + ansible.builtin.assert: + that: + - STOP_ON_WARNING_ERROR_CONFIG_CVP.configlets_validated.warnings == [] + - "STOP_ON_WARNING_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> + ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token + 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_WARNING + + - name: Validate LOCAL error configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_LOCAL }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNING_ERROR_CONFIG_LOCAL + - name: Assert - Validate LOCAL error configlet with stop_on_warning + ansible.builtin.assert: + that: + - STOP_ON_WARNING_ERROR_CONFIG_LOCAL.configlets_validated.warnings == [] + - "STOP_ON_WARNING_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_WARNING + + - name: Validate CVP error configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_CVP }}" + validate_mode: ignore + register: IGNORE_ERROR_CONFIG_CVP + - name: Assert - Validate CVP error configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_ERROR_CONFIG_CVP.failed == false + - IGNORE_ERROR_CONFIG_CVP.success == true + - IGNORE_ERROR_CONFIG_CVP.configlets_validated.warnings == [] + - "IGNORE_ERROR_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter bgp + 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') + at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_CVP_ASSERT_IGNORE + + - name: Validate LOCAL error configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_ERROR_LOCAL }}" + validate_mode: ignore + register: IGNORE_ERROR_CONFIG_LOCAL + - name: Assert - Validate LOCAL error configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_ERROR_CONFIG_LOCAL.failed == false + - IGNORE_ERROR_CONFIG_LOCAL.success == true + - IGNORE_ERROR_CONFIG_LOCAL.configlets_validated.warnings == [] + - "IGNORE_ERROR_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"> ruter + bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: + '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_ERROR_LOCAL_ASSERT_IGNORE + + ##################################### + # VALID CONFIGLET # + ##################################### + + - name: Validate CVP valid configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_CVP }}" + validate_mode: stop_on_error + register: STOP_ON_ERROR_VALID_CONFIG_CVP + - name: Assert - Validate CVP valid configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_VALID_CONFIG_CVP.failed == false + - STOP_ON_ERROR_VALID_CONFIG_CVP.success == true + - STOP_ON_ERROR_VALID_CONFIG_CVP.configlets_validated.warnings == [] + - STOP_ON_ERROR_VALID_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_CVP_ASSERT_ERROR + + - name: Validate LOCAL valid configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_LOCAL }}" + validate_mode: stop_on_error + register: STOP_ON_ERROR_VALID_CONFIG_LOCAL + - name: Assert - Validate LOCAL valid configlet with stop_on_error + ansible.builtin.assert: + that: + - STOP_ON_ERROR_VALID_CONFIG_LOCAL.failed == false + - STOP_ON_ERROR_VALID_CONFIG_LOCAL.success == true + - STOP_ON_ERROR_VALID_CONFIG_LOCAL.configlets_validated.warnings == [] + - STOP_ON_ERROR_VALID_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_ERROR + + - name: Validate CVP valid configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_CVP }}" + validate_mode: stop_on_warning + register: STOP_ON_WARNING_VALID_CONFIG_CVP + - name: Assert - Validate CVP valid configlet with stop_on_warning + ansible.builtin.assert: + that: + - STOP_ON_WARNING_VALID_CONFIG_CVP.failed == false + - STOP_ON_WARNING_VALID_CONFIG_CVP.success == true + - STOP_ON_WARNING_VALID_CONFIG_CVP.configlets_validated.warnings == [] + - STOP_ON_WARNING_VALID_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_CVP_ASSERT_WARNING + + - name: Validate LOCAL valid configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_LOCAL }}" + validate_mode: stop_on_warning + register: STOP_ON_WARNING_VALID_CONFIG_LOCAL + - name: Assert - Validate LOCAL valid configlet with stop_on_warning + ansible.builtin.assert: + that: + - STOP_ON_WARNING_VALID_CONFIG_LOCAL.failed == false + - STOP_ON_WARNING_VALID_CONFIG_LOCAL.success == true + - STOP_ON_WARNING_VALID_CONFIG_LOCAL.configlets_validated.warnings == [] + - STOP_ON_WARNING_VALID_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_WARNING + + - name: Validate CVP valid configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_CVP }}" + validate_mode: ignore + register: IGNORE_VALID_CONFIG_CVP + - name: Assert - Validate CVP valid configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_VALID_CONFIG_CVP.failed == false + - IGNORE_VALID_CONFIG_CVP.success == true + - IGNORE_VALID_CONFIG_CVP.configlets_validated.warnings == [] + - IGNORE_VALID_CONFIG_CVP.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_CVP_ASSERT_IGNORE + + - name: Validate LOCAL valid configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_VALID_LOCAL }}" + validate_mode: ignore + register: IGNORE_VALID_CONFIG_LOCAL + - name: Assert - Validate LOCAL valid configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_VALID_CONFIG_LOCAL.failed == false + - IGNORE_VALID_CONFIG_LOCAL.success == true + - IGNORE_VALID_CONFIG_LOCAL.configlets_validated.warnings == [] + - IGNORE_VALID_CONFIG_LOCAL.configlets_validated.errors == [] + register: VALIDATE_CONFIG_VALID_LOCAL_ASSERT_IGNORE + + ##################################### + # MULTILINE CONFIGLET # + #################################### + + - name: Validate CVP multiline configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_CVP }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_MULTILINE_CONFIG_CVP + + - name: Assert - Validate CVP multiline configlet with stop_on_error + ansible.builtin.assert: + that: + - "STOP_ON_ERROR_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "STOP_ON_ERROR_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at + token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_ERROR + + - name: Validate LOCAL multiline configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_LOCAL }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiline configlet with stop_on_error + ansible.builtin.assert: + that: + - "STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "STOP_ON_ERROR_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': + [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid + input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_ERROR + + - name: Validate CVP multiline configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_CVP }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNING_MULTILINE_CONFIG_CVP + - name: Assert - Validate CVP multiline configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNING_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "STOP_ON_WARNING_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at + token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_WARNING + + - name: Validate LOCAL multiline configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_LOCAL }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiline configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "STOP_ON_WARNING_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': + [{'error': \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid + input (at token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_WARNING + + - name: Validate CVP multiline configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_CVP }}" + validate_mode: ignore + register: IGNORE_MULTILINE_CONFIG_CVP + + - name: Assert - Validate CVP multiline configlet with ignore + ansible.builtin.assert: + that: + - "IGNORE_MULTILINE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "IGNORE_MULTILINE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at + token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_CVP_ASSERT_IGNORE + + - name: Validate LOCAL multiline configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTILINE_LOCAL }}" + validate_mode: ignore + register: IGNORE_MULTILINE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiline configlet with ignore + ansible.builtin.assert: + that: + - "IGNORE_MULTILINE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 9']}]" + - "IGNORE_MULTILINE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_multiline_LOCAL', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 5\", 'lineNo': ' 5'}, {'error': \"> neighbor 1.1.1.1 remote-bs 10% Invalid input (at + token 0: 'neighbor') at line 6\", 'lineNo': ' 6'}]}]" + register: VALIDATE_CONFIG_MULTILINE_LOCAL_ASSERT_IGNORE + + ###################################### + ## MULTIPLE CONFIGLET # + ###################################### + - name: Validate CVP multiple configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_CVP }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_MULTIPLE_CONFIG_CVP + - name: Assert - Validate CVP multiple configlet with stop_on_error + ansible.builtin.assert: + that: + - "STOP_ON_ERROR_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "STOP_ON_ERROR_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \" + > ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_ERROR + + - name: Validate LOCAL multiple configlet with stop_on_error + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_LOCAL }}" + validate_mode: stop_on_error + ignore_errors: true + register: STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiple configlet with stop_on_error + ansible.builtin.assert: + that: + - "STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "STOP_ON_ERROR_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_ERROR + + - name: Validate CVP multiple configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_CVP }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNING_MULTIPLE_CONFIG_CVP + - name: Assert - Validate CVP multiple configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNING_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "STOP_ON_WARNING_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"\ + > ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_WARNING + + - name: Validate LOCAL multiple configlet with stop_on_warning + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_LOCAL }}" + validate_mode: stop_on_warning + ignore_errors: true + register: STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiple configlet with stop_on_warning + ansible.builtin.assert: + that: + - "STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "STOP_ON_WARNINIG_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_WARNING + + - name: Validate CVP multiple configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_CVP }}" + validate_mode: ignore + register: IGNORE_MULTIPLE_CONFIG_CVP + - name: Assert - Validate CVP multiple configlet with ignore + ansible.builtin.assert: + that: + - "IGNORE_MULTIPLE_CONFIG_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning', 'warnings': ['! portfast should + only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is enabled + can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "IGNORE_MULTIPLE_CONFIG_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error', 'errors': [{'error': \"> ruter + bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: + '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_CVP_ASSERT_IGNORE + + - name: Validate LOCAL multiple configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_DEVICES_MULTIPLE_LOCAL }}" + validate_mode: ignore + register: IGNORE_MULTIPLE_CONFIG_LOCAL + - name: Assert - Validate LOCAL multiple configlet with ignore + ansible.builtin.assert: + that: + - "IGNORE_MULTIPLE_CONFIG_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'validate_warning_local', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "IGNORE_MULTIPLE_CONFIG_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'validate_error_local', 'errors': [{'error': \"\ + > ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}]" + register: VALIDATE_CONFIG_MULTIPLE_LOCAL_ASSERT_IGNORE + + #################################################### + # MULTIPLE DEVICE WARNING CONFIGLET # + #################################################### + + - name: Validate LOCAL multiple device mutliple configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_MULTIDEVICE_WARNING_IGNORE_LOCAL }}" + validate_mode: ignore + register: IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL + - name: Assert - Validate LOCAL multiple device mutliple configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.failed == false + - IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.success == true + - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'configlet1_warning', 'warnings': ['! + portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast + is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}, {'device': 's1-leaf2', 'configlet_name': 'configlet1_warning', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "IGNORE_MULTIPLE_DEVICE_WARNING_LOCAL.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'configlet2_error', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}, {'device': 's1-leaf2', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% + Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') + at line 2\", 'lineNo': ' 2'}]}]" + register: WARNING_CONFIG_MULTIPLE_DEVICE_LOCAL_ASSERT_IGNORE + + - name: Validate CVP multiple device mutliple configlet with ignore + arista.cvp.cv_validate_v3: + devices: "{{ CVP_MULTIDEVICE_WARNING_IGNORE_CVP }}" + validate_mode: ignore + register: IGNORE_MULTIPLE_DEVICE_WARNING_CVP + - name: Assert - Validate CVP multiple device mutliple configlet with ignore + ansible.builtin.assert: + that: + - IGNORE_MULTIPLE_DEVICE_WARNING_CVP.failed == false + - IGNORE_MULTIPLE_DEVICE_WARNING_CVP.success == true + - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.configlets_validated.warnings == [{'device': 's1-leaf1', 'configlet_name': 'configlet1_warning', 'warnings': ['! portfast + should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when portfast is + enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}, {'device': 's1-leaf2', 'configlet_name': 'configlet1_warning', 'warnings': + ['! portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc. to this interface when + portfast is enabled can cause temporary bridging loops. Use with CAUTION. at line 2']}]" + - "IGNORE_MULTIPLE_DEVICE_WARNING_CVP.configlets_validated.errors == [{'device': 's1-leaf1', 'configlet_name': 'configlet2_error', 'errors': [{'error': + \"> ruter bgp 1111% Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at + token 1: '1.1.1.1') at line 2\", 'lineNo': ' 2'}]}, {'device': 's1-leaf2', 'configlet_name': 'configlet2_error', 'errors': [{'error': \"> ruter bgp 1111% + Invalid input (at token 0: 'ruter') at line 1\", 'lineNo': ' 1'}, {'error': \"> neighbor 1.1.1.1 remote-bs 111% Invalid input (at token 1: '1.1.1.1') + at line 2\", 'lineNo': ' 2'}]}]" + register: WARNING_CONFIG_MULTIPLE_DEVICE_CVP_ASSERT_IGNORE + + - name: Write log file + ansible.builtin.template: + src: log.j2 + dest: "{{ playbook_dir }}/device_validate_config_LOG.log" + mode: "0666" + + - name: Delete config + arista.cvp.cv_configlet_v3: + configlets: "{{ CVP_CONFIGLET }}" + state: absent diff --git a/ansible_collections/arista/cvp/molecule/cv_validate_v3/molecule.yml b/ansible_collections/arista/cvp/molecule/cv_validate_v3/molecule.yml index 9783c4692..cf856c41b 100644 --- a/ansible_collections/arista/cvp/molecule/cv_validate_v3/molecule.yml +++ b/ansible_collections/arista/cvp/molecule/cv_validate_v3/molecule.yml @@ -12,9 +12,9 @@ provisioner: name: ansible config_options: defaults: - jinja2_extensions: 'jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n' + jinja2_extensions: jinja2.ext.loopcontrols,jinja2.ext.do,jinja2.ext.i18n gathering: explicit - command_warnings: False + command_warnings: false remote_tmp: /tmp/.ansible-${USER}/tmp stdout_callback: yaml playbooks: diff --git a/ansible_collections/arista/cvp/molecule/fixtures/cv_device_v3.yaml b/ansible_collections/arista/cvp/molecule/fixtures/cv_device_v3.yaml deleted file mode 100644 index 01a72d99f..000000000 --- a/ansible_collections/arista/cvp/molecule/fixtures/cv_device_v3.yaml +++ /dev/null @@ -1,4 +0,0 @@ -- node: 192.168.0.5 - username: arista - password: "" - device: s1-leaf1 diff --git a/ansible_collections/arista/cvp/plugins/README.md b/ansible_collections/arista/cvp/plugins/README.md index 8d8bd35fe..45223cedf 100644 --- a/ansible_collections/arista/cvp/plugins/README.md +++ b/ansible_collections/arista/cvp/plugins/README.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/plugins/module_utils/change_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/change_tools.py index 768d92478..ae7e39fcb 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/change_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/change_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/configlet_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/configlet_tools.py index 775c4516d..e0e3e4110 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/configlet_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/configlet_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/container_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/container_tools.py index 0fc62c9ab..9f2275824 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/container_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/container_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/device_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/device_tools.py index 3df8a055a..710ceddd2 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/device_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/device_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py index 427f45baf..ab7dfdd90 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/facts_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/generic_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/generic_tools.py index 31654cc5d..bc142dd92 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/generic_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/generic_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/image_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/image_tools.py index 11007980e..29d5035da 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/image_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/image_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/logger.py b/ansible_collections/arista/cvp/plugins/module_utils/logger.py index 7ea87a0b6..2126c6b46 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/logger.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/logger.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/resources/api/fields.py b/ansible_collections/arista/cvp/plugins/module_utils/resources/api/fields.py index 3aaeae2ae..fc495e3f6 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/resources/api/fields.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/resources/api/fields.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/resources/exceptions.py b/ansible_collections/arista/cvp/plugins/module_utils/resources/exceptions.py index 002ebe159..b90389523 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/resources/exceptions.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/resources/exceptions.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/resources/modules/fields.py b/ansible_collections/arista/cvp/plugins/module_utils/resources/modules/fields.py index 1807379fe..f78b61a16 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/resources/modules/fields.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/resources/modules/fields.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v1.py b/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v1.py index 043f35af0..d3e9c5294 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v1.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v1.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v3.py b/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v3.py index 23b6c46a8..6569a40df 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v3.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/resources/schemas/v3.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/response.py b/ansible_collections/arista/cvp/plugins/module_utils/response.py index 16bd5dc03..91f2c36d4 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/response.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/response.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/schema_v1.py b/ansible_collections/arista/cvp/plugins/module_utils/schema_v1.py index 2d79f4270..ddcb600e1 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/schema_v1.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/schema_v1.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py index 13acf7de2..10b43f281 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tag_tools.py @@ -1,9 +1,9 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- -# +# # pylint: disable=unknown-option-value from __future__ import (absolute_import, division, print_function) @@ -113,7 +113,6 @@ def tasker(self, tags: list, mode: string, auto_create: bool = True): # create tags and assign tags for per_device in tags: - if mode in ('assign', 'unassign', 'delete'): if 'device_id' in per_device: device_id = per_device['device_id'] diff --git a/ansible_collections/arista/cvp/plugins/module_utils/task_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/task_tools.py index c338833d5..f02374ccd 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/task_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/task_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tools.py b/ansible_collections/arista/cvp/plugins/module_utils/tools.py index 7d2fa4bf9..a1eaf31ac 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tools.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tools_cv.py b/ansible_collections/arista/cvp/plugins/module_utils/tools_cv.py index fe047b94d..c031474a9 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tools_cv.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tools_cv.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tools_inventory.py b/ansible_collections/arista/cvp/plugins/module_utils/tools_inventory.py index f0e0ff7b3..ca77bfa04 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tools_inventory.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tools_inventory.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tools_schema.py b/ansible_collections/arista/cvp/plugins/module_utils/tools_schema.py index 5a12b166d..a92a133cc 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tools_schema.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tools_schema.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/tools_tree.py b/ansible_collections/arista/cvp/plugins/module_utils/tools_tree.py index 4e5e591fb..c77b3f88d 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/tools_tree.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/tools_tree.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py b/ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py index 756cb3313..bc8e2de1f 100644 --- a/ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py +++ b/ansible_collections/arista/cvp/plugins/module_utils/validate_tools.py @@ -1,9 +1,9 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- -# +# pylint: disable=unknown-option-value from __future__ import (absolute_import, division, print_function) diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_change_control_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_change_control_v3.py index 472bd78f5..1c33e9882 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_change_control_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_change_control_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -49,7 +49,7 @@ --- - name: CVP Change Control Tests hosts: cv_server - gather_facts: no + gather_facts: false vars: ansible_command_timeout: 1200 ansible_connect_timeout: 600 @@ -135,7 +135,6 @@ arista.cvp.cv_change_control_v3: state: execute change_id: ["{{ cv_change_control.data.id }}"] - ''' # Required by Ansible and CVP diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_configlet.py b/ansible_collections/arista/cvp/plugins/modules/cv_configlet.py index d5dcb2f68..218f2d692 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_configlet.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_configlet.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -106,7 +106,7 @@ cvp_facts: "{{cvp_facts.ansible_facts}}" configlets: "{{configlet_list}}" configlets_notes: "Configlet managed by Ansible" - configlet_filter: ["New", "Test","base-chk","base-firewall"] + configlet_filter: ["New", "Test", "base-chk", "base-firewall"] register: cvp_configlet ''' diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_configlet_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_configlet_v3.py index dc13c0e19..b0e55c2f0 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_configlet_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_configlet_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -53,7 +53,7 @@ - name: Test cv_configlet_v3 hosts: cvp connection: local - gather_facts: no + gather_facts: false vars: configlet_list: Test_Configlet: "! This is a Very First Testing Configlet\n!" diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_container.py b/ansible_collections/arista/cvp/plugins/modules/cv_container.py index 456421903..72cabfca3 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_container.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_container.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -82,15 +82,15 @@ devices: - veos01 tasks: - - name: "Gather CVP facts {{inventory_hostname}}" + - name: "Gather CVP facts {{ inventory_hostname }}" cv_facts: register: cvp_facts - - name: "Build Container topology on {{inventory_hostname}}" + - name: "Build Container topology on {{ inventory_hostname }}" cv_container: - cvp_facts: "{{cvp_facts.ansible_facts}}" - topology: "{{containers}}" + cvp_facts: "{{ cvp_facts.ansible_facts }}" + topology: "{{ containers }}" mode: merge - register: CVP_CONTAINERS_RESULT + register: cvp_containers_result ''' import sys diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_container_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_container_v3.py index bad23fc8c..eeed79359 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_container_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_container_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -57,39 +57,39 @@ - name: Create container topology on CVP hosts: cvp connection: local - gather_facts: no + gather_facts: false vars: - verbose: False + verbose: false CVP_CONTAINERS: - Fabric: - parentContainerName: Tenant - Spines: - parentContainerName: Fabric - configlets: - - container_configlet + Fabric: + parentContainerName: Tenant + Spines: + parentContainerName: Fabric + configlets: + - container_configlet tasks: - - name: 'running cv_container' + - name: 'Running cv_container' arista.cvp.cv_container_v3: - topology: "{{CVP_CONTAINERS}}" + topology: "{{ CVP_CONTAINERS }}" # task in strict mode - name: Create container topology on CVP hosts: cvp connection: local - gather_facts: no + gather_facts: false vars: - verbose: False + verbose: false CVP_CONTAINERS: - Fabric: - parentContainerName: Tenant - Spines: - parentContainerName: Fabric - configlets: - - container_configlet + Fabric: + parentContainerName: Tenant + Spines: + parentContainerName: Fabric + configlets: + - container_configlet tasks: - - name: 'running cv_container' + - name: 'Running cv_container' arista.cvp.cv_container_v3: - topology: "{{CVP_CONTAINERS}}" + topology: "{{ CVP_CONTAINERS }}" apply_mode: strict ''' diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_device.py b/ansible_collections/arista/cvp/plugins/modules/cv_device.py index 4e71f9e69..e742f96f7 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_device.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_device.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_device_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_device_v3.py index 5a6b5639d..fe043bb29 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_device_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_device_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -60,19 +60,17 @@ hosts: cv_server connection: local gather_facts: false - collections: - - arista.cvp vars: CVP_DEVICES: - fqdn: CV-ANSIBLE-EOS01 parentContainerName: ANSIBLE configlets: - - 'CV-EOS-ANSIBLE01' + - 'CV-EOS-ANSIBLE01' imageBundle: leaf_image_bundle tasks: - - name: "Configure devices on {{inventory_hostname}}" + - name: "Configure devices on {{ inventory_hostname }}" arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + devices: '{{ CVP_DEVICES }}' state: present search_key: fqdn @@ -81,19 +79,17 @@ hosts: cv_server connection: local gather_facts: false - collections: - - arista.cvp vars: CVP_DEVICES: - fqdn: NON-EXISTING-DEVICE parentContainerName: ANSIBLE configlets: - - 'CV-EOS-ANSIBLE01' + - 'CV-EOS-ANSIBLE01' imageBundle: leaf_image_bundle tasks: - - name: "Configure devices on {{inventory_hostname}}" + - name: "Configure devices on {{ inventory_hostname }}" arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + devices: '{{ CVP_DEVICES }}' state: present search_key: fqdn inventory_mode: loose @@ -104,18 +100,16 @@ hosts: cv_server connection: local gather_facts: false - collections: - - arista.cvp vars: CVP_DEVICES: - serialNumber: xxxxxxxxxxxx parentContainerName: ANSIBLE configlets: - - 'CV-EOS-ANSIBLE01' + - 'CV-EOS-ANSIBLE01' tasks: - - name: "Configure devices on {{inventory_hostname}}" + - name: "Configure devices on {{ inventory_hostname }}" arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + devices: '{{ CVP_DEVICES }}' state: present search_key: serialNumber @@ -124,18 +118,16 @@ hosts: cv_server connection: local gather_facts: false - collections: - - arista.cvp vars: CVP_DEVICES: - fqdn: CV-ANSIBLE-EOS01 parentContainerName: ANSIBLE configlets: - - 'CV-EOS-ANSIBLE01' + - 'CV-EOS-ANSIBLE01' tasks: - - name: "Configure devices on {{inventory_hostname}}" + - name: "Configure devices on {{ inventory_hostname }}" arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + devices: '{{ CVP_DEVICES }}' state: present apply_mode: strict @@ -143,15 +135,15 @@ - name: Decommission device hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_DEVICES: - fqdn: leaf1 parentContainerName: "" tasks: - - name: decommission device - arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + - name: Decommission device + arista.cvp.cv_device_v3: + devices: '{{ CVP_DEVICES }}' state: absent # Remove a device from provisioning @@ -159,30 +151,30 @@ - name: Remove device hosts: CVP connection: local - gather_facts: no + gather_facts: false vars: CVP_DEVICES: - fqdn: leaf2 parentContainerName: "" tasks: - - name: remove device - arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + - name: Remove device + arista.cvp.cv_device_v3: + devices: '{{ CVP_DEVICES }}' state: provisioning_reset # Factory reset a device (moves the device to ZTP mode) - name: Factory reset device hosts: CVP connection: local - gather_facts: no + gather_facts: false vars: CVP_DEVICES: - fqdn: leaf2 parentContainerName: "" tasks: - - name: remove device - arista.cvp.cv_device_v3: - devices: '{{CVP_DEVICES}}' + - name: Remove device + arista.cvp.cv_device_v3: + devices: '{{ CVP_DEVICES }}' state: factory_reset ''' diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_facts.py b/ansible_collections/arista/cvp/plugins/modules/cv_facts.py index f1eec9abc..79397f12f 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_facts.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_facts.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # pylint: skip-file diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py index 92a3cb8c7..567773b07 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_facts_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -57,52 +57,57 @@ ''' EXAMPLES = r''' +- name: Collect Facts from CloudVision + hosts: cv_server + connection: local + gather_facts: false + tasks: - - name: '#01 - Collect devices facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - - - name: '#02 - Collect devices facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - configlets - register: FACTS_DEVICES - - - name: '#03 - Collect devices facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - devices - - containers - register: FACTS_DEVICES - - - name: '#04 - Collect devices facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - devices - regexp_filter: "spine1" - verbose: long - register: FACTS_DEVICES - - - name: '#05 - Collect images facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - images - register: FACTS_DEVICES - - - name: '#06 - Collect task facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - tasks - regexp_filter: 'Pending' # get facts filtered by task status - 'Failed', 'Pending', 'Completed', 'Cancelled' - verbose: 'long' - register: FACTS_DEVICES - - - name: '#07 - Collect task facts from {{inventory_hostname}}' - arista.cvp.cv_facts_v3: - facts: - - tasks - regexp_filter: 95 # get facts filtered by task_Id (int) - verbose: 'long' - register: FACTS_DEVICES + - name: '01 - Collect devices facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + + - name: '02 - Collect devices facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - configlets + register: FACTS_DEVICES + + - name: '03 - Collect devices facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - devices + - containers + register: FACTS_DEVICES + + - name: '04 - Collect devices facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - devices + regexp_filter: "spine1" + verbose: long + register: FACTS_DEVICES + + - name: '05 - Collect images facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - images + register: FACTS_DEVICES + + - name: '06 - Collect task facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - tasks + regexp_filter: 'Pending' # get facts filtered by task status - 'Failed', 'Pending', 'Completed', 'Cancelled' + verbose: 'long' + register: FACTS_DEVICES + + - name: '07 - Collect task facts from {{ inventory_hostname }}' + arista.cvp.cv_facts_v3: + facts: + - tasks + regexp_filter: 95 # get facts filtered by task_Id (int) + verbose: 'long' + register: FACTS_DEVICES ''' import logging diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_image_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_image_v3.py index 319b2ad41..1154a38fa 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_image_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_image_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -58,13 +58,13 @@ --- - name: CVP Image Tests hosts: cv_server - gather_facts: no + gather_facts: false vars: tasks: - name: "Gather CVP image information facts {{inventory_hostname}}" arista.cvp.cv_image_v3: - mode: image - action: get + mode: image + action: get register: image_data - name: "Print out facts from {{inventory_hostname}}" @@ -92,8 +92,8 @@ action: add bundle_name: Test_bundle image_list: - - TerminAttr-1.16.4-1.swix - - EOS-4.25.4M.swi + - TerminAttr-1.16.4-1.swix + - EOS-4.25.4M.swi ''' # Required by Ansible and CVP diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py index 7334f5a37..a276d1896 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_tag_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -42,10 +42,10 @@ EXAMPLES = r''' # Create and assign device and interface tags to multiple devices and interfaces -- name: cv_tag_v3 example1 +- name: Cv_tag_v3 example1 hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_TAGS: - device: leaf1 @@ -91,17 +91,17 @@ - name: tag6i value: value6i tasks: - - name: "create tags" + - name: "Create tags" arista.cvp.cv_tag_v3: - tags: "{{CVP_TAGS}}" + tags: "{{ CVP_TAGS }}" mode: assign auto_create: true # Delete device and interface tags using device_id -- name: cv_tag_v3 example2 +- name: Cv_tag_v3 example2 hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_TAGS: - device_id: JPE123435 @@ -114,16 +114,16 @@ - name: tag1i value: value1i tasks: - - name: "create tags" + - name: "Create tags" arista.cvp.cv_tag_v3: - tags: "{{CVP_TAGS}}" + tags: "{{ CVP_TAGS }}" mode: delete # Create device and interface tags (without assigning to the devices) using device_id -- name: cv_tag_v3 example3 +- name: Cv_tag_v3 example3 hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_TAGS: - device_id: JPE123435 @@ -136,16 +136,16 @@ - name: tag1i value: value1i tasks: - - name: "create tags" + - name: "Create tags" arista.cvp.cv_tag_v3: - tags: "{{CVP_TAGS}}" + tags: "{{ CVP_TAGS }}" mode: create # Assign device and interface tags -- name: cv_tag_v3 example4 +- name: Cv_tag_v3 example4 hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_TAGS: - device: leaf1 @@ -158,16 +158,16 @@ - name: tag1i value: value1i tasks: - - name: "create tags" + - name: "Create tags" arista.cvp.cv_tag_v3: - tags: "{{CVP_TAGS}}" + tags: "{{ CVP_TAGS }}" mode: assign # Unassign device and interface tags -- name: cv_tag_v3 example5 +- name: Cv_tag_v3 example5 hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_TAGS: - device: leaf1 @@ -180,9 +180,9 @@ - name: tag1i value: value1i tasks: - - name: "create tags" + - name: "Create tags" arista.cvp.cv_tag_v3: - tags: "{{CVP_TAGS}}" + tags: "{{ CVP_TAGS }}" mode: assign ''' diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_task.py b/ansible_collections/arista/cvp/plugins/modules/cv_task.py index 820f6139c..334940ef6 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_task.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_task.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_task_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_task_v3.py index 5417ce96b..b17ff09d2 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_task_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_task_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py b/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py index 1461c2f9d..ec10da86a 100644 --- a/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py +++ b/ansible_collections/arista/cvp/plugins/modules/cv_validate_v3.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- @@ -35,41 +35,41 @@ EXAMPLES = r""" # offline validation -- name: offline configlet validation +- name: Offline configlet validation hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_DEVICES: - device_name: leaf1 - search_type: hostname #[hostname | serialNumber | fqdn] + search_type: hostname # [hostname | serialNumber | fqdn] local_configlets: valid: "interface Ethernet1\n description test_validate" error: "ruter bgp 1111\n neighbor 1.1.1.1 remote-bs 111" tasks: - - name: validate module + - name: Validate module arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES}}" + devices: "{{ CVP_DEVICES }}" validate_mode: stop_on_error # | stop_on_warning | valid # online validation - name: Online configlet validation hosts: cv_server connection: local - gather_facts: no + gather_facts: false vars: CVP_DEVICES: - device_name: leaf1.aristanetworks.com - search_type: fqdn #[hostname | serialNumber | fqdn] + search_type: fqdn # [hostname | serialNumber | fqdn] cvp_configlets: - valid - invalid tasks: - - name: validate module + - name: Validate module arista.cvp.cv_validate_v3: - devices: "{{CVP_DEVICES}}" + devices: "{{ CVP_DEVICES }}" validate_mode: stop_on_error # | stop_on_warning | valid """ diff --git a/ansible_collections/arista/cvp/requirements-dev.txt b/ansible_collections/arista/cvp/requirements-dev.txt index 1eda6992f..103c2334e 100644 --- a/ansible_collections/arista/cvp/requirements-dev.txt +++ b/ansible_collections/arista/cvp/requirements-dev.txt @@ -1,6 +1,6 @@ ansible-core>=2.14.0,<2.17.0 ansible-builder -ansible-lint>=6.13.0 +ansible-lint==6.22.2 galaxy-importer>=0.3.1 pycodestyle flake8 diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/README.md b/ansible_collections/arista/cvp/roles/configlets_sync/README.md index 743d10dc5..4cb2d8a8b 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/README.md +++ b/ansible_collections/arista/cvp/roles/configlets_sync/README.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/defaults/main.yml b/ansible_collections/arista/cvp/roles/configlets_sync/defaults/main.yml index de0ad23e5..e09dcb33e 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/defaults/main.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/defaults/main.yml @@ -4,9 +4,9 @@ # Dir where to store configlets information cvpsync_data: 'generated_vars/' -common_configlets_dir: '{{cvpsync_data}}/common_configlets/' -cvp_servers_dir: '{{cvpsync_data}}/cvp_servers/' -devices_dir: '{{cvpsync_data}}/devices/' +common_configlets_dir: '{{ cvpsync_data }}/common_configlets/' +cvp_servers_dir: '{{ cvpsync_data }}/cvp_servers/' +devices_dir: '{{ cvpsync_data }}/devices/' # Configlet filter to look for diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/handlers/main.yml b/ansible_collections/arista/cvp/roles/configlets_sync/handlers/main.yml index b45db1eb8..3df7c6bf6 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/handlers/main.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/handlers/main.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/init.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/init.yml index 4fad476d8..110524369 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/init.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/init.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- @@ -10,8 +10,8 @@ # delegate_to: localhost # run_once: True -- name: 'creating folder {{ common_configlets_dir }}' - file: +- name: 'Creating folder {{ common_configlets_dir }}' + ansible.builtin.file: path: '{{ common_configlets_dir }}' recurse: true state: directory @@ -19,8 +19,8 @@ delegate_to: localhost run_once: true -- name: 'creating folder {{ cvp_servers_dir }}' - file: +- name: 'Creating folder {{ cvp_servers_dir }}' + ansible.builtin.file: path: '{{ cvp_servers_dir }}' recurse: true state: directory @@ -28,8 +28,8 @@ delegate_to: localhost run_once: true -- name: 'creating folder {{ devices_dir }}' - file: +- name: 'Creating folder {{ devices_dir }}' + ansible.builtin.file: path: '{{ devices_dir }}' recurse: true state: directory diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/main.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/main.yml index a113c192d..ded6ce965 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/main.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/main.yml @@ -1,7 +1,7 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- # Manual action selection -- name: 'load tasks for {{action}}' - include_tasks: "{{action}}.yml" +- name: 'Load tasks for {{ action }}' + ansible.builtin.include_tasks: "{{ action }}.yml" diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/pull.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/pull.yml index 06c760bb8..ca059ce8c 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/pull.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/pull.yml @@ -1,56 +1,56 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- # tasks file for configlets-sync -- name: "collect facts from {{ inventory_hostname }}" +- name: "Collect facts from {{ inventory_hostname }}" arista.cvp.cv_facts: register: CVP_FACTS - name: "Extract shared Configlets" - template: + ansible.builtin.template: src: "template.shared_configlets.j2" dest: "{{ common_configlets_dir }}/{{ inventory_hostname }}.yml" mode: 0644 delegate_to: '{{ ansible_runner }}' run_once: false -- name: "check for shared_master" - stat: +- name: "Check for shared_master" + ansible.builtin.stat: path: '{{ common_configlets_dir }}/master.yml' register: status_shared_master delegate_to: '{{ ansible_runner }}' -- name: "create {{ common_configlets_dir }}/master.yml" - file: +- name: "Create {{ common_configlets_dir }}/master.yml" + ansible.builtin.file: path: '{{ common_configlets_dir }}/master.yml' state: touch mode: 0644 when: status_shared_master.stat.exists is false delegate_to: '{{ ansible_runner }}' -- name: "add YAML designators to {{ common_configlets_dir }}/master.yml" - copy: +- name: "Add YAML designators to {{ common_configlets_dir }}/master.yml" + ansible.builtin.copy: content: "---" dest: "{{ common_configlets_dir }}/master.yml" mode: 0644 when: status_shared_master.stat.exists is false delegate_to: '{{ ansible_runner }}' -- name: "load Common CVP Servers Configlet Data" - include_vars: +- name: "Load Common CVP Servers Configlet Data" + ansible.builtin.include_vars: file: '{{ common_configlets_dir }}/master.yml' name: 'shared_master' delegate_to: '{{ ansible_runner }}' -- name: "load CVP Instance Shared Configlet Data" - include_vars: +- name: "Load CVP Instance Shared Configlet Data" + ansible.builtin.include_vars: file: "{{ common_configlets_dir }}/{{ inventory_hostname }}.yml" name: 'shared_server' delegate_to: '{{ ansible_runner }}' -- name: "compare shared Configlets" - template: +- name: "Compare shared Configlets" + ansible.builtin.template: src: "template.compare_configlets.j2" dest: "{{ common_configlets_dir }}/master.yml" mode: 0644 diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/push.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/push.yml index 8f26e2c52..c3435ab86 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/push.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/push.yml @@ -1,8 +1,8 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- -- name: "collect CVP Facts" +- name: "Collect CVP Facts" tags: - sync arista.cvp.cv_facts: @@ -11,7 +11,7 @@ - name: "Refresh Shared Configlet Data" tags: - sync - include_vars: + ansible.builtin.include_vars: file: '{{ common_configlets_dir }}/master.yml' name: 'shared_configlets' delegate_to: '{{ ansible_runner }}' @@ -19,7 +19,7 @@ - name: 'Refresh Shared configlet files for CVP' tags: - sync - template: + ansible.builtin.template: src: "template.cvp.shared_configlets.j2" dest: '{{ cvp_servers_dir }}/{{ inventory_hostname }}_shared.yml' mode: 0644 @@ -29,7 +29,7 @@ - name: "Load refreshed CVP shared Configlet information" tags: - sync - include_vars: '{{ cvp_servers_dir }}/{{ inventory_hostname }}_shared.yml' + ansible.builtin.include_vars: '{{ cvp_servers_dir }}/{{ inventory_hostname }}_shared.yml' delegate_to: '{{ ansible_runner }}' - name: 'Update Shared configlets on CVP Servers.' diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/sync.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/sync.yml index 46a077756..042c523c9 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tasks/sync.yml +++ b/ansible_collections/arista/cvp/roles/configlets_sync/tasks/sync.yml @@ -1,12 +1,12 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # Run everything if user set action=sync - name: 'Run init phase' - include_tasks: "init.yml" + ansible.builtin.include_tasks: "init.yml" - name: 'Run pull phase' - include_tasks: "pull.yml" + ansible.builtin.include_tasks: "pull.yml" - name: 'Run push phase' - include_tasks: "push.yml" + ansible.builtin.include_tasks: "push.yml" diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.compare_configlets.j2 b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.compare_configlets.j2 index d4246d604..a7d8a60bd 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.compare_configlets.j2 +++ b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.compare_configlets.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.cvp.shared_configlets.j2 b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.cvp.shared_configlets.j2 index 17d3db701..829299c3f 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.cvp.shared_configlets.j2 +++ b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.cvp.shared_configlets.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.device_configlets.j2 b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.device_configlets.j2 index 865a599e6..20d5cb560 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.device_configlets.j2 +++ b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.device_configlets.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.shared_configlets.j2 b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.shared_configlets.j2 index 264155d91..470e9db75 100644 --- a/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.shared_configlets.j2 +++ b/ansible_collections/arista/cvp/roles/configlets_sync/templates/template.shared_configlets.j2 @@ -1,5 +1,5 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tests/inventory b/ansible_collections/arista/cvp/roles/configlets_sync/tests/inventory deleted file mode 100644 index 2fbb50c4a..000000000 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/ansible_collections/arista/cvp/roles/configlets_sync/tests/test.yml b/ansible_collections/arista/cvp/roles/configlets_sync/tests/test.yml deleted file mode 100644 index 295de2957..000000000 --- a/ansible_collections/arista/cvp/roles/configlets_sync/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - configlets-sync diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/README.md b/ansible_collections/arista/cvp/roles/dhcp_configuration/README.md index d8c9302ad..384cc1d7f 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/README.md +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/README.md @@ -1,5 +1,5 @@ diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/handlers/main.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/handlers/main.yml index eb7085572..794cac023 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/handlers/main.yml +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/handlers/main.yml @@ -1,16 +1,16 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- # handlers file for ztp_configuration - name: Restart DHCP service - service: + ansible.builtin.service: name: '{{ dhcp_service }}' state: restarted - listen: "restart dhcpd" + listen: "Restart dhcpd" -- name: restart apparmor - service: +- name: Restart apparmor + ansible.builtin.service: name: apparmor state: restarted diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/fix-debian.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/fix-debian.yml index 01c9314ba..95533f8a0 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/fix-debian.yml +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/fix-debian.yml @@ -1,9 +1,9 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- -- name: 'set a default listening interface' - lineinfile: +- name: 'Set a default listening interface' + ansible.builtin.lineinfile: dest: /etc/default/isc-dhcp-server line: 'INTERFACESv4="{{ ansible_default_ipv4.interface }}"' regexp: '^INTERFACESv4=' diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/main.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/main.yml index 5fabb7d20..05d26531d 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/main.yml +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/main.yml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- @@ -7,4 +7,4 @@ # If mode=offline generate dhcpd.conf to {{output_dir}} - name: Start creation/update process. tags: [provision] - include_tasks: "./{{ mode }}.yml" + ansible.builtin.include_tasks: "./{{ mode }}.yml" diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/offline.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/offline.yml index b2b4fe505..eb26a5df3 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/offline.yml +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/offline.yml @@ -1,9 +1,9 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- - name: 'Generate DHCPd configuration file' - template: + ansible.builtin.template: src: 'dhcpd.conf.j2' dest: '{{ output_dir }}/dhcpd.conf' backup: true diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/online.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/online.yml index 3a19171ef..8a84e659e 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/online.yml +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/tasks/online.yml @@ -1,41 +1,42 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. --- -- name: gather os specific variables for Centos / Red Hat OS - include_vars: "centos-{{ ansible_distribution_major_version }}.yml" +- name: Gather os specific variables for Centos / Red Hat OS + ansible.builtin.include_vars: "centos-{{ ansible_distribution_major_version }}.yml" when: ansible_distribution == "CentOS" or ansible_distribution == 'Red Hat Enterprise Linux' -- name: gather os specific variables for Debian / Ubuntu OS - include_vars: "debian.yml" +- name: Gather os specific variables for Debian / Ubuntu OS + ansible.builtin.include_vars: "debian.yml" when: ansible_distribution == "Debian" or ansible_distribution == 'Ubuntu' -- name: update packages list - apt: +- name: Update packages list + ansible.builtin.apt: update_cache: true when: ansible_distribution == "Debian" or ansible_distribution == 'Ubuntu' -- name: install packages +- name: Install packages become: true - package: + ansible.builtin.package: name: "{{ dhcp_packages }}" state: "{{ dhcp_packages_state }}" -- include_tasks: fix-debian.yml +- name: Run task for debian host + ansible.builtin.include_tasks: fix-debian.yml when: ansible_distribution == "Debian" or ansible_distribution == 'Ubuntu' -- name: 'generate DHCPd configuration file' +- name: 'Generate DHCPd configuration file' become: true - template: + ansible.builtin.template: src: 'dhcpd.conf.j2' dest: '{{ dhcp_config }}' mode: 0644 backup: true - notify: "restart dhcpd" + notify: "Restart dhcpd" -- name: check & activate DHCP service +- name: Check & activate DHCP service become: true - service: + ansible.builtin.service: name: '{{ dhcp_service }}' enabled: true state: started diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/templates/dhcpd.conf.j2 b/ansible_collections/arista/cvp/roles/dhcp_configuration/templates/dhcpd.conf.j2 index 4b2b7a079..2ef93ddc8 100644 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/templates/dhcpd.conf.j2 +++ b/ansible_collections/arista/cvp/roles/dhcp_configuration/templates/dhcpd.conf.j2 @@ -1,6 +1,6 @@ {# - Copyright (c) 2023 Arista Networks, Inc. + 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. #} diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/inventory b/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/inventory deleted file mode 100644 index 2fbb50c4a..000000000 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/inventory +++ /dev/null @@ -1 +0,0 @@ -localhost diff --git a/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/test.yml b/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/test.yml deleted file mode 100644 index 81350a866..000000000 --- a/ansible_collections/arista/cvp/roles/dhcp_configuration/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - ztp-setup diff --git a/ansible_collections/arista/cvp/tests/sanity/ignore-2.17.txt b/ansible_collections/arista/cvp/tests/sanity/ignore-2.17.txt new file mode 100644 index 000000000..d908e6847 --- /dev/null +++ b/ansible_collections/arista/cvp/tests/sanity/ignore-2.17.txt @@ -0,0 +1,14 @@ +plugins/modules/cv_change_control_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_configlet_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_configlet.py validate-modules:missing-gplv3-license +plugins/modules/cv_container_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_container.py validate-modules:missing-gplv3-license +plugins/modules/cv_device_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_device.py validate-modules:missing-gplv3-license +plugins/modules/cv_facts_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_facts.py validate-modules:missing-gplv3-license +plugins/modules/cv_image_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_tag_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_validate_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_task_v3.py validate-modules:missing-gplv3-license +plugins/modules/cv_task.py validate-modules:missing-gplv3-license diff --git a/contributing.md b/contributing.md index c70ac87c3..a1023344c 100644 --- a/contributing.md +++ b/contributing.md @@ -1,5 +1,5 @@ diff --git a/development/README.md b/development/README.md index 94aeebf80..c360cc10d 100644 --- a/development/README.md +++ b/development/README.md @@ -1,5 +1,5 @@ diff --git a/tests/Makefile b/tests/Makefile index 00f960c3a..63bd67377 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -7,6 +7,10 @@ COVERAGE = --cov=ansible_collections.arista.cvp.plugins.module_utils CLI_LOGGING ?= INFO PYTEST_LOGGING ?= DEBUG -.PHONY: test -test: ## Run Pytest in verbose mode with CLI report only for all tests. By default only unit and system, but can be changed by declaring TEST_PATH variable and its value - export PYTEST_LOG_LEVEL=$(PYTEST_LOGGING) && pytest $(TEST_OPT) $(REPORT) $(COVERAGE) --log-cli-level=$(CLI_LOGGING) -m '$(TAG)' $(TESTS) +.PHONY: unit-tests +unit-tests: ## Run python unit tests in verbose mode with CLI report only for all tests + export PYTEST_LOG_LEVEL=$(PYTEST_LOGGING) && pytest ./unit $(TEST_OPT) $(REPORT) $(COVERAGE) --log-cli-level=$(CLI_LOGGING) -m '$(TAG)' $(TESTS) + +.PHONY: system-tests +system-tests: ## Run python system tests in verbose mode with CLI report only for all tests + export PYTEST_LOG_LEVEL=$(PYTEST_LOGGING) && pytest ./system $(TEST_OPT) $(REPORT) $(COVERAGE) --log-cli-level=$(CLI_LOGGING) -m '$(TAG)' $(TESTS) diff --git a/tests/PR_testing/README.md b/tests/PR_testing/README.md index c555e0db5..1793608b8 100644 --- a/tests/PR_testing/README.md +++ b/tests/PR_testing/README.md @@ -1,5 +1,5 @@ diff --git a/tests/README.md b/tests/README.md index df4d06742..d2c7de385 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,5 +1,5 @@ diff --git a/tests/Unittest-README.md b/tests/Unittest-README.md index bd010cea7..5632badf1 100644 --- a/tests/Unittest-README.md +++ b/tests/Unittest-README.md @@ -1,5 +1,5 @@ diff --git a/tests/data/container_tools_unit.py b/tests/data/container_tools_unit.py index ce41d2e81..98a58d95d 100644 --- a/tests/data/container_tools_unit.py +++ b/tests/data/container_tools_unit.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/data/device_tools_unit.py b/tests/data/device_tools_unit.py index c9f8b5057..afcb7b21b 100644 --- a/tests/data/device_tools_unit.py +++ b/tests/data/device_tools_unit.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # mock data from CVP version 2022.1.1 diff --git a/tests/data/facts_system_cvaas.py b/tests/data/facts_system_cvaas.py index 8a788e84c..d34f04e6b 100644 --- a/tests/data/facts_system_cvaas.py +++ b/tests/data/facts_system_cvaas.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/data/facts_unit.py b/tests/data/facts_unit.py index 9d7957c5f..e3c8ebb26 100644 --- a/tests/data/facts_unit.py +++ b/tests/data/facts_unit.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/data/image_unit.py b/tests/data/image_unit.py index 794779e69..9a613c279 100644 --- a/tests/data/image_unit.py +++ b/tests/data/image_unit.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/data/validate_tools_unit.py b/tests/data/validate_tools_unit.py index a63b8bede..e93747689 100644 --- a/tests/data/validate_tools_unit.py +++ b/tests/data/validate_tools_unit.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # error configlet diff --git a/tests/lib/config.py b/tests/lib/config.py index c6cd73dd6..a7b47f050 100644 --- a/tests/lib/config.py +++ b/tests/lib/config.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/cvaas_configlet.py b/tests/lib/cvaas_configlet.py index 89a6359dd..5fde54404 100644 --- a/tests/lib/cvaas_configlet.py +++ b/tests/lib/cvaas_configlet.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/helpers.py b/tests/lib/helpers.py index 86f364d53..c2d54ad9a 100644 --- a/tests/lib/helpers.py +++ b/tests/lib/helpers.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/json_data.py b/tests/lib/json_data.py index 9805a68b6..45da4dc13 100644 --- a/tests/lib/json_data.py +++ b/tests/lib/json_data.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/mock.py b/tests/lib/mock.py index 17a9cb739..317bcc843 100644 --- a/tests/lib/mock.py +++ b/tests/lib/mock.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/mockMagic.py b/tests/lib/mockMagic.py index 141a69533..b24dde3b8 100644 --- a/tests/lib/mockMagic.py +++ b/tests/lib/mockMagic.py @@ -1,6 +1,8 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. +# pylint: disable=unknown-option-value + from tests.data.device_tools_unit import (image_bundle, device_data) from tests.data.validate_tools_unit import (validate_router_bgp, return_validate_config_for_device, validate_warning, validate_true) diff --git a/tests/lib/mock_ansible.py b/tests/lib/mock_ansible.py index cc07deeb8..4faa72379 100644 --- a/tests/lib/mock_ansible.py +++ b/tests/lib/mock_ansible.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/parametrize.py b/tests/lib/parametrize.py index 6f48569f0..c71ac0d6b 100644 --- a/tests/lib/parametrize.py +++ b/tests/lib/parametrize.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/provisioner.py b/tests/lib/provisioner.py index 41eaf134b..135afad67 100644 --- a/tests/lib/provisioner.py +++ b/tests/lib/provisioner.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/static_content.py b/tests/lib/static_content.py index c360d1125..c9002559d 100644 --- a/tests/lib/static_content.py +++ b/tests/lib/static_content.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/lib/utils.py b/tests/lib/utils.py index e35e10eca..8da1d65b4 100644 --- a/tests/lib/utils.py +++ b/tests/lib/utils.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. """ diff --git a/tests/system/constants_data.py b/tests/system/constants_data.py index 54578328b..d24dd2b28 100644 --- a/tests/system/constants_data.py +++ b/tests/system/constants_data.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. """ diff --git a/tests/system/test_cv_configlet.py b/tests/system/test_cv_configlet.py index 57dca33e4..4df59fbcf 100644 --- a/tests/system/test_cv_configlet.py +++ b/tests/system/test_cv_configlet.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_container_tools.py b/tests/system/test_cv_container_tools.py index 72772145a..ee40fe5a4 100644 --- a/tests/system/test_cv_container_tools.py +++ b/tests/system/test_cv_container_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_device_tools.py b/tests/system/test_cv_device_tools.py index d43c68ca7..77ce1f554 100644 --- a/tests/system/test_cv_device_tools.py +++ b/tests/system/test_cv_device_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_device_tools_fqdn.py b/tests/system/test_cv_device_tools_fqdn.py index 9d080679d..a442fe28b 100644 --- a/tests/system/test_cv_device_tools_fqdn.py +++ b/tests/system/test_cv_device_tools_fqdn.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_device_tools_generic.py b/tests/system/test_cv_device_tools_generic.py index bdc56da67..1c3885400 100644 --- a/tests/system/test_cv_device_tools_generic.py +++ b/tests/system/test_cv_device_tools_generic.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_device_tools_serial.py b/tests/system/test_cv_device_tools_serial.py index 8e1e24b37..cb41d7cc8 100644 --- a/tests/system/test_cv_device_tools_serial.py +++ b/tests/system/test_cv_device_tools_serial.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/system/test_cv_facts_tools.py b/tests/system/test_cv_facts_tools.py index 49fa95e6e..0c8a6caee 100644 --- a/tests/system/test_cv_facts_tools.py +++ b/tests/system/test_cv_facts_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 2f99feed5..8ee2b23af 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. from unittest.mock import create_autospec diff --git a/tests/unit/module_utils/test_validate_tools.py b/tests/unit/module_utils/test_validate_tools.py index af1ee3b00..8fdcff117 100644 --- a/tests/unit/module_utils/test_validate_tools.py +++ b/tests/unit/module_utils/test_validate_tools.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. from unittest.mock import call diff --git a/tests/unit/test_configlet_input.py b/tests/unit/test_configlet_input.py index d813a8076..cc8c9f255 100644 --- a/tests/unit/test_configlet_input.py +++ b/tests/unit/test_configlet_input.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_container_inputs.py b/tests/unit/test_container_inputs.py index d2c4c4979..a0ebd4895 100644 --- a/tests/unit/test_container_inputs.py +++ b/tests/unit/test_container_inputs.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_cv_container_tools.py b/tests/unit/test_cv_container_tools.py index df2021287..183ec0764 100644 --- a/tests/unit/test_cv_container_tools.py +++ b/tests/unit/test_cv_container_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_cv_device_tools.py b/tests/unit/test_cv_device_tools.py index f976f8df9..5dbefbfa9 100644 --- a/tests/unit/test_cv_device_tools.py +++ b/tests/unit/test_cv_device_tools.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Arista Networks, Inc. +# 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. from unittest.mock import call diff --git a/tests/unit/test_cv_facts_tools.py b/tests/unit/test_cv_facts_tools.py index de8275256..3b971d6a5 100644 --- a/tests/unit/test_cv_facts_tools.py +++ b/tests/unit/test_cv_facts_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_cv_image_tools.py b/tests/unit/test_cv_image_tools.py index 9487c29a4..a3314e43f 100644 --- a/tests/unit/test_cv_image_tools.py +++ b/tests/unit/test_cv_image_tools.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_cv_response.py b/tests/unit/test_cv_response.py index ce08ad5c3..6d334a902 100644 --- a/tests/unit/test_cv_response.py +++ b/tests/unit/test_cv_response.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_device_element.py b/tests/unit/test_device_element.py index 8f1d4768a..6e35a438c 100644 --- a/tests/unit/test_device_element.py +++ b/tests/unit/test_device_element.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_device_inventory.py b/tests/unit/test_device_inventory.py index 136f721bc..a7c082343 100644 --- a/tests/unit/test_device_inventory.py +++ b/tests/unit/test_device_inventory.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_json_schema.py b/tests/unit/test_json_schema.py index 6eae5feb3..dfa0ab0f6 100644 --- a/tests/unit/test_json_schema.py +++ b/tests/unit/test_json_schema.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*- diff --git a/tests/unit/test_tools_cv.py b/tests/unit/test_tools_cv.py index b98e687d1..24deae1be 100644 --- a/tests/unit/test_tools_cv.py +++ b/tests/unit/test_tools_cv.py @@ -1,5 +1,5 @@ #!/usr/bin/python -# Copyright (c) 2023 Arista Networks, Inc. +# 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. # coding: utf-8 -*-