92 lines
2.6 KiB
YAML
92 lines
2.6 KiB
YAML
|
---
|
||
|
- debug:
|
||
|
msg: "Start exos_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }}"
|
||
|
|
||
|
- include_tasks: _reset_config.yaml
|
||
|
|
||
|
- include_tasks: _populate_config.yaml
|
||
|
|
||
|
- set_fact:
|
||
|
config:
|
||
|
- enabled: true
|
||
|
name: '2'
|
||
|
- enabled: true
|
||
|
name: '3'
|
||
|
config_all:
|
||
|
- enabled: true
|
||
|
name: '4'
|
||
|
- enabled: true
|
||
|
name: '5'
|
||
|
|
||
|
- exos_facts:
|
||
|
gather_network_resources: lldp_interfaces
|
||
|
|
||
|
- block:
|
||
|
- name: Delete LLDP interface configuration
|
||
|
exos_lldp_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.lldp_interfaces|symmetric_difference(result.before) == []"
|
||
|
|
||
|
- exos_facts:
|
||
|
gather_network_resources: lldp_interfaces
|
||
|
|
||
|
- name: Assert that after dicts were correctly generated
|
||
|
assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []"
|
||
|
- "config|difference(ansible_facts.network_resources.lldp_interfaces) == []"
|
||
|
|
||
|
- name: Delete LLDP interface configuration
|
||
|
exos_lldp_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.lldp_interfaces|symmetric_difference(result.before) == []"
|
||
|
|
||
|
- exos_facts:
|
||
|
gather_network_resources: lldp_interfaces
|
||
|
|
||
|
- name: Assert that after dicts were correctly generated
|
||
|
assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.after) == []"
|
||
|
- "config_all|difference(ansible_facts.network_resources.lldp_interfaces) == []"
|
||
|
|
||
|
- name: Delete attributes of all configured interfaces (IDEMPOTENT)
|
||
|
exos_lldp_interfaces: *deleted
|
||
|
register: result
|
||
|
|
||
|
- name: Assert that the previous task was idempotent
|
||
|
assert:
|
||
|
that:
|
||
|
- "result.changed == false"
|
||
|
|
||
|
- exos_facts:
|
||
|
gather_network_resources: lldp_interfaces
|
||
|
|
||
|
- name: Assert that the before dicts were correctly generated
|
||
|
assert:
|
||
|
that:
|
||
|
- "ansible_facts.network_resources.lldp_interfaces|symmetric_difference(result.before) == []"
|
||
|
|
||
|
- set_fact:
|
||
|
expected_config: "{{ config }} + {{ config_all }}"
|
||
|
|
||
|
- assert:
|
||
|
that:
|
||
|
- "expected_config|difference(ansible_facts.network_resources.lldp_interfaces) == []"
|