ansible/test/integration/targets/nxos_l3_interfaces/tests/cli/deleted.yaml

53 lines
1.2 KiB
YAML
Raw Normal View History

---
- 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:
- "result.before|length == (ansible_facts.network_resources.l3_interfaces|length - 1)"
- "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