2019-08-26 13:16:05 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_l2_interfaces merged integration tests connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
|
|
|
|
|
|
|
- name: setup
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
|
|
|
default interface {{ test_int1 }}
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
2019-09-12 18:16:52 +02:00
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
interface {{ test_int1 }}
|
|
|
|
switchport
|
|
|
|
|
2019-08-26 13:16:05 +02:00
|
|
|
- name: Merged
|
|
|
|
nxos_l2_interfaces: &merged
|
|
|
|
config:
|
|
|
|
- name: "{{ test_int1 }}"
|
|
|
|
access:
|
|
|
|
vlan: 6
|
|
|
|
state: merged
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "result.before|length == 0"
|
|
|
|
- "'interface {{ test_int1 }}' in result.commands"
|
|
|
|
- "'switchport access vlan 6' in result.commands"
|
|
|
|
- "result.commands|length == 2"
|
|
|
|
|
|
|
|
- name: Gather l2_interfaces facts
|
|
|
|
nxos_facts:
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: l2_interfaces
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after)|length == 0"
|
|
|
|
|
|
|
|
- name: Idempotence - Merged
|
|
|
|
nxos_l2_interfaces: *merged
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|
|
|
|
ignore_errors: yes
|