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/eos_vrf/tests/cli/basic.yaml

243 lines
5.5 KiB
YAML

---
- name: setup - remove vrf
eos_vrf:
name: test
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: setup - remove vrf
eos_vrf:
name: test2
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: setup - remove vrf
eos_vrf:
name: test3
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: Create vrf
eos_vrf:
name: test
rd: 1:200
state: present
authorize: yes
provider: "{{ cli }}"
become: yes
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 }}"
become: yes
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 }}"
become: yes
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 }}"
become: yes
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 }}"
become: yes
register: result
- assert:
that:
- "result.changed == true"
- "'interface ethernet2' in result.commands"
- "'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:
- ethernet 2 # interface name modified to test case insensitive and space scenario
provider: "{{ cli }}"
become: yes
register: result
- assert:
that:
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "'session_name' not in result.commands"
- name: Create aggregate of VRFs
eos_vrf:
aggregate:
- { name: test2, rd: "1:202" }
- { name: test3, rd: "1:203" }
state: present
authorize: yes
provider: "{{ cli }}"
become: yes
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 }}"
become: yes
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: 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 }}"
become: yes
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"
- name: Delete VRFs
eos_vrf:
name: test
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: Delete VRFs again (idempotent)
eos_vrf:
name: test
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: Delete aggregate of VRFs
eos_vrf:
aggregate:
- { name: test2 }
- { name: test3 }
- { name: test4 }
- { name: test5 }
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
- name: Delete VRFs again (idempotent)
eos_vrf:
aggregate:
- { name: test2 }
- { name: test3 }
- { name: test4 }
- { name: test5 }
state: absent
authorize: yes
provider: "{{ cli }}"
become: yes
# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
# FIXME Without powers ensure "privileged mode required"