1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/net_vrf/tests/junos/basic.yaml
Ganesh Nalawade 5ab8d30d10 Add net_vrf implementation for junos (#27055)
*  junos_vrf implementation
*  junos_vrf integration test
*  net_vrf integration test for junos
2017-07-20 11:20:18 +05:30

171 lines
5 KiB
YAML

---
- 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"
- "'+ test-1' in result.diff.prepared"
- "'+ description test-vrf-1;' in result.diff.prepared"
- "'+ instance-type vrf;' in result.diff.prepared"
- "'+ interface ge-0/0/5.0;' in result.diff.prepared"
- "'+ interface ge-0/0/6.0;' in result.diff.prepared"
- "'+ route-distinguisher 3.3.3.3:10;' in result.diff.prepared"
- "'+ vrf-target target:65513:111;' in result.diff.prepared"
- 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"
- "'+ interface ge-0/0/2.0;' in result.diff.prepared"
- "'+ interface ge-0/0/3.0;' in result.diff.prepared"
- "'- interface ge-0/0/5.0;' in result.diff.prepared"
- "'- interface ge-0/0/6.0;' in result.diff.prepared"
- "'[edit routing-instances test-1]' in result.diff.prepared"
- "'- route-distinguisher 3.3.3.3:10;' in result.diff.prepared"
- "'+ route-distinguisher 1.1.1.1:10;' in result.diff.prepared"
- "'- vrf-target target:65513:111;' in result.diff.prepared"
- "'+ vrf-target target:65514:113;' in result.diff.prepared"
- name: Deactivate vrf
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
active: False
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'[edit routing-instances]' in result.diff.prepared"
- "'! inactive: test-1' in result.diff.prepared"
- "'[edit routing-instances test-1]' in result.diff.prepared"
- "'! inactive: interface ge-0/0/2.0' in result.diff.prepared"
- "'! inactive: interface ge-0/0/3.0' in result.diff.prepared"
- "'[edit routing-instances test-1]' in result.diff.prepared"
- "'! inactive: route-distinguisher' in result.diff.prepared"
- "'! inactive: vrf-target' in result.diff.prepared"
- name: Activate vrf
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
active: True
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'[edit routing-instances]' in result.diff.prepared"
- "'! active: test-1' in result.diff.prepared"
- "'[edit routing-instances test-1]' in result.diff.prepared"
- "'! active: interface ge-0/0/2.0' in result.diff.prepared"
- "'! active: interface ge-0/0/3.0' in result.diff.prepared"
- "'[edit routing-instances test-1]' in result.diff.prepared"
- "'! active: route-distinguisher' in result.diff.prepared"
- "'! active: vrf-target' in result.diff.prepared"
- name: Delete vrf
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: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == true"
- "'[edit routing-instances]' in result.diff.prepared"
- "'- test-1' in result.diff.prepared"
- "'- description test-vrf-1;' in result.diff.prepared"
- "'- instance-type vrf;' in result.diff.prepared"
- "'- interface ge-0/0/2.0;' in result.diff.prepared"
- "'- interface ge-0/0/3.0;' in result.diff.prepared"
- "'- route-distinguisher 1.1.1.1:10;' in result.diff.prepared"
- "'- vrf-target target:65514:113;' in result.diff.prepared"
- name: Delete vrf (idempotent)
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: absent
provider: "{{ netconf }}"
register: result
- assert:
that:
- "result.changed == false"