mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
ba60ac04fc
* Implementation of junos_static_route module * junos implementation of net_static_route * integration test for junos_static_route * integration test for junos net_static_route * Minor change * Doc change * Fix CI issue
142 lines
3.4 KiB
YAML
142 lines
3.4 KiB
YAML
---
|
|
- debug: msg="START junos_static_route netconf/basic.yaml"
|
|
|
|
- name: setup - remove static route
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
state: absent
|
|
provider: "{{ netconf }}"
|
|
|
|
- name: Confgiure static route
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: present
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<name>1.1.1.0/24</name>' in config.xml"
|
|
- "'<next-hop>3.3.3.3</next-hop>' in config.xml"
|
|
- "'<qualified-next-hop>' in config.xml"
|
|
- "'<name>5.5.5.5</name>' in config.xml"
|
|
- "'<preference>30</preference>' in config.xml"
|
|
- "'<metric-value>10</metric-value>' in config.xml"
|
|
|
|
- name: Confgiure static route (idempotent)
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: present
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|
|
|
|
- name: Deactivate static route
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: present
|
|
active: False
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<route inactive=\"inactive\">' in config.xml"
|
|
- "'inactive: route 1.1.1.0/24' in result.diff"
|
|
|
|
- name: Activate static route
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: present
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<name>1.1.1.0/24</name>' in config.xml"
|
|
- "'<next-hop>3.3.3.3</next-hop>' in config.xml"
|
|
- "'<qualified-next-hop>' in config.xml"
|
|
- "'<name>5.5.5.5</name>' in config.xml"
|
|
- "'<preference>30</preference>' in config.xml"
|
|
- "'<metric-value>10</metric-value>' in config.xml"
|
|
- "'inactive: route 1.1.1.0/24' not in result.diff"
|
|
|
|
- name: Delete static route
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: absent
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- name: Get running configuration
|
|
junos_rpc:
|
|
rpc: get-configuration
|
|
provider: "{{ netconf }}"
|
|
register: config
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == true"
|
|
- "'<name>1.1.1.0/24</name>' not in config.xml"
|
|
|
|
- name: Delete static route (idempotent)
|
|
junos_static_route:
|
|
address: 1.1.1.0/24
|
|
next_hop: 3.3.3.3
|
|
preference: 10
|
|
qualified_next_hop: 5.5.5.5
|
|
qualified_preference: 30
|
|
state: absent
|
|
active: True
|
|
provider: "{{ netconf }}"
|
|
register: result
|
|
|
|
- assert:
|
|
that:
|
|
- "result.changed == false"
|