2017-10-26 17:27:55 +02:00
|
|
|
---
|
2018-01-05 18:39:04 +01: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 17:27:55 +02:00
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: create static route
|
|
|
|
nxos_static_route: &configure
|
|
|
|
prefix: "192.168.20.64/24"
|
2018-05-30 19:03:20 +02:00
|
|
|
next_hop: "192.0.2.3"
|
2017-10-26 17:27:55 +02:00
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
|
|
|
tag: 5500
|
2018-03-26 17:13:32 +02:00
|
|
|
vrf: "{{ item }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &true
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
|
|
|
|
- name: "Conf Idempotence"
|
|
|
|
nxos_static_route: *configure
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: &false
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
2018-03-26 17:13:32 +02:00
|
|
|
- name: change static route
|
|
|
|
nxos_static_route: &configure1
|
|
|
|
prefix: "192.168.20.64/24"
|
2018-05-30 19:03:20 +02:00
|
|
|
next_hop: "192.0.2.3"
|
2018-03-26 17:13:32 +02:00
|
|
|
route_name: default
|
|
|
|
pref: 10
|
|
|
|
tag: default
|
|
|
|
vrf: "{{ item }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Conf1 Idempotence"
|
|
|
|
nxos_static_route: *configure1
|
|
|
|
with_items: "{{ vrfs }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-10-26 17:27:55 +02:00
|
|
|
- name: remove static route
|
|
|
|
nxos_static_route: &remove
|
|
|
|
prefix: "192.168.20.64/24"
|
2018-05-30 19:03:20 +02:00
|
|
|
next_hop: "192.0.2.3"
|
2017-10-26 17:27:55 +02:00
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
2018-03-26 17:13:32 +02:00
|
|
|
vrf: "{{ item }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
state: absent
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *true
|
|
|
|
|
|
|
|
- name: "Remove Idempotence"
|
|
|
|
nxos_static_route: *remove
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert: *false
|
|
|
|
|
2017-12-20 12:38:29 +01:00
|
|
|
- name: configure static route(aggregate)
|
|
|
|
nxos_static_route: &conf_agg
|
|
|
|
aggregate:
|
2018-05-30 19:03:20 +02:00
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "192.0.2.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "192.0.2.3" }
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-20 12:38:29 +01:00
|
|
|
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:
|
2018-05-30 19:03:20 +02:00
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "192.0.2.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "192.0.2.3" }
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-20 12:38:29 +01:00
|
|
|
state: absent
|
|
|
|
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 17:27:55 +02:00
|
|
|
always:
|
|
|
|
- name: remove static route
|
|
|
|
nxos_static_route:
|
|
|
|
prefix: "192.168.20.64/24"
|
2018-05-30 19:03:20 +02:00
|
|
|
next_hop: "192.0.2.3"
|
2017-10-26 17:27:55 +02:00
|
|
|
route_name: testing
|
|
|
|
pref: 100
|
|
|
|
tag: 5500
|
2018-03-26 17:13:32 +02:00
|
|
|
vrf: "{{ item }}"
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
state: absent
|
2018-03-26 17:13:32 +02:00
|
|
|
with_items: "{{ vrfs }}"
|
2017-10-26 17:27:55 +02:00
|
|
|
ignore_errors: yes
|
|
|
|
|
2017-12-20 12:38:29 +01:00
|
|
|
- name: remove static route aggregate
|
|
|
|
nxos_static_route:
|
|
|
|
aggregate:
|
2018-05-30 19:03:20 +02:00
|
|
|
- { prefix: "192.168.22.64/24", next_hop: "192.0.2.3" }
|
|
|
|
- { prefix: "192.168.24.64/24", next_hop: "192.0.2.3" }
|
2018-07-02 15:43:51 +02:00
|
|
|
provider: "{{ connection }}"
|
2017-12-20 12:38:29 +01:00
|
|
|
state: absent
|
|
|
|
ignore_errors: yes
|
|
|
|
|
2018-01-05 18:39:04 +01:00
|
|
|
- debug: msg="END connection={{ ansible_connection }} nxos_static_route sanity test"
|