mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.7 KiB
YAML
71 lines
1.7 KiB
YAML
---
|
|
- debug:
|
|
msg: "Start nxos_l3_interfaces deleted integration tests connection={{ ansible_connection }}"
|
|
|
|
- set_fact:
|
|
test_int3: "{{ nxos_int3 }}"
|
|
subint3: "{{ nxos_int3 }}.42"
|
|
|
|
- name: setup1
|
|
cli_config: &cleanup
|
|
config: |
|
|
no system default switchport
|
|
default interface {{ test_int3 }}
|
|
interface {{ test_int3 }}
|
|
no switchport
|
|
ignore_errors: yes
|
|
|
|
- name: setup2 cleanup all L3 interfaces on device
|
|
nxos_l3_interfaces:
|
|
state: deleted
|
|
|
|
- block:
|
|
- name: setup3
|
|
cli_config:
|
|
config: |
|
|
interface {{ subint3 }}
|
|
encapsulation dot1q 42
|
|
ip address 192.168.10.2/24
|
|
no ip redirects
|
|
ip unreachables
|
|
|
|
- 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|int - rsvd_intf_len|int)"
|
|
- "result.after|length == 0"
|
|
- "result.changed == true"
|
|
- "'interface {{ subint3 }}' in result.commands"
|
|
- "'no encapsulation dot1q' in result.commands"
|
|
- "'ip redirects' in result.commands"
|
|
- "'no ip unreachables' in result.commands"
|
|
- "'no ip address' in result.commands"
|
|
- "result.commands|length == 5"
|
|
|
|
- name: Idempotence - deleted
|
|
nxos_l3_interfaces: *deleted
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
- "result.commands|length == 0"
|
|
|
|
always:
|
|
- name: teardown
|
|
cli_config:
|
|
config: |
|
|
no interface {{ subint3 }}
|
|
ignore_errors: yes
|