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.
68 lines
1.5 KiB
YAML
68 lines
1.5 KiB
YAML
5 years ago
|
---
|
||
|
- debug:
|
||
|
msg: "Start nxos_vlans overridden integration tests connection={{ ansible_connection }}"
|
||
|
|
||
|
- name: setup1
|
||
|
cli_config: &cleanup
|
||
|
config: |
|
||
|
no vlan 5
|
||
|
no vlan 6
|
||
|
no vlan 9
|
||
|
|
||
|
- block:
|
||
|
- name: setup
|
||
|
cli_config:
|
||
|
config: |
|
||
|
vlan 5
|
||
|
name test-vlan5
|
||
|
state suspend
|
||
|
vlan 6
|
||
|
|
||
|
- name: Gather vlans facts
|
||
|
nxos_facts: &facts
|
||
|
gather_subset:
|
||
|
- '!all'
|
||
|
- '!min'
|
||
|
gather_network_resources: vlans
|
||
|
|
||
|
- name: Overridden
|
||
|
nxos_vlans: &overridden
|
||
|
config:
|
||
|
- vlan_id: 9
|
||
|
name: test-vlan9
|
||
|
enabled: false
|
||
|
state: overridden
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.vlans|symmetric_difference(result.before)|length == 0"
|
||
|
- "result.changed == true"
|
||
|
- "'vlan 5' in result.commands"
|
||
|
- "'no name' in result.commands"
|
||
|
- "'no state' in result.commands"
|
||
|
- "'vlan 9' in result.commands"
|
||
|
- "'name test-vlan9' in result.commands"
|
||
|
- "'shutdown' in result.commands"
|
||
|
- "result.commands|length == 6"
|
||
|
|
||
|
- name: Gather vlans post facts
|
||
|
nxos_facts: *facts
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.vlans|symmetric_difference(result.after)|length == 0"
|
||
|
|
||
|
- name: Idempotence - Overridden
|
||
|
nxos_vlans: *overridden
|
||
|
register: result
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
- "result.commands|length == 0"
|
||
|
|
||
|
always:
|
||
|
- name: teardown
|
||
|
cli_config: *cleanup
|