Debian Codegraph @

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

raw symbols SCIP
1 # Test code for the ACI modules
2 # Copyright: (c) 2021, Tim Cragg (@timcragg)
3 # Copyright: (c) 2023, Akini Ross (@akinross) <[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 # GET Credentials from the inventory
13 - name: Set vars
14 ansible.builtin.set_fact:
15 aci_info: &aci_info
16 host: "{{ aci_hostname }}"
17 username: "{{ aci_username }}"
18 password: "{{ aci_password }}"
19 validate_certs: '{{ aci_validate_certs | default(false) }}'
20 use_ssl: '{{ aci_use_ssl | default(true) }}'
21 use_proxy: '{{ aci_use_proxy | default(true) }}'
22 output_level: debug
23
24 # CLEAN ENVIRONMENT
25 - name: Remove ansible_tenant if it already exists
26 cisco.aci.aci_tenant:
27 <<: *aci_info
28 tenant: ansible_tenant
29 state: absent
30
31 - name: Verify Cloud and Non-Cloud Sites in use.
32 ansible.builtin.include_tasks: ../../../../../../integration/targets/aci_cloud_provider/tasks/main.yml
33
34 - name: Execute tasks only for non-cloud sites
35 when: query_cloud.current == [] # This condition will execute only non-cloud sites
36 block: # block specifies execution of tasks within, based on conditions
37 - name: Remove ansible_l3ext_domain if it already exists
38 cisco.aci.aci_domain:
39 <<: *aci_info
40 domain: ansible_l3ext_domain
41 domain_type: l3dom
42 state: absent
43
44 - name: Remove ansible_port_channel_ipg if it already exists
45 cisco.aci.aci_interface_policy_leaf_policy_group:
46 <<: *aci_info
47 lag_type: link
48 policy_group: ansible_port_channel_ipg
49 state: absent
50
51 - name: Remove ansible_vpc_ipg if it already exists
52 cisco.aci.aci_interface_policy_leaf_policy_group:
53 <<: *aci_info
54 lag_type: node
55 policy_group: ansible_vpc_ipg
56 state: absent
57
58 - name: Add a new tenant required for l3out
59 cisco.aci.aci_tenant:
60 <<: *aci_info
61 tenant: ansible_tenant
62 description: Ansible tenant
63 state: present
64
65 # ADD domain
66 - name: Add domain for l3out
67 cisco.aci.aci_domain:
68 <<: *aci_info
69 domain: ansible_l3ext_domain
70 domain_type: l3dom
71 state: present
72
73 # ADD VRF
74 - name: Add VRF for l3out
75 cisco.aci.aci_vrf:
76 <<: *aci_info
77 tenant: ansible_tenant
78 vrf: ansible_vrf
79 state: present
80
81 # ADD PC IPG
82 - name: Add port-channel IPG
83 cisco.aci.aci_interface_policy_leaf_policy_group:
84 <<: *aci_info
85 lag_type: link
86 policy_group: ansible_port_channel_ipg
87 state: present
88
89 # ADD vPC IPG
90 - name: Add vPC IPG
91 cisco.aci.aci_interface_policy_leaf_policy_group:
92 <<: *aci_info
93 lag_type: node
94 policy_group: ansible_vpc_ipg
95 state: present
96
97 # ADD l3out
98 - name: Add l3out
99 cisco.aci.aci_l3out:
100 <<: *aci_info
101 tenant: ansible_tenant
102 name: ansible_l3out
103 vrf: ansible_vrf
104 domain: ansible_domain
105 route_control: export
106 state: present
107
108 # ADD l3out logical node profile
109 - name: l3out logical node profile
110 cisco.aci.aci_l3out_logical_node_profile:
111 <<: *aci_info
112 tenant: ansible_tenant
113 l3out: ansible_l3out
114 node_profile: ansible_node_profile
115 state: present
116
117 # ADD l3out logical interface profile
118 - name: l3out logical interface profile
119 cisco.aci.aci_l3out_logical_interface_profile:
120 <<: *aci_info
121 tenant: ansible_tenant
122 l3out: ansible_l3out
123 node_profile: ansible_node_profile
124 interface_profile: ansible_interface_profile
125 state: present
126
127 # ADD l3out interface
128 - name: Add routed interface
129 cisco.aci.aci_l3out_interface:
130 <<: *aci_info
131 tenant: ansible_tenant
132 l3out: ansible_l3out
133 node_profile: ansible_node_profile
134 interface_profile: ansible_interface_profile
135 pod_id: 1
136 node_id: 201
137 path_ep: eth1/15
138 interface_type: l3-port
139 mode: regular
140 addr: 192.168.50.1/27
141 ipv6_dad: disabled
142 mtu: 1500
143 auto_state: disabled
144 state: present
145 register: add_l3out_interface
146
147 - name: Verify l3out has been created with the correct attributes
148 ansible.builtin.assert:
149 that:
150 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[eth1/15]]"
151 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.50.1/27"
152 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.ipv6Dad == "disabled"
153 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.mtu == "1500"
154 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.autostate == "disabled"
155 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
156 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
157 - add_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.annotation == 'orchestrator:ansible'
158
159 # ADD l3out interface again to check idempotency
160 - name: Add routed interface again
161 cisco.aci.aci_l3out_interface:
162 <<: *aci_info
163 tenant: ansible_tenant
164 l3out: ansible_l3out
165 node_profile: ansible_node_profile
166 interface_profile: ansible_interface_profile
167 pod_id: 1
168 node_id: 201
169 path_ep: eth1/15
170 interface_type: l3-port
171 mode: regular
172 addr: 192.168.50.1/27
173 ipv6_dad: disabled
174 mtu: 1500
175 auto_state: disabled
176 state: present
177 register: add_l3out_interface_again
178
179 - name: Verify l3out has not changed
180 ansible.builtin.assert:
181 that:
182 - add_l3out_interface_again is not changed
183
184 # MODIFY l3out attributes
185 - name: Update routed interface
186 cisco.aci.aci_l3out_interface:
187 <<: *aci_info
188 tenant: ansible_tenant
189 l3out: ansible_l3out
190 node_profile: ansible_node_profile
191 interface_profile: ansible_interface_profile
192 pod_id: 1
193 node_id: 201
194 path_ep: eth1/15
195 interface_type: sub-interface
196 mode: regular
197 addr: 192.168.60.1/27
198 encap: vlan-913
199 state: present
200 register: update_l3out_interface
201
202 - name: Verify routed interface has correct attributes
203 ansible.builtin.assert:
204 that:
205 - update_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[eth1/15]]"
206 - update_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.60.1/27"
207 - update_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "sub-interface"
208 - update_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
209 - update_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
210
211 # QUERY l3out interface
212 - name: Query routed interface
213 cisco.aci.aci_l3out_interface:
214 <<: *aci_info
215 tenant: ansible_tenant
216 l3out: ansible_l3out
217 node_profile: ansible_node_profile
218 interface_profile: ansible_interface_profile
219 pod_id: 1
220 node_id: 201
221 path_ep: eth1/15
222 state: query
223 register: query_l3out_interface
224
225 - name: Verify query_l3out_interface
226 ansible.builtin.assert:
227 that:
228 - query_l3out_interface is not changed
229 - query_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[eth1/15]]"
230 - query_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.60.1/27"
231 - query_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "sub-interface"
232 - query_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
233 - query_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
234
235 - name: Query all interfaces
236 cisco.aci.aci_l3out_interface:
237 <<: *aci_info
238 tenant: ansible_tenant
239 l3out: ansible_l3out
240 node_profile: ansible_node_profile
241 interface_profile: ansible_interface_profile
242 state: query
243 register: query_l3out_interfaces
244
245 - name: Verify query_l3out_interfaces
246 ansible.builtin.assert:
247 that:
248 - query_l3out_interfaces is not changed
249 - query_l3out_interfaces.current.0.l3extLIfP.children.0.l3extRsPathL3OutAtt.attributes.rn == "rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[eth1/15]]"
250 - query_l3out_interfaces.current.0.l3extLIfP.children.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.60.1/27"
251 - query_l3out_interfaces.current.0.l3extLIfP.children.0.l3extRsPathL3OutAtt.attributes.ifInstT == "sub-interface"
252 - query_l3out_interfaces.current.0.l3extLIfP.children.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
253 - query_l3out_interfaces.current.0.l3extLIfP.children.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
254
255 # DELETE l3out interface
256 - name: Remove routed sub-interface
257 cisco.aci.aci_l3out_interface:
258 <<: *aci_info
259 tenant: ansible_tenant
260 l3out: ansible_l3out
261 node_profile: ansible_node_profile
262 interface_profile: ansible_interface_profile
263 pod_id: 1
264 node_id: 201
265 path_ep: eth1/15
266 state: absent
267 register: delete_l3out_interface
268
269 - name: Verify interface has been deleted
270 ansible.builtin.assert:
271 that:
272 - delete_l3out_interface.current == []
273 - delete_l3out_interface.previous.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[eth1/15]]"
274
275 # ADD l3out port-channel
276 - name: Add routed interface port-channel
277 cisco.aci.aci_l3out_interface:
278 <<: *aci_info
279 tenant: ansible_tenant
280 l3out: ansible_l3out
281 node_profile: ansible_node_profile
282 interface_profile: ansible_interface_profile
283 pod_id: 1
284 node_id: 201
285 path_ep: ansible_port_channel_ipg
286 interface_type: l3-port
287 mode: regular
288 addr: 192.168.70.1/27
289 state: present
290 register: add_l3out_pc_interface
291
292 - name: Verify l3out port-channel has been created with the correct attributes
293 ansible.builtin.assert:
294 that:
295 - add_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[ansible_port_channel_ipg]]"
296 - add_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.70.1/27"
297 - add_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
298 - add_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
299
300 # ADD l3out port-channel again to check idempotency
301 - name: Add routed interface port-channel again
302 cisco.aci.aci_l3out_interface:
303 <<: *aci_info
304 tenant: ansible_tenant
305 l3out: ansible_l3out
306 node_profile: ansible_node_profile
307 interface_profile: ansible_interface_profile
308 pod_id: 1
309 node_id: 201
310 path_ep: ansible_port_channel_ipg
311 interface_type: l3-port
312 mode: regular
313 addr: 192.168.70.1/27
314 state: present
315 register: add_l3out_pc_interface_again
316
317 - name: Verify interface has not changed
318 ansible.builtin.assert:
319 that:
320 - add_l3out_pc_interface_again is not changed
321
322 # MODIFY l3out port-channel attributes
323 - name: Update routed port-channel interface
324 cisco.aci.aci_l3out_interface:
325 <<: *aci_info
326 tenant: ansible_tenant
327 l3out: ansible_l3out
328 node_profile: ansible_node_profile
329 interface_profile: ansible_interface_profile
330 pod_id: 1
331 node_id: 201
332 path_ep: ansible_port_channel_ipg
333 interface_type: l3-port
334 mode: regular
335 addr: 192.168.80.1/27
336 state: present
337 register: update_l3out_pc_interface
338
339 - name: Verify l3out port-channel has been updated with the correct attributes
340 ansible.builtin.assert:
341 that:
342 - update_l3out_pc_interface is changed
343 - update_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[ansible_port_channel_ipg]]"
344 - update_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.80.1/27"
345 - update_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
346 - update_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
347
348 # QUERY l3out port-channel interface
349 - name: Query l3out port-channel
350 cisco.aci.aci_l3out_interface:
351 <<: *aci_info
352 tenant: ansible_tenant
353 l3out: ansible_l3out
354 node_profile: ansible_node_profile
355 interface_profile: ansible_interface_profile
356 pod_id: 1
357 node_id: 201
358 path_ep: ansible_port_channel_ipg
359 state: query
360 register: query_l3out_pc_interface
361
362 - name: Verify query_l3out_pc_interface
363 ansible.builtin.assert:
364 that:
365 - query_l3out_pc_interface is not changed
366 - query_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[ansible_port_channel_ipg]]"
367 - query_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.80.1/27"
368 - query_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
369 - query_l3out_pc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
370
371 # DELETE l3out port-channel interface
372 - name: Remove port-channel
373 cisco.aci.aci_l3out_interface:
374 <<: *aci_info
375 tenant: ansible_tenant
376 l3out: ansible_l3out
377 node_profile: ansible_node_profile
378 interface_profile: ansible_interface_profile
379 pod_id: 1
380 node_id: 201
381 path_ep: ansible_port_channel_ipg
382 state: absent
383 register: delete_l3out_pc_interface
384
385 - name: Verify interface has been deleted
386 ansible.builtin.assert:
387 that:
388 - delete_l3out_pc_interface.current == []
389 - delete_l3out_pc_interface.previous.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/paths-201/pathep-[ansible_port_channel_ipg]]"
390
391 # ADD l3out vPC
392 - name: Add interface vPC
393 cisco.aci.aci_l3out_interface: &ext_svi_interface
394 <<: *aci_info
395 tenant: ansible_tenant
396 l3out: ansible_l3out
397 node_profile: ansible_node_profile
398 interface_profile: ansible_interface_profile
399 pod_id: 1
400 node_id: 201-202
401 path_ep: ansible_vpc_ipg
402 interface_type: ext-svi
403 mode: native
404 addr: 192.168.90.1/27
405 encap: vlan-913
406 mac: "00:22:BD:F8:19:FE"
407 description: "anisble test description"
408 state: present
409 register: add_l3out_vpc_interface
410
411 - name: Verify l3out vPC has been created with the correct attributes
412 ansible.builtin.assert:
413 that:
414 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/protpaths-201-202/pathep-[ansible_vpc_ipg]]"
415 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/27"
416 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "ext-svi"
417 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
418 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.encapScope == "local"
419 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "native"
420 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.mac == "00:22:BD:F8:19:FE"
421 - add_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.descr == "anisble test description"
422
423 - name: Add interface vPC again
424 cisco.aci.aci_l3out_interface:
425 <<: *ext_svi_interface
426 register: add_l3out_vpc_interface_again
427
428 - name: Change encap_scope on interface vPC
429 cisco.aci.aci_l3out_interface:
430 <<: *ext_svi_interface
431 encap_scope: vrf
432 state: present
433 register: change_l3out_vpc_interface_encap_scope
434
435 - name: Verify vPC interface is not changed
436 ansible.builtin.assert:
437 that:
438 - add_l3out_vpc_interface_again is not changed
439 - change_l3out_vpc_interface_encap_scope.previous.0.l3extRsPathL3OutAtt.attributes.encapScope == "local"
440 - change_l3out_vpc_interface_encap_scope.current.0.l3extRsPathL3OutAtt.attributes.encapScope == "ctx"
441
442 # MODIFY vPC interface
443 - name: Update interface vPC
444 cisco.aci.aci_l3out_interface:
445 <<: *aci_info
446 tenant: ansible_tenant
447 l3out: ansible_l3out
448 node_profile: ansible_node_profile
449 interface_profile: ansible_interface_profile
450 pod_id: 1
451 node_id: 201-202
452 path_ep: ansible_vpc_ipg
453 interface_type: ext-svi
454 mode: regular
455 addr: 192.168.90.1/27
456 encap: vlan-913
457 state: present
458 register: modify_l3out_vpc_interface
459
460 - name: Verify l3out vPC has been updated with the correct attributes
461 ansible.builtin.assert:
462 that:
463 - modify_l3out_vpc_interface is changed
464 - modify_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/protpaths-201-202/pathep-[ansible_vpc_ipg]]"
465 - modify_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/27"
466 - modify_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "ext-svi"
467 - modify_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
468 - modify_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
469
470 # QUERY vPC interface
471 - name: Query vPC interface
472 cisco.aci.aci_l3out_interface:
473 <<: *aci_info
474 tenant: ansible_tenant
475 l3out: ansible_l3out
476 node_profile: ansible_node_profile
477 interface_profile: ansible_interface_profile
478 pod_id: 1
479 node_id: 201-202
480 path_ep: ansible_vpc_ipg
481 state: query
482 register: query_l3out_vpc_interface
483
484 - name: Verify l3out vPC query
485 ansible.builtin.assert:
486 that:
487 - query_l3out_vpc_interface is not changed
488 - query_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.dn == "uni/tn-ansible_tenant/out-ansible_l3out/lnodep-ansible_node_profile/lifp-ansible_interface_profile/rspathL3OutAtt-[topology/pod-1/protpaths-201-202/pathep-[ansible_vpc_ipg]]"
489 - query_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/27"
490 - query_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "ext-svi"
491 - query_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.encap == "vlan-913"
492 - query_l3out_vpc_interface.current.0.l3extRsPathL3OutAtt.attributes.mode == "regular"
493
494 - name: Delete vPC interface
495 cisco.aci.aci_l3out_interface:
496 <<: *aci_info
497 tenant: ansible_tenant
498 l3out: ansible_l3out
499 node_profile: ansible_node_profile
500 interface_profile: ansible_interface_profile
501 pod_id: 1
502 node_id: 201-202
503 path_ep: ansible_vpc_ipg
504 state: absent
505 register: delete_l3out_vpc_interface
506
507 - name: Verify vPC interface is deleted
508 ansible.builtin.assert:
509 that:
510 - delete_l3out_vpc_interface.current == []
511
512 - name: Execute tasks only for APIC version 5.x and above
513 when:
514 - version.current.0.topSystem.attributes.version is version('5', '>=') # This condition will execute only for APIC version 5.x and above
515 block:
516
517 - name: Ensure infra SR-MPLS l3out does not exist
518 cisco.aci.aci_l3out: &aci_infra_sr_mpls_l3out_absent
519 <<: *aci_info
520 tenant: infra
521 name: ansible_infra_sr_mpls_l3out
522 domain: ansible_dom
523 vrf: overlay-1
524 mpls: "yes"
525 l3protocol: bgp
526 state: absent
527
528 - name: Add a infra SR-MPLS l3out
529 cisco.aci.aci_l3out:
530 <<: *aci_infra_sr_mpls_l3out_absent
531 state: present
532
533 - name: Add a node profile in the infra SR-MPLS l3out
534 cisco.aci.aci_l3out_logical_node_profile: &aci_infra_node_profile
535 <<: *aci_info
536 tenant: infra
537 l3out: ansible_infra_sr_mpls_l3out
538 node_profile: ansible_infra_sr_mpls_l3out_node_profile
539
540 - name: Add interface profile in the infra SR-MPLS l3out node profile
541 cisco.aci.aci_l3out_logical_interface_profile: &aci_infra_interface_profile
542 <<: *aci_infra_node_profile
543 interface_profile: ansible_infra_sr_mpls_l3out_interface_profile
544
545 - name: Add direct port channel interface in the infra SR-MPLS l3out interface profile (check_mode)
546 aci_l3out_interface: &aci_infra_pc_interface
547 <<: *aci_infra_interface_profile
548 pod_id: 1
549 node_id: 101
550 path_ep: pc_ansible_test
551 interface_type: l3-port
552 addr: 192.168.90.1/24
553 state: present
554 register: cm_add_infra_sr_mpls_l3out_port_channel_interface
555 check_mode: true
556
557 - name: Add direct port channel interface in the infra SR-MPLS l3out interface profile
558 aci_l3out_interface:
559 <<: *aci_infra_pc_interface
560 register: nm_add_infra_sr_mpls_l3out_port_channel_interface
561
562 - name: Add direct port channel interface in the infra SR-MPLS l3out interface profile again
563 aci_l3out_interface:
564 <<: *aci_infra_pc_interface
565 register: nm_add_infra_sr_mpls_l3out_port_channel_interface_again
566
567 - name: Add interface in the infra SR-MPLS l3out interface profile
568 aci_l3out_interface: &aci_infra_interface
569 <<: *aci_infra_interface_profile
570 pod_id: 1
571 node_id: 101
572 path_ep: eth1/17
573 interface_type: l3-port
574 addr: 192.168.91.1/24
575 state: present
576 register: nm_add_infra_sr_mpls_l3out_interface
577
578 - name: Add sub interface in the infra SR-MPLS l3out interface profile
579 aci_l3out_interface: &aci_infra_sub_interface
580 <<: *aci_infra_interface_profile
581 pod_id: 1
582 node_id: 101
583 path_ep: eth1/18
584 interface_type: sub-interface
585 addr: 192.168.92.1/24
586 state: present
587 register: nm_add_infra_sr_mpls_l3out_sub_interface
588
589 - name: Verify interfaces in the infra SR-MPLS l3out interface profile
590 assert:
591 that:
592 - cm_add_infra_sr_mpls_l3out_port_channel_interface is changed
593 - cm_add_infra_sr_mpls_l3out_port_channel_interface.previous == []
594 - cm_add_infra_sr_mpls_l3out_port_channel_interface.proposed.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
595 - cm_add_infra_sr_mpls_l3out_port_channel_interface.proposed.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/24"
596 - cm_add_infra_sr_mpls_l3out_port_channel_interface.proposed.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
597 - cm_add_infra_sr_mpls_l3out_port_channel_interface.proposed.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[pc_ansible_test]"
598 - nm_add_infra_sr_mpls_l3out_port_channel_interface is changed
599 - nm_add_infra_sr_mpls_l3out_port_channel_interface.previous == []
600 - nm_add_infra_sr_mpls_l3out_port_channel_interface.current.0.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
601 - nm_add_infra_sr_mpls_l3out_port_channel_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/24"
602 - nm_add_infra_sr_mpls_l3out_port_channel_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
603 - nm_add_infra_sr_mpls_l3out_port_channel_interface.current.0.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[pc_ansible_test]"
604 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again is not changed
605 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.previous.0.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
606 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.previous.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/24"
607 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.previous.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
608 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.previous.0.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[pc_ansible_test]"
609 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.current.0.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
610 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.90.1/24"
611 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
612 - nm_add_infra_sr_mpls_l3out_port_channel_interface_again.current.0.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[pc_ansible_test]"
613 - nm_add_infra_sr_mpls_l3out_interface is changed
614 - nm_add_infra_sr_mpls_l3out_interface.previous == []
615 - nm_add_infra_sr_mpls_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
616 - nm_add_infra_sr_mpls_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.91.1/24"
617 - nm_add_infra_sr_mpls_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "l3-port"
618 - nm_add_infra_sr_mpls_l3out_interface.current.0.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[eth1/17]"
619 - nm_add_infra_sr_mpls_l3out_sub_interface is changed
620 - nm_add_infra_sr_mpls_l3out_sub_interface.previous == []
621 - nm_add_infra_sr_mpls_l3out_sub_interface.current.0.l3extRsPathL3OutAtt.attributes.annotation == "orchestrator:ansible"
622 - nm_add_infra_sr_mpls_l3out_sub_interface.current.0.l3extRsPathL3OutAtt.attributes.addr == "192.168.92.1/24"
623 - nm_add_infra_sr_mpls_l3out_sub_interface.current.0.l3extRsPathL3OutAtt.attributes.ifInstT == "sub-interface"
624 - nm_add_infra_sr_mpls_l3out_sub_interface.current.0.l3extRsPathL3OutAtt.attributes.tDn == "topology/pod-1/paths-101/pathep-[eth1/18]"
625
626 - name: Enable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface profile without destination (error)
627 aci_l3out_interface:
628 <<: *aci_infra_pc_interface
629 micro_bfd: true
630 register: err_micro_bfd_not_provided_destination
631 ignore_errors: true
632
633 - name: Enable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface profile timer without micro BFD (error)
634 aci_l3out_interface:
635 <<: *aci_infra_pc_interface
636 micro_bfd_timer: 75
637 register: err_micro_bfd_timer_not_provided_micro_bfd
638 ignore_errors: true
639
640 - name: Enable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface profile destination without micro BFD (error)
641 aci_l3out_interface:
642 <<: *aci_infra_pc_interface
643 micro_bfd_destination: true
644 register: err_micro_bfd_destination_not_provided_micro_bfd
645 ignore_errors: true
646
647 - name: Verify micro BFD errors
648 assert:
649 that:
650 - err_micro_bfd_not_provided_destination is failed
651 - err_micro_bfd_not_provided_destination.msg == "micro_bfd is True but all of the following are missing{{":"}} micro_bfd_destination"
652 - err_micro_bfd_timer_not_provided_micro_bfd is failed
653 - err_micro_bfd_timer_not_provided_micro_bfd.msg == "missing parameter(s) required by 'micro_bfd_timer'{{":"}} micro_bfd"
654 - err_micro_bfd_destination_not_provided_micro_bfd is failed
655 - err_micro_bfd_destination_not_provided_micro_bfd.msg == "missing parameter(s) required by 'micro_bfd_destination'{{":"}} micro_bfd"
656
657 - name: Enable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface (check_mode)
658 aci_l3out_interface: &enable_bfd
659 <<: *aci_infra_pc_interface
660 micro_bfd: true
661 micro_bfd_destination: 192.168.90.2
662 register: cm_enable_micro_bfd
663 check_mode: true
664
665 - name: Enable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface
666 aci_l3out_interface:
667 <<: *enable_bfd
668 register: nm_enable_micro_bfd
669
670 - name: Change timer for micro on direct port channel interface in the infra SR-MPLS l3out interface
671 aci_l3out_interface:
672 <<: *enable_bfd
673 micro_bfd_timer: 75
674 register: nm_change_micro_bfd_timer
675
676 - name: Diable micro BFD on direct port channel interface in the infra SR-MPLS l3out interface
677 aci_l3out_interface:
678 <<: *enable_bfd
679 micro_bfd: false
680 register: nm_disable_micro_bfd
681
682 - name: Verify micro BFD configuration on direct port channel interface in the infra SR-MPLS l3out interface
683 assert:
684 that:
685 - cm_enable_micro_bfd is changed
686 - cm_enable_micro_bfd.previous.0.l3extRsPathL3OutAtt.children is undefined
687 - cm_enable_micro_bfd.proposed.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "yes"
688 - cm_enable_micro_bfd.proposed.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
689 - nm_enable_micro_bfd is changed
690 - nm_enable_micro_bfd.previous.0.l3extRsPathL3OutAtt.children is undefined
691 - nm_enable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "yes"
692 - nm_enable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
693 - nm_enable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.stTm == "0"
694 - nm_change_micro_bfd_timer is changed
695 - nm_change_micro_bfd_timer.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "yes"
696 - nm_change_micro_bfd_timer.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
697 - nm_change_micro_bfd_timer.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.stTm == "0"
698 - nm_change_micro_bfd_timer.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "yes"
699 - nm_change_micro_bfd_timer.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
700 - nm_change_micro_bfd_timer.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.stTm == "75"
701 - nm_disable_micro_bfd is changed
702 - nm_disable_micro_bfd.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "yes"
703 - nm_disable_micro_bfd.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
704 - nm_disable_micro_bfd.previous.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.stTm == "75"
705 - nm_disable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.adminState == "no"
706 - nm_disable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.dst == "192.168.90.2"
707 - nm_disable_micro_bfd.current.0.l3extRsPathL3OutAtt.children.0.bfdMicroBfdP.attributes.stTm == "75"
708
709 - name: Delete direct port channel interface in the infra SR-MPLS l3out interface profile again (check_mode)
710 aci_l3out_interface: &aci_infra_pc_interface_absent
711 <<: *aci_infra_pc_interface
712 state: absent
713 register: cm_delete_infra_sr_mpls_l3out_port_channel_interface
714 check_mode: true
715
716 - name: Delete direct port channel interface in the infra SR-MPLS l3out interface profile
717 aci_l3out_interface:
718 <<: *aci_infra_pc_interface_absent
719 register: nm_delete_infra_sr_mpls_l3out_port_channel_interface
720
721 - name: Delete direct port channel interface in the infra SR-MPLS l3out interface profile again
722 aci_l3out_interface:
723 <<: *aci_infra_pc_interface_absent
724 register: nm_delete_infra_sr_mpls_l3out_port_channel_interface_again
725
726 - name: Verify deletion of port channel interfaces in the infra SR-MPLS l3out interface profile
727 assert:
728 that:
729 - cm_delete_infra_sr_mpls_l3out_port_channel_interface is changed
730 - cm_delete_infra_sr_mpls_l3out_port_channel_interface.previous != []
731 - cm_delete_infra_sr_mpls_l3out_port_channel_interface.proposed == {}
732 - nm_delete_infra_sr_mpls_l3out_port_channel_interface is changed
733 - nm_delete_infra_sr_mpls_l3out_port_channel_interface.previous != []
734 - nm_delete_infra_sr_mpls_l3out_port_channel_interface.current == []
735 - nm_delete_infra_sr_mpls_l3out_port_channel_interface_again is not changed
736 - nm_delete_infra_sr_mpls_l3out_port_channel_interface_again.previous == []
737 - nm_delete_infra_sr_mpls_l3out_port_channel_interface_again.current == []
738
739 - name: Remove a infra SR-MPLS l3out
740 cisco.aci.aci_l3out:
741 <<: *aci_infra_sr_mpls_l3out_absent
742
743 # CLEAN UP
744 - name: Remove ansible_tenant
745 cisco.aci.aci_tenant:
746 <<: *aci_info
747 tenant: ansible_tenant
748 state: absent
749
750 - name: Remove ansible_l3ext_domain
751 cisco.aci.aci_domain:
752 <<: *aci_info
753 domain: ansible_l3ext_domain
754 domain_type: l3dom
755 state: absent
756
757 - name: Remove ansible_port_channel_ipg
758 cisco.aci.aci_interface_policy_leaf_policy_group:
759 <<: *aci_info
760 lag_type: link
761 policy_group: ansible_port_channel_ipg
762 state: absent
763
764 - name: Remove ansible_vpc_ipg
765 cisco.aci.aci_interface_policy_leaf_policy_group:
766 <<: *aci_info
767 lag_type: node
768 policy_group: ansible_vpc_ipg
769 state: absent