Remove Nova v3 API clients
Nova v3 API has disappeared, and Tempest isn't testing the API on the
gate now. In addition, Nova team is creating a new REST API "Nova v2.1
API + microversions" and the interfaces are different from v3 API.
So it is not necessary to keep Nova v3 API tests in Tempest.
This patch removes the clients.
Change-Id: I90f48b3adcd94435320de965a3db21eefaa97cda
diff --git a/tempest/clients.py b/tempest/clients.py
index 91dc5f7..261b27c 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -59,33 +59,6 @@
TenantUsagesClientJSON
from tempest.services.compute.json.volumes_extensions_client import \
VolumesExtensionsClientJSON
-from tempest.services.compute.v3.json.agents_client import AgentsV3ClientJSON
-from tempest.services.compute.v3.json.aggregates_client import \
- AggregatesV3ClientJSON
-from tempest.services.compute.v3.json.availability_zone_client import \
- AvailabilityZoneV3ClientJSON
-from tempest.services.compute.v3.json.certificates_client import \
- CertificatesV3ClientJSON
-from tempest.services.compute.v3.json.extensions_client import \
- ExtensionsV3ClientJSON
-from tempest.services.compute.v3.json.flavors_client import FlavorsV3ClientJSON
-from tempest.services.compute.v3.json.hosts_client import HostsV3ClientJSON
-from tempest.services.compute.v3.json.hypervisor_client import \
- HypervisorV3ClientJSON
-from tempest.services.compute.v3.json.interfaces_client import \
- InterfacesV3ClientJSON
-from tempest.services.compute.v3.json.keypairs_client import \
- KeyPairsV3ClientJSON
-from tempest.services.compute.v3.json.migration_client import \
- MigrationsV3ClientJSON
-from tempest.services.compute.v3.json.quotas_client import \
- QuotasV3ClientJSON
-from tempest.services.compute.v3.json.servers_client import \
- ServersV3ClientJSON
-from tempest.services.compute.v3.json.services_client import \
- ServicesV3ClientJSON
-from tempest.services.compute.v3.json.version_client import \
- VersionV3ClientJSON
from tempest.services.data_processing.v1_1.client import DataProcessingClient
from tempest.services.database.json.flavors_client import \
DatabaseFlavorsClientJSON
@@ -224,45 +197,28 @@
def _set_compute_json_clients(self):
self.certificates_client = CertificatesClientJSON(self.auth_provider)
- self.certificates_v3_client = CertificatesV3ClientJSON(
- self.auth_provider)
self.servers_client = ServersClientJSON(self.auth_provider)
- self.servers_v3_client = ServersV3ClientJSON(self.auth_provider)
self.limits_client = LimitsClientJSON(self.auth_provider)
self.images_client = ImagesClientJSON(self.auth_provider)
self.keypairs_client = KeyPairsClientJSON(self.auth_provider)
- self.keypairs_v3_client = KeyPairsV3ClientJSON(self.auth_provider)
self.quotas_client = QuotasClientJSON(self.auth_provider)
self.quota_classes_client = QuotaClassesClientJSON(self.auth_provider)
- self.quotas_v3_client = QuotasV3ClientJSON(self.auth_provider)
self.flavors_client = FlavorsClientJSON(self.auth_provider)
- self.flavors_v3_client = FlavorsV3ClientJSON(self.auth_provider)
self.extensions_client = ExtensionsClientJSON(self.auth_provider)
- self.extensions_v3_client = ExtensionsV3ClientJSON(self.auth_provider)
self.volumes_extensions_client = VolumesExtensionsClientJSON(
self.auth_provider)
self.floating_ips_client = FloatingIPsClientJSON(self.auth_provider)
self.security_groups_client = SecurityGroupsClientJSON(
self.auth_provider)
self.interfaces_client = InterfacesClientJSON(self.auth_provider)
- self.interfaces_v3_client = InterfacesV3ClientJSON(self.auth_provider)
self.fixed_ips_client = FixedIPsClientJSON(self.auth_provider)
self.availability_zone_client = AvailabilityZoneClientJSON(
self.auth_provider)
- self.availability_zone_v3_client = AvailabilityZoneV3ClientJSON(
- self.auth_provider)
- self.services_v3_client = ServicesV3ClientJSON(self.auth_provider)
- self.agents_v3_client = AgentsV3ClientJSON(self.auth_provider)
self.aggregates_client = AggregatesClientJSON(self.auth_provider)
- self.aggregates_v3_client = AggregatesV3ClientJSON(self.auth_provider)
self.services_client = ServicesClientJSON(self.auth_provider)
self.tenant_usages_client = TenantUsagesClientJSON(self.auth_provider)
- self.version_v3_client = VersionV3ClientJSON(self.auth_provider)
- self.migrations_v3_client = MigrationsV3ClientJSON(self.auth_provider)
self.hosts_client = HostsClientJSON(self.auth_provider)
- self.hosts_v3_client = HostsV3ClientJSON(self.auth_provider)
self.hypervisor_client = HypervisorClientJSON(self.auth_provider)
- self.hypervisor_v3_client = HypervisorV3ClientJSON(self.auth_provider)
self.instance_usages_audit_log_client = \
InstanceUsagesAuditLogClientJSON(self.auth_provider)
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 6f74c3e..8707427 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -137,7 +137,6 @@
def get_extension_client(os, service):
extensions_client = {
'nova': os.extensions_client,
- 'nova_v3': os.extensions_v3_client,
'cinder': os.volumes_extension_client,
'neutron': os.network_client,
'swift': os.account_client,
@@ -151,7 +150,6 @@
def get_enabled_extensions(service):
extensions_options = {
'nova': CONF.compute_feature_enabled.api_extensions,
- 'nova_v3': CONF.compute_feature_enabled.api_v3_extensions,
'cinder': CONF.volume_feature_enabled.api_extensions,
'neutron': CONF.network_feature_enabled.api_extensions,
'swift': CONF.object_storage_feature_enabled.discoverable_apis,
@@ -199,7 +197,6 @@
update_dict = {
'swift': 'object-storage-feature-enabled',
'nova': 'compute-feature-enabled',
- 'nova_v3': 'compute-feature-enabled',
'cinder': 'volume-feature-enabled',
'neutron': 'network-feature-enabled',
}
@@ -234,9 +231,6 @@
if service == 'swift':
change_option('discoverable_apis', update_dict[service],
output_string)
- elif service == 'nova_v3':
- change_option('api_v3_extensions', update_dict[service],
- output_string)
else:
change_option('api_extensions', update_dict[service],
output_string)
@@ -341,10 +335,8 @@
os = clients.ComputeAdminManager(interface='json')
services = check_service_availability(os, update)
results = {}
- for service in ['nova', 'nova_v3', 'cinder', 'neutron', 'swift']:
- if service == 'nova_v3' and 'nova' not in services:
- continue
- elif service not in services:
+ for service in ['nova', 'cinder', 'neutron', 'swift']:
+ if service not in services:
continue
results = verify_extensions(os, service, results)
diff --git a/tempest/services/compute/v3/__init__.py b/tempest/services/compute/v3/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/services/compute/v3/__init__.py
+++ /dev/null
diff --git a/tempest/services/compute/v3/json/__init__.py b/tempest/services/compute/v3/json/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/services/compute/v3/json/__init__.py
+++ /dev/null
diff --git a/tempest/services/compute/v3/json/agents_client.py b/tempest/services/compute/v3/json/agents_client.py
deleted file mode 100644
index ffca142..0000000
--- a/tempest/services/compute/v3/json/agents_client.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import urllib
-
-from tempest.api_schema.response.compute import agents as common_schema
-from tempest.api_schema.response.compute.v3 import agents as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class AgentsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(AgentsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_agents(self, params=None):
- """List all agent builds."""
- url = 'os-agents'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(common_schema.list_agents, resp, body)
- return resp, body['agents']
-
- def create_agent(self, **kwargs):
- """Create an agent build."""
- post_body = json.dumps({'agent': kwargs})
- resp, body = self.post('os-agents', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_agent, resp, body)
- return resp, body['agent']
-
- def delete_agent(self, agent_id):
- """Delete an existing agent build."""
- resp, body = self.delete("os-agents/%s" % str(agent_id))
- self.validate_response(schema.delete_agent, resp, body)
- return resp, body
-
- def update_agent(self, agent_id, **kwargs):
- """Update an agent build."""
- put_body = json.dumps({'agent': kwargs})
- resp, body = self.put('os-agents/%s' % str(agent_id), put_body)
- return resp, self._parse_resp(body)
diff --git a/tempest/services/compute/v3/json/aggregates_client.py b/tempest/services/compute/v3/json/aggregates_client.py
deleted file mode 100644
index e11ed45..0000000
--- a/tempest/services/compute/v3/json/aggregates_client.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# Copyright 2013 NEC Corporation.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute import aggregates as schema
-from tempest.api_schema.response.compute.v3 import aggregates as v3_schema
-from tempest.common import rest_client
-from tempest import config
-from tempest import exceptions
-
-CONF = config.CONF
-
-
-class AggregatesV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(AggregatesV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_aggregates(self):
- """Get aggregate list."""
- resp, body = self.get("os-aggregates")
- body = json.loads(body)
- self.validate_response(schema.list_aggregates, resp, body)
- return resp, body['aggregates']
-
- def get_aggregate(self, aggregate_id):
- """Get details of the given aggregate."""
- resp, body = self.get("os-aggregates/%s" % str(aggregate_id))
- body = json.loads(body)
- self.validate_response(schema.get_aggregate, resp, body)
- return resp, body['aggregate']
-
- def create_aggregate(self, **kwargs):
- """Creates a new aggregate."""
- post_body = json.dumps({'aggregate': kwargs})
- resp, body = self.post('os-aggregates', post_body)
-
- body = json.loads(body)
- self.validate_response(v3_schema.create_aggregate, resp, body)
- return resp, body['aggregate']
-
- def update_aggregate(self, aggregate_id, name, availability_zone=None):
- """Update a aggregate."""
- put_body = {
- 'name': name,
- 'availability_zone': availability_zone
- }
- put_body = json.dumps({'aggregate': put_body})
- resp, body = self.put('os-aggregates/%s' % str(aggregate_id), put_body)
-
- body = json.loads(body)
- self.validate_response(schema.update_aggregate, resp, body)
- return resp, body['aggregate']
-
- def delete_aggregate(self, aggregate_id):
- """Deletes the given aggregate."""
- resp, body = self.delete("os-aggregates/%s" % str(aggregate_id))
- self.validate_response(v3_schema.delete_aggregate, resp, body)
- return resp, body
-
- def is_resource_deleted(self, id):
- try:
- self.get_aggregate(id)
- except exceptions.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'aggregate'
-
- def add_host(self, aggregate_id, host):
- """Adds a host to the given aggregate."""
- post_body = {
- 'host': host,
- }
- post_body = json.dumps({'add_host': post_body})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(v3_schema.aggregate_add_remove_host, resp, body)
- return resp, body['aggregate']
-
- def remove_host(self, aggregate_id, host):
- """Removes a host from the given aggregate."""
- post_body = {
- 'host': host,
- }
- post_body = json.dumps({'remove_host': post_body})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(v3_schema.aggregate_add_remove_host, resp, body)
- return resp, body['aggregate']
-
- def set_metadata(self, aggregate_id, meta):
- """Replaces the aggregate's existing metadata with new metadata."""
- post_body = {
- 'metadata': meta,
- }
- post_body = json.dumps({'set_metadata': post_body})
- resp, body = self.post('os-aggregates/%s/action' % aggregate_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.aggregate_set_metadata, resp, body)
- return resp, body['aggregate']
diff --git a/tempest/services/compute/v3/json/availability_zone_client.py b/tempest/services/compute/v3/json/availability_zone_client.py
deleted file mode 100644
index 0da78da..0000000
--- a/tempest/services/compute/v3/json/availability_zone_client.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2013 NEC Corporation.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute.v3 import availability_zone as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class AvailabilityZoneV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(AvailabilityZoneV3ClientJSON, self).__init__(
- auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def get_availability_zone_list(self):
- resp, body = self.get('os-availability-zone')
- body = json.loads(body)
- self.validate_response(schema.get_availability_zone_list, resp, body)
- return resp, body['availability_zone_info']
-
- def get_availability_zone_list_detail(self):
- resp, body = self.get('os-availability-zone/detail')
- body = json.loads(body)
- self.validate_response(schema.get_availability_zone_list_detail, resp,
- body)
- return resp, body['availability_zone_info']
diff --git a/tempest/services/compute/v3/json/certificates_client.py b/tempest/services/compute/v3/json/certificates_client.py
deleted file mode 100644
index 42e9d5a..0000000
--- a/tempest/services/compute/v3/json/certificates_client.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2013 IBM Corp
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute import certificates as schema
-from tempest.api_schema.response.compute.v3 import certificates as v3schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class CertificatesV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(CertificatesV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def get_certificate(self, id):
- url = "os-certificates/%s" % (id)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_certificate, resp, body)
- return resp, body['certificate']
-
- def create_certificate(self):
- """create certificates."""
- url = "os-certificates"
- resp, body = self.post(url, None)
- body = json.loads(body)
- self.validate_response(v3schema.create_certificate, resp, body)
- return resp, body['certificate']
diff --git a/tempest/services/compute/v3/json/extensions_client.py b/tempest/services/compute/v3/json/extensions_client.py
deleted file mode 100644
index f172efd..0000000
--- a/tempest/services/compute/v3/json/extensions_client.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute.v3 import extensions as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ExtensionsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ExtensionsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_extensions(self):
- url = 'extensions'
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_extensions, resp, body)
- return resp, body['extensions']
-
- def is_enabled(self, extension):
- _, extensions = self.list_extensions()
- exts = extensions['extensions']
- return any([e for e in exts if e['name'] == extension])
-
- def get_extension(self, extension_alias):
- resp, body = self.get('extensions/%s' % extension_alias)
- body = json.loads(body)
- return resp, body['extension']
diff --git a/tempest/services/compute/v3/json/flavors_client.py b/tempest/services/compute/v3/json/flavors_client.py
deleted file mode 100644
index fdca6b3..0000000
--- a/tempest/services/compute/v3/json/flavors_client.py
+++ /dev/null
@@ -1,183 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import urllib
-
-from tempest.api_schema.response.compute import flavors as common_schema
-from tempest.api_schema.response.compute import flavors_access as schema_access
-from tempest.api_schema.response.compute import flavors_extra_specs \
- as schema_extra_specs
-from tempest.api_schema.response.compute.v3 import flavors as v3schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class FlavorsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(FlavorsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_flavors(self, params=None):
- url = 'flavors'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(common_schema.list_flavors, resp, body)
- return resp, body['flavors']
-
- def list_flavors_with_detail(self, params=None):
- url = 'flavors/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(v3schema.list_flavors_details, resp, body)
- return resp, body['flavors']
-
- def get_flavor_details(self, flavor_id):
- resp, body = self.get("flavors/%s" % str(flavor_id))
- body = json.loads(body)
- self.validate_response(v3schema.get_flavor_details, resp, body)
- return resp, body['flavor']
-
- def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
- """Creates a new flavor or instance type."""
- post_body = {
- 'name': name,
- 'ram': ram,
- 'vcpus': vcpus,
- 'disk': disk,
- 'id': flavor_id,
- }
- if kwargs.get('ephemeral'):
- post_body['ephemeral'] = kwargs.get('ephemeral')
- if kwargs.get('swap'):
- post_body['swap'] = kwargs.get('swap')
- if kwargs.get('rxtx'):
- post_body['os-flavor-rxtx:rxtx_factor'] = kwargs.get('rxtx')
- if kwargs.get('is_public'):
- post_body['flavor-access:is_public'] = kwargs.get('is_public')
- post_body = json.dumps({'flavor': post_body})
- resp, body = self.post('flavors', post_body)
-
- body = json.loads(body)
- self.validate_response(v3schema.create_flavor_details, resp, body)
- return resp, body['flavor']
-
- def delete_flavor(self, flavor_id):
- """Deletes the given flavor."""
- resp, body = self.delete("flavors/{0}".format(flavor_id))
- self.validate_response(v3schema.delete_flavor, resp, body)
- return resp, body
-
- def is_resource_deleted(self, id):
- # Did not use get_flavor_details(id) for verification as it gives
- # 200 ok even for deleted id. LP #981263
- # we can remove the loop here and use get by ID when bug gets sortedout
- resp, flavors = self.list_flavors_with_detail()
- for flavor in flavors:
- if flavor['id'] == id:
- return False
- return True
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'flavor'
-
- def set_flavor_extra_spec(self, flavor_id, specs):
- """Sets extra Specs to the mentioned flavor."""
- post_body = json.dumps({'extra_specs': specs})
- resp, body = self.post('flavors/%s/flavor-extra-specs' % flavor_id,
- post_body)
- body = json.loads(body)
- self.validate_response(v3schema.set_flavor_extra_specs, resp, body)
- return resp, body['extra_specs']
-
- def get_flavor_extra_spec(self, flavor_id):
- """Gets extra Specs details of the mentioned flavor."""
- resp, body = self.get('flavors/%s/flavor-extra-specs' % flavor_id)
- body = json.loads(body)
- self.validate_response(schema_extra_specs.flavor_extra_specs,
- resp, body)
- return resp, body['extra_specs']
-
- def get_flavor_extra_spec_with_key(self, flavor_id, key):
- """Gets extra Specs key-value of the mentioned flavor and key."""
- resp, body = self.get('flavors/%s/flavor-extra-specs/%s' %
- (str(flavor_id), key))
- body = json.loads(body)
- self.validate_response(schema_extra_specs.flavor_extra_specs_key,
- resp, body)
- return resp, body
-
- def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
- """Update specified extra Specs of the mentioned flavor and key."""
- resp, body = self.put('flavors/%s/flavor-extra-specs/%s' %
- (flavor_id, key), json.dumps(kwargs))
- body = json.loads(body)
- self.validate_response(schema_extra_specs.flavor_extra_specs_key,
- resp, body)
- return resp, body
-
- def unset_flavor_extra_spec(self, flavor_id, key):
- """Unsets extra Specs from the mentioned flavor."""
- resp, body = self.delete('flavors/%s/flavor-extra-specs/%s' %
- (str(flavor_id), key))
- self.validate_response(v3schema.unset_flavor_extra_specs, resp, body)
- return resp, body
-
- def list_flavor_access(self, flavor_id):
- """Gets flavor access information given the flavor id."""
- resp, body = self.get('flavors/%s/flavor-access' % flavor_id)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return resp, body['flavor_access']
-
- def add_flavor_access(self, flavor_id, tenant_id):
- """Add flavor access for the specified tenant."""
- post_body = {
- 'add_tenant_access': {
- 'tenant_id': tenant_id
- }
- }
- post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return resp, body['flavor_access']
-
- def remove_flavor_access(self, flavor_id, tenant_id):
- """Remove flavor access from the specified tenant."""
- post_body = {
- 'remove_tenant_access': {
- 'tenant_id': tenant_id
- }
- }
- post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return resp, body['flavor_access']
diff --git a/tempest/services/compute/v3/json/hosts_client.py b/tempest/services/compute/v3/json/hosts_client.py
deleted file mode 100644
index 476afad..0000000
--- a/tempest/services/compute/v3/json/hosts_client.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2013 IBM Corp.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import urllib
-
-from tempest.api_schema.response.compute import hosts as schema
-from tempest.api_schema.response.compute.v3 import hosts as v3_schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class HostsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(HostsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_hosts(self, params=None):
- """Lists all hosts."""
-
- url = 'os-hosts'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_hosts, resp, body)
- return resp, body['hosts']
-
- def show_host_detail(self, hostname):
- """Show detail information for the host."""
-
- resp, body = self.get("os-hosts/%s" % str(hostname))
- body = json.loads(body)
- self.validate_response(schema.show_host_detail, resp, body)
- return resp, body['host']
-
- def update_host(self, hostname, **kwargs):
- """Update a host."""
-
- request_body = {
- 'status': None,
- 'maintenance_mode': None,
- }
- request_body.update(**kwargs)
- request_body = json.dumps({'host': request_body})
-
- resp, body = self.put("os-hosts/%s" % str(hostname), request_body)
- body = json.loads(body)
- self.validate_response(v3_schema.update_host, resp, body)
- return resp, body
-
- def startup_host(self, hostname):
- """Startup a host."""
-
- resp, body = self.get("os-hosts/%s/startup" % str(hostname))
- body = json.loads(body)
- self.validate_response(v3_schema.startup_host, resp, body)
- return resp, body['host']
-
- def shutdown_host(self, hostname):
- """Shutdown a host."""
-
- resp, body = self.get("os-hosts/%s/shutdown" % str(hostname))
- body = json.loads(body)
- self.validate_response(v3_schema.shutdown_host, resp, body)
- return resp, body['host']
-
- def reboot_host(self, hostname):
- """reboot a host."""
-
- resp, body = self.get("os-hosts/%s/reboot" % str(hostname))
- body = json.loads(body)
- self.validate_response(v3_schema.reboot_host, resp, body)
- return resp, body['host']
diff --git a/tempest/services/compute/v3/json/hypervisor_client.py b/tempest/services/compute/v3/json/hypervisor_client.py
deleted file mode 100644
index 507157a..0000000
--- a/tempest/services/compute/v3/json/hypervisor_client.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2013 IBM Corporation.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute import hypervisors as common_schema
-from tempest.api_schema.response.compute.v3 import hypervisors as v3schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class HypervisorV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(HypervisorV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def get_hypervisor_list(self):
- """List hypervisors information."""
- resp, body = self.get('os-hypervisors')
- body = json.loads(body)
- self.validate_response(common_schema.common_hypervisors_detail,
- resp, body)
- return resp, body['hypervisors']
-
- def get_hypervisor_list_details(self):
- """Show detailed hypervisors information."""
- resp, body = self.get('os-hypervisors/detail')
- body = json.loads(body)
- self.validate_response(v3schema.list_hypervisors_detail, resp, body)
- return resp, body['hypervisors']
-
- def get_hypervisor_show_details(self, hyper_id):
- """Display the details of the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s' % hyper_id)
- body = json.loads(body)
- self.validate_response(v3schema.show_hypervisor, resp, body)
- return resp, body['hypervisor']
-
- def get_hypervisor_servers(self, hyper_name):
- """List instances belonging to the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s/servers' % hyper_name)
- body = json.loads(body)
- self.validate_response(v3schema.hypervisors_servers, resp, body)
- return resp, body['hypervisor']
-
- def get_hypervisor_stats(self):
- """Get hypervisor statistics over all compute nodes."""
- resp, body = self.get('os-hypervisors/statistics')
- body = json.loads(body)
- self.validate_response(common_schema.hypervisor_statistics, resp, body)
- return resp, body['hypervisor_statistics']
-
- def get_hypervisor_uptime(self, hyper_id):
- """Display the uptime of the specified hypervisor."""
- resp, body = self.get('os-hypervisors/%s/uptime' % hyper_id)
- body = json.loads(body)
- self.validate_response(common_schema.hypervisor_uptime, resp, body)
- return resp, body['hypervisor']
-
- def search_hypervisor(self, hyper_name):
- """Search specified hypervisor."""
- resp, body = self.get('os-hypervisors/search?query=%s' % hyper_name)
- body = json.loads(body)
- self.validate_response(common_schema.common_hypervisors_detail,
- resp, body)
- return resp, body['hypervisors']
diff --git a/tempest/services/compute/v3/json/interfaces_client.py b/tempest/services/compute/v3/json/interfaces_client.py
deleted file mode 100644
index ccc20c8..0000000
--- a/tempest/services/compute/v3/json/interfaces_client.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright 2013 IBM Corp.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import time
-
-from tempest.api_schema.response.compute import interfaces as common_schema
-from tempest.api_schema.response.compute import servers as servers_schema
-from tempest.api_schema.response.compute.v3 import interfaces as schema
-from tempest.common import rest_client
-from tempest import config
-from tempest import exceptions
-
-CONF = config.CONF
-
-
-class InterfacesV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(InterfacesV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_interfaces(self, server):
- resp, body = self.get('servers/%s/os-attach-interfaces' % server)
- body = json.loads(body)
- self.validate_response(schema.list_interfaces, resp, body)
- return resp, body['interface_attachments']
-
- def create_interface(self, server, port_id=None, network_id=None,
- fixed_ip=None):
- post_body = dict()
- if port_id:
- post_body['port_id'] = port_id
- if network_id:
- post_body['net_id'] = network_id
- if fixed_ip:
- post_body['fixed_ips'] = [dict(ip_address=fixed_ip)]
- post_body = json.dumps({'interface_attachment': post_body})
- resp, body = self.post('servers/%s/os-attach-interfaces' % server,
- body=post_body)
- body = json.loads(body)
- return resp, body['interface_attachment']
-
- def show_interface(self, server, port_id):
- resp, body =\
- self.get('servers/%s/os-attach-interfaces/%s' % (server, port_id))
- body = json.loads(body)
- return resp, body['interface_attachment']
-
- def delete_interface(self, server, port_id):
- resp, body =\
- self.delete('servers/%s/os-attach-interfaces/%s' % (server,
- port_id))
- self.validate_response(common_schema.delete_interface, resp, body)
- return resp, body
-
- def wait_for_interface_status(self, server, port_id, status):
- """Waits for a interface to reach a given status."""
- resp, body = self.show_interface(server, port_id)
- interface_status = body['port_state']
- start = int(time.time())
-
- while(interface_status != status):
- time.sleep(self.build_interval)
- resp, body = self.show_interface(server, port_id)
- interface_status = body['port_state']
-
- timed_out = int(time.time()) - start >= self.build_timeout
-
- if interface_status != status and timed_out:
- message = ('Interface %s failed to reach %s status '
- '(current %s) within the required time (%s s).' %
- (port_id, status, interface_status,
- self.build_timeout))
- raise exceptions.TimeoutException(message)
-
- return resp, body
-
- def add_fixed_ip(self, server_id, network_id):
- """Add a fixed IP to input server instance."""
- post_body = json.dumps({
- 'add_fixed_ip': {
- 'network_id': network_id
- }
- })
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- self.validate_response(servers_schema.server_actions_common_schema,
- resp, body)
- return resp, body
-
- def remove_fixed_ip(self, server_id, ip_address):
- """Remove input fixed IP from input server instance."""
- post_body = json.dumps({
- 'remove_fixed_ip': {
- 'address': ip_address
- }
- })
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- self.validate_response(servers_schema.server_actions_common_schema,
- resp, body)
- return resp, body
diff --git a/tempest/services/compute/v3/json/keypairs_client.py b/tempest/services/compute/v3/json/keypairs_client.py
deleted file mode 100644
index a290acb..0000000
--- a/tempest/services/compute/v3/json/keypairs_client.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute import keypairs as common_schema
-from tempest.api_schema.response.compute.v3 import keypairs as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class KeyPairsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(KeyPairsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_keypairs(self):
- resp, body = self.get("keypairs")
- body = json.loads(body)
- # Each returned keypair is embedded within an unnecessary 'keypair'
- # element which is a deviation from other resources like floating-ips,
- # servers, etc. A bug?
- # For now we shall adhere to the spec, but the spec for keypairs
- # is yet to be found
- self.validate_response(common_schema.list_keypairs, resp, body)
- return resp, body['keypairs']
-
- def get_keypair(self, key_name):
- resp, body = self.get("keypairs/%s" % str(key_name))
- body = json.loads(body)
- self.validate_response(schema.get_keypair, resp, body)
- return resp, body['keypair']
-
- def create_keypair(self, name, pub_key=None):
- post_body = {'keypair': {'name': name}}
- if pub_key:
- post_body['keypair']['public_key'] = pub_key
- post_body = json.dumps(post_body)
- resp, body = self.post("keypairs", body=post_body)
- body = json.loads(body)
- self.validate_response(schema.create_keypair, resp, body)
- return resp, body['keypair']
-
- def delete_keypair(self, key_name):
- resp, body = self.delete("keypairs/%s" % str(key_name))
- self.validate_response(schema.delete_keypair, resp, body)
- return resp, body
diff --git a/tempest/services/compute/v3/json/migration_client.py b/tempest/services/compute/v3/json/migration_client.py
deleted file mode 100644
index bf1ae85..0000000
--- a/tempest/services/compute/v3/json/migration_client.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2014 NEC Corporation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import urllib
-
-from tempest.api_schema.response.compute import migrations as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class MigrationsV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(MigrationsV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_migrations(self, params=None):
- """Lists all migrations."""
-
- url = 'os-migrations'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_migrations, resp, body)
- return resp, body['migrations']
diff --git a/tempest/services/compute/v3/json/quotas_client.py b/tempest/services/compute/v3/json/quotas_client.py
deleted file mode 100644
index f9aa9e9..0000000
--- a/tempest/services/compute/v3/json/quotas_client.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright 2012 NTT Data
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute.v3 import quotas as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class QuotasV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(QuotasV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def get_quota_set(self, tenant_id, user_id=None):
- """List the quota set for a tenant."""
-
- url = 'os-quota-sets/%s' % str(tenant_id)
- if user_id:
- url += '?user_id=%s' % str(user_id)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.quota_set, resp, body)
- return resp, body['quota_set']
-
- def get_quota_set_detail(self, tenant_id):
- """Get the quota set detail for a tenant."""
-
- url = 'os-quota-sets/%s/detail' % str(tenant_id)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.quota_set_detail, resp, body)
- return resp, body['quota_set']
-
- def get_default_quota_set(self, tenant_id):
- """List the default quota set for a tenant."""
-
- url = 'os-quota-sets/%s/defaults' % str(tenant_id)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.quota_set, resp, body)
- return resp, body['quota_set']
-
- def update_quota_set(self, tenant_id, user_id=None, force=None,
- metadata_items=None, ram=None, floating_ips=None,
- fixed_ips=None, key_pairs=None, instances=None,
- security_group_rules=None, cores=None,
- security_groups=None):
- """
- Updates the tenant's quota limits for one or more resources
- """
- post_body = {}
-
- if force is not None:
- post_body['force'] = force
-
- if metadata_items is not None:
- post_body['metadata_items'] = metadata_items
-
- if ram is not None:
- post_body['ram'] = ram
-
- if floating_ips is not None:
- post_body['floating_ips'] = floating_ips
-
- if fixed_ips is not None:
- post_body['fixed_ips'] = fixed_ips
-
- if key_pairs is not None:
- post_body['key_pairs'] = key_pairs
-
- if instances is not None:
- post_body['instances'] = instances
-
- if security_group_rules is not None:
- post_body['security_group_rules'] = security_group_rules
-
- if cores is not None:
- post_body['cores'] = cores
-
- if security_groups is not None:
- post_body['security_groups'] = security_groups
-
- post_body = json.dumps({'quota_set': post_body})
-
- if user_id:
- resp, body = self.put('os-quota-sets/%s?user_id=%s' %
- (str(tenant_id), str(user_id)), post_body)
- else:
- resp, body = self.put('os-quota-sets/%s' % str(tenant_id),
- post_body)
-
- body = json.loads(body)
- self.validate_response(schema.quota_set, resp, body)
- return resp, body['quota_set']
-
- def delete_quota_set(self, tenant_id):
- """Delete the tenant's quota set."""
- resp, body = self.delete('os-quota-sets/%s' % str(tenant_id))
- self.validate_response(schema.delete_quota, resp, body)
- return resp, body
diff --git a/tempest/services/compute/v3/json/servers_client.py b/tempest/services/compute/v3/json/servers_client.py
deleted file mode 100644
index 89e282d..0000000
--- a/tempest/services/compute/v3/json/servers_client.py
+++ /dev/null
@@ -1,531 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# Copyright 2013 Hewlett-Packard Development Company, L.P.
-# Copyright 2013 IBM Corp
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import time
-import urllib
-
-from tempest.api_schema.response.compute import servers as common_schema
-from tempest.api_schema.response.compute.v3 import servers as schema
-from tempest.common import rest_client
-from tempest.common import waiters
-from tempest import config
-from tempest import exceptions
-
-CONF = config.CONF
-
-
-class ServersV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServersV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def create_server(self, name, image_ref, flavor_ref, **kwargs):
- """
- Creates an instance of a server.
- name (Required): The name of the server.
- image_ref (Required): Reference to the image used to build the server.
- flavor_ref (Required): The flavor used to build the server.
- Following optional keyword arguments are accepted:
- admin_password: Sets the initial root password.
- key_name: Key name of keypair that was created earlier.
- meta: A dictionary of values to be used as metadata.
- security_groups: A list of security group dicts.
- networks: A list of network dicts with UUID and fixed_ip.
- user_data: User data for instance.
- availability_zone: Availability zone in which to launch instance.
- access_ip_v4: The IPv4 access address for the server.
- access_ip_v6: The IPv6 access address for the server.
- min_count: Count of minimum number of instances to launch.
- max_count: Count of maximum number of instances to launch.
- disk_config: Determines if user or admin controls disk configuration.
- return_reservation_id: Enable/Disable the return of reservation id
- block_device_mapping: Block device mapping for the server.
- """
- post_body = {
- 'name': name,
- 'image_ref': image_ref,
- 'flavor_ref': flavor_ref
- }
-
- for option in ['admin_password', 'key_name', 'networks',
- ('os-security-groups:security_groups',
- 'security_groups'),
- ('os-user-data:user_data', 'user_data'),
- ('os-availability-zone:availability_zone',
- 'availability_zone'),
- ('os-access-ips:access_ip_v4', 'access_ip_v4'),
- ('os-access-ips:access_ip_v6', 'access_ip_v6'),
- ('os-multiple-create:min_count', 'min_count'),
- ('os-multiple-create:max_count', 'max_count'),
- ('metadata', 'meta'),
- ('os-disk-config:disk_config', 'disk_config'),
- ('os-multiple-create:return_reservation_id',
- 'return_reservation_id'),
- ('os-block-device-mapping:block_device_mapping',
- 'block_device_mapping')]:
- if isinstance(option, tuple):
- post_param = option[0]
- key = option[1]
- else:
- post_param = option
- key = option
- value = kwargs.get(key)
- if value is not None:
- post_body[post_param] = value
- post_body = json.dumps({'server': post_body})
- resp, body = self.post('servers', post_body)
-
- body = json.loads(body)
- # NOTE(maurosr): this deals with the case of multiple server create
- # with return reservation id set True
- if 'servers_reservation' in body:
- return resp, body['servers_reservation']
- if CONF.compute_feature_enabled.enable_instance_password:
- create_schema = schema.create_server_with_admin_pass
- else:
- create_schema = schema.create_server
- self.validate_response(create_schema, resp, body)
- return resp, body['server']
-
- def update_server(self, server_id, name=None, meta=None, access_ip_v4=None,
- access_ip_v6=None, disk_config=None):
- """
- Updates the properties of an existing server.
- server_id: The id of an existing server.
- name: The name of the server.
- access_ip_v4: The IPv4 access address for the server.
- access_ip_v6: The IPv6 access address for the server.
- """
-
- post_body = {}
-
- if meta is not None:
- post_body['metadata'] = meta
-
- if name is not None:
- post_body['name'] = name
-
- if access_ip_v4 is not None:
- post_body['os-access-ips:access_ip_v4'] = access_ip_v4
-
- if access_ip_v6 is not None:
- post_body['os-access-ips:access_ip_v6'] = access_ip_v6
-
- if disk_config is not None:
- post_body['os-disk-config:disk_config'] = disk_config
-
- post_body = json.dumps({'server': post_body})
- resp, body = self.put("servers/%s" % str(server_id), post_body)
- body = json.loads(body)
- self.validate_response(schema.update_server, resp, body)
- return resp, body['server']
-
- def get_server(self, server_id):
- """Returns the details of an existing server."""
- resp, body = self.get("servers/%s" % str(server_id))
- body = json.loads(body)
- self.validate_response(schema.get_server, resp, body)
- return resp, body['server']
-
- def delete_server(self, server_id):
- """Deletes the given server."""
- resp, body = self.delete("servers/%s" % str(server_id))
- self.validate_response(common_schema.delete_server, resp, body)
- return resp, body
-
- def list_servers(self, params=None):
- """Lists all servers for a user."""
-
- url = 'servers'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(common_schema.list_servers, resp, body)
- return resp, body
-
- def list_servers_with_detail(self, params=None):
- """Lists all servers in detail for a user."""
-
- url = 'servers/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_servers_detail, resp, body)
- return resp, body
-
- def wait_for_server_status(self, server_id, status, extra_timeout=0,
- raise_on_error=True):
- """Waits for a server to reach a given status."""
- return waiters.wait_for_server_status(self, server_id, status,
- extra_timeout=extra_timeout,
- raise_on_error=raise_on_error)
-
- def wait_for_server_termination(self, server_id, ignore_error=False):
- """Waits for server to reach termination."""
- start_time = int(time.time())
- while True:
- try:
- resp, body = self.get_server(server_id)
- except exceptions.NotFound:
- return
-
- server_status = body['status']
- if server_status == 'ERROR' and not ignore_error:
- raise exceptions.BuildErrorException(server_id=server_id)
-
- if int(time.time()) - start_time >= self.build_timeout:
- raise exceptions.TimeoutException
-
- time.sleep(self.build_interval)
-
- def list_addresses(self, server_id):
- """Lists all addresses for a server."""
- resp, body = self.get("servers/%s/ips" % str(server_id))
- body = json.loads(body)
- self.validate_response(schema.list_addresses, resp, body)
- return resp, body['addresses']
-
- def list_addresses_by_network(self, server_id, network_id):
- """Lists all addresses of a specific network type for a server."""
- resp, body = self.get("servers/%s/ips/%s" %
- (str(server_id), network_id))
- body = json.loads(body)
- self.validate_response(schema.list_addresses_by_network, resp, body)
- return resp, body
-
- def action(self, server_id, action_name, response_key,
- schema=common_schema.server_actions_common_schema, **kwargs):
- post_body = json.dumps({action_name: kwargs})
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- if response_key is not None:
- body = json.loads(body)
- # Check for Schema as 'None' because if we do not have any server
- # action schema implemented yet then they can pass 'None' to skip
- # the validation.Once all server action has their schema
- # implemented then, this check can be removed if every actions are
- # supposed to validate their response.
- # TODO(GMann): Remove the below 'if' check once all server actions
- # schema are implemented.
- if schema is not None:
- self.validate_response(schema, resp, body)
- body = body[response_key]
- else:
- self.validate_response(schema, resp, body)
- return resp, body
-
- def create_backup(self, server_id, backup_type, rotation, name):
- """Backup a server instance."""
- return self.action(server_id, "create_backup", None,
- backup_type=backup_type,
- rotation=rotation,
- name=name)
-
- def change_password(self, server_id, admin_password):
- """Changes the root password for the server."""
- return self.action(server_id, 'change_password',
- None, schema.server_actions_change_password,
- admin_password=admin_password)
-
- def get_password(self, server_id):
- resp, body = self.get("servers/%s/os-server-password" %
- str(server_id))
- body = json.loads(body)
- self.validate_response(common_schema.get_password, resp, body)
- return resp, body
-
- def delete_password(self, server_id):
- """
- Removes the encrypted server password from the metadata server
- Note that this does not actually change the instance server
- password.
- """
- resp, body = self.delete("servers/%s/os-server-password" %
- str(server_id))
- self.validate_response(common_schema.server_actions_delete_password,
- resp, body)
- return resp, body
-
- def reboot(self, server_id, reboot_type):
- """Reboots a server."""
- return self.action(server_id, 'reboot', None, type=reboot_type)
-
- def rebuild(self, server_id, image_ref, **kwargs):
- """Rebuilds a server with a new image."""
- kwargs['image_ref'] = image_ref
- if 'disk_config' in kwargs:
- kwargs['os-disk-config:disk_config'] = kwargs['disk_config']
- del kwargs['disk_config']
- if CONF.compute_feature_enabled.enable_instance_password:
- rebuild_schema = schema.rebuild_server_with_admin_pass
- else:
- rebuild_schema = schema.rebuild_server
- return self.action(server_id, 'rebuild', 'server',
- rebuild_schema, **kwargs)
-
- def resize(self, server_id, flavor_ref, **kwargs):
- """Changes the flavor of a server."""
- kwargs['flavor_ref'] = flavor_ref
- if 'disk_config' in kwargs:
- kwargs['os-disk-config:disk_config'] = kwargs['disk_config']
- del kwargs['disk_config']
- return self.action(server_id, 'resize', None, **kwargs)
-
- def confirm_resize(self, server_id, **kwargs):
- """Confirms the flavor change for a server."""
- return self.action(server_id, 'confirm_resize', None, **kwargs)
-
- def revert_resize(self, server_id, **kwargs):
- """Reverts a server back to its original flavor."""
- return self.action(server_id, 'revert_resize', None, **kwargs)
-
- def create_image(self, server_id, name, meta=None):
- """Creates an image of the original server."""
-
- post_body = {
- 'create_image': {
- 'name': name,
- }
- }
-
- if meta is not None:
- post_body['create_image']['metadata'] = meta
-
- post_body = json.dumps(post_body)
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- return resp, body
-
- def list_server_metadata(self, server_id):
- resp, body = self.get("servers/%s/metadata" % str(server_id))
- body = json.loads(body)
- self.validate_response(common_schema.list_server_metadata, resp, body)
- return resp, body['metadata']
-
- def set_server_metadata(self, server_id, meta, no_metadata_field=False):
- if no_metadata_field:
- post_body = ""
- else:
- post_body = json.dumps({'metadata': meta})
- resp, body = self.put('servers/%s/metadata' % str(server_id),
- post_body)
- body = json.loads(body)
- self.validate_response(common_schema.set_server_metadata, resp, body)
- return resp, body['metadata']
-
- def update_server_metadata(self, server_id, meta):
- post_body = json.dumps({'metadata': meta})
- resp, body = self.post('servers/%s/metadata' % str(server_id),
- post_body)
- body = json.loads(body)
- self.validate_response(schema.update_server_metadata, resp, body)
- return resp, body['metadata']
-
- def get_server_metadata_item(self, server_id, key):
- resp, body = self.get("servers/%s/metadata/%s" % (str(server_id), key))
- body = json.loads(body)
- self.validate_response(schema.set_get_server_metadata_item,
- resp, body)
- return resp, body['metadata']
-
- def set_server_metadata_item(self, server_id, key, meta):
- post_body = json.dumps({'metadata': meta})
- resp, body = self.put('servers/%s/metadata/%s' % (str(server_id), key),
- post_body)
- body = json.loads(body)
- self.validate_response(schema.set_get_server_metadata_item,
- resp, body)
- return resp, body['metadata']
-
- def delete_server_metadata_item(self, server_id, key):
- resp, body = self.delete("servers/%s/metadata/%s" %
- (str(server_id), key))
- self.validate_response(common_schema.delete_server_metadata_item,
- resp, body)
- return resp, body
-
- def stop(self, server_id, **kwargs):
- return self.action(server_id, 'stop', None, **kwargs)
-
- def start(self, server_id, **kwargs):
- return self.action(server_id, 'start', None, **kwargs)
-
- def attach_volume(self, server_id, volume_id, device='/dev/vdz'):
- """Attaches a volume to a server instance."""
- resp, body = self.action(server_id, 'attach', None,
- volume_id=volume_id, device=device)
- self.validate_response(schema.attach_detach_volume, resp, body)
- return resp, body
-
- def detach_volume(self, server_id, volume_id):
- """Detaches a volume from a server instance."""
- resp, body = self.action(server_id, 'detach', None,
- volume_id=volume_id)
- self.validate_response(schema.attach_detach_volume, resp, body)
- return resp, body
-
- def live_migrate_server(self, server_id, dest_host, use_block_migration):
- """This should be called with administrator privileges ."""
-
- migrate_params = {
- "disk_over_commit": False,
- "block_migration": use_block_migration,
- "host": dest_host
- }
-
- req_body = json.dumps({'migrate_live': migrate_params})
-
- resp, body = self.post("servers/%s/action" % str(server_id),
- req_body)
- self.validate_response(common_schema.server_actions_common_schema,
- resp, body)
- return resp, body
-
- def migrate_server(self, server_id, **kwargs):
- """Migrates a server to a new host."""
- return self.action(server_id, 'migrate', None, **kwargs)
-
- def lock_server(self, server_id, **kwargs):
- """Locks the given server."""
- return self.action(server_id, 'lock', None, **kwargs)
-
- def unlock_server(self, server_id, **kwargs):
- """UNlocks the given server."""
- return self.action(server_id, 'unlock', None, **kwargs)
-
- def suspend_server(self, server_id, **kwargs):
- """Suspends the provided server."""
- return self.action(server_id, 'suspend', None, **kwargs)
-
- def resume_server(self, server_id, **kwargs):
- """Un-suspends the provided server."""
- return self.action(server_id, 'resume', None, **kwargs)
-
- def pause_server(self, server_id, **kwargs):
- """Pauses the provided server."""
- return self.action(server_id, 'pause', None, **kwargs)
-
- def unpause_server(self, server_id, **kwargs):
- """Un-pauses the provided server."""
- return self.action(server_id, 'unpause', None, **kwargs)
-
- def reset_state(self, server_id, state='error'):
- """Resets the state of a server to active/error."""
- return self.action(server_id, 'reset_state', None, state=state)
-
- def shelve_server(self, server_id, **kwargs):
- """Shelves the provided server."""
- return self.action(server_id, 'shelve', None, **kwargs)
-
- def unshelve_server(self, server_id, **kwargs):
- """Un-shelves the provided server."""
- return self.action(server_id, 'unshelve', None, **kwargs)
-
- def shelve_offload_server(self, server_id, **kwargs):
- """Shelve-offload the provided server."""
- return self.action(server_id, 'shelve_offload', None, **kwargs)
-
- def get_console_output(self, server_id, length):
- if length is None:
- # NOTE(mriedem): -1 means optional/unlimited in the nova v3 API.
- length = -1
- return self.action(server_id, 'get_console_output', 'output',
- common_schema.get_console_output, length=length)
-
- def rescue_server(self, server_id, **kwargs):
- """Rescue the provided server."""
- post_body = json.dumps({'rescue': kwargs})
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- if CONF.compute_feature_enabled.enable_instance_password:
- rescue_schema = schema.rescue_server_with_admin_pass
- else:
- rescue_schema = schema.rescue_server
- body = json.loads(body)
- self.validate_response(rescue_schema, resp, body)
- return resp, body
-
- def unrescue_server(self, server_id):
- """Unrescue the provided server."""
- return self.action(server_id, 'unrescue', None)
-
- def get_server_diagnostics(self, server_id):
- """Get the usage data for a server."""
- resp, body = self.get("servers/%s/os-server-diagnostics" %
- str(server_id))
- return resp, json.loads(body)
-
- def list_server_actions(self, server_id):
- """List the provided server action."""
- resp, body = self.get("servers/%s/os-server-actions" %
- str(server_id))
- body = json.loads(body)
- self.validate_response(schema.list_server_actions, resp, body)
- return resp, body['server_actions']
-
- def get_server_action(self, server_id, request_id):
- """Returns the action details of the provided server."""
- resp, body = self.get("servers/%s/os-server-actions/%s" %
- (str(server_id), str(request_id)))
- body = json.loads(body)
- self.validate_response(schema.get_server_action, resp, body)
- return resp, body['server_action']
-
- def force_delete_server(self, server_id, **kwargs):
- """Force delete a server."""
- return self.action(server_id, 'force_delete', None, **kwargs)
-
- def restore_soft_deleted_server(self, server_id, **kwargs):
- """Restore a soft-deleted server."""
- return self.action(server_id, 'restore', None, **kwargs)
-
- def get_vnc_console(self, server_id, type):
- """Get URL of VNC console."""
- post_body = json.dumps({
- "get_vnc_console": {
- "type": type
- }
- })
- resp, body = self.post('servers/%s/action' % str(server_id),
- post_body)
- body = json.loads(body)
- self.validate_response(common_schema.get_vnc_console, resp, body)
- return resp, body['console']
-
- def reset_network(self, server_id, **kwargs):
- """Resets the Network of a server"""
- return self.action(server_id, 'reset_network', None, **kwargs)
-
- def inject_network_info(self, server_id, **kwargs):
- """Inject the Network Info into server"""
- return self.action(server_id, 'inject_network_info', None, **kwargs)
-
- def get_spice_console(self, server_id, console_type):
- """Get URL of Spice console."""
- return self.action(server_id, "get_spice_console"
- "console", None, type=console_type)
-
- def get_rdp_console(self, server_id, console_type):
- """Get URL of RDP console."""
- return self.action(server_id, "get_rdp_console"
- "console", None, type=console_type)
diff --git a/tempest/services/compute/v3/json/services_client.py b/tempest/services/compute/v3/json/services_client.py
deleted file mode 100644
index 0645287..0000000
--- a/tempest/services/compute/v3/json/services_client.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# Copyright 2013 NEC Corporation
-# Copyright 2013 IBM Corp.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-import urllib
-
-from tempest.api_schema.response.compute import services as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class ServicesV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(ServicesV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def list_services(self, params=None):
- url = 'os-services'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_services, resp, body)
- return resp, body['services']
-
- def enable_service(self, host_name, binary):
- """
- Enable service on a host
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps({
- 'service': {
- 'binary': binary,
- 'host': host_name
- }
- })
- resp, body = self.put('os-services/enable', post_body)
- body = json.loads(body)
- self.validate_response(schema.enable_service, resp, body)
- return resp, body['service']
-
- def disable_service(self, host_name, binary):
- """
- Disable service on a host
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps({
- 'service': {
- 'binary': binary,
- 'host': host_name
- }
- })
- resp, body = self.put('os-services/disable', post_body)
- body = json.loads(body)
- return resp, body['service']
diff --git a/tempest/services/compute/v3/json/version_client.py b/tempest/services/compute/v3/json/version_client.py
deleted file mode 100644
index bc4f58c..0000000
--- a/tempest/services/compute/v3/json/version_client.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2014 NEC Corporation.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import json
-
-from tempest.api_schema.response.compute import version as schema
-from tempest.common import rest_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class VersionV3ClientJSON(rest_client.RestClient):
-
- def __init__(self, auth_provider):
- super(VersionV3ClientJSON, self).__init__(auth_provider)
- self.service = CONF.compute.catalog_v3_type
-
- def get_version(self):
- resp, body = self.get('')
- body = json.loads(body)
- self.validate_response(schema.version, resp, body)
- return resp, body['version']
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index b672b86..ba69a5d 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -336,45 +336,6 @@
self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
sorted(results['nova']['extensions']))
- def test_verify_extensions_nova_v3(self):
- def fake_list_extensions():
- return (None, [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}])
- fake_os = mock.MagicMock()
- fake_os.extensions_v3_client.list_extensions = fake_list_extensions
- self.useFixture(mockpatch.PatchObject(
- verify_tempest_config, 'get_enabled_extensions',
- return_value=(['fake1', 'fake2', 'fake3'])))
- results = verify_tempest_config.verify_extensions(fake_os,
- 'nova_v3', {})
- self.assertIn('nova_v3', results)
- self.assertIn('fake1', results['nova_v3'])
- self.assertTrue(results['nova_v3']['fake1'])
- self.assertIn('fake2', results['nova_v3'])
- self.assertTrue(results['nova_v3']['fake2'])
- self.assertIn('fake3', results['nova_v3'])
- self.assertFalse(results['nova_v3']['fake3'])
- self.assertIn('not_fake', results['nova_v3'])
- self.assertFalse(results['nova_v3']['not_fake'])
-
- def test_verify_extensions_nova_v3_all(self):
- def fake_list_extensions():
- return (None, {'extensions': [{'alias': 'fake1'},
- {'alias': 'fake2'},
- {'alias': 'not_fake'}]})
- fake_os = mock.MagicMock()
- fake_os.extensions_v3_client.list_extensions = fake_list_extensions
- self.useFixture(mockpatch.PatchObject(
- verify_tempest_config, 'get_enabled_extensions',
- return_value=(['all'])))
- results = verify_tempest_config.verify_extensions(fake_os,
- 'nova_v3', {})
- self.assertIn('nova_v3', results)
- self.assertIn('extensions', results['nova_v3'])
- self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),
- sorted(results['nova_v3']['extensions']))
-
def test_verify_extensions_swift(self):
def fake_list_extensions():
return (None, {'fake1': 'metadata',