2017-06-09 13:24:28 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: setup - remove vrf
|
|
|
|
eos_vrf:
|
2018-02-12 08:03:22 +01:00
|
|
|
name: "{{ item }}"
|
2017-08-10 10:54:13 +02:00
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2018-02-12 08:03:22 +01:00
|
|
|
with_items:
|
|
|
|
- test
|
|
|
|
- test1
|
|
|
|
- test2
|
|
|
|
- test3
|
|
|
|
- test4
|
|
|
|
- test5
|
2017-08-10 10:54:13 +02:00
|
|
|
|
2017-06-09 13:24:28 +02:00
|
|
|
- name: Create vrf
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:200
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'vrf definition test' in result.commands"
|
|
|
|
- "'rd 1:200' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Create vrf again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:200
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands | length == 0"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "result.session_name is not defined"
|
|
|
|
|
|
|
|
- name: Modify rd
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:201
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'vrf definition test' in result.commands"
|
|
|
|
- "'rd 1:201' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Modify rd again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:201
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands | length == 0"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "result.session_name is not defined"
|
|
|
|
|
|
|
|
- name: Add Ethernet2 to vrf
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:201
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
interfaces:
|
|
|
|
- Ethernet2
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
2018-01-16 13:16:14 +01:00
|
|
|
- "'interface ethernet2' in result.commands"
|
2017-06-09 13:24:28 +02:00
|
|
|
- "'vrf forwarding test' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Add Ethernet2 to vrf again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
rd: 1:201
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
interfaces:
|
2018-01-16 13:16:14 +01:00
|
|
|
- ethernet 2 # interface name modified to test case insensitive and space scenario
|
2017-06-09 13:24:28 +02:00
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands | length == 0"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
2017-07-12 11:34:36 +02:00
|
|
|
- "'session_name' not in result.commands"
|
2017-06-09 13:24:28 +02:00
|
|
|
|
2018-02-12 08:03:22 +01:00
|
|
|
- name: Add multiple interfaces to vrf
|
|
|
|
eos_vrf:
|
|
|
|
name: test1
|
|
|
|
rd: 1:202
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
interfaces:
|
|
|
|
- loopback10
|
|
|
|
- loopback11
|
|
|
|
- loopback12
|
|
|
|
- loopback13
|
|
|
|
- loopback14
|
|
|
|
- loopback15
|
|
|
|
- loopback1000
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'interface loopback10' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback11' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback12' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback13' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback14' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback15' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'interface loopback1000' in result.commands"
|
|
|
|
- "'vrf forwarding test1' in result.commands"
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Add multiple interfaces to vrf (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
name: test1
|
|
|
|
rd: 1:202
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
interfaces:
|
|
|
|
- loopback10
|
|
|
|
- loopback11
|
|
|
|
- loopback12
|
|
|
|
- loopback13
|
|
|
|
- loopback14
|
|
|
|
- loopback15
|
|
|
|
- loopback1000
|
|
|
|
provider: "{{ cli }}"
|
|
|
|
become: yes
|
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands | length == 0"
|
|
|
|
|
2017-08-10 10:54:13 +02:00
|
|
|
- name: Create aggregate of VRFs
|
|
|
|
eos_vrf:
|
|
|
|
aggregate:
|
|
|
|
- { name: test2, rd: "1:202" }
|
|
|
|
- { name: test3, rd: "1:203" }
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 10:54:13 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'vrf definition test2' in result.commands"
|
|
|
|
- "'rd 1:202' in result.commands"
|
|
|
|
- "'vrf definition test3' in result.commands"
|
|
|
|
- "'rd 1:203' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
|
|
|
- name: Create aggregate of VRFs again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
aggregate:
|
|
|
|
- { name: test2, rd: "1:202" }
|
|
|
|
- { name: test3, rd: "1:203" }
|
|
|
|
state: present
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 10:54:13 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == false"
|
|
|
|
- "result.commands | length == 0"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "result.session_name is not defined"
|
|
|
|
|
2017-08-10 19:59:32 +02:00
|
|
|
- name: Create aggregate of VRFs with purge
|
|
|
|
eos_vrf:
|
|
|
|
aggregate:
|
|
|
|
- { name: test4, rd: "1:204" }
|
|
|
|
- { name: test5, rd: "1:205" }
|
|
|
|
state: present
|
|
|
|
purge: yes
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 19:59:32 +02:00
|
|
|
register: result
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- "result.changed == true"
|
|
|
|
- "'vrf definition test4' in result.commands"
|
|
|
|
- "'rd 1:204' in result.commands"
|
|
|
|
- "'vrf definition test5' in result.commands"
|
|
|
|
- "'rd 1:205' in result.commands"
|
|
|
|
- "'no vrf definition test' in result.commands"
|
|
|
|
- "'no vrf definition test2' in result.commands"
|
|
|
|
- "'no vrf definition test3' in result.commands"
|
|
|
|
# Ensure sessions contains epoc. Will fail after 18th May 2033
|
|
|
|
- "'ansible_1' in result.session_name"
|
|
|
|
|
2017-08-10 10:54:13 +02:00
|
|
|
- name: Delete VRFs
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 10:54:13 +02:00
|
|
|
|
|
|
|
- name: Delete VRFs again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
name: test
|
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 10:54:13 +02:00
|
|
|
|
|
|
|
- name: Delete aggregate of VRFs
|
|
|
|
eos_vrf:
|
|
|
|
aggregate:
|
2018-02-12 08:03:22 +01:00
|
|
|
- { name: test1 }
|
2017-08-10 10:54:13 +02:00
|
|
|
- { name: test2 }
|
|
|
|
- { name: test3 }
|
2017-08-10 19:59:32 +02:00
|
|
|
- { name: test4 }
|
|
|
|
- { name: test5 }
|
2017-08-10 10:54:13 +02:00
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-08-10 10:54:13 +02:00
|
|
|
|
|
|
|
- name: Delete VRFs again (idempotent)
|
|
|
|
eos_vrf:
|
|
|
|
aggregate:
|
2018-02-12 08:03:22 +01:00
|
|
|
- { name: test1 }
|
2017-08-10 10:54:13 +02:00
|
|
|
- { name: test2 }
|
|
|
|
- { name: test3 }
|
2017-08-10 19:59:32 +02:00
|
|
|
- { name: test4 }
|
|
|
|
- { name: test5 }
|
2017-08-10 10:54:13 +02:00
|
|
|
state: absent
|
|
|
|
authorize: yes
|
|
|
|
provider: "{{ cli }}"
|
2017-12-19 21:49:49 +01:00
|
|
|
become: yes
|
2017-06-09 13:24:28 +02:00
|
|
|
|
|
|
|
# FIXME add in tests for everything defined in docs
|
|
|
|
# FIXME Test state:absent + test:
|
|
|
|
# FIXME Without powers ensure "privileged mode required"
|