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
This commit is contained in:
Matthew Treinish 2014-01-30 16:27:40 +00:00
parent e2b56b5713
commit 684d8997bb
97 changed files with 629 additions and 369 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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):

View File

@ -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

View File

@ -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)

View File

@ -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":

View File

@ -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."""

View File

@ -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')

View File

@ -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)

View File

@ -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'

View File

@ -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)

View File

@ -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'

View File

@ -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."""

View File

@ -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."""

View File

@ -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."""

View File

@ -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."""

View File

@ -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'

View File

@ -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)

View File

@ -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")

View File

@ -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")

View File

@ -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."""

View File

@ -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."""

View File

@ -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):
"""

View File

@ -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'

View File

@ -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'

View File

@ -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."""

View File

@ -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."""

View File

@ -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')

View File

@ -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)

View File

@ -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'

View File

@ -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'

View File

@ -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."""

View File

@ -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."""

View File

@ -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:

View File

@ -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)

View File

@ -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")

View File

@ -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."""

View File

@ -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):
"""

View File

@ -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'

View File

@ -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'

View File

@ -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('')

View File

@ -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)

View File

@ -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]

View File

@ -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)

View File

@ -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 = []

View File

@ -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)

View File

@ -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': []}

View File

@ -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 = []

View File

@ -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."""

View File

@ -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]

View File

@ -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)

View File

@ -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'

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 = {}

View File

@ -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 = []

View File

@ -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 <foo key='key'>value</foo> data into {'key': 'value'}."""

View File

@ -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'

View File

@ -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)

View File

@ -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())

View File

@ -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):

View File

@ -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:

View File

@ -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):

View File

@ -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):

View File

@ -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 = {

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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()

View File

@ -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',

View File

@ -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()

View File

@ -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):

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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,

View File

@ -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:

View File

@ -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."""

View File

@ -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", ""))

View File

@ -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:

View File

@ -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 = []

View File

@ -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."""

View File

@ -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."""

View File

@ -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'

View File

@ -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."""

View File

@ -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."""

View File

@ -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):
"""

View File

@ -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())

View File

@ -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 = []

View File

@ -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."""

View File

@ -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())

View File

@ -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',