2019-08-05 09:20:16 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_vlans replaced integration tests connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- name: setup1
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
2019-11-19 09:54:52 +01:00
|
|
|
no vlan 2-100
|
2019-08-05 09:20:16 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
vlan 5
|
2019-11-19 09:54:52 +01:00
|
|
|
name test-vlan5
|
2019-08-05 09:20:16 +02:00
|
|
|
vlan 6
|
2019-11-19 09:54:52 +01:00
|
|
|
name test-vlan6
|
|
|
|
exit
|
2019-08-05 09:20:16 +02:00
|
|
|
|
|
|
|
- name: Gather vlans facts
|
|
|
|
nxos_facts: &facts
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: vlans
|
|
|
|
|
|
|
|
- name: Replaced
|
|
|
|
nxos_vlans: &replaced
|
|
|
|
config:
|
|
|
|
- vlan_id: 6
|
|
|
|
state: suspend
|
|
|
|
state: replaced
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-11-19 09:54:52 +01:00
|
|
|
- "result.before|length == (ansible_facts.network_resources.vlans|length - 1)"
|
2019-08-05 09:20:16 +02:00
|
|
|
- "result.changed == true"
|
|
|
|
- "'vlan 6' in result.commands"
|
|
|
|
- "'no name' in result.commands"
|
|
|
|
- "'state suspend' in result.commands"
|
|
|
|
- "result.commands|length == 3"
|
|
|
|
|
|
|
|
- name: Gather vlans post facts
|
|
|
|
nxos_facts: *facts
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2019-11-19 09:54:52 +01:00
|
|
|
- "result.after|length == (ansible_facts.network_resources.vlans|length - 1)"
|
2019-08-05 09:20:16 +02:00
|
|
|
|
|
|
|
- name: Idempotence - Replaced
|
|
|
|
nxos_vlans: *replaced
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|