48ab1a1334
* eos_static_route DI module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add net_static_route test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Validate ip address Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
102 lines
2.5 KiB
YAML
102 lines
2.5 KiB
YAML
---
|
|
- name: setup - remove config used in test
|
|
net_static_route:
|
|
aggregate:
|
|
- { address: 192.168.3.0/24, next_hop: 192.168.0.1 }
|
|
- { 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 }}"
|
|
|
|
- name: configure static route
|
|
net_static_route: &single_route
|
|
address: 192.168.3.0/24
|
|
next_hop: 192.168.0.1
|
|
admin_distance: 2
|
|
authorize: yes
|
|
provider: "{{ cli }}"
|
|
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)
|
|
net_static_route: *single_route
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: delete static route
|
|
net_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
|
|
regiser: 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
|
|
net_static_route: *delete_single
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: configure static routes using aggregate
|
|
net_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 }}"
|
|
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)
|
|
net_static_route: *configure_aggregate
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: delete static routes using aggregate
|
|
net_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 }}"
|
|
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)
|
|
net_static_route: *delete_aggregate
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|