ansible/test/integration/targets/nxos_l3_interfaces/tests/cli/replaced.yaml
Trishna Guha f0ef624cff
Add nxos_l3_interfaces resource module (#61021)
Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2019-08-23 15:06:26 +05:30

64 lines
1.6 KiB
YAML

---
- debug:
msg: "Start nxos_l3_interfaces replaced 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: Replaced
nxos_l3_interfaces: &replaced
config:
- name: "{{ test_int1 }}"
ipv6:
- address: "fd5d:12c9:2201:1::1/64"
tag: 6
state: replaced
register: result
- assert:
that:
- "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.before)|length == 0"
- "result.changed == true"
- "'interface {{ test_int1 }}' in result.commands"
- "'no ip address' in result.commands"
- "'ipv6 address fd5d:12c9:2201:1::1/64 tag 6' in result.commands"
- "result.commands|length == 3"
- name: Gather l3_interfaces post facts
nxos_facts: *facts
- assert:
that:
- "ansible_facts.network_resources.l3_interfaces|symmetric_difference(result.after)|length == 0"
- name: Idempotence - Replaced
nxos_l3_interfaces: *replaced
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup