Debian Codegraph @

ansible_collections/cisco/aci/tests/integration/targets/aci_cloud_region/tasks/main.yml

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2020, Cindy Zhao (@cizhao) <[email protected]>
3
4 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 - name: Test that we have an ACI APIC host, ACI username and ACI password
7 ansible.builtin.fail:
8 msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
9 when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
10
11 # CLEAN ENVIRONMENT
12 - name: Set vars
13 ansible.builtin.set_fact:
14 aci_info: &aci_info
15 host: "{{ aci_hostname }}"
16 username: "{{ aci_username }}"
17 password: "{{ aci_password }}"
18 validate_certs: '{{ aci_validate_certs | default(false) }}'
19 use_ssl: '{{ aci_use_ssl | default(true) }}'
20 use_proxy: '{{ aci_use_proxy | default(true) }}'
21 output_level: '{{ aci_output_level | default("info") }}'
22
23 - name: Verify Cloud and Non-Cloud Sites in use.
24 ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
25
26 - name: Execute tasks only for cloud sites
27 when: query_cloud.current | length > 0 # This condition will execute only cloud sites
28 block: # block specifies execution of tasks within, based on conditions
29 - name: Query all regions
30 cisco.aci.aci_cloud_region:
31 <<: *aci_info
32 cloud: "{{ cloud_type }}"
33 state: query
34 register: query_all
35
36 - name: Verify query_all
37 ansible.builtin.assert:
38 that:
39 - query_all is not changed
40 - query_all.current.0.cloudProvP.attributes.dn == "uni/clouddomp/provp-{{cloud_type}}"
41 - query_all.current.0.cloudProvP.attributes.vendor == "{{cloud_type}}"
42 - query_all.current.0.cloudProvP.children | length > 10
43 when: query_all.current != []
44
45 - name: Query a specific region
46 cisco.aci.aci_cloud_region:
47 <<: *aci_info
48 cloud: "{{ cloud_type }}"
49 region: "{{ region_2 }}"
50 state: query
51 register: query_region
52
53 - name: Verify query_region
54 ansible.builtin.assert:
55 that:
56 - query_region is not changed
57 - query_region.current.0.cloudRegion.attributes.adminSt == "managed"
58 - query_region.current.0.cloudRegion.attributes.dn == "uni/clouddomp/provp-{{cloud_type}}/region-{{region_2}}"
59 - query_region.current.0.cloudRegion.attributes.name == "{{region_2}}"
60 when: query_region.current != []
61
62 - name: Query non_existing region
63 cisco.aci.aci_cloud_region:
64 <<: *aci_info
65 cloud: "{{ cloud_type }}"
66 region: non_existing
67 state: query
68 register: query_non_existing_region
69
70 - name: Verify query_non_existing_region
71 ansible.builtin.assert:
72 that:
73 - query_non_existing_region is not changed
74 - query_non_existing_region.current == []