ansible/test/integration/targets/vyos_firewall_rules/tests/cli/merged.yaml
Rohit e76630c4e4
VyOS: firewall_rules module added (#65680)
* firewall_rules module added

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>

* state fact gathering code

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>

* facts and operation code added

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>

* unit tests 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>

* sanity fixes

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>

* delete opr updated

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
2020-02-17 08:08:08 -05:00

87 lines
2.9 KiB
YAML

---
- debug:
msg: "START vyos_firewall_rules merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _populate.yaml
- include_tasks: _remove_config.yaml
- block:
- name: Merge the provided configuration with the exisiting running configuration
vyos_firewall_rules: &merged
config:
- afi: 'ipv6'
rule_sets:
- name: 'UPLINK'
description: 'This is ipv6 specific rule-set'
default_action: 'accept'
rules:
- number: 1
action: 'accept'
description: 'Fwipv6-Rule 1 is configured by Ansible'
ipsec: 'match-ipsec'
- number: 2
action: 'accept'
description: 'Fwipv6-Rule 2 is configured by Ansible'
ipsec: 'match-ipsec'
- afi: 'ipv4'
rule_sets:
- name: 'INBOUND'
description: 'IPv4 INBOUND rule set'
default_action: 'accept'
rules:
- number: 101
action: 'accept'
description: 'Rule 101 is configured by Ansible'
ipsec: 'match-ipsec'
- number: 102
action: 'reject'
description: 'Rule 102 is configured by Ansible'
ipsec: 'match-ipsec'
- number: 103
action: 'accept'
description: 'Rule 103 is configured by Ansible'
destination:
group:
address_group: 'inbound'
source:
address: '192.0.2.0'
state:
established: true
new: false
invalid: false
related: true
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_rules: *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