1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/eos_static_route/tests/cli/basic.yaml
Nathaniel Case 513c75079e
Port eos tests to network_cli (#33586)
* Add eos and fix tests to run multiple connections

* Update tests to report connection

* Add missing START messages

* Fix unspecified connection

* Python 3 updates

Exceptions don't have `.message` in Python 3

* Override `become` when using `connection=local`

* Slight restructuring to make eapi easier later on

* Move eapi toggle to prepare_eos
* Pull out connection on eapi tasks
2017-12-19 15:49:49 -05:00

124 lines
3 KiB
YAML

---
- debug: msg="START cli/basic.yaml on connection={{ ansible_connection }}"
- 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 }}"
become: yes
- 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 }}"
become: yes
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
become: yes
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
become: yes
register: result
- 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
become: yes
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 }
authorize: yes
provider: "{{ cli }}"
become: yes
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
become: yes
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 }}"
become: yes
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
become: yes
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 }}"
become: yes
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"