Skip to content

Commit

Permalink
Revert "ACI: Implement encoded query_string" (ansible#56783)
Browse files Browse the repository at this point in the history
This reverts commit 1690af0.
  • Loading branch information
dagwieers authored May 22, 2019
1 parent e4239d9 commit 4f89c1d
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 51 deletions.
3 changes: 1 addition & 2 deletions lib/ansible/module_utils/network/aci/aci.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
from copy import deepcopy

from ansible.module_utils.parsing.convert_bool import boolean
from ansible.module_utils.six.moves.urllib.parse import urlencode
from ansible.module_utils.urls import fetch_url
from ansible.module_utils._text import to_bytes, to_native

Expand Down Expand Up @@ -402,7 +401,7 @@ def update_qs(self, params):
self.filter_string += '&'
else:
self.filter_string = '?'
self.filter_string += urlencode(accepted_params)
self.filter_string += '&'.join(['%s=%s' % (k, v) for (k, v) in accepted_params.items()])

# TODO: This could be designed to accept multiple obj_classes and keys
def build_filter(self, obj_class, params):
Expand Down
5 changes: 1 addition & 4 deletions test/integration/targets/aci_ap/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@
ap: "{{ fakevar | default(omit) }}"
register: query_all

- debug:
msg: '{{ query_ap_ap.filter_string|urldecode }}'

- name: query assertions
assert:
that:
Expand All @@ -121,7 +118,7 @@
- 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|urldecode'
- '"query-target-filter=eq(fvAp.name, \"anstest\")" in query_ap_ap.filter_string'
- '"class/fvAp.json" in query_ap_ap.url'
- query_all is not changed
- query_all.current | length > 1
Expand Down
10 changes: 5 additions & 5 deletions test/integration/targets/aci_bd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@
- query_all is not changed
- query_all.current | length > 1
- query_all.current.0.fvBD is defined
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_all.filter_string|urldecode'
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_all.filter_string'
- '"class/fvBD.json" in query_all.url'
- query_tenant is not changed
- query_tenant.current | length == 1
- query_tenant.current.0.fvTenant.children | length == 2
- '"rsp-subtree-class=fvRsBdToEpRet,fvBD,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_tenant.filter_string|urldecode'
- '"rsp-subtree-class=fvRsBdToEpRet,fvBD,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_tenant.filter_string'
- '"tn-anstest.json" in query_tenant.url'
- query_bd_bd is not changed
- query_bd_bd.current != []
- '"query-target-filter=eq(fvBD.name, \"anstest\")" in query_bd_bd.filter_string|urldecode'
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd_bd.filter_string|urldecode'
- '"query-target-filter=eq(fvBD.name, \"anstest\")" in query_bd_bd.filter_string'
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd_bd.filter_string'
- '"class/fvBD.json" in query_bd_bd.url'
- query_bd is not changed
- query_bd.current | length == 1
- query_bd.current.0.fvBD.attributes.name == "anstest"
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd.filter_string|urldecode'
- '"rsp-subtree-class=fvRsBdToEpRet,fvRsCtx,fvRsIgmpsn,fvRsBDToNdP" in query_bd.filter_string'
- '"tn-anstest/BD-anstest.json" in query_bd.url'

- name: delete bd - check mode works
Expand Down
10 changes: 5 additions & 5 deletions test/integration/targets/aci_bd_subnet/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,23 @@
- get_all_tenant is not changed
- '"tn-anstest.json" in get_all_tenant.url'
- get_all_bd is not changed
- '"query-target-filter=eq(fvBD.name, \"anstest\")" in get_all_bd.filter_string|urldecode'
- '"query-target-filter=eq(fvBD.name, \"anstest\")" in get_all_bd.filter_string'
- '"class/fvBD.json" in get_all_bd.url'
- get_all_tenant_bd is not changed
- '"tn-anstest/BD-anstest.json" in get_all_tenant_bd.url'
- get_all_tenant_bd.current.0.fvBD.children | length > 1
- get_subnet_tenant is not changed
- '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_tenant.filter_string|urldecode'
- '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_tenant.filter_string'
- '"tn-anstest.json" in get_subnet_tenant.url'
- get_subnet_bd is not changed
- '"query-target-filter=eq(fvBD.name, \"anstest\")"|urldecode'
- '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_bd.filter_string|urldecode'
- '"query-target-filter=eq(fvBD.name, \"anstest\")"'
- '"rsp-subtree-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnet_bd.filter_string'
- '"class/fvBD.json" in get_subnet_bd.url'
- get_subnet is not changed
- get_subnet.current | length == 1
- '"tn-anstest/BD-anstest/subnet-[10.100.100.1/24].json" in get_subnet.url'
- get_subnets_gateway is not changed
- '"query-target-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnets_gateway.filter_string|urldecode'
- '"query-target-filter=eq(fvSubnet.ip, \"10.100.100.1/24\")" in get_subnets_gateway.filter_string'
- '"class/fvSubnet.json" in get_subnets_gateway.url'

- name: delete subnet - check mode works
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
- query_snapshot is not failed
- query_snapshot is not changed
- '"class/configSnapshot.json" in query_snapshot.url'
- '"configSnapshot.name, \"{{ test_snapshot }}\"" in query_snapshot.filter_string|urldecode'
- '"configSnapshot.name, \"{{ test_snapshot }}\"" in query_snapshot.filter_string'
- query_all is not failed
- query_all is not changed
- '"class/configSnapshot.json" in query_all.url'
Expand Down
2 changes: 1 addition & 1 deletion test/integration/targets/aci_contract/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
- '"tn-anstest.json" in query_tenant.url'
- query_name is not changed
- query_name.current != []
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_name.filter_string|urldecode'
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_name.filter_string'
- '"class/vzBrCP.json" in query_name.url'
- query_all is not changed
- query_all.current | length > 1
Expand Down
12 changes: 6 additions & 6 deletions test/integration/targets/aci_contract_subject/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,30 +156,30 @@
- query_tenant_subject.current.0.fvTenant.attributes.name == "anstest"
- query_tenant_subject.current.0.fvTenant.children.0.vzBrCP.children | length == 1
- query_tenant_subject.current.0.fvTenant.children.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"
- '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_tenant_subject.filter_string|urldecode'
- '"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 is not changed
- query_contract_subject.current.0.vzBrCP.attributes.name == "anstest"
- query_contract_subject.current.0.vzBrCP.children | length == 1
- query_contract_subject.current.0.vzBrCP.children.0.vzSubj.attributes.name == "anstest"
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract_subject.filter_string|urldecode'
- '"rsp-subtree-filter=eq(vzSubj.name, \"anstest\")" in query_contract_subject.filter_string|urldecode'
- '"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 is not changed
- query_tenant.current | length == 1
- query_tenant.current.0.fvTenant.attributes.name == "anstest"
- '"rsp-subtree-class=vzBrCP,vzSubj" in query_tenant.filter_string|urldecode'
- '"rsp-subtree-class=vzBrCP,vzSubj" in query_tenant.filter_string'
- '"tn-anstest.json" in query_tenant.url'
- query_contract is not changed
- query_contract.current.0.vzBrCP.attributes.name == "anstest"
- '"query-target-filter=eq(vzBrCP.name, \"anstest\")" in query_contract.filter_string|urldecode'
- '"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 is not changed
- query_subject.current.0.vzSubj.attributes.name == "anstest"
- '"query-target-filter=eq(vzSubj.name, \"anstest\")" in query_subject.filter_string|urldecode'
- '"query-target-filter=eq(vzSubj.name, \"anstest\")" in query_subject.filter_string'
- '"class/vzSubj.json" in query_subject.url'
- query_all is not changed
- query_all.current > 1
Expand Down
20 changes: 10 additions & 10 deletions test/integration/targets/aci_encap_pool_range/tasks/vlan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@
that:
- range_query_from_to_name is not changed
- range_query_from_to_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to_name.filter_string'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_to_name.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to_name.filter_string'
- range_query_from_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- range_query_from_to_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20"
- range_query_from_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40"
Expand All @@ -246,8 +246,8 @@
that:
- range_query_from_name is not changed
- range_query_from_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_name.filter_string'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_from_name.filter_string'
- range_query_from_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- range_query_from_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20"

Expand All @@ -262,8 +262,8 @@
that:
- range_query_to_name is not changed
- range_query_to_name.url.endswith('class/fvnsEncapBlk.json')
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_to_name.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_to_name.filter_string'
- range_query_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- range_query_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40"

Expand All @@ -279,7 +279,7 @@
that:
- range_query_name is not changed
- range_query_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in range_query_name.filter_string'
- range_query_name.current.0.fvnsEncapBlk.attributes.name == "anstest"

- name: query vlan pool range - from and to are filtered
Expand All @@ -293,8 +293,8 @@
that:
- range_query_from_to is not changed
- range_query_from_to.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in range_query_from_to.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in range_query_from_to.filter_string'
- range_query_from_to.current.0.fvnsEncapBlk.attributes.from == "vlan-20"
- range_query_from_to.current.0.fvnsEncapBlk.attributes.to == "vlan-40"

Expand Down
12 changes: 6 additions & 6 deletions test/integration/targets/aci_filter_entry/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@
- query_filter_entry is not changed
- query_filter_entry.current.0.vzFilter.attributes.name == "anstest"
- query_filter_entry.current.0.vzFilter.children | length == 1
- '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter_entry.filter_string|urldecode'
- '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_filter_entry.filter_string|urldecode'
- '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter_entry.filter_string'
- '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_filter_entry.filter_string'
- '"class/vzFilter.json" in query_filter_entry.url'
- query_tenant_entry is not changed
- query_tenant_entry.current | length == 1
- query_tenant_entry.current.0.fvTenant.attributes.name == "anstest"
- '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_tenant_entry.filter_string|urldecode'
- '"rsp-subtree-filter=eq(vzEntry.name, \"anstest\")" in query_tenant_entry.filter_string'
- '"rsp-subtree-class=vzEntry" in query_tenant_entry.filter_string'
- '"tn-anstest.json" in query_tenant_entry.url'
- query_tenant_filter is not changed
Expand All @@ -212,17 +212,17 @@
- '"tn-anstest/flt-anstest.json" in query_tenant_filter.url'
- query_entry is not changed
- query_entry.current.0.vzEntry.attributes.name == "anstest"
- '"query-target-filter=eq(vzEntry.name, \"anstest\")" in query_entry.filter_string|urldecode'
- '"query-target-filter=eq(vzEntry.name, \"anstest\")" in query_entry.filter_string'
- '"class/vzEntry.json" in query_entry.url'
- query_filter is not changed
- query_filter.current.0.vzFilter.attributes.name == "anstest"
- '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter.filter_string|urldecode'
- '"query-target-filter=eq(vzFilter.name, \"anstest\")" in query_filter.filter_string'
- '"rsp-subtree-class=vzEntry" in query_filter.filter_string'
- '"class/vzFilter.json" in query_filter.url'
- query_tenant is not changed
- query_tenant.current | length == 1
- query_tenant.current.0.fvTenant.attributes.name == "anstest"
- '"rsp-subtree-class=vzEntry,vzFilter" in query_tenant.filter_string|urldecode'
- '"rsp-subtree-class=vzEntry,vzFilter" in query_tenant.filter_string'
- '"tn-anstest.json" in query_tenant.url'
- query_all is not changed
- query_all.current | length > 1
Expand Down
20 changes: 10 additions & 10 deletions test/integration/targets/aci_vlan_pool_encap_block/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@
that:
- encap_block_query_from_to_name is not changed
- encap_block_query_from_to_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to_name.filter_string'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_to_name.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to_name.filter_string'
- encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20"
- encap_block_query_from_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40"
Expand All @@ -242,8 +242,8 @@
that:
- encap_block_query_from_name is not changed
- encap_block_query_from_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_name.filter_string'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_from_name.filter_string'
- encap_block_query_from_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- encap_block_query_from_name.current.0.fvnsEncapBlk.attributes.from == "vlan-20"

Expand All @@ -258,8 +258,8 @@
that:
- encap_block_query_to_name is not changed
- encap_block_query_to_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_to_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_to_name.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_to_name.filter_string'
- encap_block_query_to_name.current.0.fvnsEncapBlk.attributes.name == "anstest"
- encap_block_query_to_name.current.0.fvnsEncapBlk.attributes.to == "vlan-40"

Expand All @@ -275,7 +275,7 @@
that:
- encap_block_query_name is not changed
- encap_block_query_name.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_name.filter_string|urldecode'
- '"eq(fvnsEncapBlk.name, \"anstest\")" in encap_block_query_name.filter_string'
- encap_block_query_name.current.0.fvnsEncapBlk.attributes.name == "anstest"

- name: Query vlan pool range - from and to are filtered
Expand All @@ -289,8 +289,8 @@
that:
- encap_block_query_from_to is not changed
- encap_block_query_from_to.url.endswith("class/fvnsEncapBlk.json")
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to.filter_string|urldecode'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to.filter_string|urldecode'
- '"eq(fvnsEncapBlk.from, \"vlan-20\")" in encap_block_query_from_to.filter_string'
- '"eq(fvnsEncapBlk.to, \"vlan-40\")" in encap_block_query_from_to.filter_string'
- encap_block_query_from_to.current.0.fvnsEncapBlk.attributes.from == "vlan-20"
- encap_block_query_from_to.current.0.fvnsEncapBlk.attributes.to == "vlan-40"

Expand Down
2 changes: 1 addition & 1 deletion test/integration/targets/aci_vrf/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
- query_vrf_vrf is not changed
- query_vrf_vrf.current != []
- query_vrf_vrf.current.0.fvCtx.attributes.name == "anstest"
- '"query-target-filter=eq(fvCtx.name, \"anstest\")" in query_vrf_vrf.filter_string|urldecode'
- '"query-target-filter=eq(fvCtx.name, \"anstest\")" in query_vrf_vrf.filter_string'
- '"class/fvCtx.json" in query_vrf_vrf.url'
- query_vrf is not changed
- query_vrf.current | length == 1
Expand Down

0 comments on commit 4f89c1d

Please sign in to comment.