8f9f8ec594
* firewall_interfaces module added Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * sanity fixes Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * sanity fixes Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * delete opr updated Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * tests updated Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * comments incorporated Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com> * ci failure fix Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
76 lines
2.1 KiB
YAML
76 lines
2.1 KiB
YAML
---
|
|
- debug:
|
|
msg: "START vyos_firewall_interfaces round trip integration tests on connection={{ ansible_connection }}"
|
|
|
|
- include_tasks: _remove_config.yaml
|
|
|
|
- include_tasks: _remove_firewall_config.yaml
|
|
|
|
- include_tasks: _populate_rule_sets.yaml
|
|
|
|
- block:
|
|
- name: Apply the provided configuration (base config)
|
|
vyos_firewall_interfaces:
|
|
config:
|
|
- name: 'eth1'
|
|
access_rules:
|
|
- afi: 'ipv4'
|
|
rules:
|
|
- name: 'INBOUND'
|
|
direction: 'in'
|
|
- name: 'OUTBOUND'
|
|
direction: 'out'
|
|
- name: 'LOCAL'
|
|
direction: 'local'
|
|
- afi: 'ipv6'
|
|
rules:
|
|
- name: 'V6-LOCAL'
|
|
direction: 'local'
|
|
state: merged
|
|
register: base_config
|
|
|
|
- name: Gather firewall_interfaces facts
|
|
vyos_facts:
|
|
gather_subset:
|
|
- default
|
|
gather_network_resources:
|
|
- firewall_interfaces
|
|
|
|
- name: Apply the provided configuration (config to be reverted)
|
|
vyos_firewall_interfaces:
|
|
config:
|
|
- name: 'eth2'
|
|
access_rules:
|
|
- afi: 'ipv4'
|
|
rules:
|
|
- name: 'INBOUND'
|
|
direction: 'in'
|
|
- name: 'OUTBOUND'
|
|
direction: 'out'
|
|
- name: 'LOCAL'
|
|
direction: 'local'
|
|
- afi: 'ipv6'
|
|
rules:
|
|
- name: 'V6-LOCAL'
|
|
direction: 'local'
|
|
state: merged
|
|
register: result
|
|
|
|
- name: Assert that changes were applied
|
|
assert:
|
|
that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}"
|
|
|
|
- name: Revert back to base config using facts round trip
|
|
vyos_firewall_interfaces:
|
|
config: "{{ ansible_facts['network_resources']['firewall_interfaces'] }}"
|
|
state: overridden
|
|
register: revert
|
|
|
|
- name: Assert that config was reverted
|
|
assert:
|
|
that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}"
|
|
|
|
always:
|
|
- include_tasks: _remove_config.yaml
|
|
|
|
- include_tasks: _remove_firewall_config.yaml
|