ansible/test/integration/targets/vyos_firewall_interfaces/tests/cli/parsed.yaml

45 lines
1.2 KiB
YAML
Raw Normal View History

---
- debug:
msg: "START vyos_firewall_interfaces parsed integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml
- include_tasks: _remove_firewall_config.yaml
- include_tasks: _populate_rule_sets.yaml
- include_tasks: _populate.yaml
- block:
- name: Gather firewall_interfaces facts
vyos_facts:
gather_subset:
- default
gather_network_resources:
- firewall_interfaces
register: firewall_interfaces_facts
- name: Provide the running configuration for parsing (config to be parsed)
vyos_firewall_interfaces: &parsed
running_config:
"{{ lookup('file', '_parsed_config.cfg') }}"
state: parsed
register: result
- name: Assert that correct parsing done
assert:
that: "{{ ansible_facts['network_resources']['firewall_interfaces'] | symmetric_difference(result['parsed']) |length == 0 }}"
- name: Gather the existing running configuration (IDEMPOTENT)
vyos_firewall_interfaces: *parsed
register: result
- name: Assert that the previous task was idempotent
assert:
that:
- "result['changed'] == false"
always:
- include_tasks: _remove_config.yaml
- include_tasks: _remove_firewall_config.yaml