ACI: Make querying links and nodes possible (#43441)

This functionality was not considered when the module was written, but
there's no reason why it shouldn't be supported.

We had to rework the query string construction and object filtering.
This new functionality allows to filter on arbitrary keys and supports
None values.

This PR fixes various issues with the existing framework, including
querying specific objects using construct_url_4 (i.e.
aci_epg_to_contract and aci_static_binding_to_epg)
This commit is contained in:
Dag Wieers 2018-08-07 23:54:54 +02:00 committed by GitHub
commit d8ba8c03f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
105 changed files with 1236 additions and 1052 deletions

View file

@ -41,7 +41,8 @@
- name: Verify add_dynamic_vlan_pool
assert:
that:
- cm_add_dynamic_vlan_pool.changed == nm_add_dynamic_vlan_pool.changed == true
- cm_add_dynamic_vlan_pool is changed
- nm_add_dynamic_vlan_pool is changed
- 'cm_add_dynamic_vlan_pool.sent == nm_add_dynamic_vlan_pool.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "name": "anstest"}}}'
- 'cm_add_dynamic_vlan_pool.proposed == nm_add_dynamic_vlan_pool.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "name": "anstest"}}}'
- cm_add_dynamic_vlan_pool.previous == nm_add_dynamic_vlan_pool.previous == []
@ -64,7 +65,8 @@
- name: Verify add_dynamic_vlan_pool_again
assert:
that:
- cm_add_dynamic_vlan_pool_again.changed == nm_add_dynamic_vlan_pool_again.changed == false
- cm_add_dynamic_vlan_pool_again is not changed
- nm_add_dynamic_vlan_pool_again is not changed
- cm_add_dynamic_vlan_pool_again.current == nm_add_dynamic_vlan_pool_again.current == nm_add_dynamic_vlan_pool.current
@ -85,7 +87,8 @@
- name: Verify add_dynamic_vlan_pool_descr
assert:
that:
- cm_add_dynamic_vlan_pool_descr.changed == nm_add_dynamic_vlan_pool_descr.changed == true
- cm_add_dynamic_vlan_pool_descr is changed
- nm_add_dynamic_vlan_pool_descr is changed
- 'cm_add_dynamic_vlan_pool_descr.sent == nm_add_dynamic_vlan_pool_descr.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible test dynamic vlan pool"}}}'
- 'cm_add_dynamic_vlan_pool_descr.proposed == nm_add_dynamic_vlan_pool_descr.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible test dynamic vlan pool", "name": "anstest"}}}'
- cm_add_dynamic_vlan_pool_descr.previous == nm_add_dynamic_vlan_pool_descr.previous == cm_add_dynamic_vlan_pool_descr.current == nm_add_dynamic_vlan_pool.current
@ -110,7 +113,8 @@
- name: Verify add_dynamic_vlan_pool_descr_again
assert:
that:
- cm_add_dynamic_vlan_pool_descr_again.changed == nm_add_dynamic_vlan_pool_descr_again.changed == false
- cm_add_dynamic_vlan_pool_descr_again is not changed
- nm_add_dynamic_vlan_pool_descr_again is not changed
- cm_add_dynamic_vlan_pool_descr_again.current == nm_add_dynamic_vlan_pool_descr_again.current == nm_add_dynamic_vlan_pool_descr.current
@ -127,7 +131,8 @@
- name: Verify add_dynamic_vlan_pool_again_no_descr
assert:
that:
- cm_add_dynamic_vlan_pool_again_no_descr.changed == nm_add_dynamic_vlan_pool_again_no_descr.changed == false
- cm_add_dynamic_vlan_pool_again_no_descr is not changed
- nm_add_dynamic_vlan_pool_again_no_descr is not changed
- cm_add_dynamic_vlan_pool_again_no_descr.current == nm_add_dynamic_vlan_pool_again_no_descr.current == nm_add_dynamic_vlan_pool_descr.current
@ -152,7 +157,8 @@
- name: Verify query_all_dynamic_vlan_pools
assert:
that:
- cm_query_all_dynamic_vlan_pools.changed == nm_query_all_dynamic_vlan_pools.changed == false
- cm_query_all_dynamic_vlan_pools is not changed
- nm_query_all_dynamic_vlan_pools is not changed
- cm_query_all_dynamic_vlan_pools == nm_query_all_dynamic_vlan_pools
- cm_query_all_dynamic_vlan_pools.current|length >= 1
@ -176,7 +182,8 @@
- name: Verify query_dynamic_vlan_pool
assert:
that:
- cm_query_dynamic_vlan_pool.changed == nm_query_dynamic_vlan_pool.changed == false
- cm_query_dynamic_vlan_pool is not changed
- nm_query_dynamic_vlan_pool is not changed
- cm_query_dynamic_vlan_pool == nm_query_dynamic_vlan_pool
- nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'dynamic'
- nm_query_dynamic_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test dynamic vlan pool'
@ -197,7 +204,8 @@
- name: Verify remove_dynamic_vlan_pool
assert:
that:
- cm_remove_dynamic_vlan_pool.changed == nm_remove_dynamic_vlan_pool.changed == true
- cm_remove_dynamic_vlan_pool is changed
- nm_remove_dynamic_vlan_pool is changed
- 'cm_remove_dynamic_vlan_pool.current == cm_remove_dynamic_vlan_pool.previous == nm_remove_dynamic_vlan_pool.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible test dynamic vlan pool", "dn": "uni/infra/vlanns-[anstest]-dynamic", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
- nm_remove_dynamic_vlan_pool.current == []
@ -213,7 +221,8 @@
- name: Verify remove_dynamic_vlan_pool_again
assert:
that:
- cm_remove_dynamic_vlan_pool_again.changed == nm_remove_dynamic_vlan_pool_again.changed == false
- cm_remove_dynamic_vlan_pool_again is not changed
- nm_remove_dynamic_vlan_pool_again is not changed
- cm_remove_dynamic_vlan_pool_again.proposed == nm_remove_dynamic_vlan_pool_again.proposed == {}
- cm_remove_dynamic_vlan_pool_again.sent == nm_remove_dynamic_vlan_pool_again.sent == {}
- cm_remove_dynamic_vlan_pool_again.previous == nm_remove_dynamic_vlan_pool_again.previous == []
@ -240,7 +249,8 @@
- name: Verify query_non_dynamic_vlan_pool
assert:
that:
- cm_query_non_dynamic_vlan_pool.changed == nm_query_non_dynamic_vlan_pool.changed == false
- cm_query_non_dynamic_vlan_pool is not changed
- nm_query_non_dynamic_vlan_pool is not changed
- cm_remove_dynamic_vlan_pool_again.previous == nm_remove_dynamic_vlan_pool_again.previous == []
- cm_remove_dynamic_vlan_pool_again.current == nm_remove_dynamic_vlan_pool_again.current == []
@ -262,7 +272,7 @@
- name: Verify error_on_missing_required_param
assert:
that:
- error_on_missing_required_param.failed == true
- error_on_missing_required_param is failed
- 'error_on_missing_required_param.msg == "state is present but all of the following are missing: pool"'
- name: Error when together parameter is missing
@ -282,5 +292,5 @@
- name: Verify error_on_missing_together_param
assert:
that:
- error_on_missing_together_param.failed == true
- error_on_missing_together_param is failed
- error_on_missing_together_param.msg == "ACI requires the 'pool_allocation_mode' when 'pool' is provided"

View file

@ -41,7 +41,8 @@
- name: Verify add_static_vlan_pool
assert:
that:
- cm_add_static_vlan_pool.changed == nm_add_static_vlan_pool.changed == true
- cm_add_static_vlan_pool is changed
- nm_add_static_vlan_pool is changed
- 'cm_add_static_vlan_pool.sent == nm_add_static_vlan_pool.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "name": "anstest"}}}'
- 'cm_add_static_vlan_pool.proposed == nm_add_static_vlan_pool.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "name": "anstest"}}}'
- cm_add_static_vlan_pool.previous == nm_add_static_vlan_pool.previous == []
@ -64,7 +65,8 @@
- name: Verify add_static_vlan_pool_again
assert:
that:
- cm_add_static_vlan_pool_again.changed == nm_add_static_vlan_pool_again.changed == false
- cm_add_static_vlan_pool_again is not changed
- nm_add_static_vlan_pool_again is not changed
- cm_add_static_vlan_pool_again.current == nm_add_static_vlan_pool_again.current == nm_add_static_vlan_pool.current
@ -85,7 +87,8 @@
- name: Verify add_static_vlan_pool_descr
assert:
that:
- cm_add_static_vlan_pool_descr.changed == nm_add_static_vlan_pool_descr.changed == true
- cm_add_static_vlan_pool_descr is changed
- nm_add_static_vlan_pool_descr is changed
- 'cm_add_static_vlan_pool_descr.sent == nm_add_static_vlan_pool_descr.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible test static vlan pool"}}}'
- 'cm_add_static_vlan_pool_descr.proposed == nm_add_static_vlan_pool_descr.proposed == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible test static vlan pool", "name": "anstest"}}}'
- cm_add_static_vlan_pool_descr.previous == nm_add_static_vlan_pool_descr.previous == cm_add_static_vlan_pool_descr.current == nm_add_static_vlan_pool.current
@ -110,7 +113,8 @@
- name: Verify add_static_vlan_pool_descr_again
assert:
that:
- cm_add_static_vlan_pool_descr_again.changed == nm_add_static_vlan_pool_descr_again.changed == false
- cm_add_static_vlan_pool_descr_again is not changed
- nm_add_static_vlan_pool_descr_again is not changed
- cm_add_static_vlan_pool_descr_again.current == nm_add_static_vlan_pool_descr_again.current == nm_add_static_vlan_pool_descr.current
@ -127,7 +131,8 @@
- name: Verify add_static_vlan_pool_again_no_descr
assert:
that:
- cm_add_static_vlan_pool_again_no_descr.changed == nm_add_static_vlan_pool_again_no_descr.changed == false
- cm_add_static_vlan_pool_again_no_descr is not changed
- nm_add_static_vlan_pool_again_no_descr is not changed
- cm_add_static_vlan_pool_again_no_descr.current == nm_add_static_vlan_pool_again_no_descr.current == nm_add_static_vlan_pool_descr.current
@ -152,7 +157,8 @@
- name: Verify query_all_static_vlan_pools
assert:
that:
- cm_query_all_static_vlan_pools.changed == nm_query_all_static_vlan_pools.changed == false
- cm_query_all_static_vlan_pools is not changed
- nm_query_all_static_vlan_pools is not changed
- cm_query_all_static_vlan_pools == nm_query_all_static_vlan_pools
- cm_query_all_static_vlan_pools.current|length >= 1
@ -176,7 +182,8 @@
- name: Verify query_static_vlan_pool
assert:
that:
- cm_query_static_vlan_pool.changed == nm_query_static_vlan_pool.changed == false
- cm_query_static_vlan_pool is not changed
- nm_query_static_vlan_pool is not changed
- cm_query_static_vlan_pool == nm_query_static_vlan_pool
- nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.allocMode == 'static'
- nm_query_static_vlan_pool.current.0.fvnsVlanInstP.attributes.descr == 'Ansible test static vlan pool'
@ -197,7 +204,8 @@
- name: Verify remove_static_vlan_pool
assert:
that:
- cm_remove_static_vlan_pool.changed == nm_remove_static_vlan_pool.changed == true
- cm_remove_static_vlan_pool is changed
- nm_remove_static_vlan_pool is changed
- 'cm_remove_static_vlan_pool.current == cm_remove_static_vlan_pool.previous == nm_remove_static_vlan_pool.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible test static vlan pool", "dn": "uni/infra/vlanns-[anstest]-static", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
- nm_remove_static_vlan_pool.current == []
@ -213,7 +221,8 @@
- name: Verify remove_static_vlan_pool_again
assert:
that:
- cm_remove_static_vlan_pool_again.changed == nm_remove_static_vlan_pool_again.changed == false
- cm_remove_static_vlan_pool_again is not changed
- nm_remove_static_vlan_pool_again is not changed
- cm_remove_static_vlan_pool_again.proposed == nm_remove_static_vlan_pool_again.proposed == {}
- cm_remove_static_vlan_pool_again.sent == nm_remove_static_vlan_pool_again.sent == {}
- cm_remove_static_vlan_pool_again.previous == nm_remove_static_vlan_pool_again.previous == []
@ -240,7 +249,8 @@
- name: Verify query_non_static_vlan_pool
assert:
that:
- cm_query_non_static_vlan_pool.changed == nm_query_non_static_vlan_pool.changed == false
- cm_query_non_static_vlan_pool is not changed
- nm_query_non_static_vlan_pool is not changed
- cm_remove_static_vlan_pool_again.previous == nm_remove_static_vlan_pool_again.previous == []
- cm_remove_static_vlan_pool_again.current == nm_remove_static_vlan_pool_again.current == []
@ -262,7 +272,7 @@
- name: Verify error_on_missing_required_param
assert:
that:
- error_on_missing_required_param.failed == true
- error_on_missing_required_param is failed
- 'error_on_missing_required_param.msg == "state is present but all of the following are missing: pool"'
- name: Error when together parameter is missing
@ -282,5 +292,5 @@
- name: Verify error_on_missing_together_param
assert:
that:
- error_on_missing_together_param.failed == true
- error_on_missing_together_param is failed
- error_on_missing_together_param.msg == "ACI requires the 'pool_allocation_mode' when 'pool' is provided"