ansible/test/integration/targets/exos_lldp_interfaces/tests/httpapi/merged.yaml

58 lines
1.7 KiB
YAML
Raw Normal View History

---
- debug:
msg: "START exos_lldp_interfaces merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _reset_config.yaml
- include_tasks: _populate_config.yaml
- set_fact:
config:
- enabled: false
name: '1'
- enabled: true
name: '2'
- exos_facts:
gather_network_resources: lldp_interfaces
- block:
- name: Merge the provided configuration with the existing running configuration
exos_lldp_interfaces: &merged
config: "{{ config }}"
state: merged
register: result
- name: Assert that correct set of results were generated
assert:
that:
- "merged['requests']|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: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
exos_lldp_interfaces: *merged
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) == []"
- "config|difference(ansible_facts.network_resources.lldp_interfaces) == []"