You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/net_vrf/tests/junos/basic.yaml

172 lines
5.0 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"