Skip to content

Commit

Permalink
Test: New cvp integration molecule test (aristanetworks#3500)
Browse files Browse the repository at this point in the history
Co-authored-by: Claus Holbech <[email protected]>
Co-authored-by: Tamas Plugor <[email protected]>
  • Loading branch information
3 people authored Apr 10, 2024
1 parent 9264f7f commit f33ad97
Show file tree
Hide file tree
Showing 43 changed files with 1,988 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ansible_collections/arista/avd/molecule/cv_workflow/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## How to test

NOTE: Can only be run on aawg-ci tenant.

1. Create a service account token on cvaas
2. Load the token as environment variable on your local machine
3. `bash# export CVAAS_AAWG_CI=<your token here>`
4. `bash# cd avd/ansible_collections/arista/avd`
5. `bash# molecule test -s cv_workflow`
6. You can add the `-- -vvv` option to get extended logs
7. Verify that the molecule test completes without any errors

## Test Suite

1. Use the `cv_workflow` action plugin to deploy configs to CV with the following options
1. `ws_req_state: submitted`
2. `cc_requested_state: running`
2. Test strict tags functionality with
1. `strict_tags: true`
3. Test tags value change
1. Change the value an already existing tag
4. Dotted hostname
1. Change hostname of the switch to have dots in it
2. use `cv_workflow` to deploy configs to CV
59 changes: 59 additions & 0 deletions ansible_collections/arista/avd/molecule/cv_workflow/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
- name: Converge - Configuration deployment with CVP
hosts: localhost
connection: local
gather_facts: false
vars:
cv_server: www.cv-staging.corp.arista.io
# token: "{{ lookup('file', playbook_dir ~ '/token-aawg-ci.tok')}}"
token: "{{ lookup('env', 'CVAAS_AAWG_CI') }}"
configuration_dir: "{{ playbook_dir }}/intended/configs/base_configs"
structured_config_dir: "{{ playbook_dir }}/intended/structured_configs/base_configs"

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

- name: Set facts
ansible.builtin.set_fact:
ws_name: avd-static-studio-cleanup-{{ r }}
ws_description: sample description
ws_req_state: submitted
ws_force: true
cc_name: cc_avd_studio-cleanup-{{ r }}
cc_requested_state: completed
cc_description: sample description
run_once: true

- name: Clean up and provision CVP with with base AVD configuration
run_once: true
delegate_to: localhost
arista.avd.cv_workflow:
configuration_dir: "{{ configuration_dir }}"
structured_config_dir: "{{ structured_config_dir }}"
# structured_config_suffix: "yml"
# device_list: "{{ ansible_play_hosts }}"
device_list: ["ci-s1-leaf1", "ci-s1-leaf2", "ci-s1-leaf3", "ci-s1-leaf4", "ci-s1-spine1", "ci-s1-spine2"]
strict_tags: true
# skip_strict_devices: false
# configlet_name_template: "AVD-${hostname}"
cv_servers: [ '{{ cv_server }}' ]
cv_token: '{{ token }}'
# cv_verify_certs: True
workspace:
name: '{{ ws_name }}'
description: '{{ ws_description }}'
id: '{{ ws_name }}'
requested_state: '{{ ws_req_state }}'
force: '{{ ws_force }}'
change_control:
name: '{{ cc_name }}'
description: '{{ cc_description }}'
requested_state: '{{ cc_requested_state }}'
# timeouts:
# workspace_build_timeout: 300.0
# change_control_creation_timeout: 300.0
return_details: true
register: cvp_results
Loading

0 comments on commit f33ad97

Please sign in to comment.