aci_domain_to_encap_pool: Add integration tests (#36217)
This commit is contained in:
parent
3ecf2d5ba2
commit
d86c5aee3c
6 changed files with 670 additions and 3 deletions
|
@ -187,12 +187,15 @@ VM_PROVIDER_MAPPING = dict(
|
|||
POOL_MAPPING = dict(
|
||||
vlan=dict(
|
||||
aci_mo='uni/infra/vlanns-{0}',
|
||||
child_class='infraRsVlanNs',
|
||||
),
|
||||
vxlan=dict(
|
||||
aci_mo='uni/infra/vxlanns-{0}',
|
||||
child_class='vmmRsVxlanNs',
|
||||
),
|
||||
vsan=dict(
|
||||
aci_mo='uni/infra/vsanns-{0}',
|
||||
child_class='fcRsVsanNs',
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -269,7 +272,8 @@ def main():
|
|||
if domain is None:
|
||||
domain_mo = None
|
||||
|
||||
pool_mo = POOL_MAPPING[pool_type]["aci_mo"].format(pool_name)
|
||||
pool_mo = POOL_MAPPING[pool_type]['aci_mo'].format(pool_name)
|
||||
child_class = POOL_MAPPING[pool_type]['child_class']
|
||||
|
||||
aci = ACIModule(module)
|
||||
aci.construct_url(
|
||||
|
@ -279,7 +283,7 @@ def main():
|
|||
filter_target='eq({0}.name, "{1}")'.format(domain_class, domain),
|
||||
module_object=domain_mo,
|
||||
),
|
||||
child_classes=['infraRsVlanNs'],
|
||||
child_classes=[child_class],
|
||||
)
|
||||
|
||||
aci.get_existing()
|
||||
|
@ -290,7 +294,7 @@ def main():
|
|||
aci_class=domain_class,
|
||||
class_config=dict(name=domain),
|
||||
child_configs=[
|
||||
{'infraRsVlanNs': {'attributes': {'tDn': pool_mo}}},
|
||||
{child_class: {'attributes': {'tDn': pool_mo}}},
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# Test code for the ACI modules
|
||||
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: Test that we have an ACI APIC host, ACI username and ACI password
|
||||
fail:
|
||||
msg: 'Please define the following variables: aci_hostname, aci_username and aci_password.'
|
||||
when: aci_hostname is not defined or aci_username is not defined or aci_password is not defined
|
||||
|
||||
- include_tasks: vlan.yml
|
||||
when: vlan is not defined or vlan
|
||||
|
||||
- include_tasks: vsan.yml
|
||||
when: vsan is not defined or vsan
|
||||
|
||||
- include_tasks: vxlan.yml
|
||||
when: vxlan is not defined or vxlan
|
215
test/integration/targets/aci_domain_to_encap_pool/tasks/vlan.yml
Normal file
215
test/integration/targets/aci_domain_to_encap_pool/tasks/vlan.yml
Normal file
|
@ -0,0 +1,215 @@
|
|||
# Test code for the ACI modules
|
||||
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# CLEAN ENVIRONMENT
|
||||
- name: Remove domain to VLAN pool binding
|
||||
aci_domain_to_encap_pool: &binding_absent
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
state: absent
|
||||
|
||||
- name: Remove physical domain
|
||||
aci_domain:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
state: absent
|
||||
|
||||
- name: Create VLAN pool
|
||||
aci_encap_pool:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
description: Test VLAN pool
|
||||
state: present
|
||||
|
||||
|
||||
# ADD BINDING
|
||||
- name: Add domain to VLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_present
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
state: present
|
||||
check_mode: yes
|
||||
register: cm_add_binding
|
||||
|
||||
- name: Add domain to VLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding
|
||||
|
||||
- name: Verify add_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding.changed == nm_add_binding.changed == true
|
||||
- 'cm_add_binding.sent == nm_add_binding.sent == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}'
|
||||
- 'cm_add_binding.proposed == nm_add_binding.proposed == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}'
|
||||
- cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == []
|
||||
- 'nm_add_binding.current == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}]'
|
||||
|
||||
- name: Add domain to VLAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
check_mode: yes
|
||||
register: cm_add_binding_again
|
||||
|
||||
- name: Add domain to VLAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding_again
|
||||
|
||||
- name: Verify add_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding_again.changed == nm_add_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY ALL BINDINGS
|
||||
- name: Query all domain to VLAN pool bindings (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_query
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain_type: phys
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
state: query
|
||||
check_mode: yes
|
||||
register: cm_query_all_bindings
|
||||
|
||||
- name: Query all domain to VLAN pool bindings (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_query
|
||||
register: nm_query_all_bindings
|
||||
|
||||
- name: Verify query_all_bindings
|
||||
assert:
|
||||
that:
|
||||
- cm_query_all_bindings.changed == nm_query_all_bindings.changed == false
|
||||
- cm_query_all_bindings == nm_query_all_bindings
|
||||
- nm_query_all_bindings.current|length >= 1
|
||||
|
||||
|
||||
# QUERY A BINDING
|
||||
- name: Query our domain to VLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
check_mode: yes
|
||||
register: cm_query_binding
|
||||
|
||||
- name: Query our domain to VLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
register: nm_query_binding
|
||||
|
||||
- name: Verify query_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_binding.changed == nm_query_binding.changed == false
|
||||
- cm_query_binding == nm_query_binding
|
||||
- nm_query_binding.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom'
|
||||
- nm_query_binding.current.0.physDomP.attributes.name == 'phys_dom'
|
||||
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP'
|
||||
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vlanns-[test_pool]-dynamic'
|
||||
|
||||
|
||||
# REMOVE BINDING
|
||||
- name: Remove domain to VLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding
|
||||
|
||||
- name: Remove domain to VLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding
|
||||
|
||||
- name: Verify remove_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding.changed == nm_remove_binding.changed == true
|
||||
- 'cm_remove_binding.current == cm_remove_binding.previous == nm_remove_binding.previous == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vlanns-[test_pool]-dynamic"}}}]}}]'
|
||||
- nm_remove_binding.current == []
|
||||
|
||||
- name: Remove domain to VLAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding_again
|
||||
|
||||
- name: Remove domain to VLAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding_again
|
||||
|
||||
- name: Verify remove_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding_again.changed == nm_remove_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY NON-EXISTING BINDING
|
||||
- name: Query non-existing domain to VLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
check_mode: yes
|
||||
register: cm_query_non_binding
|
||||
|
||||
- name: Query non-existing domain to VLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vlan
|
||||
pool_allocation_mode: dynamic
|
||||
register: nm_query_non_binding
|
||||
|
||||
- name: Verify query_non_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_non_binding.changed == nm_query_non_binding.changed == false
|
||||
- cm_query_non_binding == nm_query_non_binding
|
||||
- nm_query_non_binding.current == []
|
215
test/integration/targets/aci_domain_to_encap_pool/tasks/vsan.yml
Normal file
215
test/integration/targets/aci_domain_to_encap_pool/tasks/vsan.yml
Normal file
|
@ -0,0 +1,215 @@
|
|||
# Test code for the ACI modules
|
||||
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# CLEAN ENVIRONMENT
|
||||
- name: Remove domain to VSAN pool binding
|
||||
aci_domain_to_encap_pool: &binding_absent
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
state: absent
|
||||
|
||||
- name: Remove physical domain
|
||||
aci_domain:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
state: absent
|
||||
|
||||
- name: Create VSAN pool
|
||||
aci_encap_pool:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
description: Test VSAN pool
|
||||
state: present
|
||||
|
||||
|
||||
# ADD BINDING
|
||||
- name: Add domain to VSAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_present
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: phys_dom
|
||||
domain_type: phys
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
state: present
|
||||
check_mode: yes
|
||||
register: cm_add_binding
|
||||
|
||||
- name: Add domain to VSAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding
|
||||
|
||||
- name: Verify add_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding.changed == nm_add_binding.changed == true
|
||||
- 'cm_add_binding.sent == nm_add_binding.sent == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vsanns-[test_pool]-static"}}}]}}'
|
||||
- 'cm_add_binding.proposed == nm_add_binding.proposed == {"physDomP": {"attributes": {"name": "phys_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vsanns-[test_pool]-static"}}}]}}'
|
||||
- cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == []
|
||||
- 'nm_add_binding.current == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vsanns-[test_pool]-static"}}}]}}]'
|
||||
|
||||
- name: Add domain to VSAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
check_mode: yes
|
||||
register: cm_add_binding_again
|
||||
|
||||
- name: Add domain to VSAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding_again
|
||||
|
||||
- name: Verify add_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding_again.changed == nm_add_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY ALL BINDINGS
|
||||
- name: Query all domain to VSAN pool bindings (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_query
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain_type: phys
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
state: query
|
||||
check_mode: yes
|
||||
register: cm_query_all_bindings
|
||||
|
||||
- name: Query all domain to VSAN pool bindings (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_query
|
||||
register: nm_query_all_bindings
|
||||
|
||||
- name: Verify query_all_bindings
|
||||
assert:
|
||||
that:
|
||||
- cm_query_all_bindings.changed == nm_query_all_bindings.changed == false
|
||||
- cm_query_all_bindings == nm_query_all_bindings
|
||||
- nm_query_all_bindings.current|length >= 1
|
||||
|
||||
|
||||
# QUERY A BINDING
|
||||
- name: Query our domain to VSAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
check_mode: yes
|
||||
register: cm_query_binding
|
||||
|
||||
- name: Query our domain to VSAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
register: nm_query_binding
|
||||
|
||||
- name: Verify query_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_binding.changed == nm_query_binding.changed == false
|
||||
- cm_query_binding == nm_query_binding
|
||||
- nm_query_binding.current.0.physDomP.attributes.dn == 'uni/phys-phys_dom'
|
||||
- nm_query_binding.current.0.physDomP.attributes.name == 'phys_dom'
|
||||
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP'
|
||||
- nm_query_binding.current.0.physDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vsanns-[test_pool]-static'
|
||||
|
||||
|
||||
# REMOVE BINDING
|
||||
- name: Remove domain to VSAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding
|
||||
|
||||
- name: Remove domain to VSAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding
|
||||
|
||||
- name: Verify remove_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding.changed == nm_remove_binding.changed == true
|
||||
- 'cm_remove_binding.current == cm_remove_binding.previous == nm_remove_binding.previous == [{"physDomP": {"attributes": {"dn": "uni/phys-phys_dom", "name": "phys_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vsanns-[test_pool]-static"}}}]}}]'
|
||||
- nm_remove_binding.current == []
|
||||
|
||||
- name: Remove domain to VSAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding_again
|
||||
|
||||
- name: Remove domain to VSAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding_again
|
||||
|
||||
- name: Verify remove_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding_again.changed == nm_remove_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY NON-EXISTING BINDING
|
||||
- name: Query non-existing domain to VSAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
check_mode: yes
|
||||
register: cm_query_non_binding
|
||||
|
||||
- name: Query non-existing domain to VSAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: phys_dom
|
||||
pool: test_pool
|
||||
pool_type: vsan
|
||||
pool_allocation_mode: static
|
||||
register: nm_query_non_binding
|
||||
|
||||
- name: Verify query_non_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_non_binding.changed == nm_query_non_binding.changed == false
|
||||
- cm_query_non_binding == nm_query_non_binding
|
||||
- nm_query_non_binding.current == []
|
|
@ -0,0 +1,215 @@
|
|||
# Test code for the ACI modules
|
||||
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
|
||||
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
|
||||
# CLEAN ENVIRONMENT
|
||||
- name: Remove domain to VXLAN pool binding
|
||||
aci_domain_to_encap_pool: &binding_absent
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: vmm_dom
|
||||
domain_type: vmm
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
state: absent
|
||||
|
||||
- name: Remove VMM domain
|
||||
aci_domain:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
domain: vmm_dom
|
||||
domain_type: vmm
|
||||
vm_provider: vmware
|
||||
state: absent
|
||||
|
||||
- name: Create VXLAN pool
|
||||
aci_encap_pool:
|
||||
host: "{{ aci_hostname }}"
|
||||
username: "{{ aci_username }}"
|
||||
password: "{{ aci_password }}"
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
description: Test VXLAN pool
|
||||
state: present
|
||||
|
||||
|
||||
# ADD BINDING
|
||||
- name: Add domain to VXLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_present
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain: vmm_dom
|
||||
domain_type: vmm
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
state: present
|
||||
check_mode: yes
|
||||
register: cm_add_binding
|
||||
|
||||
- name: Add domain to VXLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding
|
||||
|
||||
- name: Verify add_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding.changed == nm_add_binding.changed == true
|
||||
- 'cm_add_binding.sent == nm_add_binding.sent == {"vmmDomP": {"attributes": {"name": "vmm_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vxlanns-[test_pool]-dynamic"}}}]}}'
|
||||
- 'cm_add_binding.proposed == nm_add_binding.proposed == {"vmmDomP": {"attributes": {"name": "vmm_dom"}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vxlanns-[test_pool]-dynamic"}}}]}}'
|
||||
- cm_add_binding.current == cm_add_binding.previous == nm_add_binding.previous == []
|
||||
- 'nm_add_binding.current == [{"vmmDomP": {"attributes": {"dn": "uni/vmm-vmm_dom", "name": "vmm_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vxlanns-[test_pool]-dynamic"}}}]}}]'
|
||||
|
||||
- name: Add domain to VXLAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
check_mode: yes
|
||||
register: cm_add_binding_again
|
||||
|
||||
- name: Add domain to VXLAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_present
|
||||
register: nm_add_binding_again
|
||||
|
||||
- name: Verify add_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_add_binding_again.changed == nm_add_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY ALL BINDINGS
|
||||
- name: Query all domain to VXLAN pool bindings (check_mode)
|
||||
aci_domain_to_encap_pool: &binding_query
|
||||
host: '{{ aci_hostname }}'
|
||||
username: '{{ aci_username }}'
|
||||
password: '{{ aci_password }}'
|
||||
validate_certs: '{{ aci_validate_certs | default(false) }}'
|
||||
use_ssl: '{{ aci_use_ssl | default(true) }}'
|
||||
use_proxy: '{{ aci_use_proxy | default(true) }}'
|
||||
output_level: info
|
||||
domain_type: vmm
|
||||
vm_provider: vmware
|
||||
pool_type: vxlan
|
||||
state: query
|
||||
check_mode: yes
|
||||
register: cm_query_all_bindings
|
||||
|
||||
- name: Query all domain to VXLAN pool bindings (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_query
|
||||
register: nm_query_all_bindings
|
||||
|
||||
- name: Verify query_all_bindings
|
||||
assert:
|
||||
that:
|
||||
- cm_query_all_bindings.changed == nm_query_all_bindings.changed == false
|
||||
- cm_query_all_bindings == nm_query_all_bindings
|
||||
- nm_query_all_bindings.current|length >= 1
|
||||
|
||||
|
||||
# QUERY A BINDING
|
||||
- name: Query our domain to VXLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: vmm_dom
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
check_mode: yes
|
||||
register: cm_query_binding
|
||||
|
||||
- name: Query our domain to VXLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: vmm_dom
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
register: nm_query_binding
|
||||
|
||||
- name: Verify query_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_binding.changed == nm_query_binding.changed == false
|
||||
- cm_query_binding == nm_query_binding
|
||||
- nm_query_binding.current.0.vmmDomP.attributes.dn == 'uni/vmm-vmm_dom'
|
||||
- nm_query_binding.current.0.vmmDomP.attributes.name == 'vmm_dom'
|
||||
- nm_query_binding.current.0.vmmDomP.children.0.infraRsVlanNs.attributes.tCl == 'fvnsVlanInstP'
|
||||
- nm_query_binding.current.0.vmmDomP.children.0.infraRsVlanNs.attributes.tDn == 'uni/infra/vxlanns-[test_pool]-dynamic'
|
||||
|
||||
|
||||
# REMOVE BINDING
|
||||
- name: Remove domain to VXLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding
|
||||
|
||||
- name: Remove domain to VXLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding
|
||||
|
||||
- name: Verify remove_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding.changed == nm_remove_binding.changed == true
|
||||
- 'cm_remove_binding.current == cm_remove_binding.previous == nm_remove_binding.previous == [{"vmmDomP": {"attributes": {"dn": "uni/vmm-vmm_dom", "name": "vmm_dom", "nameAlias": "", "ownerKey": "", "ownerTag": ""}, "children": [{"infraRsVlanNs": {"attributes": {"tDn": "uni/infra/vxlanns-[test_pool]-dynamic"}}}]}}]'
|
||||
- nm_remove_binding.current == []
|
||||
|
||||
- name: Remove domain to VXLAN pool binding again (check_mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
check_mode: yes
|
||||
register: cm_remove_binding_again
|
||||
|
||||
- name: Remove domain to VXLAN pool binding again (normal mode)
|
||||
aci_domain_to_encap_pool: *binding_absent
|
||||
register: nm_remove_binding_again
|
||||
|
||||
- name: Verify remove_binding_again
|
||||
assert:
|
||||
that:
|
||||
- cm_remove_binding_again.changed == nm_remove_binding_again.changed == false
|
||||
|
||||
|
||||
# QUERY NON-EXISTING BINDING
|
||||
- name: Query non-existing domain to VXLAN pool binding (check_mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: vmm_dom
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
check_mode: yes
|
||||
register: cm_query_non_binding
|
||||
|
||||
- name: Query non-existing domain to VXLAN pool binding (normal mode)
|
||||
aci_domain_to_encap_pool:
|
||||
<<: *binding_query
|
||||
domain: vmm_dom
|
||||
vm_provider: vmware
|
||||
pool: test_pool
|
||||
pool_type: vxlan
|
||||
register: nm_query_non_binding
|
||||
|
||||
- name: Verify query_non_binding
|
||||
assert:
|
||||
that:
|
||||
- cm_query_non_binding.changed == nm_query_non_binding.changed == false
|
||||
- cm_query_non_binding == nm_query_non_binding
|
||||
- nm_query_non_binding.current == []
|
Loading…
Reference in a new issue