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

@ -65,17 +65,17 @@
- name: present asserts
assert:
that:
- ap_present_check_mode.changed == true
- ap_present.changed == true
- ap_present_check_mode is changed
- ap_present is changed
- ap_present.previous == []
- ap_present.sent == ap_present_check_mode.sent
- 'ap_present.sent == {"fvAp": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
- ap_present_idempotent.changed == false
- ap_present_idempotent is not changed
- ap_present_idempotent.previous != []
- ap_present_idempotent.sent == {}
- ap_present_update.changed == true
- ap_present_update is changed
- 'ap_present_update.sent.fvAp.attributes == {"descr": "Ansible Test Update"}'
- ap_present_missing_param.failed == true
- ap_present_missing_param is failed
- 'ap_present_missing_param.msg == "state is present but all of the following are missing: ap"'
- name: get ap - query specific ap
@ -106,21 +106,21 @@
- name: query assertions
assert:
that:
- query_ap.changed == false
- query_ap is not changed
- query_ap.current | length == 1
- 'query_ap.current.0.fvAp.attributes.name == "anstest"'
- query_ap.current.0.fvAp.attributes.name == "anstest"
- '"tn-anstest/ap-anstest.json" in query_ap.url'
- query_ap_tenant.changed == false
- query_ap_tenant is not changed
- query_ap_tenant.current | length == 1
- query_ap_tenant.current.0.fvTenant.children | length == 2
- '"rsp-subtree-class=fvAp" in query_ap_tenant.filter_string'
- '"tn-anstest.json" in query_ap_tenant.url'
- query_ap_ap.changed == false
- query_ap_ap is not changed
- query_ap_ap.current != []
- query_ap_ap.current.0.fvAp is defined
- '"query-target-filter=eq(fvAp.name, \"anstest\")" in query_ap_ap.filter_string'
- '"class/fvAp.json" in query_ap_ap.url'
- query_all.changed == false
- query_all is not changed
- query_all.current | length > 1
- '"class/fvAp.json" in query_all.url'
@ -156,18 +156,18 @@
- name: absent assertions
assert:
that:
- ap_delete_check_mode.changed == true
- ap_delete_check_mode is changed
- ap_delete_check_mode.previous != []
- '"tn-anstest/ap-anstest.json" in ap_delete_check_mode.url'
- ap_delete.changed == true
- ap_delete is changed
- ap_delete.previous == ap_delete_check_mode.previous
- ap_delete_idempotent.changed == false
- ap_delete_idempotent is not changed
- ap_delete_idempotent.previous == []
- ap_delete_missing_param.failed == true
- ap_delete_missing_param is failed
- 'ap_delete_missing_param.msg == "state is absent but all of the following are missing: tenant"'
- name: delete tenant - cleanup before ending tests
aci_tenant:
<<: *aci_tenant_present
state: absent
when: tenant_present.changed == true
when: tenant_present is changed