Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feat(cv_deploy): Expose the details of the Workspace build validation errors #4629

Open
wants to merge 28 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c7c4a6a
Update NTP settings of CI EoS instances
alexeygorbunov Oct 23, 2024
d0345a6
Attempt to improve molecule report consistency
alexeygorbunov Oct 23, 2024
7601169
Enhance cv_deploy_results by covering details of config validation er…
alexeygorbunov Oct 23, 2024
842429f
Fix ansible-lint issues
alexeygorbunov Oct 23, 2024
abc6e3a
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Oct 23, 2024
a9043ed
Remove separate set_facts tasks
alexeygorbunov Oct 23, 2024
75c4de2
Add enhancements to ws details processing and exposing
alexeygorbunov Oct 29, 2024
9bc31a2
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Oct 29, 2024
5746041
+ Expose device details under build_details
alexeygorbunov Nov 4, 2024
7feca97
Merge branch 'devel' into cv_deploy_ci
ClausHolbechArista Nov 7, 2024
41cd149
Rollback proposed exposure of processing time for cv_deploy
alexeygorbunov Nov 18, 2024
ee5d70d
Add regex-based cv_deploy warning suppression
alexeygorbunov Nov 19, 2024
f21a0ca
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Nov 19, 2024
b990b06
Merge branch 'aristanetworks:devel' into cv_deploy_ci
alexeygorbunov Nov 22, 2024
d6bd744
Merge 'upstream/devel' into cv_deploy_ci
alexeygorbunov Dec 17, 2024
a77635a
fixing linting issues
alexeygorbunov Dec 17, 2024
a856cd0
Regenerate CloudVision API wrappers
alexeygorbunov Dec 18, 2024
a89b126
Address PR comments
alexeygorbunov Dec 18, 2024
fd1037b
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Dec 18, 2024
767312c
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Jan 2, 2025
f2395bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 2, 2025
0d9c4c9
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Jan 6, 2025
c09da96
PR comments - tag cv_deploy molecule play tasks for flexible scope co…
alexeygorbunov Jan 7, 2025
7dfca6b
PR comments - end-of-file-fixer for avd-ci-core1.cfg
alexeygorbunov Jan 7, 2025
7a46766
PR comments - Delete structure_config files containing only default s…
alexeygorbunov Jan 7, 2025
7cce419
PR Comments - normalize return of get_workspace_build_details func
alexeygorbunov Jan 8, 2025
e83e74f
Remove exsessive object type validation
alexeygorbunov Jan 8, 2025
be3b97c
Merge branch 'devel' into cv_deploy_ci
alexeygorbunov Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 33 additions & 17 deletions ansible_collections/arista/avd/molecule/cv_deploy/cc_false.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Converge - cv_run_change_control = false
- name: "{{ test_id | upper }} Converge - cv_run_change_control = false"
hosts: SITE1_FABRIC
connection: local
gather_facts: false
Expand All @@ -12,46 +12,54 @@
structured_dir: "{{ playbook_dir }}/intended/structured_configs/test_configs"
intended_tag_device: avd-ci-leaf1
intended_tags: "{{ lookup('file', structured_dir ~ '/' ~ intended_tag_device ~ '.yml')| from_yaml }}"
test_id: "cc-run-false"
cv_common_pattern: "avd-cv-deploy-{{ test_id }}"

tasks:
- name: Generate random string
- name: "{{ test_id | upper }} Banner"
run_once: true
ansible.builtin.debug:
msg:
- "######################################################################"
- "### STARTING MOLECULE TEST {{ '{:<38}'.format(test_id[:38]) | upper }} ####"
- "######################################################################"

- name: "{{ test_id | upper }} Generate random string"
run_once: true
ansible.builtin.set_fact:
r: "{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=4') }}"
run_once: true

- name: Set facts
- name: "{{ test_id | upper }} Set deploy facts"
run_once: true
ansible.builtin.set_fact:
alexeygorbunov marked this conversation as resolved.
Show resolved Hide resolved
cv_workspace_name: avd-cv-deploy-{{ r }}
cv_workspace_description: sample description
cv_change_control_name: cc_cv_deploy-{{ r }}
cv_change_control_description: sample description
cv_workspace_name: "{{ cv_common_pattern }}-{{ r }}-converge"
cv_workspace_description: "{{ (cv_common_pattern + '-' + r + '-converge') | upper }}"
cv_change_control_name: "{{ cv_common_pattern }}-{{ r }}-converge"
cv_change_control_description: "{{ (cv_common_pattern + '-' + r + '-converge') | upper }}"
cv_register_detailed_results: true
run_once: true

- name: Provision with cv_run_change_control = false
- name: "{{ test_id | upper }} Provision with cv_run_change_control = false"
run_once: true
delegate_to: localhost
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
cv_submit_workspace: true
cv_run_change_control: false
cv_submit_workspace_force: true

