72 lines
2.1 KiB
YAML
72 lines
2.1 KiB
YAML
|
---
|
||
|
- debug:
|
||
|
msg: "START vyos_static_routes round trip integration tests on connection={{ ansible_connection }}"
|
||
|
|
||
|
- include_tasks: _remove_config.yaml
|
||
|
|
||
|
- block:
|
||
|
- name: Apply the provided configuration (base config)
|
||
|
vyos_static_routes:
|
||
|
config:
|
||
|
- address_families:
|
||
|
- afi: 'ipv4'
|
||
|
routes:
|
||
|
- dest: 192.0.2.32/28
|
||
|
blackhole_config:
|
||
|
type: 'blackhole'
|
||
|
next_hops:
|
||
|
- forward_router_address: 192.0.2.10
|
||
|
- forward_router_address: 192.0.2.9
|
||
|
- address_families:
|
||
|
- afi: 'ipv6'
|
||
|
routes:
|
||
|
- dest: 2001:db8:1000::/36
|
||
|
blackhole_config:
|
||
|
distance: 2
|
||
|
next_hops:
|
||
|
- forward_router_address: 2001:db8:2000:2::1
|
||
|
- forward_router_address: 2001:db8:2000:2::2
|
||
|
|
||
|
state: merged
|
||
|
register: base_config
|
||
|
|
||
|
- name: Gather static_routes facts
|
||
|
vyos_facts:
|
||
|
gather_subset:
|
||
|
- default
|
||
|
gather_network_resources:
|
||
|
- static_routes
|
||
|
|
||
|
- name: Apply the provided configuration (config to be reverted)
|
||
|
vyos_static_routes:
|
||
|
config:
|
||
|
- address_families:
|
||
|
- afi: 'ipv4'
|
||
|
routes:
|
||
|
- dest: 192.0.2.32/28
|
||
|
blackhole_config:
|
||
|
distance: 2
|
||
|
next_hops:
|
||
|
- forward_router_address: 192.0.2.7
|
||
|
- forward_router_address: 192.0.2.8
|
||
|
- forward_router_address: 192.0.2.9
|
||
|
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_static_routes:
|
||
|
config: "{{ ansible_facts['network_resources']['static_routes'] }}"
|
||
|
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
|