93280bd59c
* Resource module for exos_l2_interfaces
96 lines
2.7 KiB
YAML
96 lines
2.7 KiB
YAML
---
|
|
- debug:
|
|
msg: "Start exos_l2_interfaces deleted integration tests ansible_connection={{ ansible_connection }}"
|
|
|
|
- include_tasks: _reset_config.yaml
|
|
ignore_errors: yes
|
|
|
|
- include_tasks: _populate_config.yaml
|
|
|
|
- set_fact:
|
|
config:
|
|
- access:
|
|
vlan: 1
|
|
name: '2'
|
|
trunk: null
|
|
- access:
|
|
vlan: 1
|
|
name: '3'
|
|
trunk: null
|
|
config_all:
|
|
- access:
|
|
vlan: 1
|
|
name: '1'
|
|
trunk: null
|
|
|
|
- exos_facts:
|
|
gather_network_resources: l2_interfaces
|
|
|
|
- block:
|
|
- name: Delete L2 interface configuration
|
|
exos_l2_interfaces: &deleted
|
|
config:
|
|
- name: '2'
|
|
- name: '3'
|
|
state: deleted
|
|
register: result
|
|
|
|
- name: Assert that correct set of results were generated
|
|
assert:
|
|
that:
|
|
- "deleted['requests_1']|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: Delete L2 interface configuration
|
|
exos_l2_interfaces:
|
|
config:
|
|
state: deleted
|
|
register: result
|
|
|
|
- name: Assert that correct set of results were generated
|
|
assert:
|
|
that:
|
|
- "deleted['requests_2']|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_all|difference(ansible_facts.network_resources.l2_interfaces) == []"
|
|
|
|
- name: Delete attributes of all configured interfaces (IDEMPOTENT)
|
|
exos_l2_interfaces: *deleted
|
|
register: result
|
|
|
|
- name: Assert that the previous 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) == []"
|
|
|
|
- set_fact:
|
|
expected_config: "{{ config }} + {{ config_all }}"
|
|
|
|
- assert:
|
|
that:
|
|
- "expected_config|difference(ansible_facts.network_resources.l2_interfaces) == []"
|