Debian Codegraph @

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

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2017, Jacob McGill (@jmcgill298)
3 # Copyright: (c) 2024, Samita Bhattacharjee (@samiib) <[email protected]>
4
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 - name: Test that we have an ACI APIC host, ACI username and ACI password
8 ansible.builtin.fail:
9 msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
10 when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
11
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: debug
22
23 - name: Query system information
24 cisco.aci.aci_system:
25 <<: *aci_info
26 id: 1
27 state: query
28 register: version
29
30 - name: Verify Cloud and Non-Cloud Sites in use.
31 ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
32
33 - name: ensure tenant does not exists
34 cisco.aci.aci_tenant: &aci_tenant_absent
35 <<: *aci_info
36 state: absent
37 tenant: ansible_test
38
39 - name: Execute tasks only for non-cloud sites
40 when: query_cloud.current == [] # This condition will execute only non-cloud sites
41 block: # block specifies execution of tasks within, based on conditions
42 - name: ensure tenant exists for tests to kick off
43 cisco.aci.aci_tenant: &aci_tenant_present
44 <<: *aci_tenant_absent
45 state: present
46 register: tenant_present
47
48 - name: ensure vrf exists for tests to kick off
49 cisco.aci.aci_vrf: &aci_vrf_present
50 <<: *aci_tenant_present
51 vrf: anstest
52 register: vrf_present
53
54 - name: ensure bd anstest does not exist
55 cisco.aci.aci_bd:
56 <<: *aci_tenant_present
57 bd: anstest
58 state: absent
59
60 - name: ensure bd anstest2 does not exist
61 cisco.aci.aci_bd:
62 <<: *aci_tenant_present
63 bd: anstest2
64 state: absent
65
66 - name: ensure L3out exists
67 cisco.aci.aci_l3out: &aci_l3_out_present
68 <<: *aci_tenant_present
69 tenant: ansible_test
70 l3out: ansible_l3out
71 domain: ansible_dom
72 route_control: export
73 vrf: anstest
74 l3protocol: ospf
75 state: present
76
77 - name: ensure IGMP Interface Policy exists
78 cisco.aci.aci_igmp_interface_policy: &aci_igmp_policy_present
79 <<: *aci_tenant_present
80 name: ansible_igmp_pol
81 state: present
82
83 - name: ensure Monitoring Policy exists
84 cisco.aci.aci_epg_monitoring_policy: &aci_monitoring_policy_present
85 <<: *aci_tenant_present
86 name: ansible_monitoring_pol
87 state: present
88
89 - name: ensure PIM Route Map Policy exists
90 cisco.aci.aci_pim_route_map_policy: &aci_route_map_policy_present
91 <<: *aci_tenant_present
92 name: ansible_route_map_pol
93 state: present
94 when: version.current.0.topSystem.attributes.version is version('5.2', '>=')
95
96 - name: ensure IGMP Snoop Policy exists
97 cisco.aci.aci_rest:
98 <<: *aci_info
99 path: /api/mo/uni/tn-ansible_test.json
100 method: post
101 content:
102 igmpSnoopPol:
103 attributes:
104 name: ansible_igmp_snoop
105
106 - name: ensure MLD Snoop Policy exists
107 cisco.aci.aci_rest:
108 <<: *aci_info
109 path: /api/mo/uni/tn-ansible_test.json
110 method: post
111 content:
112 mldSnoopPol:
113 attributes:
114 name: ansible_mld_snoop
115
116 - name: ensure FHS policy exists
117 cisco.aci.aci_rest:
118 <<: *aci_info
119 path: /api/mo/uni/tn-ansible_test.json
120 method: post
121 content:
122 fhsBDPol:
123 attributes:
124 name: ansible_fhs
125
126 - name: create bd - check mode works
127 cisco.aci.aci_bd: &aci_bd_present
128 <<: *aci_tenant_present
129 bd: anstest
130 description: Ansible Test
131 mld_snoop_policy: ansible_mld_snoop
132 first_hop_security_policy: ansible_fhs
133 igmp_policy: ansible_igmp_pol
134 check_mode: true
135 register: bd_present_check_mode
136
137 - name: create bd - creation works
138 cisco.aci.aci_bd:
139 <<: *aci_bd_present
140 register: bd_present
141
142 - name: create bd again - idempotency works
143 cisco.aci.aci_bd:
144 <<: *aci_bd_present
145 register: bd_present_idempotent
146
147 # UPDATE BD
148 - name: update bd - update works
149 cisco.aci.aci_bd:
150 <<: *aci_bd_present
151 vrf: anstest
152 description: Ansible Test Update
153 register: bd_update
154
155 - name: Update bd to remove child config (check_mode)
156 cisco.aci.aci_bd: &aci_bd_update
157 <<: *aci_bd_present
158 mld_snoop_policy: ""
159 first_hop_security_policy: ""
160 igmp_policy: ""
161 check_mode: true
162 register: cm_update_bd_2
163
164 - name: Update bd to remove child config (normal_mode)
165 cisco.aci.aci_bd:
166 <<: *aci_bd_update
167 register: nm_update_bd_2
168
169 - name: Update bd again to remove child config (testing idempotency)
170 cisco.aci.aci_bd:
171 <<: *aci_bd_update
172 register: nm_update_bd_2_again
173
174 - name: create another bd - check more params
175 cisco.aci.aci_bd:
176 <<: *aci_bd_present
177 bd: anstest2
178 bd_type: ethernet
179 endpoint_move_detect: default
180 ip_learning: "no"
181 l2_unknown_unicast: flood
182 l3_unknown_multicast: opt-flood
183 multi_dest: drop
184 enable_routing: "no"
185 arp_flooding: "yes"
186 route_profile_l3out: ansible_l3out
187 route_profile: ansible_l3out_route
188 register: bd_present_2
189 when: version.current.0.topSystem.attributes.version is version('4.2', '<')
190
191 - name: create another bd - check more params (>=v4.2 & <6.0)
192 cisco.aci.aci_bd:
193 <<: *aci_bd_present
194 bd: anstest2
195 bd_type: ethernet
196 endpoint_move_detect: default
197 ip_learning: "no"
198 l2_unknown_unicast: flood
199 l3_unknown_multicast: opt-flood
200 ipv6_l3_unknown_multicast: opt-flood
201 multi_dest: drop
202 enable_routing: "yes"
203 arp_flooding: "yes"
204 route_profile_l3out: ansible_l3out
205 route_profile: ansible_l3out_route
206 host_based_routing: true
207 allow_intersite_bum_traffic: true
208 allow_intersite_l2_stretch: true
209 allow_ipv6_mcast: true
210 ll_addr: "fe80::1322:33ff:fe44:5566"
211 vmac: "00:AA:BB:CC:DD:03"
212 optimize_wan_bandwidth: true
213 vlan: vlan-101
214 igmp_policy: ansible_igmp_pol
215 monitoring_policy: ansible_monitoring_pol
216 igmp_snoop_policy: ansible_igmp_snoop
217 mld_snoop_policy: ansible_mld_snoop
218 first_hop_security_policy: ansible_fhs
219 register: bd_present_2b
220 when: version.current.0.topSystem.attributes.version is version('4.2', '>=') and
221 version.current.0.topSystem.attributes.version is version('6.0', '<')
222
223 - name: create another bd - check more params (>=v6.0)
224 cisco.aci.aci_bd:
225 <<: *aci_bd_present
226 bd: anstest2
227 bd_type: ethernet
228 endpoint_move_detect: default
229 ip_learning: "no"
230 l2_unknown_unicast: flood
231 l3_unknown_multicast: opt-flood
232 ipv6_l3_unknown_multicast: opt-flood
233 multi_dest: drop
234 enable_routing: "yes"
235 arp_flooding: "yes"
236 route_profile_l3out: ansible_l3out
237 route_profile: ansible_l3out_route
238 host_based_routing: true
239 enable_rogue_except_mac: true
240 allow_intersite_bum_traffic: true
241 allow_intersite_l2_stretch: true
242 allow_ipv6_mcast: true
243 ll_addr: "fe80::1322:33ff:fe44:5566"
244 mcast_arp_drop: true
245 vmac: "00:AA:BB:CC:DD:03"
246 optimize_wan_bandwidth: true
247 vlan: vlan-101
248 igmp_policy: ansible_igmp_pol
249 monitoring_policy: ansible_monitoring_pol
250 igmp_snoop_policy: ansible_igmp_snoop
251 mld_snoop_policy: ansible_mld_snoop
252 pim_source_filter: ansible_route_map_pol
253 pim_destination_filter: ansible_route_map_pol
254 first_hop_security_policy: ansible_fhs
255 register: bd_present_2c
256 when: version.current.0.topSystem.attributes.version is version('6.0', '>=')
257
258 - name: create bd without all necessary params - failure message works
259 cisco.aci.aci_bd:
260 <<: *aci_bd_present
261 tenant: "{{ fake_var | default(omit) }}"
262 ignore_errors: true
263 register: bd_present_missing_param
264
265 - name: present asserts for removing children
266 ansible.builtin.assert:
267 that:
268 - cm_update_bd_2 is changed
269 - cm_update_bd_2.previous == cm_update_bd_2.current
270 - cm_update_bd_2.proposed.fvBD.children | length == 3
271 - cm_update_bd_2.proposed.fvBD.children.0.fvRsMldsn.attributes.tnMldSnoopPolName == ''
272 - cm_update_bd_2.proposed.fvBD.children.1.fvRsBDToFhs.attributes.tnFhsBDPolName == ''
273 - cm_update_bd_2.proposed.fvBD.children.2.igmpIfP.children.0.igmpRsIfPol.attributes.tDn == ''
274 - nm_update_bd_2 is changed
275 - nm_update_bd_2.previous.0.fvBD.children.0.fvRsMldsn.attributes.tnMldSnoopPolName == 'ansible_mld_snoop'
276 - nm_update_bd_2.previous.0.fvBD.children.1.fvRsBDToFhs.attributes.tnFhsBDPolName == 'ansible_fhs'
277 - nm_update_bd_2.previous.0.fvBD.children.2.igmpIfP.children.0.igmpRsIfPol.attributes.tDn == 'uni/tn-ansible_test/igmpIfPol-ansible_igmp_pol'
278 - nm_update_bd_2.current.0.fvBD.children.0.fvRsMldsn.attributes.tnMldSnoopPolName == ''
279 - nm_update_bd_2.current.0.fvBD.children.1.fvRsBDToFhs.attributes.tnFhsBDPolName == ''
280 - nm_update_bd_2.current.0.fvBD.children.2.igmpIfP.children.0.igmpRsIfPol.attributes.tDn == ''
281 - nm_update_bd_2_again is not changed
282 - nm_update_bd_2_again.previous == nm_update_bd_2_again.current
283
284 - name: present asserts (<v4.2)
285 ansible.builtin.assert:
286 that:
287 - bd_present_check_mode is changed
288 - bd_present_check_mode.sent.fvBD.attributes.descr == 'Ansible Test'
289 - bd_present_check_mode.sent.fvBD.attributes.name == 'anstest'
290 - bd_present is changed
291 - bd_present.current.0.fvBD.attributes.annotation == 'orchestrator:ansible'
292 - bd_present.sent == bd_present_check_mode.sent
293 - bd_present.previous == []
294 - bd_present_idempotent is not changed
295 - bd_present_idempotent.previous != []
296 - bd_update is changed
297 - bd_update.previous != []
298 - bd_update.sent != bd_update.proposed
299 - bd_update.sent.fvBD.attributes.descr == 'Ansible Test Update'
300 - bd_update.sent.fvBD.children.0.fvRsCtx.attributes.tnFvCtxName == 'anstest'
301 - bd_present_2.sent.fvBD.attributes.arpFlood == 'yes'
302 - bd_present_2.sent.fvBD.attributes.descr == 'Ansible Test'
303 - bd_present_2.sent.fvBD.attributes.ipLearning == 'no'
304 - bd_present_2.sent.fvBD.attributes.multiDstPktAct == 'drop'
305 - bd_present_2.sent.fvBD.attributes.name == 'anstest2'
306 - bd_present_2.sent.fvBD.attributes.unicastRoute == 'no'
307 - bd_present_2.sent.fvBD.attributes.unkMacUcastAct == 'flood'
308 - bd_present_2.sent.fvBD.attributes.unkMcastAct == 'opt-flood'
309 - bd_present_2.sent.fvBD.attributes.type == 'regular'
310 - bd_present_2.sent.fvBD.children.0.fvRsBDToProfile.attributes.tnL3extOutName == 'ansible_l3out'
311 - bd_present_2.sent.fvBD.children.0.fvRsBDToProfile.attributes.tnRtctrlProfileName == 'ansible_l3out_route'
312 - bd_present_missing_param is failed
313 - 'bd_present_missing_param.msg == "state is present but all of the following are missing: tenant"'
314 when: version.current.0.topSystem.attributes.version is version('4.2', '<')
315
316 - name: present asserts (>=v4.2 & <v6.0)
317 ansible.builtin.assert:
318 that:
319 - bd_present_check_mode is changed
320 - bd_present_check_mode.sent.fvBD.attributes.descr == 'Ansible Test'
321 - bd_present_check_mode.sent.fvBD.attributes.name == 'anstest'
322 - bd_present is changed
323 - bd_present.sent == bd_present_check_mode.sent
324 - bd_present.previous == []
325 - bd_present_idempotent is not changed
326 - bd_present_idempotent.previous != []
327 - bd_update is changed
328 - bd_update.previous != []
329 - bd_update.sent != bd_update.proposed
330 - bd_update.sent.fvBD.attributes.descr == 'Ansible Test Update'
331 - bd_update.sent.fvBD.children.0.fvRsCtx.attributes.tnFvCtxName == 'anstest'
332 - bd_present_2b.sent.fvBD.attributes.arpFlood == 'yes'
333 - bd_present_2b.sent.fvBD.attributes.descr == 'Ansible Test'
334 - bd_present_2b.sent.fvBD.attributes.ipLearning == 'no'
335 - bd_present_2b.sent.fvBD.attributes.multiDstPktAct == 'drop'
336 - bd_present_2b.sent.fvBD.attributes.name == 'anstest2'
337 - bd_present_2b.sent.fvBD.attributes.unicastRoute == 'yes'
338 - bd_present_2b.sent.fvBD.attributes.unkMacUcastAct == 'flood'
339 - bd_present_2b.sent.fvBD.attributes.unkMcastAct == 'opt-flood'
340 - bd_present_2b.sent.fvBD.attributes.v6unkMcastAct == 'opt-flood'
341 - bd_present_2b.sent.fvBD.attributes.type == 'regular'
342 - bd_present_2b.sent.fvBD.attributes.hostBasedRouting == 'yes'
343 - bd_present_2b.sent.fvBD.attributes.intersiteBumTrafficAllow == 'yes'
344 - bd_present_2b.sent.fvBD.attributes.intersiteL2Stretch == 'yes'
345 - bd_present_2b.sent.fvBD.attributes.ipv6McastAllow == 'yes'
346 - bd_present_2b.sent.fvBD.attributes.llAddr == 'fe80::1322:33ff:fe44:5566'
347 - bd_present_2b.sent.fvBD.attributes.vmac == '00:AA:BB:CC:DD:03'
348 - bd_present_2b.sent.fvBD.attributes.OptimizeWanBandwidth == 'yes'
349 - bd_present_2b.sent.fvBD.children.0.fvRsIgmpsn.attributes.tnIgmpSnoopPolName == 'ansible_igmp_snoop'
350 - bd_present_2b.sent.fvBD.children.1.fvRsMldsn.attributes.tnMldSnoopPolName == 'ansible_mld_snoop'
351 - bd_present_2b.sent.fvBD.children.2.fvRsBDToProfile.attributes.tnL3extOutName == 'ansible_l3out'
352 - bd_present_2b.sent.fvBD.children.2.fvRsBDToProfile.attributes.tnRtctrlProfileName == 'ansible_l3out_route'
353 - bd_present_2b.sent.fvBD.children.3.fvRsBDToFhs.attributes.tnFhsBDPolName == 'ansible_fhs'
354 - bd_present_2b.sent.fvBD.children.4.fvAccP.attributes.encap == 'vlan-101'
355 - bd_present_2b.sent.fvBD.children.5.fvRsABDPolMonPol.attributes.tnMonEPGPolName == 'ansible_monitoring_pol'
356 - bd_present_2b.sent.fvBD.children.6.igmpIfP.children.0.igmpRsIfPol.attributes.tDn == 'uni/tn-ansible_test/igmpIfPol-ansible_igmp_pol'
357 - bd_present_missing_param is failed
358 - 'bd_present_missing_param.msg == "state is present but all of the following are missing: tenant"'
359 when: version.current.0.topSystem.attributes.version is version('4.2', '>=') and
360 version.current.0.topSystem.attributes.version is version('6.0', '<')
361
362 - name: present asserts (>=v6.0)
363 ansible.builtin.assert:
364 that:
365 - bd_present_check_mode is changed
366 - bd_present_check_mode.sent.fvBD.attributes.descr == 'Ansible Test'
367 - bd_present_check_mode.sent.fvBD.attributes.name == 'anstest'
368 - bd_present is changed
369 - bd_present.sent == bd_present_check_mode.sent
370 - bd_present.previous == []
371 - bd_present_idempotent is not changed
372 - bd_present_idempotent.previous != []
373 - bd_update is changed
374 - bd_update.previous != []
375 - bd_update.sent != bd_update.proposed
376 - bd_update.sent.fvBD.attributes.descr == 'Ansible Test Update'
377 - bd_update.sent.fvBD.children.0.fvRsCtx.attributes.tnFvCtxName == 'anstest'
378 - bd_present_2c.sent.fvBD.attributes.arpFlood == 'yes'
379 - bd_present_2c.sent.fvBD.attributes.descr == 'Ansible Test'
380 - bd_present_2c.sent.fvBD.attributes.ipLearning == 'no'
381 - bd_present_2c.sent.fvBD.attributes.multiDstPktAct == 'drop'
382 - bd_present_2c.sent.fvBD.attributes.name == 'anstest2'
383 - bd_present_2c.sent.fvBD.attributes.unicastRoute == 'yes'
384 - bd_present_2c.sent.fvBD.attributes.unkMacUcastAct == 'flood'
385 - bd_present_2c.sent.fvBD.attributes.unkMcastAct == 'opt-flood'
386 - bd_present_2c.sent.fvBD.attributes.v6unkMcastAct == 'opt-flood'
387 - bd_present_2c.sent.fvBD.attributes.type == 'regular'
388 - bd_present_2c.sent.fvBD.attributes.hostBasedRouting == 'yes'
389 - bd_present_2c.sent.fvBD.attributes.intersiteBumTrafficAllow == 'yes'
390 - bd_present_2c.sent.fvBD.attributes.intersiteL2Stretch == 'yes'
391 - bd_present_2c.sent.fvBD.attributes.ipv6McastAllow == 'yes'
392 - bd_present_2c.sent.fvBD.attributes.llAddr == 'fe80::1322:33ff:fe44:5566'
393 - bd_present_2c.sent.fvBD.attributes.mcastARPDrop == 'yes'
394 - bd_present_2c.sent.fvBD.attributes.enableRogueExceptMac == 'yes'
395 - bd_present_2c.sent.fvBD.attributes.vmac == '00:AA:BB:CC:DD:03'
396 - bd_present_2c.sent.fvBD.attributes.OptimizeWanBandwidth == 'yes'
397 - bd_present_2c.sent.fvBD.children.0.fvRsIgmpsn.attributes.tnIgmpSnoopPolName == 'ansible_igmp_snoop'
398 - bd_present_2c.sent.fvBD.children.1.fvRsMldsn.attributes.tnMldSnoopPolName == 'ansible_mld_snoop'
399 - bd_present_2c.sent.fvBD.children.2.fvRsBDToProfile.attributes.tnRtctrlProfileName == 'ansible_l3out_route'
400 - bd_present_2c.sent.fvBD.children.2.fvRsBDToProfile.attributes.tnL3extOutName == 'ansible_l3out'
401 - bd_present_2c.sent.fvBD.children.3.fvRsBDToFhs.attributes.tnFhsBDPolName == 'ansible_fhs'
402 - bd_present_2c.sent.fvBD.children.4.fvAccP.attributes.encap == 'vlan-101'
403 - bd_present_2c.sent.fvBD.children.5.fvRsABDPolMonPol.attributes.tnMonEPGPolName == 'ansible_monitoring_pol'
404 - bd_present_2c.sent.fvBD.children.6.igmpIfP.children.0.igmpRsIfPol.attributes.tDn == 'uni/tn-ansible_test/igmpIfPol-ansible_igmp_pol'
405 - bd_present_2c.sent.fvBD.children.7.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
406 - bd_present_2c.sent.fvBD.children.7.pimBDP.children.0.pimBDFilterPol.children.1.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
407 - bd_present_missing_param is failed
408 - 'bd_present_missing_param.msg == "state is present but all of the following are missing: tenant"'
409 when: version.current.0.topSystem.attributes.version is version('6.0', '>=')
410
411 - name: execute tasks for pim source filter & pim destination filter (>=v5.2)
412 when: version.current.0.topSystem.attributes.version is version('5.2', '>=')
413 block:
414
415 - name: create another bd - check pim source filter (check_mode)
416 cisco.aci.aci_bd: &aci_bd_pim_s
417 <<: *aci_bd_present
418 bd: anstest_pim_s
419 pim_source_filter: ansible_route_map_pol
420 check_mode: true
421 register: cm_bd_pim_s
422
423 - name: create another bd - check pim source filter (normal_mode)
424 cisco.aci.aci_bd:
425 <<: *aci_bd_pim_s
426 register: nm_bd_pim_s
427
428 - name: create another bd - check pim source filter (testing idempotency)
429 cisco.aci.aci_bd:
430 <<: *aci_bd_pim_s
431 register: nm_bd_pim_s_again
432
433 - name: update bd - remove pim source filter
434 cisco.aci.aci_bd:
435 <<: *aci_bd_pim_s
436 pim_source_filter: ""
437 register: nm_bd_pim_s_remove
438
439 - name: create another bd - check pim destination filter (check_mode)
440 cisco.aci.aci_bd: &aci_bd_pim_d
441 <<: *aci_bd_present
442 bd: anstest_pim_d
443 pim_destination_filter: ansible_route_map_pol
444 check_mode: true
445 register: cm_bd_pim_d
446
447 - name: create another bd - check pim destination filter (normal_mode)
448 cisco.aci.aci_bd:
449 <<: *aci_bd_pim_d
450 register: nm_bd_pim_d
451
452 - name: create another bd - check pim destination filter (testing idempotency)
453 cisco.aci.aci_bd:
454 <<: *aci_bd_pim_d
455 register: nm_bd_pim_d_again
456
457 - name: update bd - remove pim destination filter
458 cisco.aci.aci_bd:
459 <<: *aci_bd_pim_d
460 pim_destination_filter: ""
461 register: nm_bd_pim_d_remove
462
463 - name: cleanup pim_s and pim_d BDs
464 cisco.aci.aci_bd:
465 <<: *aci_bd_present
466 bd: "{{ item }}"
467 state: absent
468 loop:
469 - anstest_pim_s
470 - anstest_pim_d
471
472 - name: asserts for pim source filter and pim destination filter
473 ansible.builtin.assert:
474 that:
475 - cm_bd_pim_s is changed
476 - cm_bd_pim_s.current == []
477 - cm_bd_pim_s.previous == []
478 - cm_bd_pim_s.proposed.fvBD.children.3.pimBDP.children.0.pimBDFilterPol.children | length == 1
479 - cm_bd_pim_s.proposed.fvBD.children.3.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
480 - nm_bd_pim_s is changed
481 - nm_bd_pim_s.previous == []
482 - nm_bd_pim_s.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
483 - nm_bd_pim_s.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
484 - nm_bd_pim_s_again.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
485 - nm_bd_pim_s_again.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
486 - nm_bd_pim_s_again.previous.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
487 - nm_bd_pim_s_again.previous.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
488 - nm_bd_pim_s_remove.previous == nm_bd_pim_s.current
489 - nm_bd_pim_s_remove.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDSrcFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == ''
490 - cm_bd_pim_d is changed
491 - cm_bd_pim_d.current == []
492 - cm_bd_pim_d.previous == []
493 - cm_bd_pim_d.proposed.fvBD.children.3.pimBDP.children.0.pimBDFilterPol.children | length == 1
494 - cm_bd_pim_d.proposed.fvBD.children.3.pimBDP.children.0.pimBDFilterPol.children.0.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
495 - nm_bd_pim_d is changed
496 - nm_bd_pim_d.previous == []
497 - nm_bd_pim_d.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
498 - nm_bd_pim_d.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
499 - nm_bd_pim_d_again.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
500 - nm_bd_pim_d_again.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
501 - nm_bd_pim_d_again.previous.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children | length == 1
502 - nm_bd_pim_d_again.previous.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == 'uni/tn-ansible_test/rtmap-ansible_route_map_pol'
503 - nm_bd_pim_d_remove.previous == nm_bd_pim_d.current
504 - nm_bd_pim_d_remove.current.0.fvBD.children.5.pimBDP.children.0.pimBDFilterPol.children.0.pimBDDestFilterPol.children.0.rtdmcRsFilterToRtMapPol.attributes.tDn == ''
505
506 # TEST NO VERIFICATION
507 - name: create bd with no verification (check mode)
508 cisco.aci.aci_bd: &aci_bd_no_verify
509 <<: *aci_bd_present
510 bd: anstest-no-verify
511 no_verification: true
512 check_mode: true
513 register: bd_present_no_verify_cm
514
515 - name: create bd with no verification
516 cisco.aci.aci_bd:
517 <<: *aci_bd_no_verify
518 register: bd_present_no_verify
519
520 - name: create bd with no verification again
521 cisco.aci.aci_bd:
522 <<: *aci_bd_no_verify
523 register: bd_present_no_verify_again
524
525 - name: update bd with no verification
526 cisco.aci.aci_bd:
527 <<: *aci_bd_no_verify
528 description: Ansible Test No Verify
529 register: update_bd_present_no_verify
530
531 - name: delete bd with no verification
532 cisco.aci.aci_bd:
533 <<: *aci_bd_no_verify
534 state: absent
535 register: delete_bd_present_no_verify
536
537 - name: delete bd with no verification again
538 cisco.aci.aci_bd:
539 <<: *aci_bd_no_verify
540 state: absent
541 register: delete_bd_present_no_verify_again
542
543 - name: no verification asserts
544 ansible.builtin.assert:
545 that:
546 - bd_present_no_verify_cm is changed
547 - bd_present_no_verify_cm.current_verified == false
548 - bd_present_no_verify_cm.current.0 == bd_present_no_verify_cm.proposed
549 - bd_present_no_verify is changed
550 - bd_present_no_verify.current_verified == false
551 - bd_present_no_verify.current.0 == bd_present_no_verify.proposed
552 - bd_present_no_verify.previous == []
553 - bd_present_no_verify_again is not changed
554 - bd_present_no_verify_again.current_verified == true
555 - bd_present_no_verify_again.current.0.fvBD.attributes.name == "anstest-no-verify"
556 - bd_present_no_verify_again.current.0.fvBD.attributes.descr == "Ansible Test"
557 - bd_present_no_verify_again.previous.0.fvBD.attributes.name == "anstest-no-verify"
558 - bd_present_no_verify_again.previous.0.fvBD.attributes.descr == "Ansible Test"
559 - update_bd_present_no_verify is changed
560 - update_bd_present_no_verify.current_verified == false
561 - update_bd_present_no_verify.current.0 == update_bd_present_no_verify.proposed
562 - update_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify"
563 - update_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test"
564 - delete_bd_present_no_verify is changed
565 - delete_bd_present_no_verify.current_verified == false
566 - delete_bd_present_no_verify.current.0 == delete_bd_present_no_verify.proposed
567 - delete_bd_present_no_verify.previous.0.fvBD.attributes.name == "anstest-no-verify"
568 - delete_bd_present_no_verify.previous.0.fvBD.attributes.descr == "Ansible Test No Verify"
569 - delete_bd_present_no_verify_again is not changed
570 - delete_bd_present_no_verify_again.current_verified == true
571 - delete_bd_present_no_verify_again.current == []
572 - delete_bd_present_no_verify_again.previous == []
573 - delete_bd_present_no_verify_again.proposed == {}
574
575 - name: get all bd
576 cisco.aci.aci_bd: &aci_query
577 <<: *aci_tenant_present
578 state: query
579 tenant: "{{ fake_var | default(omit) }}"
580 register: query_all
581
582 - name: get all in tenant
583 cisco.aci.aci_bd:
584 <<: *aci_query
585 tenant: ansible_test
586 register: query_tenant
587
588 - name: get all with name
589 cisco.aci.aci_bd:
590 <<: *aci_query
591 bd: anstest
592 register: query_bd_bd
593
594 - name: get bd
595 cisco.aci.aci_bd:
596 <<: *aci_bd_present
597 state: query
598 register: query_bd
599
600 - name: query asserts
601 ansible.builtin.assert:
602 that:
603 - query_all is not changed
604 - query_all.current | length > 1
605 - query_all.current.0.fvBD is defined
606 - '"rsp-subtree-class=fvAccP,fvRsABDPolMonPol,fvRsBDToFhs,fvRsBDToNdP,fvRsBDToProfile,fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsMldsn,igmpIfP,igmpRsIfPol" in query_all.filter_string'
607 - '"class/fvBD.json" in query_all.url'
608 - query_tenant is not changed
609 - query_tenant.current | length == 1
610 - query_tenant.current.0.fvTenant.children | length == 2
611 - '"rsp-subtree-class=fvAccP,fvBD,fvRsABDPolMonPol,fvRsBDToFhs,fvRsBDToNdP,fvRsBDToProfile,fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsMldsn,igmpIfP,igmpRsIfPol" in query_tenant.filter_string'
612 - '"tn-ansible_test.json" in query_tenant.url'
613 - query_bd_bd is not changed
614 - query_bd_bd.current != []
615 - '"query-target-filter=eq(fvBD.name,\"anstest\")" in query_bd_bd.filter_string'
616 - '"rsp-subtree-class=fvAccP,fvRsABDPolMonPol,fvRsBDToFhs,fvRsBDToNdP,fvRsBDToProfile,fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsMldsn,igmpIfP,igmpRsIfPol" in query_bd_bd.filter_string'
617 - '"class/fvBD.json" in query_bd_bd.url'
618 - query_bd is not changed
619 - query_bd.current | length == 1
620 - query_bd.current.0.fvBD.attributes.name == "anstest"
621 - '"rsp-subtree-class=fvAccP,fvRsABDPolMonPol,fvRsBDToFhs,fvRsBDToNdP,fvRsBDToProfile,fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsMldsn,igmpIfP,igmpRsIfPol" in query_bd.filter_string'
622 - '"tn-ansible_test/BD-anstest.json" in query_bd.url'
623
624 - name: delete bd - check mode works
625 cisco.aci.aci_bd: &aci_bd_absent
626 <<: *aci_bd_present
627 state: absent
628 check_mode: true
629 register: bd_absent_check_mode
630
631 - name: delete bd - delete works
632 cisco.aci.aci_bd:
633 <<: *aci_bd_absent
634 register: bd_absent
635
636 - name: delete bd again - idempotency works
637 cisco.aci.aci_bd:
638 <<: *aci_bd_absent
639 register: bd_absent_idempotent
640
641 - name: delete bd - cleanup
642 cisco.aci.aci_bd:
643 <<: *aci_bd_absent
644 bd: anstest2
645
646 - name: delete bd missing param - fails properly
647 cisco.aci.aci_bd:
648 <<: *aci_bd_absent
649 bd: "{{ fakevar | default(omit) }}"
650 ignore_errors: true
651 register: bd_absent_missing_param
652
653 - name: asserts for deletion task
654 ansible.builtin.assert:
655 that:
656 - bd_absent_check_mode is changed
657 - bd_absent_check_mode.proposed == {}
658 - bd_absent is changed
659 - bd_absent.previous != []
660 - bd_absent_idempotent is not changed
661 - bd_absent_idempotent.previous == []
662 - bd_absent_missing_param is failed
663 - 'bd_absent_missing_param.msg == "state is absent but all of the following are missing: bd"'
664
665 - name: delete FHS - cleanup before ending tests
666 cisco.aci.aci_rest:
667 <<: *aci_info
668 path: /api/mo/uni/tn-ansible_test/bdpol-ansible_fhs.json
669 method: delete
670
671 - name: delete IGMP Snoop Policy - cleanup before ending tests
672 cisco.aci.aci_rest:
673 <<: *aci_info
674 path: /api/mo/uni/tn-ansible_test/snPol-ansible_igmp_snoop.json
675 method: delete
676
677 - name: delete MLD Snoop Policy - cleanup before ending tests
678 cisco.aci.aci_rest:
679 <<: *aci_info
680 path: /api/mo/uni/tn-ansible_test/mldsnoopPol-ansible_mld_snoop.json
681 method: delete
682
683 - name: delete IGMP Interface Policy - cleanup before ending tests
684 cisco.aci.aci_igmp_interface_policy:
685 <<: *aci_igmp_policy_present
686 state: absent
687
688 - name: delete Monitoring Policy - cleanup before ending tests
689 cisco.aci.aci_epg_monitoring_policy:
690 <<: *aci_monitoring_policy_present
691 state: absent
692
693 - name: delete PIM Route Map Policy - cleanup before ending tests
694 cisco.aci.aci_pim_route_map_policy:
695 <<: *aci_route_map_policy_present
696 state: absent
697 when: version.current.0.topSystem.attributes.version is version('5.2', '>=')
698
699 - name: delete vrf - cleanup before ending tests
700 cisco.aci.aci_vrf:
701 <<: *aci_vrf_present
702 state: absent
703 when: vrf_present is changed
704
705 - name: delete l3out - cleanup before ending tests
706 cisco.aci.aci_l3out:
707 <<: *aci_l3_out_present
708 state: absent
709
710 - name: delete tenant - cleanup before ending tests
711 cisco.aci.aci_tenant:
712 <<: *aci_tenant_present
713 state: absent
714 when: tenant_present is changed