mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Add aggregate functionality to eos_vrf (#27915)
* Add aggregate functionality to eos_vrf * Add tests for eos_vrf aggregate option * Remove test2 and test3 vrfs at the beginning of the eos_vrf tests * Pull all vrfs With aggregate, we need to get all VRFs and we then compare with desired VRFs, instead of assuming it will be just one.
This commit is contained in:
parent
eee09565b1
commit
7e2169f6d5
2 changed files with 188 additions and 54 deletions
|
@ -7,6 +7,20 @@
|
|||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: setup - remove vrf
|
||||
eos_vrf:
|
||||
name: test2
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: setup - remove vrf
|
||||
eos_vrf:
|
||||
name: test3
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Create vrf
|
||||
eos_vrf:
|
||||
name: test
|
||||
|
@ -110,6 +124,74 @@
|
|||
# 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 }}"
|
||||
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 }}"
|
||||
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: Delete VRFs
|
||||
eos_vrf:
|
||||
name: test
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Delete VRFs again (idempotent)
|
||||
eos_vrf:
|
||||
name: test
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Delete aggregate of VRFs
|
||||
eos_vrf:
|
||||
aggregate:
|
||||
- { name: test2 }
|
||||
- { name: test3 }
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
- name: Delete VRFs again (idempotent)
|
||||
eos_vrf:
|
||||
aggregate:
|
||||
- { name: test2 }
|
||||
- { name: test3 }
|
||||
state: absent
|
||||
authorize: yes
|
||||
provider: "{{ cli }}"
|
||||
|
||||
# FIXME add in tests for everything defined in docs
|
||||
# FIXME Test state:absent + test:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue