You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/junos_static_routes/tests/netconf/merged.yaml

73 lines
2.3 KiB
YAML

---
- debug:
msg: "START junos_static_routes merged integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml
- set_fact:
expected_merged_output:
- address_families:
- afi: 'ipv6'
routes:
- dest: 2001:db8::5/128
next_hop:
- forward_router_address: 2001:db8:0:1:2a0:a502:0:19da
- dest: ::/0
next_hop:
- forward_router_address: 2001:db8:0:1:2a0:a502:0:19da
- afi: 'ipv4'
routes:
- dest: 192.168.0.0/24
next_hop:
- forward_router_address: 192.168.0.1
- dest: 192.168.1.0/24
metric: 2
next_hop:
- forward_router_address: 192.168.1.1
- block:
- name: Merge the provided configuration with the exisiting running configuration
junos_static_routes: &merged
config:
- address_families:
- afi: 'ipv4'
routes:
- dest: 192.168.0.0/24
next_hop:
- forward_router_address: 192.168.0.1
- dest: 192.168.1.0/24
next_hop:
- forward_router_address: 192.168.1.1
metric: 2
- afi: 'ipv6'
routes:
- dest: 2001:db8::5/128
next_hop:
- forward_router_address: 2001:db8:0:1:2a0:a502:0:19da
- dest: ::/0
next_hop:
- forward_router_address: 2001:db8:0:1:2a0:a502:0:19da
state: merged
register: result
- name: Assert the configuration is reflected on host
assert:
that:
- "{{ expected_merged_output | symmetric_difference(result['after']) |length == 0 }}"
debugger: on_failed
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
junos_static_routes: *merged
register: result
- name: Assert that the previous task was idempotent
assert:
that:
- "result['changed'] == false"
always:
- include_tasks: _remove_config.yaml
- debug:
msg: "END junos_static_routes merged integration tests on connection={{ ansible_connection }}"