- name: Display CVP result
- name: "{{ test_id | upper }} Display CVP result"
run_once: true
ansible.builtin.debug:
msg: '{{ cv_deploy_results }}'

- name: Check CVP returns
- name: "{{ test_id | upper }} Check CVP returns"
run_once: true
ansible.builtin.assert:
that:
# Change control
- cv_deploy_results.change_control.requested_state == "pending approval"
- cv_deploy_results.change_control.requested_state == cv_deploy_results.change_control.state

- name: Cleanup orphan CC
- name: "{{ test_id | upper }} Cleanup orphan CC"
run_once: true
ansible.legacy.uri:
url: https://{{ cv_server }}/api/resources/changecontrol/v1/ChangeControlConfig?key.id={{ cv_deploy_results.change_control.id }}
Expand All @@ -72,14 +80,22 @@
ignore_errors: True
when: cv_deploy_results.change_control.state | lower in ['pending approval', 'approved']

- name: Cleanup
- name: "{{ test_id | upper }} Set cleanup facts"
run_once: true
ansible.builtin.set_fact:
cv_workspace_name: "{{ cv_common_pattern }}-{{ r }}-cleanup"
cv_workspace_description: "{{ cv_common_pattern + '-' + r + '-cleanup' | upper }}"
cv_change_control_name: "{{ cv_common_pattern }}-{{ r }}-cleanup"
cv_change_control_description: "{{ cv_common_pattern + '-' + r + '-cleanup' | upper }}"
cv_register_detailed_results: true

- name: "{{ test_id | upper }} Cleanup"
run_once: true
delegate_to: localhost
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
eos_config_dir: "{{ playbook_dir }}/intended/configs/base_configs"
structured_dir: "{{ playbook_dir }}/intended/structured_configs/base_configs"
cv_submit_workspace: true
cv_submit_workspace_force: true
cv_run_change_control: true
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
- name: Test Workspace Force False
import_playbook: workspace_force_false.yml

- name: Test Workspace build with invalid Designed Config
import_playbook: invalid_config.yml

- name: Test Change Control False
import_playbook: cc_false.yml
68 changes: 41 additions & 27 deletions ansible_collections/arista/avd/molecule/cv_deploy/cv_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Converge - Configuration deployment with CVP
- name: "{{ test_id | upper }} Converge - Configuration deployment with CVP"
hosts: SITE1_FABRIC
connection: local
gather_facts: false
Expand All @@ -12,42 +12,48 @@
structured_dir: "{{ playbook_dir }}/intended/structured_configs/test_configs"
intended_tag_device: avd-ci-leaf1
intended_tags: "{{ lookup('file', structured_dir ~ '/' ~ intended_tag_device ~ '.yml')| from_yaml }}"
test_id: "ws-force-true-cc-run"
cv_common_pattern: "avd-cv-deploy-{{ test_id }}"

tasks:
- name: Generate random string
- name: "{{ test_id | upper }} Banner"
run_once: true
ansible.builtin.debug:
msg:
- "######################################################################"
- "### STARTING MOLECULE TEST {{ '{:<38}'.format(test_id[:38]) | upper }} ####"
- "######################################################################"

- name: "{{ test_id | upper }} Generate random string"
run_once: true
ansible.builtin.set_fact:
r: "{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=4') }}"
run_once: true

- name: Set facts
- name: "{{ test_id | upper }} Set deploy facts"
run_once: true
ansible.builtin.set_fact:
cv_workspace_name: avd-cv-deploy-{{ r }}
cv_workspace_description: sample description
cv_change_control_name: cc_cv_deploy-{{ r }}
cv_change_control_description: sample description
cv_workspace_name: "{{ cv_common_pattern }}-{{ r }}-converge"
cv_workspace_description: "{{ (cv_common_pattern + '-' + r + '-converge') | upper }}"
cv_change_control_name: "{{ cv_common_pattern }}-{{ r }}-converge"
cv_change_control_description: "{{ (cv_common_pattern + '-' + r + '-converge') | upper }}"
cv_register_detailed_results: true
run_once: true

###########################
######## cv_deploy ########
###########################
- name: Provision CVP with AVD configuration
- name: "{{ test_id | upper }} Provision CVP with AVD configuration"
run_once: true
delegate_to: localhost
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
cv_submit_workspace: true
cv_submit_workspace_force: true
cv_run_change_control: true
cv_register_detailed_results: true

- name: Display CVP result
- name: "{{ test_id | upper }} Display CVP result"
run_once: true
ansible.builtin.debug:
msg: '{{ cv_deploy_results }}'

