ansible/test/integration/targets/vyos_firewall_global/tests/cli/merged.yaml
Rohit fc05c50b7f
VyOS: firewall global module added (#66800)
* firewall global module

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

* sanity fixed

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

* test updated

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

* sanity fixes

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

* group member handling updated

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

* comments incorporated

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
2020-02-24 09:03:02 -05:00

76 lines
2.3 KiB
YAML

---
- debug:
msg: "START vyos_firewall_global merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml
- block:
- name: Merge the provided configuration with the exisiting running configuration
vyos_firewall_global: &merged
config:
validation: strict
config_trap: True
log_martians: True
syn_cookies: True
twa_hazards_protection: True
ping:
all: True
broadcast: True
state_policy:
- connection_type: 'established'
action: 'accept'
log: True
- connection_type: 'invalid'
action: 'reject'
route_redirects:
- afi: 'ipv4'
ip_src_route: True
icmp_redirects:
send: True
receive: False
group:
address_group:
- name: 'MGMT-HOSTS'
description: 'This group has the Management hosts address list'
members:
- address: 192.0.1.1
- address: 192.0.1.3
- address: 192.0.1.5
network_group:
- name: 'MGMT'
description: 'This group has the Management network addresses'
members:
- address: 192.0.1.0/24
state: merged
register: result
- name: Assert that before dicts were correctly generated
assert:
that: "{{ merged['before'] == result['before'] }}"
- 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'] == result['after'] }}"
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
vyos_firewall_global: *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'] == result['before'] }}"
always:
- include_tasks: _remove_config.yaml