2019-08-26 13:16:05 +02:00
|
|
|
---
|
|
|
|
- debug:
|
|
|
|
msg: "Start nxos_l2_interfaces overridden integration tests connection={{ ansible_connection }}"
|
|
|
|
|
|
|
|
- set_fact: test_int1="{{ nxos_int1 }}"
|
|
|
|
- set_fact: test_int2="{{ nxos_int2 }}"
|
|
|
|
|
|
|
|
- name: setup1
|
|
|
|
cli_config: &cleanup
|
|
|
|
config: |
|
|
|
|
default interface {{ test_int1 }}
|
|
|
|
default interface {{ test_int2 }}
|
|
|
|
ignore_errors: yes
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: setup2
|
|
|
|
cli_config:
|
|
|
|
config: |
|
|
|
|
interface {{ test_int1 }}
|
2019-09-12 18:16:52 +02:00
|
|
|
switchport
|
2019-08-26 13:16:05 +02:00
|
|
|
switchport trunk allowed vlan 11
|
2019-09-12 18:16:52 +02:00
|
|
|
interface {{ test_int2 }}
|
|
|
|
switchport
|
2019-08-26 13:16:05 +02:00
|
|
|
|
|
|
|
- name: Gather l2_interfaces facts
|
|
|
|
nxos_facts: &facts
|
|
|
|
gather_subset:
|
|
|
|
- '!all'
|
|
|
|
- '!min'
|
|
|
|
gather_network_resources: l2_interfaces
|
|
|
|
|
|
|
|
- name: Overridden
|
|
|
|
nxos_l2_interfaces: &overridden
|
|
|
|
config:
|
|
|
|
- name: "{{ test_int2 }}"
|
|
|
|
access:
|
|
|
|
vlan: 6
|
2020-02-04 21:14:04 +01:00
|
|
|
trunk:
|
|
|
|
allowed_vlans: "10-12"
|
2019-08-26 13:16:05 +02:00
|
|
|
state: overridden
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before)|length == 0"
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'interface {{ test_int1 }}' in result.commands"
|
|
|
|
- "'no switchport trunk allowed vlan' in result.commands"
|
|
|
|
- "'interface {{ test_int2 }}' in result.commands"
|
|
|
|
- "'switchport access vlan 6' in result.commands"
|
2020-02-04 21:14:04 +01:00
|
|
|
- "'switchport trunk allowed vlan 10,11,12' in result.commands"
|
2019-08-26 13:16:05 +02:00
|
|
|
|
|
|
|
- name: Gather l2_interfaces post facts
|
|
|
|
nxos_facts: *facts
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after)|length == 0"
|
|
|
|
|
|
|
|
- name: Idempotence - Overridden
|
|
|
|
nxos_l2_interfaces: *overridden
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands|length == 0"
|
|
|
|
|
|
|
|
always:
|
|
|
|
- name: teardown
|
|
|
|
cli_config: *cleanup
|
|
|
|
ignore_errors: yes
|