mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
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:
parent
685dd5e8b4
commit
bee765fa6b
73 changed files with 5733 additions and 747 deletions
|
@ -7,6 +7,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: absent
|
||||
pool: anstest
|
||||
pool_type: vlan
|
||||
|
@ -29,7 +30,7 @@
|
|||
assert:
|
||||
that:
|
||||
- create_check_mode.changed == true
|
||||
- 'create_check_mode.config == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "name": "anstest"}}}'
|
||||
- 'create_check_mode.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "name": "anstest"}}}'
|
||||
|
||||
- name: create static vlan pool - creation works
|
||||
aci_encap_pool:
|
||||
|
@ -40,8 +41,8 @@
|
|||
assert:
|
||||
that:
|
||||
- create_static.changed == true
|
||||
- create_static.existing == []
|
||||
- create_static.config == create_check_mode.config
|
||||
- create_static.previous == []
|
||||
- create_static.sent == create_check_mode.sent
|
||||
|
||||
- name: create dynamic vlan pool - creation works
|
||||
aci_encap_pool: &aci_pool_present_dynamic
|
||||
|
@ -54,8 +55,8 @@
|
|||
assert:
|
||||
that:
|
||||
- create_dynamic.changed == true
|
||||
- create_dynamic.existing == []
|
||||
- 'create_dynamic.config == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "name": "anstest"}}}'
|
||||
- create_dynamic.previous == []
|
||||
- 'create_dynamic.sent == {"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "name": "anstest"}}}'
|
||||
|
||||
- name: create static vlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -66,8 +67,8 @@
|
|||
assert:
|
||||
that:
|
||||
- idempotent_static.changed == false
|
||||
- 'idempotent_static.existing == [{"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-static", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
|
||||
- idempotent_static.config == {}
|
||||
- 'idempotent_static.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "static", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-static", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
|
||||
- idempotent_static.sent == {}
|
||||
|
||||
- name: create dynamic vlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -78,8 +79,8 @@
|
|||
assert:
|
||||
that:
|
||||
- idempotent_dynamic.changed == false
|
||||
- 'idempotent_dynamic.existing == [{"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-dynamic", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
|
||||
- idempotent_dynamic.config == {}
|
||||
- 'idempotent_dynamic.previous == [{"fvnsVlanInstP": {"attributes": {"allocMode": "dynamic", "descr": "Ansible Test", "dn": "uni/infra/vlanns-[anstest]-dynamic", "name": "anstest", "nameAlias": "", "ownerKey": "", "ownerTag": ""}}}]'
|
||||
- idempotent_dynamic.sent == {}
|
||||
|
||||
- name: update static vlan pool - update works
|
||||
aci_encap_pool:
|
||||
|
@ -91,7 +92,7 @@
|
|||
assert:
|
||||
that:
|
||||
- update_static.changed == true
|
||||
- 'update_static.config == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
- 'update_static.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
|
||||
- name: update dynamic vlan pool - update works
|
||||
aci_encap_pool:
|
||||
|
@ -103,7 +104,7 @@
|
|||
assert:
|
||||
that:
|
||||
- update_dynamic.changed == true
|
||||
- 'update_dynamic.config == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
- 'update_dynamic.sent == {"fvnsVlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
|
||||
- name: missing param - failure message works
|
||||
aci_encap_pool:
|
||||
|
@ -157,7 +158,7 @@
|
|||
that:
|
||||
- get_all_pools.changed == false
|
||||
- get_all_pools.method == "GET"
|
||||
- get_all_pools.existing | length > 1
|
||||
- get_all_pools.previous | length > 1
|
||||
|
||||
- name: get created static vlan pool - get mo works
|
||||
aci_encap_pool:
|
||||
|
@ -170,9 +171,9 @@
|
|||
that:
|
||||
- get_static_pool.changed == false
|
||||
- get_static_pool.method == "GET"
|
||||
- get_static_pool.existing | length == 1
|
||||
- get_static_pool.existing.0.fvnsVlanInstP.attributes.allocMode == "static"
|
||||
- get_static_pool.existing.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
- get_static_pool.previous | length == 1
|
||||
- get_static_pool.previous.0.fvnsVlanInstP.attributes.allocMode == "static"
|
||||
- get_static_pool.previous.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
|
||||
- name: get created dynamic vlan pool - get mo works
|
||||
aci_encap_pool:
|
||||
|
@ -185,9 +186,9 @@
|
|||
that:
|
||||
- get_dynamic_pool.changed == false
|
||||
- get_dynamic_pool.method == "GET"
|
||||
- get_dynamic_pool.existing | length == 1
|
||||
- get_dynamic_pool.existing.0.fvnsVlanInstP.attributes.allocMode == "dynamic"
|
||||
- get_dynamic_pool.existing.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
- get_dynamic_pool.previous | length == 1
|
||||
- get_dynamic_pool.previous.0.fvnsVlanInstP.attributes.allocMode == "dynamic"
|
||||
- get_dynamic_pool.previous.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
|
||||
- name: get created dynamic vlan pool - get mo works
|
||||
aci_encap_pool:
|
||||
|
@ -213,8 +214,8 @@
|
|||
that:
|
||||
- delete_static.changed == true
|
||||
- delete_static.method == "DELETE"
|
||||
- delete_static.existing.0.fvnsVlanInstP.attributes.allocMode == "static"
|
||||
- delete_static.existing.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
- delete_static.previous.0.fvnsVlanInstP.attributes.allocMode == "static"
|
||||
- delete_static.previous.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
|
||||
- name: delete dynamic vlan pool - check mode works
|
||||
aci_encap_pool:
|
||||
|
@ -237,8 +238,8 @@
|
|||
that:
|
||||
- delete_dynamic.changed == true
|
||||
- delete_dynamic.method == "DELETE"
|
||||
- delete_dynamic.existing.0.fvnsVlanInstP.attributes.allocMode == "dynamic"
|
||||
- delete_dynamic.existing.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
- delete_dynamic.previous.0.fvnsVlanInstP.attributes.allocMode == "dynamic"
|
||||
- delete_dynamic.previous.0.fvnsVlanInstP.attributes.name == "anstest"
|
||||
|
||||
- name: delete static vlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -249,7 +250,7 @@
|
|||
assert:
|
||||
that:
|
||||
- idempotent_delete_static.changed == false
|
||||
- idempotent_delete_static.existing == []
|
||||
- idempotent_delete_static.previous == []
|
||||
|
||||
- name: delete dynamic vlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -260,4 +261,4 @@
|
|||
assert:
|
||||
that:
|
||||
- idempotent_delete_dynamic.changed == false
|
||||
- idempotent_delete_dynamic.existing == []
|
||||
- idempotent_delete_dynamic.previous == []
|
||||
|
|
|
@ -7,6 +7,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: absent
|
||||
pool: anstest
|
||||
pool_type: vxlan
|
||||
|
@ -23,7 +24,7 @@
|
|||
assert:
|
||||
that:
|
||||
- create_vxlan_check_mode.changed == true
|
||||
- 'create_vxlan_check_mode.config == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
|
||||
- 'create_vxlan_check_mode.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test", "name": "anstest"}}}'
|
||||
|
||||
- name: create vxlan pool - creation works
|
||||
aci_encap_pool:
|
||||
|
@ -34,8 +35,8 @@
|
|||
assert:
|
||||
that:
|
||||
- create_vxlan.changed == true
|
||||
- create_vxlan.existing == []
|
||||
- create_vxlan.config == create_vxlan_check_mode.config
|
||||
- create_vxlan.previous == []
|
||||
- create_vxlan.sent == create_vxlan_check_mode.sent
|
||||
|
||||
- name: create vxlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -46,8 +47,8 @@
|
|||
assert:
|
||||
that:
|
||||
- idempotent_vxlan.changed == false
|
||||
- 'idempotent_vxlan.existing.0.fvnsVxlanInstP.attributes.name == "anstest"'
|
||||
- idempotent_vxlan.config == {}
|
||||
- 'idempotent_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest"'
|
||||
- idempotent_vxlan.sent == {}
|
||||
|
||||
- name: update vxlan pool - update works
|
||||
aci_encap_pool:
|
||||
|
@ -59,7 +60,7 @@
|
|||
assert:
|
||||
that:
|
||||
- update_vxlan.changed == true
|
||||
- 'update_vxlan.config == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
- 'update_vxlan.sent == {"fvnsVxlanInstP": {"attributes": {"descr": "Ansible Test Change"}}}'
|
||||
|
||||
- name: create vxlan pool - used for query
|
||||
aci_encap_pool:
|
||||
|
@ -96,7 +97,7 @@
|
|||
assert:
|
||||
that:
|
||||
- query_vxlan.changed == false
|
||||
- query_vxlan.existing | length == 1
|
||||
- query_vxlan.previous | length == 1
|
||||
- '"infra/vxlanns-anstest.json" in query_vxlan.url'
|
||||
|
||||
- name: get created static vlan pool - get class works
|
||||
|
@ -109,7 +110,7 @@
|
|||
assert:
|
||||
that:
|
||||
- query_vxlan_all.changed == false
|
||||
- query_vxlan_all.existing | length > 1
|
||||
- query_vxlan_all.previous | length > 1
|
||||
- '"class/fvnsVxlanInstP.json" in query_vxlan_all.url'
|
||||
|
||||
- name: delete vxlan pool - check mode works
|
||||
|
@ -122,7 +123,7 @@
|
|||
assert:
|
||||
that:
|
||||
- delete_vxlan_check_mode.changed == true
|
||||
- delete_vxlan_check_mode.existing != []
|
||||
- delete_vxlan_check_mode.previous != []
|
||||
|
||||
- name: delete vxlan pool - deletion works
|
||||
aci_encap_pool:
|
||||
|
@ -133,8 +134,8 @@
|
|||
assert:
|
||||
that:
|
||||
- delete_vxlan.changed == true
|
||||
- delete_vxlan.existing == delete_vxlan_check_mode.existing
|
||||
- delete_vxlan.existing.0.fvnsVxlanInstP.attributes.name == "anstest"
|
||||
- delete_vxlan.previous == delete_vxlan_check_mode.previous
|
||||
- delete_vxlan.previous.0.fvnsVxlanInstP.attributes.name == "anstest"
|
||||
|
||||
- name: delete vxlan pool again - idempotency works
|
||||
aci_encap_pool:
|
||||
|
@ -152,7 +153,7 @@
|
|||
assert:
|
||||
that:
|
||||
- delete_vxlan_idempotent.changed == false
|
||||
- delete_vxlan_idempotent.existing == []
|
||||
- delete_vxlan_idempotent.previous == []
|
||||
|
||||
- name: delete vxlan pool - cleanup
|
||||
aci_encap_pool:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue