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

58 lines
1.7 KiB
YAML
Raw Normal View History

---
- debug:
msg: "START exos_lldp_interfaces replaced integration tests on connection={{ ansible_connection }}"
- include_tasks: _reset_config.yaml
- include_tasks: _populate_config.yaml
- set_fact:
config:
- enabled: true
name: '3'
- enabled: false
name: '4'
- exos_facts:
gather_network_resources: lldp_interfaces
- block:
- name: Replace LLDP interface configuration with provided configuration
exos_lldp_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.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: Replace LLDP interface configuration with provided configuration (IDEMPOTENT)
exos_lldp_interfaces: *replaced
register: result
- name: Assert that 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) == []"