2019-08-23 11:36:26 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_l3_interfaces deleted integration tests connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
|
|
|
|
|
|
|
- name: setup1
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
|
|
|
default interface {{ test_int1 }}
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
interface {{ test_int1 }}
|
|
|
|
no switchport
|
|
|
|
ip address 192.168.10.2/24
|
|
|
|
|
|
|
|
- name: Gather l3_interfaces facts
|
|
|
|
nxos_facts: &facts
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: l3_interfaces
|
|
|
|
|
|
|
|
- name: deleted
|
|
|
|
nxos_l3_interfaces: &deleted
|
|
|
|
state: deleted
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-10-02 19:43:17 +02:00
|
|
|
- "result.before|length == (ansible_facts.network_resources.l3_interfaces|length - 1)"
|
2019-08-23 11:36:26 +02:00
|
|
|
- "result.after|length == 0"
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'interface {{ test_int1 }}' in result.commands"
|
|
|
|
- "'no ip address' in result.commands"
|
|
|
|
- "result.commands|length == 2"
|
|
|
|
|
|
|
|
- name: Idempotence - deleted
|
|
|
|
nxos_l3_interfaces: *deleted
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|