ansible/test/integration/targets/exos_l2_interfaces/tests/httpapi/overridden.yaml
JayalakshmiV 93280bd59c exos_l2_interfaces Resource module (#63113)
* Resource module for exos_l2_interfaces
2019-10-18 13:10:19 -04:00

76 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) == []"