You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/exos_l2_interfaces/tests/httpapi/overridden.yaml

77 lines
2.1 KiB
YAML

---
- debug:
msg: "Start exos_l2_interfaces overridden integration tests ansible_connection={{ ansible_connection }}"
- include_tasks: _reset_config.yaml
ignore_errors: yes
- include_tasks: _populate_config.yaml
- set_fact:
config:
- access: null
name: '1'
trunk:
native_vlan: 10
trunk_allowed_vlans:
- 20
- 30
config_all:
- access:
vlan: 1
name: '2'
trunk: null
- access:
vlan: 1
name: '3'
trunk: null
- exos_facts:
gather_network_resources: l2_interfaces
- block:
- name: Override device L2 interface configuration with provided configurations
exos_l2_interfaces: &overridden
config: "{{ config }}"
state: overridden
register: result
- name: Assert that correct set of results were generated
assert:
that:
- "overridden['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) == []"
- set_fact:
expected_config: "{{ config }} + {{ config_all }}"
- assert:
that:
- "expected_config|difference(ansible_facts.network_resources.l2_interfaces) == []"
- name: Override device LLDP interface configuration with provided configurations (IDEMPOTENT)
exos_l2_interfaces: *overridden
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) == []"
- "expected_config|difference(ansible_facts.network_resources.l2_interfaces) == []"