2017-07-20 05:50:18 +00:00
|
|
|
---
|
|
|
|
- debug: msg="START net_vrf junos/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove vrf
|
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Configure vrf and its parameter
|
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/6
|
|
|
|
- ge-0/0/5
|
|
|
|
rd: 3.3.3.3:10
|
|
|
|
target: target:65513:111
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\+ *test-1")
|
|
|
|
- result.diff.prepared is search("\+ *description test-vrf-1")
|
|
|
|
- result.diff.prepared is search("\+ *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/5.0")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/6.0")
|
|
|
|
- result.diff.prepared is search("\+ *route-distinguisher 3.3.3.3:10")
|
|
|
|
- result.diff.prepared is search("\+ *vrf-target target:65513:111")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Configure vrf and its parameter (idempotent)
|
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/6
|
|
|
|
- ge-0/0/5
|
|
|
|
rd: 3.3.3.3:10
|
|
|
|
target: target:65513:111
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
|
|
|
|
- name: Change vrf parameter
|
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/3
|
|
|
|
- ge-0/0/2
|
|
|
|
rd: 1.1.1.1:10
|
|
|
|
target: target:65514:113
|
|
|
|
state: present
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/3.0")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\+ *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared is search("\+ *vrf-target target:65514:113")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
|
2017-08-04 09:25:58 +00:00
|
|
|
- name: Delete vrf
|
2017-07-20 05:50:18 +00:00
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/3
|
|
|
|
- ge-0/0/2
|
|
|
|
rd: 1.1.1.1:10
|
|
|
|
target: target:65514:113
|
2017-08-04 09:25:58 +00:00
|
|
|
state: absent
|
2017-07-20 05:50:18 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\- *test-1")
|
|
|
|
- result.diff.prepared is search("\- *description test-vrf-1")
|
|
|
|
- result.diff.prepared is search("\- *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/3.0")
|
|
|
|
- result.diff.prepared is search("\- *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared is search("\- *vrf-target target:65514:113")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
2017-08-04 09:25:58 +00:00
|
|
|
- name: Delete vrf (idempotent)
|
2017-07-20 05:50:18 +00:00
|
|
|
net_vrf:
|
|
|
|
name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/3
|
|
|
|
- ge-0/0/2
|
|
|
|
rd: 1.1.1.1:10
|
|
|
|
target: target:65514:113
|
2017-08-04 09:25:58 +00:00
|
|
|
state: absent
|
2017-07-20 05:50:18 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2017-08-04 09:25:58 +00:00
|
|
|
- "result.changed == false"
|
2017-07-20 05:50:18 +00:00
|
|
|
|
2017-08-04 09:25:58 +00:00
|
|
|
- name: Setup vrf using aggregate
|
2017-07-20 05:50:18 +00:00
|
|
|
net_vrf:
|
2017-08-04 09:25:58 +00:00
|
|
|
aggregate:
|
|
|
|
- name: test-1
|
|
|
|
- name: test-2
|
2017-08-14 04:47:03 +00:00
|
|
|
state: absent
|
2017-08-04 09:25:58 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- name: Create vrf using aggregate
|
|
|
|
net_vrf:
|
|
|
|
aggregate:
|
|
|
|
- name: test-1
|
|
|
|
description: test-vrf-1
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/3
|
|
|
|
- ge-0/0/2
|
|
|
|
rd: 1.1.1.1:10
|
|
|
|
target: target:65514:113
|
|
|
|
- name: test-2
|
|
|
|
description: test-vrf-2
|
|
|
|
interfaces:
|
|
|
|
- ge-0/0/4
|
|
|
|
- ge-0/0/5
|
|
|
|
rd: 2.2.2.2:10
|
|
|
|
target: target:65515:114
|
2017-07-20 05:50:18 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\+ *test-1")
|
|
|
|
- result.diff.prepared is search("\+ *description test-vrf-1")
|
|
|
|
- result.diff.prepared is search("\+ *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/3.0")
|
|
|
|
- result.diff.prepared is search("\+ *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared is search("\+ *vrf-target target:65514:113")
|
|
|
|
- result.diff.prepared is search("\+ *test-2")
|
|
|
|
- result.diff.prepared is search("\+ *description test-vrf-2")
|
|
|
|
- result.diff.prepared is search("\+ *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/4.0")
|
|
|
|
- result.diff.prepared is search("\+ *interface ge-0/0/5.0")
|
|
|
|
- result.diff.prepared is search("\+ *route-distinguisher 2.2.2.2:10")
|
|
|
|
- result.diff.prepared is search("\+ *vrf-target target:65515:114")
|
2017-08-04 09:25:58 +00:00
|
|
|
|
|
|
|
- name: Delete vrf configuration using aggregate
|
|
|
|
net_vrf:
|
|
|
|
aggregate:
|
|
|
|
- name: test-1
|
|
|
|
- name: test-2
|
2017-08-14 04:47:03 +00:00
|
|
|
state: absent
|
2017-08-04 09:25:58 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
2017-07-20 05:50:18 +00:00
|
|
|
|
2017-08-04 09:25:58 +00:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-11-27 22:58:08 +00:00
|
|
|
- result.diff.prepared is search("\- *test-1")
|
|
|
|
- result.diff.prepared is search("\- *description test-vrf-1")
|
|
|
|
- result.diff.prepared is search("\- *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/3.0")
|
|
|
|
- result.diff.prepared is search("\- *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared is search("\- *vrf-target target:65514:113")
|
|
|
|
- result.diff.prepared is search("\- *test-2")
|
|
|
|
- result.diff.prepared is search("\- *description test-vrf-2")
|
|
|
|
- result.diff.prepared is search("\- *instance-type vrf")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/4.0")
|
|
|
|
- result.diff.prepared is search("\- *interface ge-0/0/5.0")
|
|
|
|
- result.diff.prepared is search("\- *route-distinguisher 2.2.2.2:10")
|
|
|
|
- result.diff.prepared is search("\- *vrf-target target:65515:114")
|
2017-08-04 09:25:58 +00:00
|
|
|
|
|
|
|
- name: Delete vrf configuration using aggregate (idempotent)
|
2017-07-20 05:50:18 +00:00
|
|
|
net_vrf:
|
2017-08-04 09:25:58 +00:00
|
|
|
aggregate:
|
|
|
|
- name: test-1
|
|
|
|
- name: test-2
|
2017-08-14 04:47:03 +00:00
|
|
|
state: absent
|
2017-07-20 05:50:18 +00:00
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|