ACI: Change RETURN output as discussed (#35617)

* ACI: Change result output as discussed

* Update all modules to use new aci.exit_json()

* Update output_level spec and docs

* Fix integration tests

* Small PEP8 fix

* Asorted fixes to tests and aci_rest

* More test fixes and support for ANSIBLE_DEBUG

* Fix another PEP8 issues

* Move response handling inside ACI module

* Reform of ACI error handling and error output

* Diff multiline json output

* Fix a few more tests

* Revert aci_bd tests

* Small correction

* UI change: existing->current, original->previous

* UI change: config->sent

* Update all modules with RETURN values

* Fix a few more tests

* Improve docstring and add 'raw' return value

* Fix thinko

* Fix sanity/pep8 issues

* Rewrite unit tests to comply with new design
This commit is contained in:
Dag Wieers 2018-02-03 00:41:56 +01:00 committed by GitHub
commit bee765fa6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
73 changed files with 5733 additions and 747 deletions

View file

@ -16,6 +16,7 @@
validate_certs: '{{ aci_validate_certs | default(false) }}'
use_ssl: '{{ aci_use_ssl | default(true) }}'
use_proxy: '{{ aci_use_proxy | default(true) }}'
output_level: debug
state: present
tenant: anstest
register: tenant_present
@ -72,17 +73,17 @@
assert:
that:
- subject_present_check_mode.changed == true
- 'subject_present_check_mode.config == {"vzSubj": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
- 'subject_present_check_mode.sent == {"vzSubj": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
- subject_present.changed == true
- subject_present.existing == []
- subject_present.config == subject_present_check_mode.config
- subject_present.previous == []
- subject_present.sent == subject_present_check_mode.sent
- subject_present_idempotent.changed == false
- subject_present_idempotent.existing != []
- subject_present_idempotent.previous != []
- subject_update.changed == true
- subject_update.config != subject_update.proposed
- 'subject_update.config.vzSubj.attributes == {"prio": "level2", "provMatchT": "AtmostOne"}'
- subject_update.sent != subject_update.proposed
- 'subject_update.sent.vzSubj.attributes == {"prio": "level2", "provMatchT": "AtmostOne"}'
- subject_present_2.changed == true
- 'subject_present_2.config.vzSubj.attributes == {"consMatchT": "All", "name": "anstest2", "prio": "level3", "revFltPorts": "no"}'
- 'subject_present_2.sent.vzSubj.attributes == {"consMatchT": "All", "name": "anstest2", "prio": "level3", "revFltPorts": "no"}'
- present_missing_param.failed == true
- 'present_missing_param.msg == "state is present but all of the following are missing: contract, subject"'
@ -141,48 +142,48 @@
assert:
that:
- query_tenant_contract_subject.changed == false
- query_tenant_contract_subject.existing | length == 1
- 'query_tenant_contract_subject.existing.0.vzSubj.attributes.name == "anstest"'
- query_tenant_contract_subject.previous | length == 1
- 'query_tenant_contract_subject.previous.0.vzSubj.attributes.name == "anstest"'
- '"tn-anstest/brc-anstest/subj-anstest.json" in query_tenant_contract_subject.url'
- query_tenant_contract.changed == false
- query_tenant_contract.existing | length == 1
- 'query_tenant_contract.existing.0.vzBrCP.attributes.name == "anstest"'
- query_tenant_contract.existing.0.vzBrCP.children | length == 2
- query_tenant_contract.previous | length == 1
- 'query_tenant_contract.previous.0.vzBrCP.attributes.name == "anstest"'
- query_tenant_contract.previous.0.vzBrCP.children | length == 2
- '"rsp-subtree-class=vzSubj" in query_tenant_contract.filter_string'
- '"tn-anstest/brc-anstest.json" in query_tenant_contract.url'
- query_tenant_subject.changed == false
- query_tenant_subject.existing | length == 1
- 'query_tenant_subject.existing.0.fvTenant.attributes.name == "anstest"'
- query_tenant_subject.existing.0.fvTenant.children.0.vzBrCP.children | length == 1
- 'query_tenant_subject.existing.0.fvTenant.children.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"'
- query_tenant_subject.previous | length == 1
- 'query_tenant_subject.previous.0.fvTenant.attributes.name == "anstest"'
- query_tenant_subject.previous.0.fvTenant.children.0.vzBrCP.children | length == 1
- 'query_tenant_subject.previous.0.fvTenant.children.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"'
- '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_tenant_subject.filter_string'
- '"rsp-subtree-class=vzSubj" in query_tenant_subject.filter_string'
- '"tn-anstest.json" in query_tenant_subject.url'
- query_contract_subject.changed == false
- 'query_contract_subject.existing.0.vzBrCP.attributes.name == "anstest"'
- query_contract_subject.existing.0.vzBrCP.children | length == 1
- 'query_contract_subject.existing.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"'
- 'query_contract_subject.previous.0.vzBrCP.attributes.name == "anstest"'
- query_contract_subject.previous.0.vzBrCP.children | length == 1
- 'query_contract_subject.previous.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"'
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract_subject.filter_string'
- '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_contract_subject.filter_string'
- '"rsp-subtree-class=vzSubj" in query_contract_subject.filter_string'
- '"class/vzBrCP.json" in query_contract_subject.url'
- query_tenant.changed == false
- query_tenant.existing | length == 1
- 'query_tenant.existing.0.fvTenant.attributes.name == "anstest"'
- query_tenant.previous | length == 1
- 'query_tenant.previous.0.fvTenant.attributes.name == "anstest"'
- '"rsp-subtree-class=vzBrCP,vzSubj" in query_tenant.filter_string'
- '"tn-anstest.json" in query_tenant.url'
- query_contract.changed == false
- 'query_contract.existing.0.vzBrCP.attributes.name == "anstest"'
- 'query_contract.previous.0.vzBrCP.attributes.name == "anstest"'
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract.filter_string'
- '"rsp-subtree-class=vzSubj" in query_contract.filter_string'
- '"class/vzBrCP.json" in query_contract.url'
- query_subject.changed == false
- 'query_subject.existing.0.vzSubj.attributes.name == "anstest"'
- 'query_subject.previous.0.vzSubj.attributes.name == "anstest"'
- '"query-target-filter=eq(vzSubj.name, \"anstest\")" in query_subject.filter_string'
- '"class/vzSubj.json" in query_subject.url'
- query_all.changed == false
- query_all.existing > 1
- query_all.existing.0.vzSubj is defined
- query_all.previous > 1
- query_all.previous.0.vzSubj is defined
- '"class/vzSubj.json" in query_all.url'
- name: delete subject - check mode works
@ -218,12 +219,12 @@
assert:
that:
- subject_absent_check_mode.changed == true
- subject_absent_check_mode.existing != []
- subject_absent_check_mode.previous != []
- subject_absent_check_mode.proposed == {}
- subject_absent.changed == true
- subject_absent.existing == subject_absent_check_mode.existing
- subject_absent.previous == subject_absent_check_mode.previous
- subject_absent_idempotent.changed == false
- subject_absent_idempotent.existing == []
- subject_absent_idempotent.previous == []
- absent_missing_param.failed == true
- 'absent_missing_param.msg == "state is absent but all of the following are missing: subject"'