diff --git a/neutron_lbaas/tests/tempest/lib/services/database/json/flavors_client.py b/neutron_lbaas/tests/tempest/lib/services/database/json/flavors_client.py index 9146e160a..271cb761b 100644 --- a/neutron_lbaas/tests/tempest/lib/services/database/json/flavors_client.py +++ b/neutron_lbaas/tests/tempest/lib/services/database/json/flavors_client.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves.urllib import parse from neutron_lbaas.tests.tempest.lib.common import service_client @@ -23,7 +23,7 @@ class DatabaseFlavorsClientJSON(service_client.ServiceClient): def list_db_flavors(self, params=None): url = 'flavors' if params: - url += '?%s' % urllib.urlencode(params) + url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/identity_client.py b/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/identity_client.py index 8b06ba5d9..82fd12734 100644 --- a/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/identity_client.py +++ b/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/identity_client.py @@ -14,7 +14,8 @@ # under the License. import json -import urllib + +from six.moves.urllib import parse from neutron_lbaas.tests.tempest.lib.common import service_client @@ -95,7 +96,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient): """Get the list of users.""" url = 'users' if params: - url += '?%s' % urllib.urlencode(params) + url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) @@ -134,7 +135,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient): def list_projects(self, params=None): url = "projects" if params: - url += '?%s' % urllib.urlencode(params) + url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) diff --git a/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/region_client.py b/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/region_client.py index 89881d5f4..a832d72a1 100644 --- a/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/region_client.py +++ b/neutron_lbaas/tests/tempest/lib/services/identity/v3/json/region_client.py @@ -14,7 +14,8 @@ # under the License. import json -import urllib + +from six.moves.urllib import parse from neutron_lbaas.tests.tempest.lib.common import service_client @@ -64,7 +65,7 @@ class RegionClientJSON(service_client.ServiceClient): """List regions.""" url = 'regions' if params: - url += '?%s' % urllib.urlencode(params) + url += '?%s' % parse.urlencode(params) resp, body = self.get(url) self.expected_success(200, resp.status) body = json.loads(body) diff --git a/neutron_lbaas/tests/tempest/lib/services/network/json/network_client.py b/neutron_lbaas/tests/tempest/lib/services/network/json/network_client.py index da16ed94f..d89423d8d 100644 --- a/neutron_lbaas/tests/tempest/lib/services/network/json/network_client.py +++ b/neutron_lbaas/tests/tempest/lib/services/network/json/network_client.py @@ -12,8 +12,8 @@ import json import time -import urllib +from six.moves.urllib import parse from tempest_lib.common.utils import misc from tempest_lib import exceptions as lib_exc @@ -98,7 +98,7 @@ class NetworkClientJSON(service_client.ServiceClient): def _list(**filters): uri = self.get_uri(plural_name) if filters: - uri += '?' + urllib.urlencode(filters, doseq=1) + uri += '?' + parse.urlencode(filters, doseq=1) resp, body = self.get(uri) result = {plural_name: self.deserialize_list(body)} self.expected_success(200, resp.status) @@ -124,7 +124,7 @@ class NetworkClientJSON(service_client.ServiceClient): plural = self.pluralize(resource_name) uri = '%s/%s' % (self.get_uri(plural), resource_id) if fields: - uri += '?' + urllib.urlencode(fields, doseq=1) + uri += '?' + parse.urlencode(fields, doseq=1) resp, body = self.get(uri) body = self.deserialize_single(body) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/lib/test.py b/neutron_lbaas/tests/tempest/lib/test.py index 5856e0380..14930a922 100644 --- a/neutron_lbaas/tests/tempest/lib/test.py +++ b/neutron_lbaas/tests/tempest/lib/test.py @@ -20,13 +20,13 @@ import os import re import sys import time -import urllib import uuid import fixtures from oslo_log import log as logging from oslo_utils import importutils import six +from six.moves.urllib import parse import testscenarios import testtools @@ -742,7 +742,7 @@ class NegativeAutoTest(BaseTestCase): if not json_dict: return url, None elif method in ["GET", "HEAD", "PUT", "DELETE"]: - return "%s?%s" % (url, urllib.urlencode(json_dict)), None + return "%s?%s" % (url, parse.urlencode(json_dict)), None else: return url, json.dumps(json_dict) diff --git a/neutron_lbaas/tests/tempest/v2/clients/health_monitors_client.py b/neutron_lbaas/tests/tempest/v2/clients/health_monitors_client.py index 0838106f0..245d954f6 100644 --- a/neutron_lbaas/tests/tempest/v2/clients/health_monitors_client.py +++ b/neutron_lbaas/tests/tempest/v2/clients/health_monitors_client.py @@ -12,9 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib - from oslo_serialization import jsonutils +from six.moves.urllib import parse from neutron_lbaas.tests.tempest.lib.common import service_client @@ -28,7 +27,7 @@ class HealthMonitorsClientJSON(service_client.ServiceClient): """List all health monitors.""" url = 'v2.0/lbaas/healthmonitors' if params: - url = "{0}?{1}".format(url, urllib.urlencode(params)) + url = "{0}?{1}".format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -38,7 +37,7 @@ class HealthMonitorsClientJSON(service_client.ServiceClient): """Get health monitor details.""" url = 'v2.0/lbaas/healthmonitors/{0}'.format(health_monitor_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/v2/clients/listeners_client.py b/neutron_lbaas/tests/tempest/v2/clients/listeners_client.py index 7ddb547d3..73319a79c 100644 --- a/neutron_lbaas/tests/tempest/v2/clients/listeners_client.py +++ b/neutron_lbaas/tests/tempest/v2/clients/listeners_client.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves.urllib import parse from oslo_serialization import jsonutils @@ -28,7 +28,7 @@ class ListenersClientJSON(service_client.ServiceClient): """List all listeners.""" url = 'v2.0/lbaas/listeners' if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -38,7 +38,7 @@ class ListenersClientJSON(service_client.ServiceClient): """Get listener details.""" url = 'v2.0/lbaas/listeners/{0}'.format(listener_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/v2/clients/load_balancers_client.py b/neutron_lbaas/tests/tempest/v2/clients/load_balancers_client.py index 670c2c8e0..6b175104e 100644 --- a/neutron_lbaas/tests/tempest/v2/clients/load_balancers_client.py +++ b/neutron_lbaas/tests/tempest/v2/clients/load_balancers_client.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves.urllib import parse from oslo_serialization import jsonutils @@ -28,7 +28,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient): """List all load balancers.""" url = 'v2.0/lbaas/loadbalancers' if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -38,7 +38,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient): """Get load balancer details.""" url = 'v2.0/lbaas/loadbalancers/{0}'.format(load_balancer_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -72,7 +72,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient): """Get a load balancer's status tree.""" url = 'v2.0/lbaas/loadbalancers/{0}/statuses'.format(load_balancer_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -82,7 +82,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient): """Get a load balancer's stats.""" url = 'v2.0/lbaas/loadbalancers/{0}/stats'.format(load_balancer_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/v2/clients/members_client.py b/neutron_lbaas/tests/tempest/v2/clients/members_client.py index f375e89df..536c7dff2 100644 --- a/neutron_lbaas/tests/tempest/v2/clients/members_client.py +++ b/neutron_lbaas/tests/tempest/v2/clients/members_client.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves.urllib import parse from oslo_serialization import jsonutils @@ -30,7 +30,7 @@ class MembersClientJSON(service_client.ServiceClient): """ url = 'v2.0/lbaas/pools/{0}/members'.format(pool_id) if params: - url = "{0}?{1}".format(url, urllib.urlencode(params)) + url = "{0}?{1}".format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -39,7 +39,7 @@ class MembersClientJSON(service_client.ServiceClient): def get_member(self, pool_id, member_id, params=None): url = 'v2.0/lbaas/pools/{0}/members/{1}'.format(pool_id, member_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) diff --git a/neutron_lbaas/tests/tempest/v2/clients/pools_client.py b/neutron_lbaas/tests/tempest/v2/clients/pools_client.py index 4f460fbdb..91eea0a22 100644 --- a/neutron_lbaas/tests/tempest/v2/clients/pools_client.py +++ b/neutron_lbaas/tests/tempest/v2/clients/pools_client.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import urllib +from six.moves.urllib import parse from oslo_serialization import jsonutils @@ -28,7 +28,7 @@ class PoolsClientJSON(service_client.ServiceClient): """List all pools""" url = 'v2.0/lbaas/pools' if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status) @@ -38,7 +38,7 @@ class PoolsClientJSON(service_client.ServiceClient): """List details of a pool""" url = 'v2.0/lbaas/pools/{pool_id}'.format(pool_id=pool_id) if params: - url = '{0}?{1}'.format(url, urllib.urlencode(params)) + url = '{0}?{1}'.format(url, parse.urlencode(params)) resp, body = self.get(url) body = jsonutils.loads(body) self.expected_success(200, resp.status)