- name: Check CVP returns
- name: "{{ test_id | upper }} Check CVP returns"
run_once: true
ansible.builtin.assert:
that:
Expand All @@ -66,77 +72,85 @@
- cv_deploy_results.change_control.requested_state == "completed"
- cv_deploy_results.change_control.description == cv_change_control_description

- name: Check tags from output
- name: "{{ test_id | upper }} Check tags from output"
run_once: true
ansible.builtin.assert:
that:
- item.0.label == item.1.label
- item.0.value == item.1.value
loop: "{{ cv_deploy_results.deployed_device_tags | zip(cv_deploy_results.device_tags) | list }}"

- name: Extract all device tags from structured configs
- name: "{{ test_id | upper }} Extract all device tags from structured configs"
run_once: true
ansible.builtin.set_fact:
expected_device_tags: "{{ intended_tags.metadata.cv_tags.device_tags }}"
output_device_tags: "{{ cv_deploy_results.deployed_device_tags }}"

- name: Check output device tags == intended device tags
- name: "{{ test_id | upper }} Check output device tags == intended device tags"
run_once: true
ansible.builtin.assert:
that:
- item.0.name == item.1.label
- item.0.value == item.1.value
loop: "{{ expected_device_tags | zip(output_device_tags) | list }}"

- name: Extract all interface tags from role output
- name: "{{ test_id | upper }} Extract all interface tags from role output"
run_once: true
ansible.builtin.set_fact:
output_interface_tags: "{{ cv_deploy_results.deployed_interface_tags }}"

- name: Extract all interface tags from structured configs
- name: "{{ test_id | upper }} Extract all interface tags from structured configs"
run_once: true
ansible.builtin.set_fact:
expected_interface_tags: "{{ expected_interface_tags | default([]) + [item.tags | list | first | combine({'interface': item.interface})] }}"
loop: "{{ intended_tags.metadata.cv_tags.interface_tags }}"
loop_control:
label: "{{ item.interface }}"

- name: Check output interface tags == intended interface tags
- name: "{{ test_id | upper }} Check output interface tags == intended interface tags"
run_once: true
ansible.builtin.assert:
that:
- item.0.name == item.1.label
- item.0.value == item.1.value
loop: "{{ expected_interface_tags | zip(output_interface_tags) | list }}"

- name: Convert unstructed data into yaml
- name: "{{ test_id | upper }} Convert unstructed data into yaml"
run_once: true
ansible.builtin.set_fact:
deivces_structure: '{{ cv_deploy_results.deployed_configs | from_yaml }}'
output_devices: []

- name: Extract devices from output
- name: "{{ test_id | upper }} Extract devices from output"
run_once: true
ansible.builtin.set_fact:
output_devices: "{{ output_devices + [item.device.hostname] }}"
loop: "{{ deivces_structure }}"
loop_control:
label: "{{ item.configlet_name }}"

- name: Check output devices == intended devices
- name: "{{ test_id | upper }} Check output devices == intended devices"
run_once: true
ansible.builtin.assert:
that:
- output_devices == cv_devices

- name: Cleanup
- name: "{{ test_id | upper }} Set cleanup facts"
run_once: true
ansible.builtin.set_fact:
cv_workspace_name: "{{ cv_common_pattern }}-{{ r }}-cleanup"
cv_workspace_description: "{{ cv_common_pattern + '-' + r + '-cleanup' | upper }}"
cv_change_control_name: "{{ cv_common_pattern }}-{{ r }}-cleanup"
cv_change_control_description: "{{ cv_common_pattern + '-' + r + '-cleanup' | upper }}"
cv_register_detailed_results: true

- name: "{{ test_id | upper }} Cleanup"
run_once: true
delegate_to: localhost
ansible.builtin.import_role:
name: arista.avd.cv_deploy
vars:
eos_config_dir: "{{ playbook_dir }}/intended/configs/base_configs"
structured_dir: "{{ playbook_dir }}/intended/structured_configs/base_configs"
cv_submit_workspace: true
cv_submit_workspace_force: true
cv_run_change_control: true
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ no ip routing vrf MGMT
!
ip route vrf MGMT 0.0.0.0/0 10.90.231.1
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf1
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf2
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf3
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf4
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-spine1
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode none
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-spine2
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode none
!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@ no ip routing vrf MGMT
!
ip route vrf MGMT 0.0.0.0/0 10.90.231.1
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
end
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf1
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf1
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf2
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf3
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ service routing protocols model multi-agent
hostname avd-ci-leaf4
ip name-server vrf MGMT 10.90.231.26
!
ntp server 1.pool.ntp.org iburst local-interface Management1
ntp server vrf MGMT 1.pool.ntp.org iburst local-interface Management1
!
spanning-tree mode mstp
no spanning-tree vlan-id 4093-4094
Expand Down
Loading
Loading