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>
75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
---
|
|
- debug:
|
|
msg: "START vyos_firewall_interfaces merged integration tests on connection={{ ansible_connection }}"
|
|
|
|
- include_tasks: _populate_rule_sets.yaml
|
|
|
|
- include_tasks: _remove_config.yaml
|
|
|
|
- block:
|
|
- name: Merge the provided configuration with the exisiting running configuration
|
|
vyos_firewall_interfaces: &merged
|
|
config:
|
|
- name: 'eth1'
|
|
access_rules:
|
|
- afi: 'ipv4'
|
|
rules:
|
|
- direction: 'in'
|
|
name: 'INBOUND'
|
|
- direction: 'local'
|
|
name: 'LOCAL'
|
|
- direction: 'out'
|
|
name: 'OUTBOUND'
|
|
- afi: 'ipv6'
|
|
rules:
|
|
- direction: 'local'
|
|
name: 'V6-LOCAL'
|
|
- name: 'eth2'
|
|
access_rules:
|
|
- afi: 'ipv4'
|
|
rules:
|
|
- direction: 'in'
|
|
name: 'INBOUND'
|
|
- direction: 'local'
|
|
name: 'LOCAL'
|
|
- direction: 'out'
|
|
name: 'OUTBOUND'
|
|
- afi: 'ipv6'
|
|
rules:
|
|
- direction: 'local'
|
|
name: 'V6-LOCAL'
|
|
state: merged
|
|
register: result
|
|
|
|
- name: Assert that before dicts were correctly generated
|
|
assert:
|
|
that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}"
|
|
|
|
- name: Assert that correct set of commands were generated
|
|
assert:
|
|
that:
|
|
- "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}"
|
|
|
|
- name: Assert that after dicts was correctly generated
|
|
assert:
|
|
that:
|
|
- "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}"
|
|
|
|
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
|
|
vyos_firewall_interfaces: *merged
|
|
register: result
|
|
|
|
- name: Assert that the previous task was idempotent
|
|
assert:
|
|
that:
|
|
- "result['changed'] == false"
|
|
|
|
- name: Assert that before dicts were correctly generated
|
|
assert:
|
|
that:
|
|
- "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}"
|
|
|
|
always:
|
|
- include_tasks: _remove_config.yaml
|
|
|
|
- include_tasks: _remove_firewall_config.yaml
|