93280bd59c
* Resource module for exos_l2_interfaces
63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
---
|
|
- debug:
|
|
msg: "START exos_l2_interfaces replaced integration tests on connection={{ ansible_connection }}"
|
|
|
|
- include_tasks: _reset_config.yaml
|
|
|
|
- include_tasks: _populate_config.yaml
|
|
|
|
- set_fact:
|
|
config:
|
|
- access: null
|
|
name: '2'
|
|
trunk:
|
|
native_vlan: 30
|
|
trunk_allowed_vlans:
|
|
- 40
|
|
- access:
|
|
vlan: 10
|
|
name: '3'
|
|
trunk: null
|
|
|
|
- exos_facts:
|
|
gather_network_resources: l2_interfaces
|
|
|
|
- block:
|
|
- name: Replace L2 interface configuration with provided configuration
|
|
exos_l2_interfaces: &replaced
|
|
config: "{{ config }}"
|
|
state: replaced
|
|
register: result
|
|
|
|
- name: Assert that correct set of results were generated
|
|
assert:
|
|
that:
|
|
- "replaced['requests']|symmetric_difference(result['requests']) == []"
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []"
|
|
|
|
- exos_facts:
|
|
gather_network_resources: l2_interfaces
|
|
|
|
- name: Assert that after dicts were correctly generated
|
|
assert:
|
|
that:
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.after) == []"
|
|
- "config|difference(ansible_facts.network_resources.l2_interfaces) == []"
|
|
|
|
- name: Replace L2 interface configuration with provided configuration (IDEMPOTENT)
|
|
exos_l2_interfaces: *replaced
|
|
register: result
|
|
|
|
- name: Assert that task was idempotent
|
|
assert:
|
|
that:
|
|
- "result['changed'] == false"
|
|
|
|
- exos_facts:
|
|
gather_network_resources: l2_interfaces
|
|
|
|
- name: Assert that the before dicts were correctly generated
|
|
assert:
|
|
that:
|
|
- "ansible_facts.network_resources.l2_interfaces|symmetric_difference(result.before) == []"
|
|
- "config|difference(ansible_facts.network_resources.l2_interfaces) == []"
|