2017-11-07 12:13:03 +01:00
|
|
|
---
|
2017-12-19 21:49:49 +01:00
|
|
|
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
|
2017-11-07 12:13:03 +01:00
|
|
|
|
|
|
|
- name: setup - remove config used in test
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- no ip route 192.168.3.0/24 192.168.0.1
|
|
|
|
- no ip route 192.168.4.0/24 192.168.0.1
|
|
|
|
- no ip route 192.168.5.0/24 192.168.0.1
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
|
|
|
|
- name: configure static route
|
|
|
|
eos_static_route: &single_route
|
|
|
|
address: 192.168.3.0/24
|
|
|
|
next_hop: 192.168.0.1
|
|
|
|
admin_distance: 2
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'ip route 192.168.3.0/24 192.168.0.1 2' in result.commands"
|
|
|
|
|
|
|
|
- name: configure static route(Idempotence)
|
|
|
|
eos_static_route: *single_route
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: delete static route
|
|
|
|
eos_static_route: &delete_single
|
|
|
|
address: 192.168.3.0/24
|
|
|
|
next_hop: 192.168.0.1
|
|
|
|
admin_distance: 2
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
state: absent
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-08 06:21:35 +01:00
|
|
|
register: result
|
2017-11-07 12:13:03 +01:00
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'no ip route 192.168.3.0/24 192.168.0.1' in result.commands"
|
|
|
|
|
|
|
|
- name: delete static route
|
|
|
|
eos_static_route: *delete_single
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: configure static routes using aggregate
|
|
|
|
eos_static_route: &configure_aggregate
|
|
|
|
aggregate:
|
|
|
|
- { address: 192.168.4.0/24, next_hop: 192.168.0.1 }
|
|
|
|
- { address: 192.168.5.0/24, next_hop: 192.168.0.1 }
|
2017-11-30 16:17:05 +01:00
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'ip route 192.168.4.0/24 192.168.0.1 1' in result.commands"
|
|
|
|
- "'ip route 192.168.5.0/24 192.168.0.1 1' in result.commands"
|
|
|
|
|
|
|
|
- name: configure static routes using aggregate(Idemporence)
|
|
|
|
eos_static_route: *configure_aggregate
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: delete static routes using aggregate
|
|
|
|
eos_static_route: &delete_aggregate
|
|
|
|
aggregate:
|
|
|
|
- { address: 192.168.4.0/24, next_hop: 192.168.0.1 }
|
|
|
|
- { address: 192.168.5.0/24, next_hop: 192.168.0.1 }
|
|
|
|
authorize: yes
|
|
|
|
state: absent
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'no ip route 192.168.4.0/24 192.168.0.1' in result.commands"
|
|
|
|
- "'no ip route 192.168.5.0/24 192.168.0.1' in result.commands"
|
|
|
|
|
|
|
|
- name: delete static routes using aggregate(Idempotence)
|
|
|
|
eos_static_route: *delete_aggregate
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: teardown
|
|
|
|
eos_config:
|
|
|
|
lines:
|
|
|
|
- no ip route 192.168.3.0/24 192.168.0.1
|
|
|
|
- no ip route 192.168.4.0/24 192.168.0.1
|
|
|
|
- no ip route 192.168.5.0/24 192.168.0.1
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-11-07 12:13:03 +01:00
|
|
|
|
2017-12-19 21:49:49 +01:00
|
|
|
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"
|