Skip to content

Commit f0a3132

Browse files
Integ test changes
1 parent 5c22ef4 commit f0a3132

5 files changed

Lines changed: 1143 additions & 21 deletions

File tree

tests/integration/targets/nd_vpc_pair/tasks/nd_vpc_pair_delete.yaml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,182 @@
274274
- validation.failed == false
275275
tags: delete
276276

277+
# TC5 - vpc_pair_details extended coverage in delete flow (create with details, then delete)
278+
- name: DELETE - TC5 - MERGE - Create vPC pair with extended vpc_pair_details
279+
cisco.nd.nd_manage_vpc_pair:
280+
fabric_name: "{{ test_fabric }}"
281+
state: merged
282+
deploy: false
283+
config:
284+
- peer1_switch_id: "{{ test_switch1 }}"
285+
peer2_switch_id: "{{ test_switch2 }}"
286+
use_virtual_peer_link: true
287+
vpc_pair_details: "{{ vpc_pair_details_extended }}"
288+
register: result
289+
when: test_fabric_type == "LANClassic"
290+
tags: delete
291+
292+
- name: DELETE - TC5 - API - Query direct vpcPair state before deletion
293+
cisco.nd.nd_rest:
294+
path: "/api/v1/manage/fabrics/{{ test_fabric }}/switches/{{ test_switch1 }}/vpcPair"
295+
method: get
296+
register: tc5_vpc_pair_direct
297+
when: test_fabric_type == "LANClassic"
298+
tags: delete
299+
300+
- name: DELETE - TC5 - VALIDATE - Verify extended vpc_pair_details before deletion
301+
cisco.nd.tests.integration.nd_vpc_pair_validate:
302+
gathered_data: "{{ {'vpc_pairs': [tc5_vpc_pair_direct.current]} }}"
303+
expected_data:
304+
- peer1_switch_id: "{{ test_switch1 }}"
305+
peer2_switch_id: "{{ test_switch2 }}"
306+
use_virtual_peer_link: true
307+
vpc_pair_details: "{{ vpc_pair_details_extended }}"
308+
mode: "full"
309+
validate_vpc_pair_details: true
310+
register: tc5_validation
311+
when: test_fabric_type == "LANClassic"
312+
tags: delete
313+
314+
- name: DELETE - TC5 - DELETE - Delete vPC pair created with extended details
315+
cisco.nd.nd_manage_vpc_pair:
316+
fabric_name: "{{ test_fabric }}"
317+
state: deleted
318+
deploy: false
319+
config:
320+
- peer1_switch_id: "{{ test_switch1 }}"
321+
peer2_switch_id: "{{ test_switch2 }}"
322+
register: tc5_delete_result
323+
when: test_fabric_type == "LANClassic"
324+
tags: delete
325+
326+
- name: DELETE - TC5 - ASSERT - Extended details delete flow passed
327+
ansible.builtin.assert:
328+
that:
329+
- result.failed == false
330+
- result.changed == true
331+
- tc5_vpc_pair_direct.failed == false
332+
- tc5_vpc_pair_direct.current is mapping
333+
- tc5_validation.failed == false
334+
- tc5_delete_result.failed == false
335+
- tc5_delete_result.changed == true
336+
when: test_fabric_type == "LANClassic"
337+
tags: delete
338+
339+
# TC6 - Delete with config_actions save+deploy
340+
- name: DELETE - TC6 - MERGE - Recreate vPC pair for config_actions delete path
341+
cisco.nd.nd_manage_vpc_pair:
342+
fabric_name: "{{ test_fabric }}"
343+
state: merged
344+
deploy: false
345+
config: "{{ nd_vpc_pair_delete_setup_conf }}"
346+
register: result
347+
tags: delete
348+
349+
- name: DELETE - TC6 - DELETE - Delete vPC pair with config_actions save+deploy
350+
cisco.nd.nd_manage_vpc_pair:
351+
fabric_name: "{{ test_fabric }}"
352+
state: deleted
353+
config_actions:
354+
save: true
355+
deploy: true
356+
type: switch
357+
config:
358+
- peer1_switch_id: "{{ test_switch1 }}"
359+
peer2_switch_id: "{{ test_switch2 }}"
360+
register: tc6_delete_result
361+
tags: delete
362+
363+
- name: DELETE - TC6 - ASSERT - Verify config_actions save+deploy execution in delete flow
364+
ansible.builtin.assert:
365+
that:
366+
- tc6_delete_result.failed == false
367+
- tc6_delete_result.changed == true
368+
- tc6_delete_result.deployment is defined
369+
- tc6_delete_result.deployment.config_actions is defined
370+
- tc6_delete_result.deployment.config_actions.save == true
371+
- tc6_delete_result.deployment.config_actions.deploy == true
372+
- tc6_delete_result.deployment.config_actions.type == "switch"
373+
- tc6_delete_result.deployment.response is defined
374+
- (tc6_delete_result.deployment.response | length) >= 2
375+
- >
376+
(
377+
tc6_delete_result.deployment.response
378+
| selectattr('REQUEST_PATH', 'search', '/actions/configSave')
379+
| list
380+
| length
381+
) > 0
382+
- >
383+
(
384+
tc6_delete_result.deployment.response
385+
| selectattr('REQUEST_PATH', 'search', '/actions/deploy')
386+
| list
387+
| length
388+
) > 0
389+
tags: delete
390+
391+
# TC7 - check_mode should not apply delete configuration changes
392+
- name: DELETE - TC7 - MERGE - Ensure vPC pair exists before check_mode delete test
393+
cisco.nd.nd_manage_vpc_pair:
394+
fabric_name: "{{ test_fabric }}"
395+
state: merged
396+
deploy: false
397+
config: "{{ nd_vpc_pair_delete_setup_conf }}"
398+
register: tc7_setup_result
399+
tags: delete
400+
401+
- name: DELETE - TC7 - ASSERT - Verify setup creation for check_mode delete
402+
ansible.builtin.assert:
403+
that:
404+
- tc7_setup_result.failed == false
405+
- tc7_setup_result.changed in [true, false]
406+
tags: delete
407+
408+
- name: DELETE - TC7 - DELETE - Run check_mode delete for existing vPC pair
409+
cisco.nd.nd_manage_vpc_pair:
410+
fabric_name: "{{ test_fabric }}"
411+
state: deleted
412+
deploy: false
413+
config:
414+
- peer1_switch_id: "{{ test_switch1 }}"
415+
peer2_switch_id: "{{ test_switch2 }}"
416+
check_mode: true
417+
register: tc7_delete_result
418+
tags: delete
419+
420+
- name: DELETE - TC7 - ASSERT - Verify check_mode delete preview behavior
421+
ansible.builtin.assert:
422+
that:
423+
- tc7_delete_result.failed == false
424+
- tc7_delete_result.changed == true
425+
- tc7_delete_result.deployment is not defined
426+
tags: delete
427+
428+
- name: DELETE - TC7 - GATHER - Verify check_mode delete did not remove vPC pair
429+
cisco.nd.nd_manage_vpc_pair:
430+
fabric_name: "{{ test_fabric }}"
431+
state: gathered
432+
deploy: false
433+
config:
434+
- peer1_switch_id: "{{ test_switch1 }}"
435+
peer2_switch_id: "{{ test_switch2 }}"
436+
register: tc7_verify_result
437+
tags: delete
438+
439+
- name: DELETE - TC7 - VALIDATE - Confirm vPC pair still exists after check_mode delete
440+
cisco.nd.tests.integration.nd_vpc_pair_validate:
441+
gathered_data: "{{ tc7_verify_result }}"
442+
expected_data: "{{ nd_vpc_pair_delete_setup_conf }}"
443+
mode: "exists"
444+
register: tc7_validation
445+
tags: delete
446+
447+
- name: DELETE - TC7 - ASSERT - Validation passed
448+
ansible.builtin.assert:
449+
that:
450+
- tc7_validation.failed == false
451+
tags: delete
452+
277453
##############################################
278454
## CLEAN-UP ##
279455
##############################################

