2017-07-20 05:50:18 +00:00
|
|
|
---
|
|
|
|
- debug: msg="START junos_vrf netconf/basic.yaml"
|
|
|
|
|
|
|
|
- name: setup - remove vrf
|
|
|
|
junos_vrf:
|
|
|
|
name: test-1
|
|
|
|
state: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
|
|
|
|
- name: Configure vrf and its parameter
|
|
|
|
junos_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-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\+ *test-1")
|
|
|
|
- result.diff.prepared | search("\+ *description test-vrf-1")
|
|
|
|
- result.diff.prepared | search("\+ *instance-type vrf")
|
|
|
|
- result.diff.prepared | search("\+ *interface ge-0/0/5.0")
|
|
|
|
- result.diff.prepared | search("\+ *interface ge-0/0/6.0")
|
|
|
|
- result.diff.prepared | search("\+ *route-distinguisher 3.3.3.3:10")
|
|
|
|
- result.diff.prepared | search("\+ *vrf-target target:65513:111")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Configure vrf and its parameter (idempotent)
|
|
|
|
junos_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
|
|
|
|
junos_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-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\+ *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared | search("\+ *interface ge-0/0/3.0")
|
|
|
|
- result.diff.prepared | search("\- *interface ge-0/0/5.0")
|
|
|
|
- result.diff.prepared | search("\- *interface ge-0/0/6.0")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\- *route-distinguisher 3.3.3.3:10")
|
|
|
|
- result.diff.prepared | search("\+ *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared | search("\- *vrf-target target:65513:111")
|
|
|
|
- result.diff.prepared | search("\+ *vrf-target target:65514:113")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Deactivate vrf
|
|
|
|
junos_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
|
|
|
|
active: False
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'[edit routing-instances]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *inactive[:] test-1")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *inactive[:] interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared | search("! *inactive[:] interface ge-0/0/3.0")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *inactive[:] route-distinguisher")
|
|
|
|
- result.diff.prepared | search("! *inactive[:] vrf-target")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Activate vrf
|
|
|
|
junos_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
|
|
|
|
active: True
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'[edit routing-instances]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *active[:] test-1")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *active[:] interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared | search("! *active[:] interface ge-0/0/3.0")
|
2017-07-20 05:50:18 +00:00
|
|
|
- "'[edit routing-instances test-1]' in result.diff.prepared"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("! *active[:] route-distinguisher")
|
|
|
|
- result.diff.prepared | search("! *active[:] vrf-target")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Delete vrf
|
|
|
|
junos_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: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2017-08-02 08:41:10 +00:00
|
|
|
- result.diff.prepared | search("\- *test-1")
|
|
|
|
- result.diff.prepared | search("\- *description test-vrf-1")
|
|
|
|
- result.diff.prepared | search("\- *instance-type vrf")
|
|
|
|
- result.diff.prepared | search("\- *interface ge-0/0/2.0")
|
|
|
|
- result.diff.prepared | search("\- *interface ge-0/0/3.0")
|
|
|
|
- result.diff.prepared | search("\- *route-distinguisher 1.1.1.1:10")
|
|
|
|
- result.diff.prepared | search("\- *vrf-target target:65514:113")
|
2017-07-20 05:50:18 +00:00
|
|
|
|
|
|
|
- name: Delete vrf (idempotent)
|
|
|
|
junos_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: absent
|
|
|
|
provider: "{{ netconf }}"
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|