2019-08-14 10:08:22 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_interfaces deleted integration tests connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
|
|
|
- set_fact: test_int2="{{ nxos_int2 }}"
|
2019-12-13 13:36:21 +01:00
|
|
|
- set_fact: test_shutdown
|
|
|
|
when: platform is not search('N3[5KL]|N[56]K|titanium')
|
|
|
|
|
|
|
|
- name: "setup0: clean up (interfaces) attributes on all interfaces"
|
|
|
|
nxos_interfaces:
|
|
|
|
state: deleted
|
2019-08-14 10:08:22 +02:00
|
|
|
|
|
|
|
- name: setup1
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
|
|
|
default interface {{ test_int1 }}
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
interface {{ test_int1 }}
|
|
|
|
description Test-interface1
|
2019-12-13 13:36:21 +01:00
|
|
|
no shutdown
|
2019-08-14 10:08:22 +02:00
|
|
|
|
|
|
|
- name: Gather interfaces facts
|
|
|
|
nxos_facts: &facts
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: interfaces
|
|
|
|
|
|
|
|
- name: deleted
|
|
|
|
nxos_interfaces: &deleted
|
|
|
|
state: deleted
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "ansible_facts.network_resources.interfaces|symmetric_difference(result.before)|length == 0"
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'interface {{ test_int1 }}' in result.commands"
|
|
|
|
- "'no description' in result.commands"
|
2019-12-13 13:36:21 +01:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.after|length == 0"
|
|
|
|
- "'shutdown' in result.commands"
|
|
|
|
when: test_shutdown is defined
|
2019-08-14 10:08:22 +02:00
|
|
|
|
|
|
|
- name: Idempotence - deleted
|
|
|
|
nxos_interfaces: *deleted
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
2019-12-13 13:36:21 +01:00
|
|
|
when: test_shutdown is defined
|
2019-08-14 10:08:22 +02:00
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|