ansible/test/integration/targets/nxos_vlans/tests/cli/replaced.yaml
Trishna Guha 021b1810c9
Add nxos_vlans resource module (#59294)
* Add nxos_vlans resource module

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* address review comments

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* fix CI failure and udpate tests

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>

* Add commands in module doc

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
2019-08-05 12:50:16 +05:30

62 lines
1.3 KiB
YAML

---
- debug:
msg: "Start nxos_vlans replaced integration tests connection={{ ansible_connection }}"
- name: setup1
cli_config: &cleanup
config: |
no vlan 5
no vlan 6
- block:
- name: setup2
cli_config:
config: |
vlan 5
name test-vlan5
vlan 6
name test-vlan6
- 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:
- "ansible_facts.network_resources.vlans|symmetric_difference(result.before)|length == 0"
- "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:
- "ansible_facts.network_resources.vlans|symmetric_difference(result.after)|length == 0"
- name: Idempotence - Replaced
nxos_vlans: *replaced
register: result
- assert:
that:
- "result.changed == false"
- "result.commands|length == 0"
always:
- name: teardown
cli_config: *cleanup