From 684d8997bbdfb14dca680e32e579d92c5cc279d0 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 30 Jan 2014 16:27:40 +0000 Subject: [PATCH] Convert all service clients to global CONF object This commit takes the rest client and all subclass(all the service clients) and converts all uses of config to the global CONF object. Partially implements bp config-cleanup Change-Id: I09525af4f1b308b91d45b7bbea05e0f734ea485c --- tempest/clients.py | 9 +++-- tempest/common/rest_client.py | 22 ++++++------ tempest/services/baremetal/base.py | 9 +++-- tempest/services/baremetal/v1/base_v1.py | 4 +-- tempest/services/baremetal/v1/client_json.py | 4 +-- tempest/services/botoclients.py | 36 ++++++++++--------- .../compute/json/aggregates_client.py | 9 +++-- .../compute/json/availability_zone_client.py | 9 +++-- .../compute/json/certificates_client.py | 9 +++-- .../compute/json/extensions_client.py | 9 +++-- .../services/compute/json/fixed_ips_client.py | 9 +++-- .../services/compute/json/flavors_client.py | 9 +++-- .../compute/json/floating_ips_client.py | 9 +++-- tempest/services/compute/json/hosts_client.py | 9 +++-- .../compute/json/hypervisor_client.py | 9 +++-- .../services/compute/json/images_client.py | 13 ++++--- .../json/instance_usage_audit_log_client.py | 9 +++-- .../compute/json/interfaces_client.py | 9 +++-- .../services/compute/json/keypairs_client.py | 9 +++-- .../services/compute/json/limits_client.py | 10 ++++-- .../services/compute/json/quotas_client.py | 9 +++-- .../compute/json/security_groups_client.py | 9 +++-- .../services/compute/json/servers_client.py | 9 +++-- .../services/compute/json/services_client.py | 9 +++-- .../compute/json/tenant_usages_client.py | 9 +++-- .../compute/json/volumes_extensions_client.py | 13 ++++--- .../compute/v3/json/aggregates_client.py | 9 +++-- .../v3/json/availability_zone_client.py | 9 +++-- .../compute/v3/json/certificates_client.py | 9 +++-- .../compute/v3/json/extensions_client.py | 9 +++-- .../compute/v3/json/flavors_client.py | 9 +++-- .../services/compute/v3/json/hosts_client.py | 9 +++-- .../compute/v3/json/hypervisor_client.py | 9 +++-- .../json/instance_usage_audit_log_client.py | 9 +++-- .../compute/v3/json/interfaces_client.py | 9 +++-- .../compute/v3/json/keypairs_client.py | 9 +++-- .../services/compute/v3/json/quotas_client.py | 9 +++-- .../compute/v3/json/servers_client.py | 9 +++-- .../compute/v3/json/services_client.py | 9 +++-- .../compute/v3/json/tenant_usages_client.py | 9 +++-- .../compute/v3/json/version_client.py | 9 +++-- .../services/compute/xml/aggregates_client.py | 9 +++-- .../compute/xml/availability_zone_client.py | 9 +++-- .../compute/xml/certificates_client.py | 9 +++-- .../services/compute/xml/extensions_client.py | 10 ++++-- .../services/compute/xml/fixed_ips_client.py | 9 +++-- .../services/compute/xml/flavors_client.py | 8 +++-- .../compute/xml/floating_ips_client.py | 9 +++-- tempest/services/compute/xml/hosts_client.py | 9 +++-- .../services/compute/xml/hypervisor_client.py | 9 +++-- tempest/services/compute/xml/images_client.py | 13 ++++--- .../xml/instance_usage_audit_log_client.py | 9 +++-- .../services/compute/xml/interfaces_client.py | 9 +++-- .../services/compute/xml/keypairs_client.py | 10 ++++-- tempest/services/compute/xml/limits_client.py | 9 +++-- tempest/services/compute/xml/quotas_client.py | 9 +++-- .../compute/xml/security_groups_client.py | 9 +++-- .../services/compute/xml/servers_client.py | 8 +++-- .../services/compute/xml/services_client.py | 10 ++++-- .../compute/xml/tenant_usages_client.py | 9 +++-- .../compute/xml/volumes_extensions_client.py | 14 ++++---- .../services/data_processing/v1_1/client.py | 9 +++-- .../services/identity/json/identity_client.py | 16 +++++---- .../identity/v3/json/credentials_client.py | 9 +++-- .../identity/v3/json/endpoints_client.py | 10 +++--- .../identity/v3/json/identity_client.py | 18 +++++----- .../identity/v3/json/policy_client.py | 9 +++-- .../identity/v3/json/service_client.py | 9 +++-- .../identity/v3/xml/credentials_client.py | 8 +++-- .../identity/v3/xml/endpoints_client.py | 11 +++--- .../identity/v3/xml/identity_client.py | 18 +++++----- .../services/identity/v3/xml/policy_client.py | 11 +++--- .../identity/v3/xml/service_client.py | 8 +++-- .../services/identity/xml/identity_client.py | 15 ++++---- .../services/image/v1/json/image_client.py | 13 ++++--- .../services/image/v2/json/image_client.py | 13 ++++--- .../services/network/json/network_client.py | 4 +-- .../services/network/network_client_base.py | 12 ++++--- .../services/network/xml/network_client.py | 4 +-- .../services/object_storage/account_client.py | 15 ++++---- .../object_storage/container_client.py | 9 +++-- .../services/object_storage/object_client.py | 17 +++++---- .../json/orchestration_client.py | 13 ++++--- .../telemetry/json/telemetry_client.py | 4 +-- .../telemetry/telemetry_client_base.py | 13 ++++--- .../telemetry/xml/telemetry_client.py | 4 +-- .../volume/json/admin/volume_hosts_client.py | 13 ++++--- .../volume/json/admin/volume_types_client.py | 13 ++++--- .../services/volume/json/extensions_client.py | 9 +++-- .../services/volume/json/snapshots_client.py | 13 ++++--- .../services/volume/json/volumes_client.py | 13 ++++--- .../volume/xml/admin/volume_hosts_client.py | 13 ++++--- .../volume/xml/admin/volume_types_client.py | 13 ++++--- .../services/volume/xml/extensions_client.py | 10 ++++-- .../services/volume/xml/snapshots_client.py | 13 ++++--- tempest/services/volume/xml/volumes_client.py | 13 ++++--- tempest/tests/test_rest_client.py | 5 +-- 97 files changed, 629 insertions(+), 369 deletions(-) diff --git a/tempest/clients.py b/tempest/clients.py index d0a14919b..797185ade 100644 --- a/tempest/clients.py +++ b/tempest/clients.py @@ -184,7 +184,6 @@ class Manager(object): :param password: Override of the password :param tenant_name: Override of the tenant name """ - self.config = CONF # If no creds are provided, we fall back on the defaults # in the config file for the Compute API. self.username = username or CONF.identity.username @@ -201,12 +200,12 @@ class Manager(object): self.auth_url = CONF.identity.uri self.auth_url_v3 = CONF.identity.uri_v3 - client_args = (CONF, self.username, self.password, + client_args = (self.username, self.password, self.auth_url, self.tenant_name) if self.auth_url_v3: auth_version = 'v3' - client_args_v3_auth = (CONF, self.username, + client_args_v3_auth = (self.username, self.password, self.auth_url_v3, self.tenant_name, auth_version) else: @@ -231,7 +230,7 @@ class Manager(object): self.volume_types_client = VolumeTypesClientXML(*client_args) self.identity_client = IdentityClientXML(*client_args) self.identity_v3_client = IdentityV3ClientXML(*client_args) - self.token_client = TokenClientXML(CONF) + self.token_client = TokenClientXML() self.security_groups_client = SecurityGroupsClientXML( *client_args) self.interfaces_client = InterfacesClientXML(*client_args) @@ -287,7 +286,7 @@ class Manager(object): self.volume_types_client = VolumeTypesClientJSON(*client_args) self.identity_client = IdentityClientJSON(*client_args) self.identity_v3_client = IdentityV3ClientJSON(*client_args) - self.token_client = TokenClientJSON(CONF) + self.token_client = TokenClientJSON() self.security_groups_client = SecurityGroupsClientJSON( *client_args) self.interfaces_v3_client = InterfacesV3ClientJSON(*client_args) diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py index b1fef9931..636e2bf84 100644 --- a/tempest/common/rest_client.py +++ b/tempest/common/rest_client.py @@ -22,10 +22,13 @@ import re import time from tempest.common import http +from tempest import config from tempest import exceptions from tempest.openstack.common import log as logging from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + # redrive rate limited calls at most twice MAX_RECURSION_DEPTH = 2 TOKEN_CHARS_RE = re.compile('^[-A-Za-z0-9+/=]*$') @@ -38,9 +41,8 @@ class RestClient(object): TYPE = "json" LOG = logging.getLogger(__name__) - def __init__(self, config, user, password, auth_url, tenant_name=None, + def __init__(self, user, password, auth_url, tenant_name=None, auth_version='v2'): - self.config = config self.user = user self.password = password self.auth_url = auth_url @@ -51,21 +53,21 @@ class RestClient(object): self.token = None self.base_url = None self.region = {} - for cfgname in dir(self.config): + for cfgname in dir(CONF): # Find all config.FOO.catalog_type and assume FOO is a service. - cfg = getattr(self.config, cfgname) + cfg = getattr(CONF, cfgname) catalog_type = getattr(cfg, 'catalog_type', None) if not catalog_type: continue service_region = getattr(cfg, 'region', None) if not service_region: - service_region = self.config.identity.region + service_region = CONF.identity.region self.region[catalog_type] = service_region self.endpoint_url = 'publicURL' self.headers = {'Content-Type': 'application/%s' % self.TYPE, 'Accept': 'application/%s' % self.TYPE} - self.build_interval = config.compute.build_interval - self.build_timeout = config.compute.build_timeout + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout self.general_header_lc = set(('cache-control', 'connection', 'date', 'pragma', 'trailer', 'transfer-encoding', 'via', @@ -74,18 +76,18 @@ class RestClient(object): 'location', 'proxy-authenticate', 'retry-after', 'server', 'vary', 'www-authenticate')) - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) def __str__(self): STRING_LIMIT = 80 - str_format = ("config:%s, user:%s, password:%s, " + str_format = ("user:%s, password:%s, " "auth_url:%s, tenant_name:%s, auth_version:%s, " "service:%s, base_url:%s, region:%s, " "endpoint_url:%s, build_interval:%s, build_timeout:%s" "\ntoken:%s..., \nheaders:%s...") - return str_format % (self.config, self.user, self.password, + return str_format % (self.user, self.password, self.auth_url, self.tenant_name, self.auth_version, self.service, self.base_url, self.region, self.endpoint_url, diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py index 74d023a3f..0b5426e37 100644 --- a/tempest/services/baremetal/base.py +++ b/tempest/services/baremetal/base.py @@ -16,6 +16,9 @@ import json import six from tempest.common import rest_client +from tempest import config + +CONF = config.CONF def handle_errors(f): @@ -44,10 +47,10 @@ class BaremetalClient(rest_client.RestClient): """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(BaremetalClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(BaremetalClient, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.baremetal.catalog_type + self.service = CONF.baremetal.catalog_type self.uri_prefix = '' def serialize(self, object_type, object_dict): diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/base_v1.py index 5e90cd6a6..13693e141 100644 --- a/tempest/services/baremetal/v1/base_v1.py +++ b/tempest/services/baremetal/v1/base_v1.py @@ -21,8 +21,8 @@ class BaremetalClientV1(base.BaremetalClient): methods in order to send requests to Ironic. """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(BaremetalClientV1, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(BaremetalClientV1, self).__init__(username, password, auth_url, tenant_name) self.version = '1' self.uri_prefix = 'v%s' % self.version diff --git a/tempest/services/baremetal/v1/client_json.py b/tempest/services/baremetal/v1/client_json.py index f1708afca..c98b20f89 100644 --- a/tempest/services/baremetal/v1/client_json.py +++ b/tempest/services/baremetal/v1/client_json.py @@ -18,8 +18,8 @@ from tempest.services.baremetal.v1 import base_v1 class BaremetalClientJSON(base_v1.BaremetalClientV1): """Tempest REST client for Ironic JSON API v1.""" - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(BaremetalClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(BaremetalClientJSON, self).__init__(username, password, auth_url, tenant_name) self.serialize = lambda obj_type, obj_body: json.dumps(obj_body) diff --git a/tempest/services/botoclients.py b/tempest/services/botoclients.py index a1e1b5c1b..03e87b13b 100644 --- a/tempest/services/botoclients.py +++ b/tempest/services/botoclients.py @@ -18,25 +18,27 @@ import contextlib import types import urlparse +from tempest import config from tempest import exceptions import boto import boto.ec2 import boto.s3.connection +CONF = config.CONF + class BotoClientBase(object): ALLOWED_METHODS = set() - def __init__(self, config, - username=None, password=None, + def __init__(self, username=None, password=None, auth_url=None, tenant_name=None, *args, **kwargs): - self.connection_timeout = str(config.boto.http_socket_timeout) - self.num_retries = str(config.boto.num_retries) - self.build_timeout = config.boto.build_timeout + self.connection_timeout = str(CONF.boto.http_socket_timeout) + self.num_retries = str(CONF.boto.num_retries) + self.build_timeout = CONF.boto.build_timeout self.ks_cred = {"username": username, "password": password, "auth_url": auth_url, @@ -103,15 +105,15 @@ class APIClientEC2(BotoClientBase): def connect_method(self, *args, **kwargs): return boto.connect_ec2(*args, **kwargs) - def __init__(self, config, *args, **kwargs): - super(APIClientEC2, self).__init__(config, *args, **kwargs) - aws_access = config.boto.aws_access - aws_secret = config.boto.aws_secret - purl = urlparse.urlparse(config.boto.ec2_url) + def __init__(self, *args, **kwargs): + super(APIClientEC2, self).__init__(*args, **kwargs) + aws_access = CONF.boto.aws_access + aws_secret = CONF.boto.aws_secret + purl = urlparse.urlparse(CONF.boto.ec2_url) - region_name = config.compute.region + region_name = CONF.compute.region if not region_name: - region_name = config.identity.region + region_name = CONF.identity.region region = boto.ec2.regioninfo.RegionInfo(name=region_name, endpoint=purl.hostname) port = purl.port @@ -194,11 +196,11 @@ class ObjectClientS3(BotoClientBase): def connect_method(self, *args, **kwargs): return boto.connect_s3(*args, **kwargs) - def __init__(self, config, *args, **kwargs): - super(ObjectClientS3, self).__init__(config, *args, **kwargs) - aws_access = config.boto.aws_access - aws_secret = config.boto.aws_secret - purl = urlparse.urlparse(config.boto.s3_url) + def __init__(self, *args, **kwargs): + super(ObjectClientS3, self).__init__(*args, **kwargs) + aws_access = CONF.boto.aws_access + aws_secret = CONF.boto.aws_secret + purl = urlparse.urlparse(CONF.boto.s3_url) port = purl.port if port is None: if purl.scheme is not "https": diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py index d9e73de77..235d00623 100644 --- a/tempest/services/compute/json/aggregates_client.py +++ b/tempest/services/compute/json/aggregates_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class AggregatesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AggregatesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AggregatesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_aggregates(self): """Get aggregate list.""" diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py index 49664c766..2b7e23c1c 100644 --- a/tempest/services/compute/json/availability_zone_client.py +++ b/tempest/services/compute/json/availability_zone_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class AvailabilityZoneClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AvailabilityZoneClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AvailabilityZoneClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_availability_zone_list(self): resp, body = self.get('os-availability-zone') diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py index f4d31edb2..06e2ae760 100644 --- a/tempest/services/compute/json/certificates_client.py +++ b/tempest/services/compute/json/certificates_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class CertificatesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(CertificatesClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(CertificatesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_certificate(self, id): url = "os-certificates/%s" % (id) diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py index ae68261d5..8505d93cc 100644 --- a/tempest/services/compute/json/extensions_client.py +++ b/tempest/services/compute/json/extensions_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ExtensionsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ExtensionsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ExtensionsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_extensions(self): url = 'extensions' diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py index 31754ca0f..19bf4e26c 100644 --- a/tempest/services/compute/json/fixed_ips_client.py +++ b/tempest/services/compute/json/fixed_ips_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class FixedIPsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FixedIPsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FixedIPsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_fixed_ip_details(self, fixed_ip): url = "os-fixed-ips/%s" % (fixed_ip) diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py index 300a0de6f..7fcf1b23a 100644 --- a/tempest/services/compute/json/flavors_client.py +++ b/tempest/services/compute/json/flavors_client.py @@ -17,14 +17,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class FlavorsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FlavorsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FlavorsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_flavors(self, params=None): url = 'flavors' diff --git a/tempest/services/compute/json/floating_ips_client.py b/tempest/services/compute/json/floating_ips_client.py index 1235dd115..7c2139d51 100644 --- a/tempest/services/compute/json/floating_ips_client.py +++ b/tempest/services/compute/json/floating_ips_client.py @@ -17,14 +17,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class FloatingIPsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FloatingIPsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FloatingIPsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_floating_ips(self, params=None): """Returns a list of all floating IPs filtered by any parameters.""" diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py index 23cb7e958..33e53453e 100644 --- a/tempest/services/compute/json/hosts_client.py +++ b/tempest/services/compute/json/hosts_client.py @@ -16,14 +16,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class HostsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HostsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HostsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_hosts(self, params=None): """Lists all hosts.""" diff --git a/tempest/services/compute/json/hypervisor_client.py b/tempest/services/compute/json/hypervisor_client.py index c8ac9518a..a4d866018 100644 --- a/tempest/services/compute/json/hypervisor_client.py +++ b/tempest/services/compute/json/hypervisor_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class HypervisorClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HypervisorClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HypervisorClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_hypervisor_list(self): """List hypervisors information.""" diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py index d64d8d74d..c9adc3fe2 100644 --- a/tempest/services/compute/json/images_client.py +++ b/tempest/services/compute/json/images_client.py @@ -18,17 +18,20 @@ import urllib from tempest.common.rest_client import RestClient from tempest.common import waiters +from tempest import config from tempest import exceptions +CONF = config.CONF + class ImagesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ImagesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ImagesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.compute.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def create_image(self, server_id, name, meta=None): """Creates an image of the original server.""" diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py index 97062cb4a..2673bd775 100644 --- a/tempest/services/compute/json/instance_usage_audit_log_client.py +++ b/tempest/services/compute/json/instance_usage_audit_log_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class InstanceUsagesAuditLogClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(InstanceUsagesAuditLogClientJSON, self).__init__( - config, username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + username, password, auth_url, tenant_name) + self.service = CONF.compute.catalog_type def list_instance_usage_audit_logs(self): url = 'os-instance_usage_audit_log' diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py index 06e647600..21d3a5acb 100644 --- a/tempest/services/compute/json/interfaces_client.py +++ b/tempest/services/compute/json/interfaces_client.py @@ -17,15 +17,18 @@ import json import time from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class InterfacesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(InterfacesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(InterfacesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_interfaces(self, server): resp, body = self.get('servers/%s/os-interface' % server) diff --git a/tempest/services/compute/json/keypairs_client.py b/tempest/services/compute/json/keypairs_client.py index efd92d20d..dd4e3e180 100644 --- a/tempest/services/compute/json/keypairs_client.py +++ b/tempest/services/compute/json/keypairs_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class KeyPairsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(KeyPairsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(KeyPairsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_keypairs(self): resp, body = self.get("os-keypairs") diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py index 525c12fb6..c5cc98807 100644 --- a/tempest/services/compute/json/limits_client.py +++ b/tempest/services/compute/json/limits_client.py @@ -14,15 +14,19 @@ # under the License. import json + from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class LimitsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(LimitsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(LimitsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_absolute_limits(self): resp, body = self.get("limits") diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py index b6ec9b829..df1246738 100644 --- a/tempest/services/compute/json/quotas_client.py +++ b/tempest/services/compute/json/quotas_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class QuotasClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(QuotasClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(QuotasClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_quota_set(self, tenant_id): """List the quota set for a tenant.""" diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py index 8a446267d..299a6e6d2 100644 --- a/tempest/services/compute/json/security_groups_client.py +++ b/tempest/services/compute/json/security_groups_client.py @@ -17,16 +17,19 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class SecurityGroupsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(SecurityGroupsClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(SecurityGroupsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_security_groups(self, params=None): """List all security groups for a user.""" diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py index 0b9ca0e7b..0987f0527 100644 --- a/tempest/services/compute/json/servers_client.py +++ b/tempest/services/compute/json/servers_client.py @@ -20,17 +20,20 @@ import urllib from tempest.common.rest_client import RestClient from tempest.common import waiters +from tempest import config from tempest import exceptions +CONF = config.CONF + class ServersClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None, + def __init__(self, username, password, auth_url, tenant_name=None, auth_version='v2'): - super(ServersClientJSON, self).__init__(config, username, password, + super(ServersClientJSON, self).__init__(username, password, auth_url, tenant_name, auth_version=auth_version) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def create_server(self, name, image_ref, flavor_ref, **kwargs): """ diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py index 7829e5a31..c209cf3df 100644 --- a/tempest/services/compute/json/services_client.py +++ b/tempest/services/compute/json/services_client.py @@ -18,14 +18,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ServicesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ServicesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ServicesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_services(self, params=None): url = 'os-services' diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py index a2637675b..c141fa798 100644 --- a/tempest/services/compute/json/tenant_usages_client.py +++ b/tempest/services/compute/json/tenant_usages_client.py @@ -17,14 +17,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class TenantUsagesClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(TenantUsagesClientJSON, self).__init__( - config, username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + username, password, auth_url, tenant_name) + self.service = CONF.compute.catalog_type def list_tenant_usages(self, params=None): url = 'os-simple-tenant-usage' diff --git a/tempest/services/compute/json/volumes_extensions_client.py b/tempest/services/compute/json/volumes_extensions_client.py index aa49be525..d61b8a547 100644 --- a/tempest/services/compute/json/volumes_extensions_client.py +++ b/tempest/services/compute/json/volumes_extensions_client.py @@ -18,18 +18,21 @@ import time import urllib from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class VolumesExtensionsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumesExtensionsClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumesExtensionsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.compute.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def list_volumes(self, params=None): """List all the volumes created.""" diff --git a/tempest/services/compute/v3/json/aggregates_client.py b/tempest/services/compute/v3/json/aggregates_client.py index d63be02be..bc037c975 100644 --- a/tempest/services/compute/v3/json/aggregates_client.py +++ b/tempest/services/compute/v3/json/aggregates_client.py @@ -16,16 +16,19 @@ import json from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class AggregatesV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AggregatesV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AggregatesV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_aggregates(self): """Get aggregate list.""" diff --git a/tempest/services/compute/v3/json/availability_zone_client.py b/tempest/services/compute/v3/json/availability_zone_client.py index 97ff21caa..a3f4d9402 100644 --- a/tempest/services/compute/v3/json/availability_zone_client.py +++ b/tempest/services/compute/v3/json/availability_zone_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class AvailabilityZoneV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AvailabilityZoneV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AvailabilityZoneV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def get_availability_zone_list(self): resp, body = self.get('os-availability-zone') diff --git a/tempest/services/compute/v3/json/certificates_client.py b/tempest/services/compute/v3/json/certificates_client.py index 7c212900a..1833cb90f 100644 --- a/tempest/services/compute/v3/json/certificates_client.py +++ b/tempest/services/compute/v3/json/certificates_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class CertificatesV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(CertificatesV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(CertificatesV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def get_certificate(self, id): url = "os-certificates/%s" % (id) diff --git a/tempest/services/compute/v3/json/extensions_client.py b/tempest/services/compute/v3/json/extensions_client.py index c508d2fbe..f7600933e 100644 --- a/tempest/services/compute/v3/json/extensions_client.py +++ b/tempest/services/compute/v3/json/extensions_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ExtensionsV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ExtensionsV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ExtensionsV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_extensions(self): url = 'extensions' diff --git a/tempest/services/compute/v3/json/flavors_client.py b/tempest/services/compute/v3/json/flavors_client.py index f8c762c62..d434f1ec2 100644 --- a/tempest/services/compute/v3/json/flavors_client.py +++ b/tempest/services/compute/v3/json/flavors_client.py @@ -17,14 +17,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class FlavorsV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FlavorsV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FlavorsV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_flavors(self, params=None): url = 'flavors' diff --git a/tempest/services/compute/v3/json/hosts_client.py b/tempest/services/compute/v3/json/hosts_client.py index 669bf59ab..d15b2372c 100644 --- a/tempest/services/compute/v3/json/hosts_client.py +++ b/tempest/services/compute/v3/json/hosts_client.py @@ -16,14 +16,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class HostsV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HostsV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HostsV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_hosts(self, params=None): """Lists all hosts.""" diff --git a/tempest/services/compute/v3/json/hypervisor_client.py b/tempest/services/compute/v3/json/hypervisor_client.py index d78cc5e97..a4ec60634 100644 --- a/tempest/services/compute/v3/json/hypervisor_client.py +++ b/tempest/services/compute/v3/json/hypervisor_client.py @@ -16,15 +16,18 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class HypervisorV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HypervisorV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HypervisorV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def get_hypervisor_list(self): """List hypervisors information.""" diff --git a/tempest/services/compute/v3/json/instance_usage_audit_log_client.py b/tempest/services/compute/v3/json/instance_usage_audit_log_client.py index c5fba4883..b51f4903b 100644 --- a/tempest/services/compute/v3/json/instance_usage_audit_log_client.py +++ b/tempest/services/compute/v3/json/instance_usage_audit_log_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class InstanceUsagesAuditLogV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(InstanceUsagesAuditLogV3ClientJSON, self).__init__( - config, username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + username, password, auth_url, tenant_name) + self.service = CONF.compute.catalog_v3_type def list_instance_usage_audit_logs(self, time_before=None): if time_before: diff --git a/tempest/services/compute/v3/json/interfaces_client.py b/tempest/services/compute/v3/json/interfaces_client.py index 7fb0fa97b..8f0760cdb 100644 --- a/tempest/services/compute/v3/json/interfaces_client.py +++ b/tempest/services/compute/v3/json/interfaces_client.py @@ -17,16 +17,19 @@ import json import time from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class InterfacesV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(InterfacesV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(InterfacesV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_interfaces(self, server): resp, body = self.get('servers/%s/os-attach-interfaces' % server) diff --git a/tempest/services/compute/v3/json/keypairs_client.py b/tempest/services/compute/v3/json/keypairs_client.py index 26018aeff..c2efb84f7 100644 --- a/tempest/services/compute/v3/json/keypairs_client.py +++ b/tempest/services/compute/v3/json/keypairs_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class KeyPairsV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(KeyPairsV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(KeyPairsV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_keypairs(self): resp, body = self.get("keypairs") diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py index 0f0fd0083..ea0d3a2cc 100644 --- a/tempest/services/compute/v3/json/quotas_client.py +++ b/tempest/services/compute/v3/json/quotas_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class QuotasV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(QuotasV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(QuotasV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def get_quota_set(self, tenant_id): """List the quota set for a tenant.""" diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py index ef282fa6d..aa8c95aee 100644 --- a/tempest/services/compute/v3/json/servers_client.py +++ b/tempest/services/compute/v3/json/servers_client.py @@ -21,17 +21,20 @@ import urllib from tempest.common.rest_client import RestClient from tempest.common import waiters +from tempest import config from tempest import exceptions +CONF = config.CONF + class ServersV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, + def __init__(self, username, password, auth_url, tenant_name=None, auth_version='v2'): - super(ServersV3ClientJSON, self).__init__(config, username, password, + super(ServersV3ClientJSON, self).__init__(username, password, auth_url, tenant_name, auth_version=auth_version) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def create_server(self, name, image_ref, flavor_ref, **kwargs): """ diff --git a/tempest/services/compute/v3/json/services_client.py b/tempest/services/compute/v3/json/services_client.py index e0c1c3c0d..174a4f7d7 100644 --- a/tempest/services/compute/v3/json/services_client.py +++ b/tempest/services/compute/v3/json/services_client.py @@ -18,14 +18,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ServicesV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ServicesV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ServicesV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def list_services(self, params=None): url = 'os-services' diff --git a/tempest/services/compute/v3/json/tenant_usages_client.py b/tempest/services/compute/v3/json/tenant_usages_client.py index ff0251d7f..fbc41deb2 100644 --- a/tempest/services/compute/v3/json/tenant_usages_client.py +++ b/tempest/services/compute/v3/json/tenant_usages_client.py @@ -17,14 +17,17 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class TenantUsagesV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(TenantUsagesV3ClientJSON, self).__init__( - config, username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + username, password, auth_url, tenant_name) + self.service = CONF.compute.catalog_v3_type def list_tenant_usages(self, params=None): url = 'os-simple-tenant-usage' diff --git a/tempest/services/compute/v3/json/version_client.py b/tempest/services/compute/v3/json/version_client.py index 1773af58a..419bbb828 100644 --- a/tempest/services/compute/v3/json/version_client.py +++ b/tempest/services/compute/v3/json/version_client.py @@ -16,15 +16,18 @@ import json from tempest.common import rest_client +from tempest import config + +CONF = config.CONF class VersionV3ClientJSON(rest_client.RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VersionV3ClientJSON, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VersionV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_v3_type + self.service = CONF.compute.catalog_v3_type def get_version(self): resp, body = self.get('') diff --git a/tempest/services/compute/xml/aggregates_client.py b/tempest/services/compute/xml/aggregates_client.py index 164a96329..ddef18be5 100644 --- a/tempest/services/compute/xml/aggregates_client.py +++ b/tempest/services/compute/xml/aggregates_client.py @@ -16,19 +16,22 @@ from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class AggregatesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AggregatesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AggregatesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _format_aggregate(self, g): agg = xml_to_json(g) diff --git a/tempest/services/compute/xml/availability_zone_client.py b/tempest/services/compute/xml/availability_zone_client.py index 4024d2929..ac1bb4b76 100644 --- a/tempest/services/compute/xml/availability_zone_client.py +++ b/tempest/services/compute/xml/availability_zone_client.py @@ -16,16 +16,19 @@ from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class AvailabilityZoneClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AvailabilityZoneClientXML, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AvailabilityZoneClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): return [xml_to_json(x) for x in node] diff --git a/tempest/services/compute/xml/certificates_client.py b/tempest/services/compute/xml/certificates_client.py index 682f8deb7..3f2438dad 100644 --- a/tempest/services/compute/xml/certificates_client.py +++ b/tempest/services/compute/xml/certificates_client.py @@ -15,14 +15,17 @@ from tempest.common.rest_client import RestClientXML +from tempest import config + +CONF = config.CONF class CertificatesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(CertificatesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(CertificatesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_certificate(self, id): url = "os-certificates/%s" % (id) diff --git a/tempest/services/compute/xml/extensions_client.py b/tempest/services/compute/xml/extensions_client.py index b2ab9da75..98cd3e324 100644 --- a/tempest/services/compute/xml/extensions_client.py +++ b/tempest/services/compute/xml/extensions_client.py @@ -14,16 +14,20 @@ # under the License. from lxml import etree + from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class ExtensionsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ExtensionsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ExtensionsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): array = [] diff --git a/tempest/services/compute/xml/fixed_ips_client.py b/tempest/services/compute/xml/fixed_ips_client.py index 53482c1fe..f212e2137 100644 --- a/tempest/services/compute/xml/fixed_ips_client.py +++ b/tempest/services/compute/xml/fixed_ips_client.py @@ -15,17 +15,20 @@ from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text +CONF = config.CONF + class FixedIPsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FixedIPsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FixedIPsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_fixed_ip_details(self, fixed_ip): url = "os-fixed-ips/%s" % (fixed_ip) diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py index b7e63e6e9..74c0e4785 100644 --- a/tempest/services/compute/xml/flavors_client.py +++ b/tempest/services/compute/xml/flavors_client.py @@ -18,12 +18,14 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF XMLNS_OS_FLV_EXT_DATA = \ "http://docs.openstack.org/compute/ext/flavor_extra_data/api/v1.1" @@ -33,10 +35,10 @@ XMLNS_OS_FLV_ACCESS = \ class FlavorsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FlavorsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FlavorsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _format_flavor(self, f): flavor = {'links': []} diff --git a/tempest/services/compute/xml/floating_ips_client.py b/tempest/services/compute/xml/floating_ips_client.py index de78b1ed3..bbfe86b99 100644 --- a/tempest/services/compute/xml/floating_ips_client.py +++ b/tempest/services/compute/xml/floating_ips_client.py @@ -17,18 +17,21 @@ from lxml import etree import urllib from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class FloatingIPsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(FloatingIPsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(FloatingIPsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): array = [] diff --git a/tempest/services/compute/xml/hosts_client.py b/tempest/services/compute/xml/hosts_client.py index e7931a37a..441be0e39 100644 --- a/tempest/services/compute/xml/hosts_client.py +++ b/tempest/services/compute/xml/hosts_client.py @@ -16,17 +16,20 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class HostsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HostsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HostsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_hosts(self, params=None): """Lists all hosts.""" diff --git a/tempest/services/compute/xml/hypervisor_client.py b/tempest/services/compute/xml/hypervisor_client.py index e988a366f..bee2dfdca 100644 --- a/tempest/services/compute/xml/hypervisor_client.py +++ b/tempest/services/compute/xml/hypervisor_client.py @@ -16,16 +16,19 @@ from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class HypervisorClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(HypervisorClientXML, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(HypervisorClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): return [xml_to_json(x) for x in node] diff --git a/tempest/services/compute/xml/images_client.py b/tempest/services/compute/xml/images_client.py index 6c5a14cd7..98de7df84 100644 --- a/tempest/services/compute/xml/images_client.py +++ b/tempest/services/compute/xml/images_client.py @@ -19,6 +19,7 @@ from lxml import etree from tempest.common.rest_client import RestClientXML from tempest.common import waiters +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element @@ -26,15 +27,17 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class ImagesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ImagesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ImagesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.compute.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def _parse_server(self, node): data = xml_to_json(node) diff --git a/tempest/services/compute/xml/instance_usage_audit_log_client.py b/tempest/services/compute/xml/instance_usage_audit_log_client.py index 473ecd1f5..2e1d6c87e 100644 --- a/tempest/services/compute/xml/instance_usage_audit_log_client.py +++ b/tempest/services/compute/xml/instance_usage_audit_log_client.py @@ -16,15 +16,18 @@ from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class InstanceUsagesAuditLogClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(InstanceUsagesAuditLogClientXML, self).__init__( - config, username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + username, password, auth_url, tenant_name) + self.service = CONF.compute.catalog_type def list_instance_usage_audit_logs(self): url = 'os-instance_usage_audit_log' diff --git a/tempest/services/compute/xml/interfaces_client.py b/tempest/services/compute/xml/interfaces_client.py index a84e0bd03..c90f507ac 100644 --- a/tempest/services/compute/xml/interfaces_client.py +++ b/tempest/services/compute/xml/interfaces_client.py @@ -18,19 +18,22 @@ import time from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class InterfacesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(InterfacesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(InterfacesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _process_xml_interface(self, node): iface = xml_to_json(node) diff --git a/tempest/services/compute/xml/keypairs_client.py b/tempest/services/compute/xml/keypairs_client.py index 57c4dda84..da3303ee1 100644 --- a/tempest/services/compute/xml/keypairs_client.py +++ b/tempest/services/compute/xml/keypairs_client.py @@ -15,19 +15,23 @@ from lxml import etree + from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class KeyPairsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(KeyPairsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(KeyPairsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_keypairs(self): resp, body = self.get("os-keypairs", self.headers) diff --git a/tempest/services/compute/xml/limits_client.py b/tempest/services/compute/xml/limits_client.py index 785d54635..923369774 100644 --- a/tempest/services/compute/xml/limits_client.py +++ b/tempest/services/compute/xml/limits_client.py @@ -16,16 +16,19 @@ from lxml import objectify from tempest.common.rest_client import RestClientXML +from tempest import config + +CONF = config.CONF NS = "{http://docs.openstack.org/common/api/v1.0}" class LimitsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(LimitsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(LimitsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def get_absolute_limits(self): resp, body = self.get("limits", self.headers) diff --git a/tempest/services/compute/xml/quotas_client.py b/tempest/services/compute/xml/quotas_client.py index f157dfbff..74aad1b25 100644 --- a/tempest/services/compute/xml/quotas_client.py +++ b/tempest/services/compute/xml/quotas_client.py @@ -16,18 +16,21 @@ from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class QuotasClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(QuotasClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(QuotasClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _format_quota(self, q): quota = {} diff --git a/tempest/services/compute/xml/security_groups_client.py b/tempest/services/compute/xml/security_groups_client.py index 498922b37..c32a81eab 100644 --- a/tempest/services/compute/xml/security_groups_client.py +++ b/tempest/services/compute/xml/security_groups_client.py @@ -17,6 +17,7 @@ from lxml import etree import urllib from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element @@ -24,14 +25,16 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class SecurityGroupsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): + def __init__(self, username, password, auth_url, tenant_name=None): super(SecurityGroupsClientXML, self).__init__( - config, username, password, + username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): array = [] diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py index 63492b773..68268a12b 100644 --- a/tempest/services/compute/xml/servers_client.py +++ b/tempest/services/compute/xml/servers_client.py @@ -21,6 +21,7 @@ from lxml import etree from tempest.common.rest_client import RestClientXML from tempest.common import waiters +from tempest import config from tempest import exceptions from tempest.openstack.common import log as logging from tempest.services.compute.xml.common import Document @@ -29,6 +30,7 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF LOG = logging.getLogger(__name__) @@ -139,12 +141,12 @@ def _translate_server_xml_to_json(xml_dom): class ServersClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None, + def __init__(self, username, password, auth_url, tenant_name=None, auth_version='v2'): - super(ServersClientXML, self).__init__(config, username, password, + super(ServersClientXML, self).__init__(username, password, auth_url, tenant_name, auth_version=auth_version) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_key_value(self, node): """Parse value data into {'key': 'value'}.""" diff --git a/tempest/services/compute/xml/services_client.py b/tempest/services/compute/xml/services_client.py index 8ef0aa88d..bfc824d23 100644 --- a/tempest/services/compute/xml/services_client.py +++ b/tempest/services/compute/xml/services_client.py @@ -17,18 +17,22 @@ import urllib from lxml import etree + from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class ServicesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ServicesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ServicesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def list_services(self, params=None): url = 'os-services' diff --git a/tempest/services/compute/xml/tenant_usages_client.py b/tempest/services/compute/xml/tenant_usages_client.py index dfa4a9fbe..ae813a62f 100644 --- a/tempest/services/compute/xml/tenant_usages_client.py +++ b/tempest/services/compute/xml/tenant_usages_client.py @@ -18,16 +18,19 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class TenantUsagesClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(TenantUsagesClientXML, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(TenantUsagesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type + self.service = CONF.compute.catalog_type def _parse_array(self, node): json = xml_to_json(node) diff --git a/tempest/services/compute/xml/volumes_extensions_client.py b/tempest/services/compute/xml/volumes_extensions_client.py index cb6cefcfe..d6723e178 100644 --- a/tempest/services/compute/xml/volumes_extensions_client.py +++ b/tempest/services/compute/xml/volumes_extensions_client.py @@ -19,6 +19,7 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element @@ -26,16 +27,17 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class VolumesExtensionsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumesExtensionsClientXML, self).__init__(config, - username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumesExtensionsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.compute.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.compute.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def _parse_volume(self, body): vol = dict((attr, body.get(attr)) for attr in body.keys()) diff --git a/tempest/services/data_processing/v1_1/client.py b/tempest/services/data_processing/v1_1/client.py index bd147e8d8..a1d558acd 100644 --- a/tempest/services/data_processing/v1_1/client.py +++ b/tempest/services/data_processing/v1_1/client.py @@ -16,13 +16,16 @@ import json from tempest.common import rest_client +from tempest import config + +CONF = config.CONF class DataProcessingClient(rest_client.RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(DataProcessingClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(DataProcessingClient, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.data_processing.catalog_type + self.service = CONF.data_processing.catalog_type @classmethod def _request_and_parse(cls, req_fun, uri, res_name, *args, **kwargs): diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py index a0411dc91..1ed7044bf 100644 --- a/tempest/services/identity/json/identity_client.py +++ b/tempest/services/identity/json/identity_client.py @@ -14,15 +14,18 @@ import json from tempest.common import http from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class IdentityClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(IdentityClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(IdentityClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def has_admin_extensions(self): @@ -239,8 +242,8 @@ class IdentityClientJSON(RestClient): class TokenClientJSON(RestClient): - def __init__(self, config): - auth_url = config.identity.uri + def __init__(self): + auth_url = CONF.identity.uri # TODO(jaypipes) Why is this all repeated code in here? # Normalize URI to ensure /tokens is in it. @@ -248,7 +251,6 @@ class TokenClientJSON(RestClient): auth_url = auth_url.rstrip('/') + '/tokens' self.auth_url = auth_url - self.config = config def auth(self, user, password, tenant): creds = { @@ -267,7 +269,7 @@ class TokenClientJSON(RestClient): def request(self, method, url, headers=None, body=None): """A simple HTTP request interface.""" - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) if headers is None: diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py index dccb9a022..1250d7976 100644 --- a/tempest/services/identity/v3/json/credentials_client.py +++ b/tempest/services/identity/v3/json/credentials_client.py @@ -17,14 +17,17 @@ import json from urlparse import urlparse from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class CredentialsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(CredentialsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(CredentialsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): diff --git a/tempest/services/identity/v3/json/endpoints_client.py b/tempest/services/identity/v3/json/endpoints_client.py index 124f498f4..bb2230bf6 100644 --- a/tempest/services/identity/v3/json/endpoints_client.py +++ b/tempest/services/identity/v3/json/endpoints_client.py @@ -17,15 +17,17 @@ import json import urlparse from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class EndPointClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(EndPointClientJSON, self).__init__(config, - username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(EndPointClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py index c89fbccdc..7dd5c6e5b 100644 --- a/tempest/services/identity/v3/json/identity_client.py +++ b/tempest/services/identity/v3/json/identity_client.py @@ -17,14 +17,17 @@ import json from urlparse import urlparse from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class IdentityV3ClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(IdentityV3ClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(IdentityV3ClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): @@ -459,19 +462,18 @@ class IdentityV3ClientJSON(RestClient): class V3TokenClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(V3TokenClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(V3TokenClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' - auth_url = config.identity.uri + auth_url = CONF.identity.uri if 'tokens' not in auth_url: auth_url = auth_url.rstrip('/') + '/tokens' self.auth_url = auth_url - self.config = config def auth(self, user_id, password): creds = { diff --git a/tempest/services/identity/v3/json/policy_client.py b/tempest/services/identity/v3/json/policy_client.py index 9ce6d5b54..3d98d99bb 100644 --- a/tempest/services/identity/v3/json/policy_client.py +++ b/tempest/services/identity/v3/json/policy_client.py @@ -17,14 +17,17 @@ import json from urlparse import urlparse from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class PolicyClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(PolicyClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(PolicyClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py index e60e7e332..57b6e9e9b 100644 --- a/tempest/services/identity/v3/json/service_client.py +++ b/tempest/services/identity/v3/json/service_client.py @@ -17,14 +17,17 @@ import json from urlparse import urlparse from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ServiceClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ServiceClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ServiceClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): diff --git a/tempest/services/identity/v3/xml/credentials_client.py b/tempest/services/identity/v3/xml/credentials_client.py index 4344db190..c8cdce7f0 100644 --- a/tempest/services/identity/v3/xml/credentials_client.py +++ b/tempest/services/identity/v3/xml/credentials_client.py @@ -19,21 +19,23 @@ from urlparse import urlparse from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF XMLNS = "http://docs.openstack.org/identity/api/v3" class CredentialsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(CredentialsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(CredentialsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def request(self, method, url, headers=None, body=None, wait=None): diff --git a/tempest/services/identity/v3/xml/endpoints_client.py b/tempest/services/identity/v3/xml/endpoints_client.py index bd2367444..e1df3a9b8 100644 --- a/tempest/services/identity/v3/xml/endpoints_client.py +++ b/tempest/services/identity/v3/xml/endpoints_client.py @@ -18,19 +18,22 @@ from lxml import etree from tempest.common import http from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + XMLNS = "http://docs.openstack.org/identity/api/v3" class EndPointClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(EndPointClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(EndPointClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def _parse_array(self, node): @@ -47,7 +50,7 @@ class EndPointClientXML(RestClientXML): def request(self, method, url, headers=None, body=None, wait=None): """Overriding the existing HTTP request in super class RestClient.""" - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) self._set_auth() diff --git a/tempest/services/identity/v3/xml/identity_client.py b/tempest/services/identity/v3/xml/identity_client.py index 579ddb89c..de75fe586 100644 --- a/tempest/services/identity/v3/xml/identity_client.py +++ b/tempest/services/identity/v3/xml/identity_client.py @@ -18,20 +18,23 @@ from urlparse import urlparse from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + XMLNS = "http://docs.openstack.org/identity/api/v3" class IdentityV3ClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(IdentityV3ClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(IdentityV3ClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def _parse_projects(self, node): @@ -451,19 +454,18 @@ class IdentityV3ClientXML(RestClientXML): class V3TokenClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(V3TokenClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(V3TokenClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' - auth_url = config.identity.uri + auth_url = CONF.identity.uri if 'tokens' not in auth_url: auth_url = auth_url.rstrip('/') + '/tokens' self.auth_url = auth_url - self.config = config def auth(self, user_id, password): user = Element('user', diff --git a/tempest/services/identity/v3/xml/policy_client.py b/tempest/services/identity/v3/xml/policy_client.py index 73177280e..54b4ad819 100644 --- a/tempest/services/identity/v3/xml/policy_client.py +++ b/tempest/services/identity/v3/xml/policy_client.py @@ -19,19 +19,22 @@ from lxml import etree from tempest.common import http from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + XMLNS = "http://docs.openstack.org/identity/api/v3" class PolicyClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(PolicyClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(PolicyClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def _parse_array(self, node): @@ -48,7 +51,7 @@ class PolicyClientXML(RestClientXML): def request(self, method, url, headers=None, body=None, wait=None): """Overriding the existing HTTP request in super class RestClient.""" - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) self._set_auth() diff --git a/tempest/services/identity/v3/xml/service_client.py b/tempest/services/identity/v3/xml/service_client.py index a142b0684..299777591 100644 --- a/tempest/services/identity/v3/xml/service_client.py +++ b/tempest/services/identity/v3/xml/service_client.py @@ -18,20 +18,22 @@ from urlparse import urlparse from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF XMLNS = "http://docs.openstack.org/identity/api/v3" class ServiceClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ServiceClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ServiceClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def _parse_array(self, node): diff --git a/tempest/services/identity/xml/identity_client.py b/tempest/services/identity/xml/identity_client.py index 6e819d83f..e6a7188a9 100644 --- a/tempest/services/identity/xml/identity_client.py +++ b/tempest/services/identity/xml/identity_client.py @@ -19,21 +19,23 @@ from lxml import etree from tempest.common import http from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF XMLNS = "http://docs.openstack.org/identity/api/v2.0" class IdentityClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(IdentityClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(IdentityClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.identity.catalog_type + self.service = CONF.identity.catalog_type self.endpoint_url = 'adminURL' def _parse_array(self, node): @@ -263,8 +265,8 @@ class IdentityClientXML(RestClientXML): class TokenClientXML(RestClientXML): - def __init__(self, config): - auth_url = config.identity.uri + def __init__(self): + auth_url = CONF.identity.uri # TODO(jaypipes) Why is this all repeated code in here? # Normalize URI to ensure /tokens is in it. @@ -272,7 +274,6 @@ class TokenClientXML(RestClientXML): auth_url = auth_url.rstrip('/') + '/tokens' self.auth_url = auth_url - self.config = config def auth(self, user, password, tenant): passwordCreds = Element("passwordCredentials", @@ -287,7 +288,7 @@ class TokenClientXML(RestClientXML): def request(self, method, url, headers=None, body=None): """A simple HTTP request interface.""" - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) if headers is None: diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/image_client.py index aa6abd02d..a5b93a024 100644 --- a/tempest/services/image/v1/json/image_client.py +++ b/tempest/services/image/v1/json/image_client.py @@ -22,19 +22,22 @@ import urllib from tempest.common import glance_http from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions from tempest.openstack.common import log as logging +CONF = config.CONF + LOG = logging.getLogger(__name__) class ImageClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ImageClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ImageClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.images.catalog_type - if config.service_available.glance: + self.service = CONF.images.catalog_type + if CONF.service_available.glance: self.http = self._get_http() def _image_meta_from_headers(self, headers): @@ -108,7 +111,7 @@ class ImageClientJSON(RestClient): self.auth_url, self.service, self.tenant_name) - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation return glance_http.HTTPClient(endpoint=endpoint, token=token, insecure=dscv) diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py index 3a7969554..0c4fb5c30 100644 --- a/tempest/services/image/v2/json/image_client.py +++ b/tempest/services/image/v2/json/image_client.py @@ -20,23 +20,26 @@ import jsonschema from tempest.common import glance_http from tempest.common import rest_client +from tempest import config from tempest import exceptions +CONF = config.CONF + class ImageClientV2JSON(rest_client.RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ImageClientV2JSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ImageClientV2JSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.images.catalog_type - if config.service_available.glance: + self.service = CONF.images.catalog_type + if CONF.service_available.glance: self.http = self._get_http() def _get_http(self): token, endpoint = self.keystone_auth(self.user, self.password, self.auth_url, self.service, self.tenant_name) - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation return glance_http.HTTPClient(endpoint=endpoint, token=token, insecure=dscv) diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py index 47c20d216..9908816f0 100644 --- a/tempest/services/network/json/network_client.py +++ b/tempest/services/network/json/network_client.py @@ -31,9 +31,9 @@ class NetworkClientJSON(network_client_base.NetworkClientBase): quotas """ - def get_rest_client(self, config, username, + def get_rest_client(self, username, password, auth_url, tenant_name=None): - return RestClient(config, username, password, auth_url, tenant_name) + return RestClient(username, password, auth_url, tenant_name) def deserialize_single(self, body): return json.loads(body) diff --git a/tempest/services/network/network_client_base.py b/tempest/services/network/network_client_base.py index f4a012f69..467256edf 100644 --- a/tempest/services/network/network_client_base.py +++ b/tempest/services/network/network_client_base.py @@ -12,6 +12,10 @@ import urllib +from tempest import config + +CONF = config.CONF + # the following map is used to construct proper URI # for the given neutron resource service_resource_prefix_map = { @@ -42,15 +46,15 @@ resource_plural_map = { class NetworkClientBase(object): - def __init__(self, config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): self.rest_client = self.get_rest_client( - config, username, password, auth_url, tenant_name) - self.rest_client.service = self.rest_client.config.network.catalog_type + username, password, auth_url, tenant_name) + self.rest_client.service = CONF.network.catalog_type self.version = '2.0' self.uri_prefix = "v%s" % (self.version) - def get_rest_client(self, config, username, password, + def get_rest_client(self, username, password, auth_url, tenant_name): raise NotImplementedError diff --git a/tempest/services/network/xml/network_client.py b/tempest/services/network/xml/network_client.py index b8e39ad88..4eb38beeb 100644 --- a/tempest/services/network/xml/network_client.py +++ b/tempest/services/network/xml/network_client.py @@ -28,9 +28,9 @@ class NetworkClientXML(client_base.NetworkClientBase): PLURALS = ['dns_nameservers', 'host_routes', 'allocation_pools', 'fixed_ips', 'extensions'] - def get_rest_client(self, config, username, password, + def get_rest_client(self, username, password, auth_url, tenant_name=None): - return RestClientXML(config, username, password, + return RestClientXML(username, password, auth_url, tenant_name) def _parse_array(self, node): diff --git a/tempest/services/object_storage/account_client.py b/tempest/services/object_storage/account_client.py index a6f47b79b..4c5b83206 100644 --- a/tempest/services/object_storage/account_client.py +++ b/tempest/services/object_storage/account_client.py @@ -18,14 +18,17 @@ import urllib from tempest.common import http from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class AccountClient(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AccountClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AccountClient, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.object_storage.catalog_type + self.service = CONF.object_storage.catalog_type self.format = 'json' def list_account_metadata(self): @@ -102,12 +105,12 @@ class AccountClient(RestClient): class AccountClientCustomizedHeader(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(AccountClientCustomizedHeader, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(AccountClientCustomizedHeader, self).__init__(username, password, auth_url, tenant_name) # Overwrites json-specific header encoding in RestClient - self.service = self.config.object_storage.catalog_type + self.service = CONF.object_storage.catalog_type self.format = 'json' def request(self, method, url, headers=None, body=None): diff --git a/tempest/services/object_storage/container_client.py b/tempest/services/object_storage/container_client.py index cbd07bfce..430858953 100644 --- a/tempest/services/object_storage/container_client.py +++ b/tempest/services/object_storage/container_client.py @@ -17,16 +17,19 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ContainerClient(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ContainerClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ContainerClient, self).__init__(username, password, auth_url, tenant_name) # Overwrites json-specific header encoding in RestClient self.headers = {} - self.service = self.config.object_storage.catalog_type + self.service = CONF.object_storage.catalog_type self.format = 'json' def create_container(self, container_name, metadata=None, diff --git a/tempest/services/object_storage/object_client.py b/tempest/services/object_storage/object_client.py index 1304a03b6..2a68a4f61 100644 --- a/tempest/services/object_storage/object_client.py +++ b/tempest/services/object_storage/object_client.py @@ -17,15 +17,18 @@ import urllib from tempest.common import http from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class ObjectClient(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ObjectClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ObjectClient, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.object_storage.catalog_type + self.service = CONF.object_storage.catalog_type def create_object(self, container, object_name, data, params=None): """Create storage object.""" @@ -135,17 +138,17 @@ class ObjectClient(RestClient): class ObjectClientCustomizedHeader(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ObjectClientCustomizedHeader, self).__init__(config, username, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ObjectClientCustomizedHeader, self).__init__(username, password, auth_url, tenant_name) # Overwrites json-specific header encoding in RestClient - self.service = self.config.object_storage.catalog_type + self.service = CONF.object_storage.catalog_type self.format = 'json' def request(self, method, url, headers=None, body=None): """A simple HTTP request interface.""" - dscv = self.config.identity.disable_ssl_certificate_validation + dscv = CONF.identity.disable_ssl_certificate_validation self.http_obj = http.ClosingHttp( disable_ssl_certificate_validation=dscv) if headers is None: diff --git a/tempest/services/orchestration/json/orchestration_client.py b/tempest/services/orchestration/json/orchestration_client.py index 20f1b06e5..273c2ae4d 100644 --- a/tempest/services/orchestration/json/orchestration_client.py +++ b/tempest/services/orchestration/json/orchestration_client.py @@ -19,17 +19,20 @@ import time import urllib from tempest.common import rest_client +from tempest import config from tempest import exceptions +CONF = config.CONF + class OrchestrationClient(rest_client.RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(OrchestrationClient, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(OrchestrationClient, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.orchestration.catalog_type - self.build_interval = self.config.orchestration.build_interval - self.build_timeout = self.config.orchestration.build_timeout + self.service = CONF.orchestration.catalog_type + self.build_interval = CONF.orchestration.build_interval + self.build_timeout = CONF.orchestration.build_timeout def list_stacks(self, params=None): """Lists all stacks for a user.""" diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py index d8662e957..a1112da73 100644 --- a/tempest/services/telemetry/json/telemetry_client.py +++ b/tempest/services/telemetry/json/telemetry_client.py @@ -20,9 +20,9 @@ import tempest.services.telemetry.telemetry_client_base as client class TelemetryClientJSON(client.TelemetryClientBase): - def get_rest_client(self, config, username, + def get_rest_client(self, username, password, auth_url, tenant_name=None): - return RestClient(config, username, password, auth_url, tenant_name) + return RestClient(username, password, auth_url, tenant_name) def deserialize(self, body): return json.loads(body.replace("\n", "")) diff --git a/tempest/services/telemetry/telemetry_client_base.py b/tempest/services/telemetry/telemetry_client_base.py index 883bf333b..24039c61c 100644 --- a/tempest/services/telemetry/telemetry_client_base.py +++ b/tempest/services/telemetry/telemetry_client_base.py @@ -17,6 +17,10 @@ import abc import six import urllib +from tempest import config + +CONF = config.CONF + @six.add_metaclass(abc.ABCMeta) class TelemetryClientBase(object): @@ -31,17 +35,16 @@ class TelemetryClientBase(object): statistics """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - self.rest_client = self.get_rest_client(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + self.rest_client = self.get_rest_client(username, password, auth_url, tenant_name) - self.rest_client.service = \ - self.rest_client.config.telemetry.catalog_type + self.rest_client.service = CONF.telemetry.catalog_type self.headers = self.rest_client.headers self.version = '2' self.uri_prefix = "v%s" % self.version @abc.abstractmethod - def get_rest_client(self, config, username, password, + def get_rest_client(self, username, password, auth_url, tenant_name): """ :param config: diff --git a/tempest/services/telemetry/xml/telemetry_client.py b/tempest/services/telemetry/xml/telemetry_client.py index ac5fa3227..862d08f31 100644 --- a/tempest/services/telemetry/xml/telemetry_client.py +++ b/tempest/services/telemetry/xml/telemetry_client.py @@ -23,9 +23,9 @@ import tempest.services.telemetry.telemetry_client_base as client class TelemetryClientXML(client.TelemetryClientBase): - def get_rest_client(self, config, username, + def get_rest_client(self, username, password, auth_url, tenant_name=None): - return RestClientXML(config, username, password, auth_url, tenant_name) + return RestClientXML(username, password, auth_url, tenant_name) def _parse_array(self, body): array = [] diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py index c9a522a85..e4178b91e 100644 --- a/tempest/services/volume/json/admin/volume_hosts_client.py +++ b/tempest/services/volume/json/admin/volume_hosts_client.py @@ -17,6 +17,9 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class VolumeHostsClientJSON(RestClient): @@ -24,13 +27,13 @@ class VolumeHostsClientJSON(RestClient): Client class to send CRUD Volume Hosts API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumeHostsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumeHostsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def list_hosts(self, params=None): """Lists all hosts.""" diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py index 4ab9b701d..5b6328be6 100644 --- a/tempest/services/volume/json/admin/volume_types_client.py +++ b/tempest/services/volume/json/admin/volume_types_client.py @@ -17,6 +17,9 @@ import json import urllib from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class VolumeTypesClientJSON(RestClient): @@ -24,13 +27,13 @@ class VolumeTypesClientJSON(RestClient): Client class to send CRUD Volume Types API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumeTypesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumeTypesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def list_volume_types(self, params=None): """List all the volume_types created.""" diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py index bdd5f1e76..c3bbb2093 100644 --- a/tempest/services/volume/json/extensions_client.py +++ b/tempest/services/volume/json/extensions_client.py @@ -16,14 +16,17 @@ import json from tempest.common.rest_client import RestClient +from tempest import config + +CONF = config.CONF class ExtensionsClientJSON(RestClient): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ExtensionsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ExtensionsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type + self.service = CONF.volume.catalog_type def list_extensions(self): url = 'extensions' diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py index 1a34898f9..a36083b77 100644 --- a/tempest/services/volume/json/snapshots_client.py +++ b/tempest/services/volume/json/snapshots_client.py @@ -15,22 +15,25 @@ import time import urllib from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions from tempest.openstack.common import log as logging +CONF = config.CONF + LOG = logging.getLogger(__name__) class SnapshotsClientJSON(RestClient): """Client class to send CRUD Volume API requests.""" - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(SnapshotsClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(SnapshotsClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def list_snapshots(self, params=None): """List all the snapshot.""" diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py index c99501bc4..6c09e02cb 100644 --- a/tempest/services/volume/json/volumes_client.py +++ b/tempest/services/volume/json/volumes_client.py @@ -18,21 +18,24 @@ import time import urllib from tempest.common.rest_client import RestClient +from tempest import config from tempest import exceptions +CONF = config.CONF + class VolumesClientJSON(RestClient): """ Client class to send CRUD Volume API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumesClientJSON, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumesClientJSON, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def get_attachment_from_volume(self, volume): """Return the element 'attachment' from input volumes.""" diff --git a/tempest/services/volume/xml/admin/volume_hosts_client.py b/tempest/services/volume/xml/admin/volume_hosts_client.py index 31e529f82..39b82e59b 100644 --- a/tempest/services/volume/xml/admin/volume_hosts_client.py +++ b/tempest/services/volume/xml/admin/volume_hosts_client.py @@ -18,20 +18,23 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class VolumeHostsClientXML(RestClientXML): """ Client class to send CRUD Volume Hosts API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumeHostsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumeHostsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def _parse_array(self, node): """ diff --git a/tempest/services/volume/xml/admin/volume_types_client.py b/tempest/services/volume/xml/admin/volume_types_client.py index 12e70d443..942c4e1fe 100644 --- a/tempest/services/volume/xml/admin/volume_types_client.py +++ b/tempest/services/volume/xml/admin/volume_types_client.py @@ -18,6 +18,7 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element @@ -25,18 +26,20 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class VolumeTypesClientXML(RestClientXML): """ Client class to send CRUD Volume Types API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumeTypesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumeTypesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def _parse_volume_type(self, body): vol_type = dict((attr, body.get(attr)) for attr in body.keys()) diff --git a/tempest/services/volume/xml/extensions_client.py b/tempest/services/volume/xml/extensions_client.py index 30997bb8c..a04616d4c 100644 --- a/tempest/services/volume/xml/extensions_client.py +++ b/tempest/services/volume/xml/extensions_client.py @@ -14,16 +14,20 @@ # under the License. from lxml import etree + from tempest.common.rest_client import RestClientXML +from tempest import config from tempest.services.compute.xml.common import xml_to_json +CONF = config.CONF + class ExtensionsClientXML(RestClientXML): - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(ExtensionsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(ExtensionsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type + self.service = CONF.volume.catalog_type def _parse_array(self, node): array = [] diff --git a/tempest/services/volume/xml/snapshots_client.py b/tempest/services/volume/xml/snapshots_client.py index ea2ea271f..3e85041e2 100644 --- a/tempest/services/volume/xml/snapshots_client.py +++ b/tempest/services/volume/xml/snapshots_client.py @@ -16,6 +16,7 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.openstack.common import log as logging from tempest.services.compute.xml.common import Document @@ -24,19 +25,21 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + LOG = logging.getLogger(__name__) class SnapshotsClientXML(RestClientXML): """Client class to send CRUD Volume API requests.""" - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(SnapshotsClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(SnapshotsClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.volume.build_interval - self.build_timeout = self.config.volume.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.volume.build_interval + self.build_timeout = CONF.volume.build_timeout def list_snapshots(self, params=None): """List all snapshot.""" diff --git a/tempest/services/volume/xml/volumes_client.py b/tempest/services/volume/xml/volumes_client.py index 37370b1fb..7adaf4b7d 100644 --- a/tempest/services/volume/xml/volumes_client.py +++ b/tempest/services/volume/xml/volumes_client.py @@ -19,6 +19,7 @@ import urllib from lxml import etree from tempest.common.rest_client import RestClientXML +from tempest import config from tempest import exceptions from tempest.services.compute.xml.common import Document from tempest.services.compute.xml.common import Element @@ -26,18 +27,20 @@ from tempest.services.compute.xml.common import Text from tempest.services.compute.xml.common import xml_to_json from tempest.services.compute.xml.common import XMLNS_11 +CONF = config.CONF + class VolumesClientXML(RestClientXML): """ Client class to send CRUD Volume API requests to a Cinder endpoint """ - def __init__(self, config, username, password, auth_url, tenant_name=None): - super(VolumesClientXML, self).__init__(config, username, password, + def __init__(self, username, password, auth_url, tenant_name=None): + super(VolumesClientXML, self).__init__(username, password, auth_url, tenant_name) - self.service = self.config.volume.catalog_type - self.build_interval = self.config.compute.build_interval - self.build_timeout = self.config.compute.build_timeout + self.service = CONF.volume.catalog_type + self.build_interval = CONF.compute.build_interval + self.build_timeout = CONF.compute.build_timeout def _parse_volume(self, body): vol = dict((attr, body.get(attr)) for attr in body.keys()) diff --git a/tempest/tests/test_rest_client.py b/tempest/tests/test_rest_client.py index acb900040..f3c744007 100644 --- a/tempest/tests/test_rest_client.py +++ b/tempest/tests/test_rest_client.py @@ -15,6 +15,7 @@ import httplib2 from tempest.common import rest_client +from tempest import config from tempest import exceptions from tempest.openstack.common.fixture import mockpatch from tempest.tests import base @@ -29,8 +30,8 @@ class BaseRestClientTestClass(base.TestCase): def setUp(self): super(BaseRestClientTestClass, self).setUp() - self.rest_client = rest_client.RestClient(fake_config.FakeConfig(), - 'fake_user', 'fake_pass', + self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakeConfig) + self.rest_client = rest_client.RestClient('fake_user', 'fake_pass', 'http://fake_url/v2.0') self.stubs.Set(httplib2.Http, 'request', self.fake_http.request) self.useFixture(mockpatch.PatchObject(self.rest_client, '_set_auth',