tests/integration/targets/nd_vpc_pair/tasks/nd_vpc_pair_gather.yaml

Lines changed: 94 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,15 @@
129129
- name: GATHER - TC4/TC5 - ASSERT - Verify partial peer gathers are rejected
130130
ansible.builtin.assert:
131131
that:
132-
- item.failed == true
133132
- item.msg is defined
133+
- >
134+
(
135+
item.failed | default(false)
136+
)
137+
or
138+
(
139+
(item.msg | lower) is search("missing required arguments")
140+
)
134141
loop: "{{ partial_filter_results.results }}"
135142
loop_control:
136143
label: "{{ item.item.test_name }}"
@@ -157,20 +164,19 @@
157164
- result.gathered is defined
158165
tags: gather
159166

160-
# TC7 - Gather with custom verify_option timeout
161-
- name: GATHER - TC7 - GATHER - Gather with verify_option override
167+
# TC7 - Gather with custom verify timeout/retries
168+
- name: GATHER - TC7 - GATHER - Gather with verify override
162169
cisco.nd.nd_manage_vpc_pair:
163170
fabric_name: "{{ test_fabric }}"
164171
state: gathered
165172
deploy: false
166-
suppress_verification: true
167-
verify_option:
173+
verify:
168174
timeout: 20
169-
iteration: 3
175+
retries: 3
170176
register: result
171177
tags: gather
172178

