b81882e2a8
* vyos_static_route implementation module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * Add vyos_static_route implementation module Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * unit test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * modify vyos_static_route Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * integration test vyos_static and net_static_route Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * fix typo integration test Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * modify vyos_static_route * modify integration test * vyos_static_route doc build fix * fix integration test data Signed-off-by: Trishna Guha <trishnaguha17@gmail.com> * update net_static_route cli test set * minor fix
127 lines
3.3 KiB
YAML
127 lines
3.3 KiB
YAML
---
|
|
- name: create static route
|
|
net_static_route:
|
|
prefix: 172.24.0.0/24
|
|
next_hop: 192.168.42.64
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
- name: create static route again (idempotent)
|
|
net_static_route:
|
|
prefix: 172.24.0.0
|
|
mask: 24
|
|
next_hop: 192.168.42.64
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
- name: modify admin distance of static route
|
|
net_static_route:
|
|
prefix: 172.24.0.0/24
|
|
next_hop: 192.168.42.64
|
|
admin_distance: 1
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set protocols static route 172.24.0.0/24 next-hop 192.168.42.64 distance 1" in result.commands'
|
|
|
|
- name: modify admin distance of static route again (idempotent)
|
|
net_static_route:
|
|
prefix: 172.24.0.0
|
|
mask: 24
|
|
next_hop: 192.168.42.64
|
|
admin_distance: 1
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
- name: delete static route
|
|
net_static_route:
|
|
prefix: 172.24.0.0/24
|
|
next_hop: 192.168.42.64
|
|
admin_distance: 1
|
|
state: absent
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete protocols static route 172.24.0.0/24" in result.commands'
|
|
|
|
- name: delete static route again (idempotent)
|
|
net_static_route:
|
|
prefix: 172.24.0.0/24
|
|
next_hop: 192.168.42.64
|
|
admin_distance: 1
|
|
state: absent
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == false'
|
|
|
|
- name: Add static route collections
|
|
net_static_route:
|
|
collection:
|
|
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
|
|
- { prefix: 172.24.2.0, mask: 24, next_hop: 192.168.42.64 }
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"set protocols static route 172.24.1.0/24 next-hop 192.168.42.64" in result.commands'
|
|
- '"set protocols static route 172.24.2.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
- name: Add and remove static route collections with overrides
|
|
net_static_route:
|
|
collection:
|
|
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
|
|
- { prefix: 172.24.2.0/24, next_hop: 192.168.42.64, state: absent }
|
|
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 }
|
|
state: present
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete protocols static route 172.24.2.0/24" in result.commands'
|
|
- '"set protocols static route 172.24.3.0/24 next-hop 192.168.42.64" in result.commands'
|
|
|
|
- name: Remove static route collections
|
|
net_static_route:
|
|
collection:
|
|
- { prefix: 172.24.1.0/24, next_hop: 192.168.42.64 }
|
|
- { prefix: 172.24.3.0/24, next_hop: 192.168.42.64 }
|
|
state: absent
|
|
provider: "{{ cli }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- 'result.changed == true'
|
|
- '"delete protocols static route 172.24.1.0/24" in result.commands'
|
|
- '"delete protocols static route 172.24.3.0/24" in result.commands'
|