Add querying all bindings (#42366)

Also fix an issue with one of the check-mode tests.
pull/41901/merge
Dag Wieers 6 years ago committed by GitHub
parent 5635848654
commit f98a0b521f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -302,9 +302,10 @@ def main():
interface_mode = module.params['interface_mode'] interface_mode = module.params['interface_mode']
interface_type = module.params['interface_type'] interface_type = module.params['interface_type']
pod_id = module.params['pod_id'] pod_id = module.params['pod_id']
# Users are likely to use integers for leaf IDs, which would raise an exception when using the join method leafs = module.params['leafs']
leafs = [str(leaf) for leaf in module.params['leafs']]
if leafs is not None: if leafs is not None:
# Users are likely to use integers for leaf IDs, which would raise an exception when using the join method
leafs = [str(leaf) for leaf in module.params['leafs']]
if len(leafs) == 1: if len(leafs) == 1:
if interface_type != 'vpc': if interface_type != 'vpc':
leafs = leafs[0] leafs = leafs[0]

@ -85,6 +85,7 @@
aci_static_binding_to_epg: aci_static_binding_to_epg:
<<: *primary_encap_id_present <<: *primary_encap_id_present
description: Binding description description: Binding description
check_mode: yes
register: description_cm register: description_cm
- name: Bind contract to epg - update description (run mode) - name: Bind contract to epg - update description (run mode)
@ -126,22 +127,21 @@
- idempotent_description_cm.changed == false - idempotent_description_cm.changed == false
- idempotent_description.changed == false - idempotent_description.changed == false
- missing_required_present.failed == true - missing_required_present.failed == true
- 'missing_required_present.msg == "missing required arguments: interface_type"' - 'missing_required_present.msg == "state is present but all of the following are missing: ap, encap_id, epg, interface, leafs, pod_id"'
- missing_required_present.failed == true - missing_required_present.failed == true
- name: Get binding - name: Query specific binding
aci_static_binding_to_epg: aci_static_binding_to_epg:
<<: *primary_encap_id_present <<: *primary_encap_id_present
state: query state: query
register: query_static_binding register: query_static_binding
- name: Missing required param - failure message works - name: Query all bindings
aci_static_binding_to_epg: aci_static_binding_to_epg:
<<: *aci_tenant_present <<: *aci_tenant_present
state: query state: query
ignore_errors: yes register: query_all
register: missing_required_query
- name: Query assertions - name: Query assertions
assert: assert:
@ -149,11 +149,8 @@
- query_static_binding.changed == false - query_static_binding.changed == false
- query_static_binding.current != [] - query_static_binding.current != []
- '"class/fvRsPathAtt.json" in query_static_binding.url' - '"class/fvRsPathAtt.json" in query_static_binding.url'
# FIXME: possibility to query all the static bindings - query_all.changed == false
# - query_all.changed == false - '"class/fvRsPathAtt.json" in query_all.url'
# - '"class/fvRsPathAtt.json" in query_all.url'
- missing_required_query.failed == true
- 'missing_required_query.msg == "missing required arguments: interface_type"'
- name: Delete provide binding - deletion works - name: Delete provide binding - deletion works
@ -184,7 +181,7 @@
- provide_absent_idempotent.previous == [] - provide_absent_idempotent.previous == []
- missing_param_absent.failed == true - missing_param_absent.failed == true
- missing_param_absent.failed == true - missing_param_absent.failed == true
- 'missing_param_absent.msg == "missing required arguments: interface_type"' - 'missing_param_absent.msg == "state is absent but all of the following are missing: ap, epg, interface, leafs, pod_id"'
- name: Cleanup binding - name: Cleanup binding
aci_static_binding_to_epg: aci_static_binding_to_epg:

Loading…
Cancel
Save