173-
- name: GATHER - TC7 - ASSERT - Verify verify_option path execution
179+
- name: GATHER - TC7 - ASSERT - Verify verify path execution
174180
ansible.builtin.assert:
175181
that:
176182
- result.failed == false
@@ -191,7 +197,9 @@
191197
- name: GATHER - TC8 - ASSERT - Verify gathered+deploy validation
192198
ansible.builtin.assert:
193199
that:
194-
- result.failed == true
200+
- result.changed == false
201+
- result.gathered is not defined
202+
- result.msg is defined
195203
- result.msg is search("Deploy parameter cannot be used")
196204
tags: gather
197205

@@ -388,6 +396,84 @@
388396
- '(result.gathered.vpc_pairs | length) == 1'
389397
tags: gather
390398

399+
# TC12 - Gather extended vpc_pair_details coverage
400+
- name: GATHER - TC12 - MERGE - Apply extended vpc_pair_details for gather coverage
401+
cisco.nd.nd_manage_vpc_pair:
402+
fabric_name: "{{ test_fabric }}"
403+
state: merged
404+
deploy: false
405+
config:
406+
- peer1_switch_id: "{{ test_switch1 }}"
407+
peer2_switch_id: "{{ test_switch2 }}"
408+
use_virtual_peer_link: true
409+
vpc_pair_details: "{{ vpc_pair_details_extended }}"
410+
register: result
411+
when: test_fabric_type == "LANClassic"
412+
tags: gather
413+
414+
- name: GATHER - TC12 - GATHER - Query pair with extended vpc_pair_details
415+
cisco.nd.nd_manage_vpc_pair:
416+
fabric_name: "{{ test_fabric }}"
417+
state: gathered
418+
deploy: false
419+
config:
420+
- peer1_switch_id: "{{ test_switch1 }}"
421+
peer2_switch_id: "{{ test_switch2 }}"
422+
register: tc12_gather_result
423+
when: test_fabric_type == "LANClassic"
424+
tags: gather
425+
426+
- name: GATHER - TC12 - VALIDATE - Verify extended vpc_pair_details in gathered output
427+
cisco.nd.tests.integration.nd_vpc_pair_validate:
428+
gathered_data: "{{ tc12_gather_result }}"
429+
expected_data:
430+
- peer1_switch_id: "{{ test_switch1 }}"
431+
peer2_switch_id: "{{ test_switch2 }}"
432+
use_virtual_peer_link: true
433+
vpc_pair_details: "{{ vpc_pair_details_extended }}"
434+
mode: "full"
435+
validate_vpc_pair_details: true
436+
register: tc12_validation
437+
when: test_fabric_type == "LANClassic"
438+
tags: gather
439+
440+
- name: GATHER - TC12 - ASSERT - Extended details gather validation passed
441+
ansible.builtin.assert:
442+
that:
443+
- result.failed == false
444+
- result.changed == true
445+
- tc12_gather_result.failed == false
446+
- tc12_validation.failed == false
447+
when: test_fabric_type == "LANClassic"
448+
tags: gather
449+
450+
# TC13 - gathered + config_actions validation (must fail)
451+
- name: GATHER - TC13 - GATHER - Gather with config_actions enabled (invalid)
452+
cisco.nd.nd_manage_vpc_pair:
453+
fabric_name: "{{ test_fabric }}"
454+
state: gathered
455+
config_actions:
456+
save: true
457+
deploy: false
458+
type: switch
459+
register: result
460+
failed_when: false
461+
tags: gather
462+
463+
- name: GATHER - TC13 - ASSERT - Verify gathered+config_actions validation
464+
ansible.builtin.assert:
465+
that:
466+
- result.changed == false
467+
- result.gathered is not defined
468+
- result.msg is defined
469+
- >
470+
(
471+
(result.msg is search("Deploy parameter cannot be used"))
472+
or
473+
(result.msg is search("config_actions.save/config_actions.deploy"))
474+
)
475+
tags: gather
476+
391477
##############################################
392478
## CLEAN-UP ##
393479
##############################################

0 commit comments

Comments
 (0)