Debian Codegraph @

ansible_collections/cisco/aci/tests/integration/targets/aci_rest/tasks/yaml_string.yml

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2017, Dag Wieers (@dagwieers) <[email protected]>
3
4 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6
7 # CLEAN ENVIRONMENT
8 - name: Remove tenant
9 cisco.aci.aci_rest: &tenant_absent
10 host: '{{ aci_hostname }}'
11 username: '{{ aci_username }}'
12 password: '{{ aci_password }}'
13 validate_certs: '{{ aci_validate_certs | default(false) }}'
14 use_ssl: '{{ aci_use_ssl | default(true) }}'
15 use_proxy: '{{ aci_use_proxy | default(true) }}'
16 output_level: '{{ aci_output_level | default("info") }}'
17 path: /api/mo/uni/tn-[ansible_test].json
18 method: delete
19
20 # ADD TENANT
21 - name: Add tenant (check mode)
22 cisco.aci.aci_rest: &tenant_present
23 host: '{{ aci_hostname }}'
24 username: '{{ aci_username }}'
25 password: '{{ aci_password }}'
26 validate_certs: '{{ aci_validate_certs | default(false) }}'
27 use_ssl: '{{ aci_use_ssl | default(true) }}'
28 use_proxy: '{{ aci_use_proxy | default(true) }}'
29 output_level: '{{ aci_output_level | default("info") }}'
30 path: /api/mo/uni.json
31 method: post
32 content: |
33 fvTenant:
34 attributes:
35 name: ansible_test
36 register: cm_add_tenant
37 check_mode: true
38
39 - name: Verify checkmode did not create tenant
40 cisco.aci.aci_tenant:
41 host: '{{ aci_hostname }}'
42 username: '{{ aci_username }}'
43 password: '{{ aci_password }}'
44 validate_certs: '{{ aci_validate_certs | default(false) }}'
45 use_ssl: '{{ aci_use_ssl | default(true) }}'
46 use_proxy: '{{ aci_use_proxy | default(true) }}'
47 output_level: '{{ aci_output_level | default("info") }}'
48 name: ansible_test
49 state: query
50 register: cm_verify_checkmode_tenant
51
52 - name: Verify checkmode POST operation
53 ansible.builtin.assert:
54 that:
55 - cm_add_tenant is changed
56 - cm_add_tenant.proposed.fvTenant.attributes.name == "ansible_test"
57 - cm_add_tenant.proposed.fvTenant.attributes.annotation == "orchestrator:ansible"
58 - cm_verify_checkmode_tenant.current == []
59
60 - name: Add tenant (normal mode)
61 cisco.aci.aci_rest: *tenant_present
62 register: nm_add_tenant
63
64 - name: Add tenant again (normal mode)
65 cisco.aci.aci_rest: *tenant_present
66 register: nm_add_tenant_again
67
68 - name: Verify add_tenant
69 ansible.builtin.assert:
70 that:
71 - nm_add_tenant is changed
72 - nm_add_tenant.imdata.0.fvTenant.attributes.annotation == "orchestrator:ansible"
73 - nm_add_tenant_again is not changed
74
75 # CHANGE TENANT
76 - name: Change description of tenant (normal mode)
77 cisco.aci.aci_rest: &tenant_changed
78 host: '{{ aci_hostname }}'
79 username: '{{ aci_username }}'
80 password: '{{ aci_password }}'
81 validate_certs: '{{ aci_validate_certs | default(false) }}'
82 use_ssl: '{{ aci_use_ssl | default(true) }}'
83 use_proxy: '{{ aci_use_proxy | default(true) }}'
84 output_level: '{{ aci_output_level | default("info") }}'
85 path: /api/mo/uni.json
86 method: post
87 content:
88 fvTenant:
89 attributes:
90 name: ansible_test
91 descr: Ansible test tenant
92 register: nm_add_tenant_descr
93
94 - name: Change description of tenant again (normal mode)
95 cisco.aci.aci_rest: *tenant_changed
96 register: nm_add_tenant_descr_again
97
98 - name: Verify add_tenant_descr
99 ansible.builtin.assert:
100 that:
101 - nm_add_tenant_descr is changed
102 - nm_add_tenant_descr_again is not changed
103
104 # ADD TENANT AGAIN
105 - name: Add tenant again with no description (normal mode)
106 cisco.aci.aci_rest: *tenant_present
107 register: nm_add_tenant_again_no_descr
108
109 - name: Verify add_tenant_again_no_descr
110 ansible.builtin.assert:
111 that:
112 - nm_add_tenant_again_no_descr is not changed
113
114 # QUERY ALL TENANTS
115 - name: Query all tenants (normal mode)
116 cisco.aci.aci_rest: &tenant_query_all
117 host: '{{ aci_hostname }}'
118 username: '{{ aci_username }}'
119 password: '{{ aci_password }}'
120 validate_certs: '{{ aci_validate_certs | default(false) }}'
121 use_ssl: '{{ aci_use_ssl | default(true) }}'
122 use_proxy: '{{ aci_use_proxy | default(true) }}'
123 output_level: '{{ aci_output_level | default("info") }}'
124 path: /api/mo/uni/tn-[ansible_test].json
125 method: get
126 register: nm_query_all_tenants
127
128 - name: Verify query_all_tenants
129 ansible.builtin.assert:
130 that:
131 - nm_query_all_tenants is not changed
132
133 # QUERY A TENANT
134 - name: Query our tenant
135 cisco.aci.aci_rest: &tenant_query
136 host: '{{ aci_hostname }}'
137 username: '{{ aci_username }}'
138 password: '{{ aci_password }}'
139 validate_certs: '{{ aci_validate_certs | default(false) }}'
140 use_ssl: '{{ aci_use_ssl | default(true) }}'
141 use_proxy: '{{ aci_use_proxy | default(true) }}'
142 output_level: '{{ aci_output_level | default("info") }}'
143 path: /api/mo/uni/tn-[ansible_test].json
144 method: get
145 register: nm_query_tenant
146
147 - name: Verify query_tenant
148 ansible.builtin.assert:
149 that:
150 - nm_query_tenant is not changed
151
152 # REMOVE TENANT
153 - name: Remove tenant (normal mode)
154 cisco.aci.aci_rest: *tenant_absent
155 register: nm_remove_tenant
156
157 - name: Remove tenant again (normal mode)
158 cisco.aci.aci_rest: *tenant_absent
159 register: nm_remove_tenant_again
160
161 - name: Verify remove_tenant
162 ansible.builtin.assert:
163 that:
164 - nm_remove_tenant is changed
165 - nm_remove_tenant_again is not changed
166
167 # QUERY NON-EXISTING TENANT
168 - name: Query non-existing tenant (normal mode)
169 cisco.aci.aci_rest: *tenant_query
170 register: nm_query_non_tenant
171
172 - name: Verify query_non_tenant
173 ansible.builtin.assert:
174 that:
175 - nm_query_non_tenant is not changed
176
177 # VERIFY ANNOTATION SUPPORT
178 - name: Add tenant with annotation option
179 cisco.aci.aci_rest:
180 host: '{{ aci_hostname }}'
181 username: '{{ aci_username }}'
182 password: '{{ aci_password }}'
183 validate_certs: '{{ aci_validate_certs | default(false) }}'
184 use_ssl: '{{ aci_use_ssl | default(true) }}'
185 use_proxy: '{{ aci_use_proxy | default(true) }}'
186 output_level: '{{ aci_output_level | default("info") }}'
187 path: /api/mo/uni.json
188 method: post
189 annotation: test:inoption
190 content: |
191 fvTenant:
192 attributes:
193 descr: Ansible test tenant
194 name: ansible_test
195 register: nm_add_tenant_annotation_option
196
197 - name: Add tenant with annotation in content
198 cisco.aci.aci_rest:
199 host: '{{ aci_hostname }}'
200 username: '{{ aci_username }}'
201 password: '{{ aci_password }}'
202 validate_certs: '{{ aci_validate_certs | default(false) }}'
203 use_ssl: '{{ aci_use_ssl | default(true) }}'
204 use_proxy: '{{ aci_use_proxy | default(true) }}'
205 output_level: '{{ aci_output_level | default("info") }}'
206 path: /api/mo/uni.json
207 method: post
208 content: |
209 fvTenant:
210 attributes:
211 descr: Ansible test tenant
212 name: ansible_test
213 annotation: test:incontent
214 register: nm_add_tenant_annotation_content
215
216 - name: Add tenant with annotation in content and option
217 cisco.aci.aci_rest:
218 host: '{{ aci_hostname }}'
219 username: '{{ aci_username }}'
220 password: '{{ aci_password }}'
221 validate_certs: '{{ aci_validate_certs | default(false) }}'
222 use_ssl: '{{ aci_use_ssl | default(true) }}'
223 use_proxy: '{{ aci_use_proxy | default(true) }}'
224 output_level: '{{ aci_output_level | default("info") }}'
225 path: /api/mo/uni.json
226 method: post
227 annotation: test:inoption
228 content: |
229 fvTenant:
230 attributes:
231 descr: Ansible test tenant
232 name: ansible_test
233 annotation: test:optionincontent
234 register: nm_add_tenant_annotation_option_content
235
236 - name: Add tag to tenant with annotation unsupported
237 cisco.aci.aci_rest:
238 host: '{{ aci_hostname }}'
239 username: '{{ aci_username }}'
240 password: '{{ aci_password }}'
241 validate_certs: '{{ aci_validate_certs | default(false) }}'
242 use_ssl: '{{ aci_use_ssl | default(true) }}'
243 use_proxy: '{{ aci_use_proxy | default(true) }}'
244 output_level: '{{ aci_output_level | default("info") }}'
245 path: /api/mo/uni/tn-ansible_test/tagKey-foo.json
246 method: post
247 annotation: test:inoption
248 content: |
249 tagTag:
250 attributes:
251 value: bar
252 register: nm_add_tag_no_annotation
253
254 - name: Remove tenant
255 cisco.aci.aci_rest: *tenant_absent
256
257 - name: Add tenant with children objects including annotation
258 cisco.aci.aci_rest:
259 host: '{{ aci_hostname }}'
260 username: '{{ aci_username }}'
261 password: '{{ aci_password }}'
262 validate_certs: '{{ aci_validate_certs | default(false) }}'
263 use_ssl: '{{ aci_use_ssl | default(true) }}'
264 use_proxy: '{{ aci_use_proxy | default(true) }}'
265 output_level: '{{ aci_output_level | default("info") }}'
266 path: /api/mo/uni.json
267 method: post
268 annotation: test:inoption
269 content: |
270 fvTenant:
271 attributes:
272 descr: Ansible test tenant
273 name: ansible_test
274 children:
275 - fvCtx:
276 attributes:
277 name: VRF1
278 - fvAp:
279 attributes:
280 name: Application1
281 children:
282 - fvAEPg:
283 attributes:
284 name: WebTier
285 annotation: test:inchild
286 register: nm_add_tenant_annotation_children
287
288 - name: Verify annotation support
289 assert:
290 that:
291 - nm_add_tenant_annotation_option.imdata.0.fvTenant.attributes.annotation == "test:inoption"
292 - nm_add_tenant_annotation_content.imdata.0.fvTenant.attributes.annotation == "test:incontent"
293 - nm_add_tenant_annotation_option_content.imdata.0.fvTenant.attributes.annotation == "test:optionincontent"
294 - nm_add_tag_no_annotation.imdata.0.tagTag.attributes.annotation is undefined
295 - nm_add_tenant_annotation_children.imdata.0.fvTenant.attributes.annotation == "test:inoption"
296 - nm_add_tenant_annotation_children.imdata.0.fvTenant.children.0.fvAp.attributes.annotation == "test:inoption"
297 - nm_add_tenant_annotation_children.imdata.0.fvTenant.children.0.fvAp.children.0.fvAEPg.attributes.annotation == "test:inchild"
298 - nm_add_tenant_annotation_children.imdata.0.fvTenant.children.2.fvCtx.attributes.annotation == "test:inoption"