ansible/test/integration/targets/ios_static_routes/tests/cli/replaced.yaml
Sumit Jaiswal 4c0eb4396b
Resource module for IOS static routes (#64632)
* ios_static_routes
2020-02-28 18:29:17 +05:30

61 lines
1.8 KiB
YAML

---
- debug:
msg: "START Replaced ios_static_routes state for integration tests on connection={{ ansible_connection }}"
- include_tasks: _remove_config.yaml
- include_tasks: _intial_setup_config.yaml
- block:
- name: Replaces device configuration of listed interfaces with provided configuration
ios_static_routes: &replaced
config:
- vrf: ansible_temp_vrf
address_families:
- afi: ipv4
routes:
- dest: 192.0.2.0/24
next_hops:
- forward_router_address: 192.0.2.1
name: replaced_vrf
tag: 75
track: 155
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
next_hops:
- forward_router_address: 198.51.101.1
name: replaced_route
distance_metric: 175
tag: 70
multicast: True
- afi: ipv6
routes:
- dest: 2001:DB8:0:3::/64
next_hops:
- forward_router_address: 2001:DB8:0:3::2
name: replaced_v6
tag: 110
state: replaced
register: result
- assert:
that:
- "result.commands|length == 7"
- "result.changed == true"
- "result.commands|symmetric_difference(replaced.commands) == []"
- name: Replaces device configuration of listed interfaces with provided configuration (IDEMPOTENT)
ios_static_routes: *replaced
register: result
- name: Assert that task was idempotent
assert:
that:
- "result.commands|length == 0"
- "result['changed'] == false"
always:
- include_tasks: _populate_config.yaml
- include_tasks: _remove_config.yaml