2017-10-26 15:27:55 +00:00
|
|
|
---
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="START connection={{ ansible_connection }} nxos_static_route sanity test"
|
|
|
|
- debug: msg="Using provider={{ connection.transport }}"
|
|
|
|
when: ansible_connection == "local"
|
2017-10-26 15:27:55 +00:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: create static route
|
|
|
|
nxos_static_route: &configure
|
|
|
|
prefix: "192.168.20.64/24"
|
|
|
|
next_hop: "3.3.3.3"
|
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
|
|
|
tag: 5500
|
|
|
|
vrf: testing
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_static_route: *configure
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: remove static route
|
|
|
|
nxos_static_route: &remove
|
|
|
|
prefix: "192.168.20.64/24"
|
|
|
|
next_hop: "3.3.3.3"
|
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
|
|
|
tag: 5500
|
|
|
|
vrf: testing
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_static_route: *remove
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-12-20 11:38:29 +00:00
|
|
|
- name: configure static route(aggregate)
|
|
|
|
nxos_static_route: &conf_agg
|
|
|
|
aggregate:
|
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: configure static route aggregate(Idempotence)
|
|
|
|
nxos_static_route: *conf_agg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: remove static route aggregate
|
|
|
|
nxos_static_route: &remove_agg
|
|
|
|
aggregate:
|
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: remove static route aggregate(Idempotence)
|
|
|
|
nxos_static_route: *remove_agg
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2017-10-26 15:27:55 +00:00
|
|
|
always:
|
|
|
|
- name: remove static route
|
|
|
|
nxos_static_route:
|
|
|
|
prefix: "192.168.20.64/24"
|
|
|
|
next_hop: "3.3.3.3"
|
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
|
|
|
tag: 5500
|
|
|
|
vrf: testing
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-12-20 11:38:29 +00:00
|
|
|
- name: remove static route aggregate
|
|
|
|
nxos_static_route:
|
|
|
|
aggregate:
|
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "3.3.3.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "3.3.3.3" }
|
|
|
|
state: absent
|
|
|
|
provider: "{{ connection }}"
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 17:39:04 +00:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test"
|