Merge "Add tests for "new" Transfers API (mv 3.55)"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 59a2f64..b738fde 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -86,7 +86,7 @@
master_doc = 'index'
# General information about the project.
-copyright = u'2013, OpenStack QA Team'
+copyright = '2013, OpenStack QA Team'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@@ -206,8 +206,8 @@
# (source start file, target name, title, author, documentclass
# [howto/manual]).
latex_documents = [
- ('index', 'doc-tempest.tex', u'Tempest Testing Project',
- u'OpenStack Foundation', 'manual'),
+ ('index', 'doc-tempest.tex', 'Tempest Testing Project',
+ 'OpenStack Foundation', 'manual'),
]
latex_use_xindy = False
diff --git a/doc/source/contributor/contributing.rst b/doc/source/contributor/contributing.rst
index 62953ff..139f0b7 100644
--- a/doc/source/contributor/contributing.rst
+++ b/doc/source/contributor/contributing.rst
@@ -13,7 +13,7 @@
Communication
~~~~~~~~~~~~~
-* IRC channel ``#openstack-qa`` at FreeNode
+* IRC channel ``#openstack-qa`` at OFTC
* Mailing list (prefix subjects with ``[qa]`` for faster responses)
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-discuss
diff --git a/releasenotes/notes/add-placement-usage-client-method-8b6015cbd8a5e0f6.yaml b/releasenotes/notes/add-placement-usage-client-method-8b6015cbd8a5e0f6.yaml
new file mode 100644
index 0000000..d31a33c
--- /dev/null
+++ b/releasenotes/notes/add-placement-usage-client-method-8b6015cbd8a5e0f6.yaml
@@ -0,0 +1,8 @@
+---
+features:
+ - |
+ Add ``placement`` API usage method for evaluating resource class
+ utilization of the resource provider. The following API call is available
+ for tempest from now in the resource_providers_client:
+
+ * GET /resource_providers/{uuid}/usages
diff --git a/releasenotes/notes/deprecate-image-v1-service-clients-d12ed42210bb76b5.yaml b/releasenotes/notes/deprecate-image-v1-service-clients-d12ed42210bb76b5.yaml
new file mode 100644
index 0000000..4a22f8e
--- /dev/null
+++ b/releasenotes/notes/deprecate-image-v1-service-clients-d12ed42210bb76b5.yaml
@@ -0,0 +1,6 @@
+---
+deprecations:
+ - |
+ Tempest service clients for image v1 APIs (tempest.lib.services.image.v1 module)
+ is deprecated and will be removed once Tempest stop supporting stable Ussuri release
+ which is last release Image v1 APIs are present in glance.
diff --git a/releasenotes/notes/deprecate-volume-v2-service-clients-ff8a2a7be1797eb5.yaml b/releasenotes/notes/deprecate-volume-v2-service-clients-ff8a2a7be1797eb5.yaml
new file mode 100644
index 0000000..de05679
--- /dev/null
+++ b/releasenotes/notes/deprecate-volume-v2-service-clients-ff8a2a7be1797eb5.yaml
@@ -0,0 +1,6 @@
+---
+deprecations:
+ - |
+ Tempest service clients for volume v2 APIs (tempest.lib.services.volume.v2 module)
+ is deprecated and will be removed once Tempest stop supporting stable wallaby release
+ which is last release volume v2 APIs are present in cinder.
diff --git a/releasenotes/notes/remove-deprecated-old-token-clients-e4c2e654132f1130.yaml b/releasenotes/notes/remove-deprecated-old-token-clients-e4c2e654132f1130.yaml
new file mode 100644
index 0000000..9acb873
--- /dev/null
+++ b/releasenotes/notes/remove-deprecated-old-token-clients-e4c2e654132f1130.yaml
@@ -0,0 +1,9 @@
+---
+prelude: >
+ Tempest's identity service client TokenClientJSON and V3TokenClientJSON
+ has been removed.
+upgrade:
+ - |
+ Tempest's identity service client TokenClientJSON and V3TokenClientJSON
+ were deprecated since long which are not removed. Please use new service
+ clients TokenClient and V3TokenClient instead.
diff --git a/releasenotes/notes/remove-volume-v1-service-clients-9235e3a965f93c09.yaml b/releasenotes/notes/remove-volume-v1-service-clients-9235e3a965f93c09.yaml
new file mode 100644
index 0000000..3c90f81
--- /dev/null
+++ b/releasenotes/notes/remove-volume-v1-service-clients-9235e3a965f93c09.yaml
@@ -0,0 +1,8 @@
+---
+prelude: >
+ Tempest Service clients for volume v1 APIs are removed.
+upgrade:
+ - |
+ Cinder removed the volume v1 APIs in queens release and Tempest
+ now support only stable train onwards release so all the Tempest
+ service clients for volume v1 APIs are now removed.
diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py
index 9a9de43..b353a18 100644
--- a/releasenotes/source/conf.py
+++ b/releasenotes/source/conf.py
@@ -59,7 +59,7 @@
master_doc = 'index'
# General information about the project.
-copyright = u'2016, tempest Developers'
+copyright = '2016, tempest Developers'
# Release do not need a version number in the title, they
# cover multiple versions.
@@ -194,8 +194,8 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('index', 'olso.configReleaseNotes.tex',
- u'olso.config Release Notes Documentation',
- u'tempest Developers', 'manual'),
+ 'olso.config Release Notes Documentation',
+ 'tempest Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@@ -225,8 +225,8 @@
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'olso.configreleasenotes',
- u'tempest Release Notes Documentation',
- [u'tempest Developers'], 1)
+ 'tempest Release Notes Documentation',
+ ['tempest Developers'], 1)
]
# If true, show URL addresses after external links.
@@ -240,8 +240,8 @@
# dir menu entry, description, category)
texinfo_documents = [
('index', 'tempestReleaseNotes',
- u'tempest Release Notes Documentation',
- u'tempest Developers', 'olso.configReleaseNotes',
+ 'tempest Release Notes Documentation',
+ 'tempest Developers', 'olso.configReleaseNotes',
'An OpenStack library for parsing configuration options from the command'
' line and configuration files.',
'Miscellaneous'),
diff --git a/roles/run-tempest/tasks/main.yaml b/roles/run-tempest/tasks/main.yaml
index 37026e4..a8b3ede 100644
--- a/roles/run-tempest/tasks/main.yaml
+++ b/roles/run-tempest/tasks/main.yaml
@@ -40,7 +40,7 @@
- "'TEMPEST_BRANCH' in devstack_localrc"
- "'TEMPEST_VENV_UPPER_CONSTRAINTS' in devstack_localrc"
- devstack_localrc['TEMPEST_BRANCH'] != 'master'
- - devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS'] != 'default'
+ - devstack_localrc['TEMPEST_VENV_UPPER_CONSTRAINTS'] != 'master'
- name: Set OS_TEST_TIMEOUT if requested
set_fact:
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index cc013e3..1c839eb 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -103,7 +103,7 @@
server = self.create_test_server(wait_until='ACTIVE')
self.addCleanup(self.delete_server, server['id'])
# Update instance name with non-ASCII characters
- prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
+ prefix_name = '\u00CD\u00F1st\u00E1\u00F1c\u00E9'
self._update_server_name(server['id'], 'ACTIVE', prefix_name)
# stop server and check server name update again
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index efa23bb..d283ab3 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -105,12 +105,10 @@
'validate the image/tasks API.')
return
- # Make sure we can access the task and that some of the key
- # fields look legit.
- tasks = self.client.show_image_tasks(image_id)
- self.assertEqual(1, len(tasks['tasks']))
- task = tasks['tasks'][0]
- self.assertEqual('success', task['status'])
+ tasks = waiters.wait_for_image_tasks_status(
+ self.client, image_id, 'success')
+ self.assertEqual(1, len(tasks))
+ task = tasks[0]
self.assertEqual(resp.response['x-openstack-request-id'],
task['request_id'])
self.assertEqual('glance-direct',
diff --git a/tempest/common/waiters.py b/tempest/common/waiters.py
index eaac05e..3750b11 100644
--- a/tempest/common/waiters.py
+++ b/tempest/common/waiters.py
@@ -193,6 +193,30 @@
raise lib_exc.TimeoutException(message)
+def wait_for_image_tasks_status(client, image_id, status):
+ """Waits for an image tasks to reach a given status."""
+ pending_tasks = []
+ start = int(time.time())
+ while int(time.time()) - start < client.build_timeout:
+ tasks = client.show_image_tasks(image_id)['tasks']
+
+ pending_tasks = [task for task in tasks if task['status'] != status]
+ if not pending_tasks:
+ return tasks
+ time.sleep(client.build_interval)
+
+ message = ('Image %(image_id)s tasks: %(pending_tasks)s '
+ 'failed to reach %(status)s state within the required '
+ 'time (%(timeout)s s).' % {'image_id': image_id,
+ 'pending_tasks': pending_tasks,
+ 'status': status,
+ 'timeout': client.build_timeout})
+ caller = test_utils.find_test_caller()
+ if caller:
+ message = '(%s) %s' % (caller, message)
+ raise lib_exc.TimeoutException(message)
+
+
def wait_for_image_imported_to_stores(client, image_id, stores=None):
"""Waits for an image to be imported to all requested stores.
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 6a97a00..c1e6b2d 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -140,20 +140,10 @@
"decorators.skip_because from tempest.lib")
-def _common_service_clients_check(logical_line, physical_line, filename,
- ignored_list_file=None):
+def _common_service_clients_check(logical_line, physical_line, filename):
if not re.match('tempest/(lib/)?services/.*', filename):
return False
- if ignored_list_file is not None:
- ignored_list = []
- with open('tempest/hacking/' + ignored_list_file) as f:
- for line in f:
- ignored_list.append(line.strip())
-
- if filename in ignored_list:
- return False
-
if not METHOD.match(physical_line):
return False
@@ -171,7 +161,7 @@
T110
"""
if not _common_service_clients_check(logical_line, physical_line,
- filename, 'ignored_list_T110.txt'):
+ filename):
return
for line in lines[line_number:]:
@@ -199,7 +189,7 @@
T111
"""
if not _common_service_clients_check(logical_line, physical_line,
- filename, 'ignored_list_T111.txt'):
+ filename):
return
for line in lines[line_number:]:
diff --git a/tempest/lib/services/clients.py b/tempest/lib/services/clients.py
index d328956..8b5c758 100644
--- a/tempest/lib/services/clients.py
+++ b/tempest/lib/services/clients.py
@@ -52,7 +52,6 @@
'image.v2': image.v2,
'network': network,
'object-storage': object_storage,
- 'volume.v1': volume.v1,
'volume.v2': volume.v2,
'volume.v3': volume.v3
}
diff --git a/tempest/lib/services/identity/v2/token_client.py b/tempest/lib/services/identity/v2/token_client.py
index 9f10f58..1191154 100644
--- a/tempest/lib/services/identity/v2/token_client.py
+++ b/tempest/lib/services/identity/v2/token_client.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from tempest.lib.common import rest_client
@@ -125,15 +124,3 @@
return body['token']['id'], body
else:
return body['token']['id']
-
-
-class TokenClientJSON(TokenClient):
- LOG = logging.getLogger(__name__)
-
- def _warn(self):
- self.LOG.warning("%s class was deprecated and renamed to %s",
- self.__class__.__name__, 'TokenClient')
-
- def __init__(self, *args, **kwargs):
- self._warn()
- super(TokenClientJSON, self).__init__(*args, **kwargs)
diff --git a/tempest/lib/services/identity/v3/token_client.py b/tempest/lib/services/identity/v3/token_client.py
index 08a8f46..c63966a 100644
--- a/tempest/lib/services/identity/v3/token_client.py
+++ b/tempest/lib/services/identity/v3/token_client.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from tempest.lib.common import rest_client
@@ -195,15 +194,3 @@
return token, body['token']
else:
return token
-
-
-class V3TokenClientJSON(V3TokenClient):
- LOG = logging.getLogger(__name__)
-
- def _warn(self):
- self.LOG.warning("%s class was deprecated and renamed to %s",
- self.__class__.__name__, 'V3TokenClient')
-
- def __init__(self, *args, **kwargs):
- self._warn()
- super(V3TokenClientJSON, self).__init__(*args, **kwargs)
diff --git a/tempest/lib/services/image/v1/__init__.py b/tempest/lib/services/image/v1/__init__.py
index 9bd8262..1f33cef 100644
--- a/tempest/lib/services/image/v1/__init__.py
+++ b/tempest/lib/services/image/v1/__init__.py
@@ -12,8 +12,17 @@
# License for the specific language governing permissions and limitations under
# the License.
+import warnings
+
from tempest.lib.services.image.v1.image_members_client import \
ImageMembersClient
from tempest.lib.services.image.v1.images_client import ImagesClient
__all__ = ['ImageMembersClient', 'ImagesClient']
+
+
+warnings.warn(
+ "The tempest.lib.services.image.v1 module (Image v1 APIs service "
+ "clients) is deprecated in favor of tempest.lib.services.image.v2 "
+ "(Image v2 APIs service clients) and will be removed once Tempest stop "
+ "supporting stable Ussuri.", DeprecationWarning)
diff --git a/tempest/lib/services/placement/resource_providers_client.py b/tempest/lib/services/placement/resource_providers_client.py
index e6fbcb2..3214053 100644
--- a/tempest/lib/services/placement/resource_providers_client.py
+++ b/tempest/lib/services/placement/resource_providers_client.py
@@ -26,6 +26,7 @@
* resource providers
* resource provider inventories
* resource provider aggregates
+ * resource provider usages
"""
def list_resource_providers(self, **params):
@@ -69,6 +70,19 @@
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
+ def list_resource_provider_usages(self, rp_uuid):
+ """List resource provider usages.
+
+ For full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/placement/#list-resource-provider-usages
+ """
+ url = '/resource_providers/%s/usages' % rp_uuid
+ resp, body = self.get(url)
+ self.expected_success(200, resp.status)
+ body = json.loads(body)
+ return rest_client.ResponseBody(resp, body)
+
def list_resource_provider_aggregates(self, rp_uuid):
"""List resource provider aggregates.
diff --git a/tempest/lib/services/volume/__init__.py b/tempest/lib/services/volume/__init__.py
index 6855d8e..4b47251 100644
--- a/tempest/lib/services/volume/__init__.py
+++ b/tempest/lib/services/volume/__init__.py
@@ -12,8 +12,7 @@
# License for the specific language governing permissions and limitations under
# the License.
-from tempest.lib.services.volume import v1
from tempest.lib.services.volume import v2
from tempest.lib.services.volume import v3
-__all__ = ['v1', 'v2', 'v3']
+__all__ = ['v2', 'v3']
diff --git a/tempest/lib/services/volume/v1/__init__.py b/tempest/lib/services/volume/v1/__init__.py
deleted file mode 100644
index 7b5991f..0000000
--- a/tempest/lib/services/volume/v1/__init__.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
-#
-# 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.
-
-from tempest.lib.services.volume.v1.availability_zone_client \
- import AvailabilityZoneClient
-from tempest.lib.services.volume.v1.backups_client import BackupsClient
-from tempest.lib.services.volume.v1.encryption_types_client import \
- EncryptionTypesClient
-from tempest.lib.services.volume.v1.extensions_client import ExtensionsClient
-from tempest.lib.services.volume.v1.hosts_client import HostsClient
-from tempest.lib.services.volume.v1.limits_client import LimitsClient
-from tempest.lib.services.volume.v1.qos_client import QosSpecsClient
-from tempest.lib.services.volume.v1.quotas_client import QuotasClient
-from tempest.lib.services.volume.v1.services_client import ServicesClient
-from tempest.lib.services.volume.v1.snapshots_client import SnapshotsClient
-from tempest.lib.services.volume.v1.types_client import TypesClient
-from tempest.lib.services.volume.v1.volumes_client import VolumesClient
-
-__all__ = ['AvailabilityZoneClient', 'BackupsClient', 'EncryptionTypesClient',
- 'ExtensionsClient', 'HostsClient', 'QosSpecsClient', 'QuotasClient',
- 'ServicesClient', 'SnapshotsClient', 'TypesClient', 'VolumesClient',
- 'LimitsClient']
diff --git a/tempest/lib/services/volume/v1/availability_zone_client.py b/tempest/lib/services/volume/v1/availability_zone_client.py
deleted file mode 100644
index be4f539..0000000
--- a/tempest/lib/services/volume/v1/availability_zone_client.py
+++ /dev/null
@@ -1,28 +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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-
-
-class AvailabilityZoneClient(rest_client.RestClient):
- """Volume V1 availability zone client."""
-
- def list_availability_zones(self):
- resp, body = self.get('os-availability-zone')
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/backups_client.py b/tempest/lib/services/volume/v1/backups_client.py
deleted file mode 100644
index 2289253..0000000
--- a/tempest/lib/services/volume/v1/backups_client.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright 2014 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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class BackupsClient(rest_client.RestClient):
- """Volume V1 Backups client"""
- api_version = "v1"
-
- def create_backup(self, **kwargs):
- """Creates a backup of volume.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-backup
- """
- post_body = json.dumps({'backup': kwargs})
- resp, body = self.post('backups', post_body)
- body = json.loads(body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def restore_backup(self, backup_id, **kwargs):
- """Restore volume from backup.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#restore-backup
- """
- post_body = json.dumps({'restore': kwargs})
- resp, body = self.post('backups/%s/restore' % (backup_id), post_body)
- body = json.loads(body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_backup(self, backup_id):
- """Delete a backup of volume."""
- resp, body = self.delete('backups/%s' % backup_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_backup(self, backup_id):
- """Returns the details of a single backup."""
- url = "backups/%s" % backup_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def list_backups(self, detail=False):
- """Information for all the tenant's backups."""
- url = "backups"
- if detail:
- url += "/detail"
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def export_backup(self, backup_id):
- """Export backup metadata record."""
- url = "backups/%s/export_record" % backup_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def import_backup(self, **kwargs):
- """Import backup metadata record."""
- # TODO(linanbj): Current api-site doesn't contain this API description.
- # After fixing the api-site, we need to fix here also for putting the
- # link to api-site.
- post_body = json.dumps({'backup-record': kwargs})
- resp, body = self.post("backups/import_record", post_body)
- body = json.loads(body)
- self.expected_success(201, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def reset_backup_status(self, backup_id, status):
- """Reset the specified backup's status."""
- post_body = json.dumps({'os-reset_status': {"status": status}})
- resp, body = self.post('backups/%s/action' % backup_id, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_backup(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'backup'
diff --git a/tempest/lib/services/volume/v1/encryption_types_client.py b/tempest/lib/services/volume/v1/encryption_types_client.py
deleted file mode 100644
index 8e75ff9..0000000
--- a/tempest/lib/services/volume/v1/encryption_types_client.py
+++ /dev/null
@@ -1,68 +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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class EncryptionTypesClient(rest_client.RestClient):
-
- def is_resource_deleted(self, id):
- try:
- body = self.show_encryption_type(id)
- if not body:
- return True
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'encryption-type'
-
- def show_encryption_type(self, volume_type_id):
- """Get the volume encryption type for the specified volume type.
-
- :param volume_type_id: Id of volume type.
- """
- url = "/types/%s/encryption" % volume_type_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_encryption_type(self, volume_type_id, **kwargs):
- """Create encryption type.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-an-encryption-type-for-v2
- """
- url = "/types/%s/encryption" % volume_type_id
- post_body = json.dumps({'encryption': kwargs})
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_encryption_type(self, volume_type_id):
- """Delete the encryption type for the specified volume type."""
- resp, body = self.delete(
- "/types/%s/encryption/provider" % volume_type_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/extensions_client.py b/tempest/lib/services/volume/v1/extensions_client.py
deleted file mode 100644
index 7b849a8..0000000
--- a/tempest/lib/services/volume/v1/extensions_client.py
+++ /dev/null
@@ -1,29 +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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-
-
-class ExtensionsClient(rest_client.RestClient):
- """Volume V1 extensions client."""
-
- def list_extensions(self):
- url = 'extensions'
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/hosts_client.py b/tempest/lib/services/volume/v1/hosts_client.py
deleted file mode 100644
index 2e94274..0000000
--- a/tempest/lib/services/volume/v1/hosts_client.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2013 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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-
-
-class HostsClient(rest_client.RestClient):
- """Client class to send CRUD Volume Host API V1 requests"""
-
- def list_hosts(self, **params):
- """Lists all hosts.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#list-all-hosts
- """
- url = 'os-hosts'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/limits_client.py b/tempest/lib/services/volume/v1/limits_client.py
deleted file mode 100644
index e14b2dc..0000000
--- a/tempest/lib/services/volume/v1/limits_client.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2016 Red Hat, Inc.
-# 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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-
-
-class LimitsClient(rest_client.RestClient):
- """Volume V1 limits client."""
-
- api_version = "v1"
-
- def show_limits(self):
- """Returns the details of a volume absolute limits."""
- url = "limits"
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/qos_client.py b/tempest/lib/services/volume/v1/qos_client.py
deleted file mode 100644
index 67f2ead..0000000
--- a/tempest/lib/services/volume/v1/qos_client.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# 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.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class QosSpecsClient(rest_client.RestClient):
- """Volume V1 QoS client.
-
- Client class to send CRUD QoS API requests
- """
-
- api_version = "v1"
-
- def is_resource_deleted(self, qos_id):
- try:
- self.show_qos(qos_id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'qos'
-
- def create_qos(self, **kwargs):
- """Create a QoS Specification.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-qos-specification
- """
- post_body = json.dumps({'qos_specs': kwargs})
- resp, body = self.post('qos-specs', post_body)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- return rest_client.ResponseBody(resp, body)
-
- def delete_qos(self, qos_id, force=False):
- """Delete the specified QoS specification."""
- resp, body = self.delete(
- "qos-specs/%s?force=%s" % (qos_id, force))
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def list_qos(self):
- """List all the QoS specifications created."""
- url = 'qos-specs'
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_qos(self, qos_id):
- """Get the specified QoS specification."""
- url = "qos-specs/%s" % qos_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def set_qos_key(self, qos_id, **kwargs):
- """Set the specified keys/values of QoS specification.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#set-keys-in-qos-specification
- """
- put_body = json.dumps({"qos_specs": kwargs})
- resp, body = self.put('qos-specs/%s' % qos_id, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def unset_qos_key(self, qos_id, keys):
- """Unset the specified keys of QoS specification.
-
- :param keys: keys to delete from the QoS specification.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#unset-keys-in-qos-specification
- """
- put_body = json.dumps({'keys': keys})
- resp, body = self.put('qos-specs/%s/delete_keys' % qos_id, put_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def associate_qos(self, qos_id, vol_type_id):
- """Associate the specified QoS with specified volume-type."""
- url = "qos-specs/%s/associate" % qos_id
- url += "?vol_type_id=%s" % vol_type_id
- resp, body = self.get(url)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_association_qos(self, qos_id):
- """Get the association of the specified QoS specification."""
- url = "qos-specs/%s/associations" % qos_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def disassociate_qos(self, qos_id, vol_type_id):
- """Disassociate the specified QoS with specified volume-type."""
- url = "qos-specs/%s/disassociate" % qos_id
- url += "?vol_type_id=%s" % vol_type_id
- resp, body = self.get(url)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def disassociate_all_qos(self, qos_id):
- """Disassociate the specified QoS with all associations."""
- url = "qos-specs/%s/disassociate_all" % qos_id
- resp, body = self.get(url)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/quotas_client.py b/tempest/lib/services/volume/v1/quotas_client.py
deleted file mode 100644
index d7c9698..0000000
--- a/tempest/lib/services/volume/v1/quotas_client.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
-#
-# 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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils
-
-from tempest.lib.common import rest_client
-
-
-class QuotasClient(rest_client.RestClient):
- """Client class to send CRUD Volume Quotas API V1 requests"""
-
- def show_default_quota_set(self, tenant_id):
- """List the default volume quota set for a tenant."""
-
- url = 'os-quota-sets/%s/defaults' % tenant_id
- resp, body = self.get(url)
- self.expected_success(200, resp.status)
- body = jsonutils.loads(body)
- return rest_client.ResponseBody(resp, body)
-
- def show_quota_set(self, tenant_id, params=None):
- """List the quota set for a tenant."""
-
- url = 'os-quota-sets/%s' % tenant_id
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- self.expected_success(200, resp.status)
- body = jsonutils.loads(body)
- return rest_client.ResponseBody(resp, body)
-
- def update_quota_set(self, tenant_id, **kwargs):
- """Updates quota set
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-quotas
- """
- put_body = jsonutils.dumps({'quota_set': kwargs})
- resp, body = self.put('os-quota-sets/%s' % tenant_id, put_body)
- self.expected_success(200, resp.status)
- body = jsonutils.loads(body)
- return rest_client.ResponseBody(resp, body)
-
- def delete_quota_set(self, tenant_id):
- """Delete the tenant's quota set."""
- resp, body = self.delete('os-quota-sets/%s' % tenant_id)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/services_client.py b/tempest/lib/services/volume/v1/services_client.py
deleted file mode 100644
index 957a0e6..0000000
--- a/tempest/lib/services/volume/v1/services_client.py
+++ /dev/null
@@ -1,34 +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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-
-
-class ServicesClient(rest_client.RestClient):
- """Volume V1 volume services client"""
-
- def list_services(self, **params):
- url = 'os-services'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/snapshots_client.py b/tempest/lib/services/volume/v1/snapshots_client.py
deleted file mode 100644
index a478686..0000000
--- a/tempest/lib/services/volume/v1/snapshots_client.py
+++ /dev/null
@@ -1,188 +0,0 @@
-# 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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class SnapshotsClient(rest_client.RestClient):
- """Client class to send CRUD Volume V1 API requests."""
-
- create_resp = 200
-
- def list_snapshots(self, detail=False, **params):
- """List all the snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#list-snapshots
- https://docs.openstack.org/api-ref/block-storage/v2/#list-snapshots-with-details
- """
- url = 'snapshots'
- if detail:
- url += '/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_snapshot(self, snapshot_id):
- """Returns the details of a single snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#show-snapshot-details
- """
- url = "snapshots/%s" % snapshot_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_snapshot(self, **kwargs):
- """Creates a new snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-snapshot
- """
- post_body = json.dumps({'snapshot': kwargs})
- resp, body = self.post('snapshots', post_body)
- body = json.loads(body)
- self.expected_success(self.create_resp, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_snapshot(self, snapshot_id):
- """Delete Snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#delete-snapshot
- """
- resp, body = self.delete("snapshots/%s" % snapshot_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_snapshot(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'volume-snapshot'
-
- def reset_snapshot_status(self, snapshot_id, status):
- """Reset the specified snapshot's status."""
- post_body = json.dumps({'os-reset_status': {"status": status}})
- resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_snapshot_status(self, snapshot_id, **kwargs):
- """Update the specified snapshot's status."""
- # TODO(gmann): api-site doesn't contain doc ref
- # for this API. After fixing the api-site, we need to
- # add the link here.
- # Bug https://bugs.launchpad.net/openstack-api-site/+bug/1532645
-
- post_body = json.dumps({'os-update_snapshot_status': kwargs})
- url = 'snapshots/%s/action' % snapshot_id
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_snapshot_metadata(self, snapshot_id, metadata):
- """Create metadata for the snapshot."""
- put_body = json.dumps({'metadata': metadata})
- url = "snapshots/%s/metadata" % snapshot_id
- resp, body = self.post(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_snapshot(self, snapshot_id, **kwargs):
- """Updates a snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-snapshot
- """
- put_body = json.dumps({'snapshot': kwargs})
- resp, body = self.put('snapshots/%s' % snapshot_id, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_snapshot_metadata(self, snapshot_id):
- """Get metadata of the snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#show-snapshot-metadata
- """
- url = "snapshots/%s/metadata" % snapshot_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_snapshot_metadata(self, snapshot_id, **kwargs):
- """Update metadata for the snapshot.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-snapshot-metadata
- """
- put_body = json.dumps(kwargs)
- url = "snapshots/%s/metadata" % snapshot_id
- resp, body = self.put(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_snapshot_metadata_item(self, snapshot_id, id, **kwargs):
- """Update metadata item for the snapshot."""
- # TODO(piyush): Current api-site doesn't contain this API description.
- # After fixing the api-site, we need to fix here also for putting the
- # link to api-site.
- # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1529064
- put_body = json.dumps(kwargs)
- url = "snapshots/%s/metadata/%s" % (snapshot_id, id)
- resp, body = self.put(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_snapshot_metadata_item(self, snapshot_id, id):
- """Delete metadata item for the snapshot."""
- url = "snapshots/%s/metadata/%s" % (snapshot_id, id)
- resp, body = self.delete(url)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def force_delete_snapshot(self, snapshot_id):
- """Force Delete Snapshot."""
- post_body = json.dumps({'os-force_delete': {}})
- resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/types_client.py b/tempest/lib/services/volume/v1/types_client.py
deleted file mode 100644
index 6237fb4..0000000
--- a/tempest/lib/services/volume/v1/types_client.py
+++ /dev/null
@@ -1,167 +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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class TypesClient(rest_client.RestClient):
- """Client class to send CRUD Volume Types API requests"""
-
- def is_resource_deleted(self, id):
- try:
- self.show_volume_type(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'volume-type'
-
- def list_volume_types(self, **params):
- """List all the volume_types created.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#list-all-volume-types-for-v2
- """
- url = 'types'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_volume_type(self, volume_type_id):
- """Returns the details of a single volume_type.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#show-volume-type-details-for-v2
- """
- url = "types/%s" % volume_type_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_volume_type(self, **kwargs):
- """Create volume type.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-volume-type-for-v2
- """
- post_body = json.dumps({'volume_type': kwargs})
- resp, body = self.post('types', post_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_volume_type(self, volume_type_id):
- """Deletes the Specified Volume_type.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#delete-volume-type
- """
- resp, body = self.delete("types/%s" % volume_type_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def list_volume_types_extra_specs(self, volume_type_id, **params):
- """List all the volume_types extra specs created.
-
- TODO: Current api-site doesn't contain this API description.
- After fixing the api-site, we need to fix here also for putting
- the link to api-site.
- """
- url = 'types/%s/extra_specs' % volume_type_id
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_volume_type_extra_specs(self, volume_type_id, extra_specs_name):
- """Returns the details of a single volume_type extra spec."""
- url = "types/%s/extra_specs/%s" % (volume_type_id, extra_specs_name)
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_volume_type_extra_specs(self, volume_type_id, extra_specs):
- """Creates a new Volume_type extra spec.
-
- volume_type_id: Id of volume_type.
- extra_specs: A dictionary of values to be used as extra_specs.
- """
- url = "types/%s/extra_specs" % volume_type_id
- post_body = json.dumps({'extra_specs': extra_specs})
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_volume_type_extra_specs(self, volume_type_id, extra_spec_name):
- """Deletes the Specified Volume_type extra spec."""
- resp, body = self.delete("types/%s/extra_specs/%s" % (
- volume_type_id, extra_spec_name))
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume_type(self, volume_type_id, **kwargs):
- """Updates volume type name, description, and/or is_public.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-volume-type
- """
- put_body = json.dumps({'volume_type': kwargs})
- resp, body = self.put('types/%s' % volume_type_id, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume_type_extra_specs(self, volume_type_id, extra_spec_name,
- extra_specs):
- """Update a volume_type extra spec.
-
- :param volume_type_id: Id of volume_type.
- :param extra_spec_name: Name of the extra spec to be updated.
- :param extra_specs: A dictionary of with key as extra_spec_name and the
- updated value.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-extra-specs-for-a-volume-type
- """
- url = "types/%s/extra_specs/%s" % (volume_type_id, extra_spec_name)
- put_body = json.dumps(extra_specs)
- resp, body = self.put(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
diff --git a/tempest/lib/services/volume/v1/volumes_client.py b/tempest/lib/services/volume/v1/volumes_client.py
deleted file mode 100644
index 5d8d73b..0000000
--- a/tempest/lib/services/volume/v1/volumes_client.py
+++ /dev/null
@@ -1,306 +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.
-
-from urllib import parse as urllib
-
-from oslo_serialization import jsonutils as json
-
-from tempest.lib.common import rest_client
-from tempest.lib import exceptions as lib_exc
-
-
-class VolumesClient(rest_client.RestClient):
- """Client class to send CRUD Volume V1 API requests"""
-
- def _prepare_params(self, params):
- """Prepares params for use in get or _ext_get methods.
-
- If params is a string it will be left as it is, but if it's not it will
- be urlencoded.
- """
- if isinstance(params, str):
- return params
- return urllib.urlencode(params)
-
- def list_volumes(self, detail=False, params=None):
- """List all the volumes created.
-
- Params can be a string (must be urlencoded) or a dictionary.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#list-volumes
- https://docs.openstack.org/api-ref/block-storage/v2/#list-volumes-with-details
- """
- url = 'volumes'
- if detail:
- url += '/detail'
- if params:
- url += '?%s' % self._prepare_params(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_volume(self, volume_id):
- """Returns the details of a single volume."""
- url = "volumes/%s" % volume_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_volume(self, **kwargs):
- """Creates a new Volume.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-volume
- """
- post_body = json.dumps({'volume': kwargs})
- resp, body = self.post('volumes', post_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume(self, volume_id, **kwargs):
- """Updates the Specified Volume.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#update-volume
- """
- put_body = json.dumps({'volume': kwargs})
- resp, body = self.put('volumes/%s' % volume_id, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_volume(self, volume_id):
- """Deletes the Specified Volume."""
- resp, body = self.delete("volumes/%s" % volume_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def upload_volume(self, volume_id, **kwargs):
- """Uploads a volume in Glance."""
- post_body = json.dumps({'os-volume_upload_image': kwargs})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def attach_volume(self, volume_id, **kwargs):
- """Attaches a volume to a given instance on a given mountpoint.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#attach-volume-to-server
- """
- post_body = json.dumps({'os-attach': kwargs})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def set_bootable_volume(self, volume_id, **kwargs):
- """set a bootable flag for a volume - true or false."""
- post_body = json.dumps({'os-set_bootable': kwargs})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def detach_volume(self, volume_id):
- """Detaches a volume from an instance."""
- post_body = json.dumps({'os-detach': {}})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def reserve_volume(self, volume_id):
- """Reserves a volume."""
- post_body = json.dumps({'os-reserve': {}})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def unreserve_volume(self, volume_id):
- """Restore a reserved volume ."""
- post_body = json.dumps({'os-unreserve': {}})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_volume(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'volume'
-
- def extend_volume(self, volume_id, **kwargs):
- """Extend a volume.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#extend-volume-size
- """
- post_body = json.dumps({'os-extend': kwargs})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def reset_volume_status(self, volume_id, **kwargs):
- """Reset the Specified Volume's Status.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#reset-volume-statuses
- """
- post_body = json.dumps({'os-reset_status': kwargs})
- resp, body = self.post('volumes/%s/action' % volume_id, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_volume_transfer(self, **kwargs):
- """Create a volume transfer.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#create-volume-transfer
- """
- post_body = json.dumps({'transfer': kwargs})
- resp, body = self.post('os-volume-transfer', post_body)
- body = json.loads(body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_volume_transfer(self, transfer_id):
- """Returns the details of a volume transfer."""
- url = "os-volume-transfer/%s" % transfer_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def list_volume_transfers(self, **params):
- """List all the volume transfers created.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#list-volume-transfers
- """
- url = 'os-volume-transfer'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_volume_transfer(self, transfer_id):
- """Delete a volume transfer."""
- resp, body = self.delete("os-volume-transfer/%s" % transfer_id)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def accept_volume_transfer(self, transfer_id, **kwargs):
- """Accept a volume transfer.
-
- For a full list of available parameters, please refer to the official
- API reference:
- https://docs.openstack.org/api-ref/block-storage/v2/#accept-volume-transfer
- """
- url = 'os-volume-transfer/%s/accept' % transfer_id
- post_body = json.dumps({'accept': kwargs})
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume_readonly(self, volume_id, **kwargs):
- """Update the Specified Volume readonly."""
- post_body = json.dumps({'os-update_readonly_flag': kwargs})
- url = 'volumes/%s/action' % (volume_id)
- resp, body = self.post(url, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def force_delete_volume(self, volume_id):
- """Force Delete Volume."""
- post_body = json.dumps({'os-force_delete': {}})
- resp, body = self.post('volumes/%s/action' % volume_id, post_body)
- self.expected_success(202, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def create_volume_metadata(self, volume_id, metadata):
- """Create metadata for the volume."""
- put_body = json.dumps({'metadata': metadata})
- url = "volumes/%s/metadata" % volume_id
- resp, body = self.post(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def show_volume_metadata(self, volume_id):
- """Get metadata of the volume."""
- url = "volumes/%s/metadata" % volume_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume_metadata(self, volume_id, metadata):
- """Update metadata for the volume."""
- put_body = json.dumps({'metadata': metadata})
- url = "volumes/%s/metadata" % volume_id
- resp, body = self.put(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def update_volume_metadata_item(self, volume_id, id, meta_item):
- """Update metadata item for the volume."""
- put_body = json.dumps({'meta': meta_item})
- url = "volumes/%s/metadata/%s" % (volume_id, id)
- resp, body = self.put(url, put_body)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def delete_volume_metadata_item(self, volume_id, id):
- """Delete metadata item for the volume."""
- url = "volumes/%s/metadata/%s" % (volume_id, id)
- resp, body = self.delete(url)
- self.expected_success(200, resp.status)
- return rest_client.ResponseBody(resp, body)
-
- def retype_volume(self, volume_id, **kwargs):
- """Updates volume with new volume type."""
- post_body = json.dumps({'os-retype': kwargs})
- resp, _ = self.post('volumes/%s/action' % volume_id, post_body)
- self.expected_success(202, resp.status)
diff --git a/tempest/lib/services/volume/v2/__init__.py b/tempest/lib/services/volume/v2/__init__.py
index 68982d9..756a41a 100644
--- a/tempest/lib/services/volume/v2/__init__.py
+++ b/tempest/lib/services/volume/v2/__init__.py
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations under
# the License.
+import warnings
+
from tempest.lib.services.volume.v2.availability_zone_client \
import AvailabilityZoneClient
from tempest.lib.services.volume.v2.backups_client import BackupsClient
@@ -44,3 +46,9 @@
'LimitsClient', 'CapabilitiesClient', 'SchedulerStatsClient',
'SnapshotManageClient', 'VolumeManageClient', 'TransfersClient',
'QuotaClassesClient']
+
+warnings.warn(
+ "The tempest.lib.services.volume.v2 module (volume v2 APIs service "
+ "clients) is deprecated in favor of tempest.lib.services.volume.v3 "
+ "(volume v3 APIs service clients) and will be removed once Tempest stop "
+ "supporting stable wallaby.", DeprecationWarning)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 9590eb4..add5c32 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -624,6 +624,13 @@
ssh_client = self.get_remote_client(
ip_address, private_key=private_key, server=server)
+ # NOTE: Server needs to renew its dhcp lease in order to get new
+ # definitions from subnet
+ # NOTE(amuller): we are renewing the lease as part of the retry
+ # because Neutron updates dnsmasq asynchronously after the
+ # subnet-update API call returns.
+ ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'],
+ dhcp_client=CONF.scenario.dhcp_client)
dns_servers = [initial_dns_server]
servers = ssh_client.get_dns_servers()
self.assertEqual(set(dns_servers), set(servers),
diff --git a/tempest/tests/cmd/test_cleanup_services.py b/tempest/tests/cmd/test_cleanup_services.py
index fc44793..2301be6 100644
--- a/tempest/tests/cmd/test_cleanup_services.py
+++ b/tempest/tests/cmd/test_cleanup_services.py
@@ -143,40 +143,40 @@
saved_state = {
# Static list to ensure global service saved items are not deleted
- "users": {u'32rwef64245tgr20121qw324bgg': u'Lightning'},
- "flavors": {u'42': u'm1.tiny'},
- "images": {u'34yhwr-4t3q': u'stratus-0.3.2-x86_64-disk'},
- "roles": {u'3efrt74r45hn': u'president'},
- "projects": {u'f38ohgp93jj032': u'manhattan'},
- "domains": {u'default': u'Default'},
+ "users": {'32rwef64245tgr20121qw324bgg': 'Lightning'},
+ "flavors": {'42': 'm1.tiny'},
+ "images": {'34yhwr-4t3q': 'stratus-0.3.2-x86_64-disk'},
+ "roles": {'3efrt74r45hn': 'president'},
+ "projects": {'f38ohgp93jj032': 'manhattan'},
+ "domains": {'default': 'Default'},
# Static list to ensure project service saved items are not deleted
- "snapshots": {u'1ad4c789-7e8w-4dwg-afc5': u'saved-snapshot'},
- "servers": {u'7a6d4v7w-36ds-4216': u'saved-server'},
- "server_groups": {u'as6d5f7g-46ca-475e': u'saved-server-group'},
- "keypairs": {u'saved-key-pair': {
- u'fingerprint': u'7e:eb:ab:24',
- u'name': u'saved-key-pair'
+ "snapshots": {'1ad4c789-7e8w-4dwg-afc5': 'saved-snapshot'},
+ "servers": {'7a6d4v7w-36ds-4216': 'saved-server'},
+ "server_groups": {'as6d5f7g-46ca-475e': 'saved-server-group'},
+ "keypairs": {'saved-key-pair': {
+ 'fingerprint': '7e:eb:ab:24',
+ 'name': 'saved-key-pair'
}},
- "volumes": {u'aa77asdf-1234': u'saved-volume'},
- "networks": {u'6722fc13-4319': {
- u'id': u'6722fc13-4319',
- u'name': u'saved-network'
+ "volumes": {'aa77asdf-1234': 'saved-volume'},
+ "networks": {'6722fc13-4319': {
+ 'id': '6722fc13-4319',
+ 'name': 'saved-network'
}},
- "floatingips": {u'9e82d248-408a': {
- u'id': u'9e82d248-408a',
- u'status': u'ACTIVE'
+ "floatingips": {'9e82d248-408a': {
+ 'id': '9e82d248-408a',
+ 'status': 'ACTIVE'
}},
- "routers": {u'4s5w34hj-id44': u'saved-router'},
- "metering_label_rules": {u'93a973ce-4dc5': {
- u'direction': u'ingress',
- u'id': u'93a973ce-4dc5'
+ "routers": {'4s5w34hj-id44': 'saved-router'},
+ "metering_label_rules": {'93a973ce-4dc5': {
+ 'direction': 'ingress',
+ 'id': '93a973ce-4dc5'
}},
- "metering_labels": {u'723b346ce866-4c7q': u'saved-label'},
- "ports": {u'aa74aa4v-741a': u'saved-port'},
- "security_groups": {u'7q844add-3697': u'saved-sec-group'},
- "subnets": {u'55ttda4a-2584': u'saved-subnet'},
- "subnetpools": {u'8acf64c1-43fc': u'saved-subnet-pool'},
- "regions": {u'RegionOne': {}}
+ "metering_labels": {'723b346ce866-4c7q': 'saved-label'},
+ "ports": {'aa74aa4v-741a': 'saved-port'},
+ "security_groups": {'7q844add-3697': 'saved-sec-group'},
+ "subnets": {'55ttda4a-2584': 'saved-subnet'},
+ "subnetpools": {'8acf64c1-43fc': 'saved-subnet-pool'},
+ "regions": {'RegionOne': {}}
}
# Mocked methods
get_method = 'tempest.lib.common.rest_client.RestClient.get'
diff --git a/tempest/tests/common/test_waiters.py b/tempest/tests/common/test_waiters.py
index d64d7b0..f801243 100755
--- a/tempest/tests/common/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -120,6 +120,29 @@
waiters.wait_for_image_copied_to_stores,
self.client, 'fake_image_id')
+ def test_wait_for_image_tasks_status(self):
+ self.client.show_image_tasks.return_value = ({
+ 'tasks': [{'status': 'success'}]})
+ start_time = int(time.time())
+ waiters.wait_for_image_tasks_status(
+ self.client, 'fake_image_id', 'success')
+ end_time = int(time.time())
+ # Ensure waiter returns before build_timeout
+ self.assertLess((end_time - start_time), 10)
+
+ def test_wait_for_image_tasks_status_timeout(self):
+ time_mock = self.patch('time.time')
+ self.patch('time.time', side_effect=[0., 1.])
+ time_mock.side_effect = utils.generate_timeout_series(1)
+
+ self.client.show_image_tasks.return_value = ({
+ 'tasks': [
+ {'status': 'success'},
+ {'status': 'processing'}]})
+ self.assertRaises(lib_exc.TimeoutException,
+ waiters.wait_for_image_tasks_status,
+ self.client, 'fake_image_id', 'success')
+
class TestInterfaceWaiters(base.TestCase):
diff --git a/tempest/tests/lib/services/compute/test_aggregates_client.py b/tempest/tests/lib/services/compute/test_aggregates_client.py
index 674d92a..1448a4d 100644
--- a/tempest/tests/lib/services/compute/test_aggregates_client.py
+++ b/tempest/tests/lib/services/compute/test_aggregates_client.py
@@ -37,7 +37,7 @@
FAKE_CREATE_AGGREGATE = {
"aggregate":
{
- "name": u'\xf4',
+ "name": '\xf4',
"availability_zone": None,
"deleted": False,
"created_at": "2015-07-21T04:11:18.000000",
@@ -50,7 +50,7 @@
FAKE_UPDATE_AGGREGATE = {
"aggregate":
{
- "name": u'\xe9',
+ "name": '\xe9',
"availability_zone": None,
"deleted": False,
"created_at": "2015-07-16T03:07:32.000000",
@@ -74,7 +74,7 @@
"metadata": {
"availability_zone": "nova"
},
- "name": u'\xe9',
+ "name": '\xe9',
"updated_at": None
}
diff --git a/tempest/tests/lib/services/compute/test_availability_zone_client.py b/tempest/tests/lib/services/compute/test_availability_zone_client.py
index 6608592..aef98fc 100644
--- a/tempest/tests/lib/services/compute/test_availability_zone_client.py
+++ b/tempest/tests/lib/services/compute/test_availability_zone_client.py
@@ -27,7 +27,7 @@
"available": True
},
"hosts": None,
- "zoneName": u'\xf4'
+ "zoneName": '\xf4'
}
]
}
diff --git a/tempest/tests/lib/services/compute/test_extensions_client.py b/tempest/tests/lib/services/compute/test_extensions_client.py
index d7e217e..053b84c 100644
--- a/tempest/tests/lib/services/compute/test_extensions_client.py
+++ b/tempest/tests/lib/services/compute/test_extensions_client.py
@@ -27,7 +27,7 @@
"namespace":
"http://docs.openstack.org/compute/ext/multinic/api/v1.1",
"alias": "NMN",
- "description": u'\u2740(*\xb4\u25e1`*)\u2740'
+ "description": '\u2740(*\xb4\u25e1`*)\u2740'
}
}
diff --git a/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py b/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py
index b0c00f0..6278df4 100644
--- a/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py
+++ b/tempest/tests/lib/services/compute/test_floating_ip_pools_client.py
@@ -22,8 +22,8 @@
FAKE_FLOATING_IP_POOLS = {
"floating_ip_pools":
[
- {"name": u'\u3042'},
- {"name": u'\u3044'}
+ {"name": '\u3042'},
+ {"name": '\u3044'}
]
}
diff --git a/tempest/tests/lib/services/compute/test_keypairs_client.py b/tempest/tests/lib/services/compute/test_keypairs_client.py
index ed3b9dd..214d0e5 100644
--- a/tempest/tests/lib/services/compute/test_keypairs_client.py
+++ b/tempest/tests/lib/services/compute/test_keypairs_client.py
@@ -23,7 +23,7 @@
FAKE_KEYPAIR = {"keypair": {
"public_key": "ssh-rsa foo Generated-by-Nova",
- "name": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "name": '\u2740(*\xb4\u25e1`*)\u2740',
"user_id": "525d55f98980415ba98e634972fa4a10",
"fingerprint": "76:24:66:49:d7:ca:6e:5c:77:ea:8e:bb:9c:15:5f:98"
}}
diff --git a/tempest/tests/lib/services/compute/test_networks_client.py b/tempest/tests/lib/services/compute/test_networks_client.py
index 1908b57..5a88671 100644
--- a/tempest/tests/lib/services/compute/test_networks_client.py
+++ b/tempest/tests/lib/services/compute/test_networks_client.py
@@ -31,7 +31,7 @@
"deleted_at": None,
"gateway": None,
"rxtx_base": None,
- "label": u'30d7',
+ "label": '30d7',
"priority": None,
"project_id": None,
"vpn_private_address": None,
diff --git a/tempest/tests/lib/services/compute/test_quota_classes_client.py b/tempest/tests/lib/services/compute/test_quota_classes_client.py
index 22d8b91..6921365 100644
--- a/tempest/tests/lib/services/compute/test_quota_classes_client.py
+++ b/tempest/tests/lib/services/compute/test_quota_classes_client.py
@@ -29,7 +29,7 @@
"ram": 51200,
"floating_ips": 10,
"key_pairs": 100,
- "id": u'\u2740(*\xb4\u25e1`*)\u2740',
+ "id": '\u2740(*\xb4\u25e1`*)\u2740',
"instances": 10,
"security_group_rules": 20,
"security_groups": 10,
diff --git a/tempest/tests/lib/services/compute/test_tenant_networks_client.py b/tempest/tests/lib/services/compute/test_tenant_networks_client.py
index f71aad9..a042a1a 100644
--- a/tempest/tests/lib/services/compute/test_tenant_networks_client.py
+++ b/tempest/tests/lib/services/compute/test_tenant_networks_client.py
@@ -22,7 +22,7 @@
FAKE_NETWORK = {
"cidr": "None",
"id": "c2329eb4-cc8e-4439-ac4c-932369309e36",
- "label": u'\u30d7'
+ "label": '\u30d7'
}
FAKE_NETWORKS = [FAKE_NETWORK]
diff --git a/tempest/tests/lib/services/placement/test_resource_providers_client.py b/tempest/tests/lib/services/placement/test_resource_providers_client.py
index 485f584..2871395 100644
--- a/tempest/tests/lib/services/placement/test_resource_providers_client.py
+++ b/tempest/tests/lib/services/placement/test_resource_providers_client.py
@@ -85,6 +85,14 @@
},
"resource_provider_generation": 1
}
+ FAKE_RESOURCE_PROVIDER_USAGES = {
+ "usages": {
+ "VCPU": 2,
+ "MEMORY_MB": 1024,
+ "DISK_GB": 10
+ },
+ "resource_provider_generation": 3
+ }
def setUp(self):
super(TestResourceProvidersClient, self).setUp()
@@ -180,3 +188,19 @@
def test_list_resource_provider_aggregates_with_bytes_body(self):
self._test_list_resource_provider_aggregates(bytes_body=True)
+
+ def _test_list_resource_provider_usages(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.list_resource_provider_usages,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_RESOURCE_PROVIDER_USAGES,
+ to_utf=bytes_body,
+ status=200,
+ rp_uuid=self.FAKE_RESOURCE_PROVIDER_UUID
+ )
+
+ def test_show_resource_provider_usages_with_str_body(self):
+ self._test_list_resource_provider_inventories()
+
+ def test_show_resource_provider_usages_with_with_bytes_body(self):
+ self._test_list_resource_provider_inventories(bytes_body=True)
diff --git a/tempest/tests/lib/services/registry_fixture.py b/tempest/tests/lib/services/registry_fixture.py
index 07af68a..a368705 100644
--- a/tempest/tests/lib/services/registry_fixture.py
+++ b/tempest/tests/lib/services/registry_fixture.py
@@ -38,8 +38,7 @@
"""Initialise the registry fixture"""
self.services = set(['compute', 'identity.v2', 'identity.v3',
'image.v1', 'image.v2', 'network', 'placement',
- 'volume.v1', 'volume.v2', 'volume.v3',
- 'object-storage'])
+ 'volume.v2', 'volume.v3', 'object-storage'])
def _setUp(self):
# Cleanup the registry
diff --git a/tempest/tests/lib/services/volume/v1/__init__.py b/tempest/tests/lib/services/volume/v1/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/tempest/tests/lib/services/volume/v1/__init__.py
+++ /dev/null
diff --git a/tempest/tests/lib/services/volume/v1/test_encryption_types_client.py b/tempest/tests/lib/services/volume/v1/test_encryption_types_client.py
deleted file mode 100644
index 585904e..0000000
--- a/tempest/tests/lib/services/volume/v1/test_encryption_types_client.py
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 2016 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.
-
-from tempest.lib.services.volume.v1 import encryption_types_client
-from tempest.tests.lib import fake_auth_provider
-from tempest.tests.lib.services import base
-
-
-class TestEncryptionTypesClient(base.BaseServiceTest):
- FAKE_CREATE_ENCRYPTION_TYPE = {
- "encryption": {
- "id": "cbc36478b0bd8e67e89",
- "name": "FakeEncryptionType",
- "type": "fakeType",
- "provider": "LuksEncryptor",
- "cipher": "aes-xts-plain64",
- "key_size": "512",
- "control_location": "front-end"
- }
- }
-
- FAKE_INFO_ENCRYPTION_TYPE = {
- "encryption": {
- "name": "FakeEncryptionType",
- "type": "fakeType",
- "description": "test_description",
- "volume_type": "fakeType",
- "provider": "LuksEncryptor",
- "cipher": "aes-xts-plain64",
- "key_size": "512",
- "control_location": "front-end"
- }
- }
-
- def setUp(self):
- super(TestEncryptionTypesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = encryption_types_client.EncryptionTypesClient(fake_auth,
- 'volume',
- 'regionOne'
- )
-
- def _test_create_encryption(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_encryption_type,
- 'tempest.lib.common.rest_client.RestClient.post',
- self.FAKE_CREATE_ENCRYPTION_TYPE,
- bytes_body, volume_type_id="cbc36478b0bd8e67e89")
-
- def _test_show_encryption_type(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_encryption_type,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_INFO_ENCRYPTION_TYPE,
- bytes_body, volume_type_id="cbc36478b0bd8e67e89")
-
- def test_create_encryption_type_with_str_body(self):
- self._test_create_encryption()
-
- def test_create_encryption_type_with_bytes_body(self):
- self._test_create_encryption(bytes_body=True)
-
- def test_show_encryption_type_with_str_body(self):
- self._test_show_encryption_type()
-
- def test_show_encryption_type_with_bytes_body(self):
- self._test_show_encryption_type(bytes_body=True)
-
- def test_delete_encryption_type(self):
- self.check_service_client_function(
- self.client.delete_encryption_type,
- 'tempest.lib.common.rest_client.RestClient.delete',
- {},
- volume_type_id="cbc36478b0bd8e67e89",
- status=202)
diff --git a/tempest/tests/lib/services/volume/v1/test_quotas_client.py b/tempest/tests/lib/services/volume/v1/test_quotas_client.py
deleted file mode 100644
index f9e76af..0000000
--- a/tempest/tests/lib/services/volume/v1/test_quotas_client.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2016 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.
-
-from tempest.lib.services.volume.v1 import quotas_client
-from tempest.tests.lib import fake_auth_provider
-from tempest.tests.lib.services import base
-
-
-class TestQuotasClient(base.BaseServiceTest):
- FAKE_QUOTAS = {
- "quota_set": {
- "cores": 20,
- "fixed_ips": -1,
- "floating_ips": 10,
- "id": "fake_tenant",
- "injected_file_content_bytes": 10240,
- "injected_file_path_bytes": 255,
- "injected_files": 5,
- "instances": 10,
- "key_pairs": 100,
- "metadata_items": 128,
- "ram": 51200,
- "security_group_rules": 20,
- "security_groups": 10
- }
- }
-
- FAKE_UPDATE_QUOTAS_REQUEST = {
- "quota_set": {
- "security_groups": 45
- }
- }
-
- def setUp(self):
- super(TestQuotasClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quotas_client.QuotasClient(fake_auth,
- 'volume',
- 'regionOne')
-
- def _test_show_default_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_default_quota_set,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_QUOTAS,
- bytes_body, tenant_id="fake_tenant")
-
- def _test_show_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_quota_set,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_QUOTAS,
- bytes_body, tenant_id="fake_tenant")
-
- def _test_update_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_quota_set,
- 'tempest.lib.common.rest_client.RestClient.put',
- self.FAKE_UPDATE_QUOTAS_REQUEST,
- bytes_body, tenant_id="fake_tenant")
-
- def test_show_default_quota_set_with_str_body(self):
- self._test_show_default_quota_set()
-
- def test_show_default_quota_set_with_bytes_body(self):
- self._test_show_default_quota_set(bytes_body=True)
-
- def test_show_quota_set_with_str_body(self):
- self._test_show_quota_set()
-
- def test_show_quota_set_with_bytes_body(self):
- self._test_show_quota_set(bytes_body=True)
-
- def test_update_quota_set_with_str_body(self):
- self._test_update_quota_set()
-
- def test_update_quota_set_with_bytes_body(self):
- self._test_update_quota_set(bytes_body=True)
-
- def test_delete_quota_set(self):
- self.check_service_client_function(
- self.client.delete_quota_set,
- 'tempest.lib.common.rest_client.RestClient.delete',
- {},
- tenant_id="fake_tenant")
diff --git a/tempest/tests/lib/services/volume/v1/test_snapshots_client.py b/tempest/tests/lib/services/volume/v1/test_snapshots_client.py
deleted file mode 100644
index 49191e3..0000000
--- a/tempest/tests/lib/services/volume/v1/test_snapshots_client.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# Copyright 2016 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.
-
-from tempest.lib.services.volume.v1 import snapshots_client
-from tempest.tests.lib import fake_auth_provider
-from tempest.tests.lib.services import base
-
-
-class TestSnapshotsClient(base.BaseServiceTest):
- FAKE_CREATE_SNAPSHOT = {
- "snapshot": {
- "display_name": "snap-001",
- "display_description": "Daily backup",
- "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- "force": True
- }
- }
-
- FAKE_UPDATE_SNAPSHOT_REQUEST = {
- "metadata": {
- "key": "v1"
- }
- }
-
- FAKE_INFO_SNAPSHOT = {
- "snapshot": {
- "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
- "display_name": "snap-001",
- "display_description": "Daily backup",
- "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- "status": "available",
- "size": 30,
- "created_at": "2012-02-29T03:50:07Z"
- }
- }
-
- FAKE_LIST_SNAPSHOTS = {
- "snapshots": [
- {
- "id": "3fbbcccf-d058-4502-8844-6feeffdf4cb5",
- "display_name": "snap-001",
- "display_description": "Daily backup",
- "volume_id": "521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- "status": "available",
- "size": 30,
- "created_at": "2012-02-29T03:50:07Z",
- "metadata": {
- "contents": "junk"
- }
- },
- {
- "id": "e479997c-650b-40a4-9dfe-77655818b0d2",
- "display_name": "snap-002",
- "display_description": "Weekly backup",
- "volume_id": "76b8950a-8594-4e5b-8dce-0dfa9c696358",
- "status": "available",
- "size": 25,
- "created_at": "2012-03-19T01:52:47Z",
- "metadata": {}
- }
- ]
- }
-
- def setUp(self):
- super(TestSnapshotsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = snapshots_client.SnapshotsClient(fake_auth,
- 'volume',
- 'regionOne')
-
- def _test_create_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_snapshot,
- 'tempest.lib.common.rest_client.RestClient.post',
- self.FAKE_CREATE_SNAPSHOT,
- bytes_body)
-
- def _test_show_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_snapshot,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_INFO_SNAPSHOT,
- bytes_body,
- snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
-
- def _test_list_snapshots(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_snapshots,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_LIST_SNAPSHOTS,
- bytes_body,
- detail=True)
-
- def _test_create_snapshot_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_snapshot_metadata,
- 'tempest.lib.common.rest_client.RestClient.post',
- self.FAKE_INFO_SNAPSHOT,
- bytes_body,
- snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5",
- metadata={"key": "v1"})
-
- def _test_update_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_snapshot,
- 'tempest.lib.common.rest_client.RestClient.put',
- self.FAKE_UPDATE_SNAPSHOT_REQUEST,
- bytes_body,
- snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
-
- def _test_show_snapshot_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_snapshot_metadata,
- 'tempest.lib.common.rest_client.RestClient.get',
- self.FAKE_UPDATE_SNAPSHOT_REQUEST,
- bytes_body,
- snapshot_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
-
- def _test_update_snapshot_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_snapshot_metadata,
- 'tempest.lib.common.rest_client.RestClient.put',
- self.FAKE_UPDATE_SNAPSHOT_REQUEST,
- bytes_body, snapshot_id="cbc36478b0bd8e67e89")
-
- def _test_update_snapshot_metadata_item(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_snapshot_metadata_item,
- 'tempest.lib.common.rest_client.RestClient.put',
- self.FAKE_INFO_SNAPSHOT,
- bytes_body, volume_type_id="cbc36478b0bd8e67e89")
-
- def test_create_snapshot_with_str_body(self):
- self._test_create_snapshot()
-
- def test_create_snapshot_with_bytes_body(self):
- self._test_create_snapshot(bytes_body=True)
-
- def test_show_snapshot_with_str_body(self):
- self._test_show_snapshot()
-
- def test_show_snapshot_with_bytes_body(self):
- self._test_show_snapshot(bytes_body=True)
-
- def test_list_snapshots_with_str_body(self):
- self._test_list_snapshots()
-
- def test_list_snapshots_with_bytes_body(self):
- self._test_list_snapshots(bytes_body=True)
-
- def test_create_snapshot_metadata_with_str_body(self):
- self._test_create_snapshot_metadata()
-
- def test_create_snapshot_metadata_with_bytes_body(self):
- self._test_create_snapshot_metadata(bytes_body=True)
-
- def test_update_snapshot_with_str_body(self):
- self._test_update_snapshot()
-
- def test_update_snapshot_with_bytes_body(self):
- self._test_update_snapshot(bytes_body=True)
-
- def test_show_snapshot_metadata_with_str_body(self):
- self._test_show_snapshot_metadata()
-
- def test_show_snapshot_metadata_with_bytes_body(self):
- self._test_show_snapshot_metadata(bytes_body=True)
-
- def test_update_snapshot_metadata_with_str_body(self):
- self._test_update_snapshot_metadata()
-
- def test_update_snapshot_metadata_with_bytes_body(self):
- self._test_update_snapshot_metadata(bytes_body=True)
-
- def test_force_delete_snapshot(self):
- self.check_service_client_function(
- self.client.force_delete_snapshot,
- 'tempest.lib.common.rest_client.RestClient.post',
- {},
- snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- status=202)
-
- def test_delete_snapshot(self):
- self.check_service_client_function(
- self.client.delete_snapshot,
- 'tempest.lib.common.rest_client.RestClient.delete',
- {},
- snapshot_id="521752a6-acf6-4b2d-bc7a-119f9148cd8c",
- status=202)
diff --git a/tempest/tests/lib/services/volume/v3/test_versions_client.py b/tempest/tests/lib/services/volume/v3/test_versions_client.py
index 575cae3..862fb9b 100644
--- a/tempest/tests/lib/services/volume/v3/test_versions_client.py
+++ b/tempest/tests/lib/services/volume/v3/test_versions_client.py
@@ -22,21 +22,6 @@
FAKE_VERSIONS_INFO = {
"versions": [
{
- "status": "DEPRECATED", "updated": "2016-05-02T20:25:19Z",
- "links": [
- {"href": "http://docs.openstack.org/", "type": "text/html",
- "rel": "describedby"},
- {"href": "https://10.30.197.39:8776/v1/", "rel": "self"}
- ],
- "min_version": "",
- "version": "",
- "media-types": [
- {"base": "application/json",
- "type": "application/vnd.openstack.volume+json;version=1"}
- ],
- "id": "v1.0"
- },
- {
"status": "DEPRECATED", "updated": "2017-02-25T12:00:00Z",
"links": [
{"href": "http://docs.openstack.org/", "type": "text/html",
@@ -134,8 +119,6 @@
self._test_show_version('v3', bytes_body=True)
def test_get_base_version_url_app_name(self):
- self._test_get_base_version_url('https://bar.org/volume/v1/123',
- 'https://bar.org/volume/')
self._test_get_base_version_url('https://bar.org/volume/v2/123',
'https://bar.org/volume/')
self._test_get_base_version_url('https://bar.org/volume/v3/123',
diff --git a/tox.ini b/tox.ini
index 2315163..cd32174 100644
--- a/tox.ini
+++ b/tox.ini
@@ -409,3 +409,15 @@
allowlist_externals = bash
commands =
bash tools/tempest-plugin-sanity.sh
+
+[testenv:stestr-master]
+envdir = .tox/tempest
+sitepackages = {[tempestenv]sitepackages}
+basepython = {[tempestenv]basepython}
+setenv = {[tempestenv]setenv}
+deps = {[tempestenv]deps}
+# The below command install stestr master version and run smoke tests
+commands =
+ find . -type f -name "*.pyc" -delete
+ pip install -U git+https://github.com/mtreinish/stestr
+ tempest run --regex '\[.*\bsmoke\b.*\]' {posargs}
diff --git a/zuul.d/integrated-gate.yaml b/zuul.d/integrated-gate.yaml
index b83eb34..d931c55 100644
--- a/zuul.d/integrated-gate.yaml
+++ b/zuul.d/integrated-gate.yaml
@@ -408,8 +408,9 @@
- job:
name: tempest-cinder-v2-api
parent: devstack-tempest
- branches:
- - master
+ # NOTE(gmann): Cinder v2 APIs are available until
+ # stable/wallaby only.
+ override-checkout: stable/wallaby
description: |
This job runs the cinder API test against v2 endpoint.
vars:
diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml
index b93a8b0..698df53 100644
--- a/zuul.d/project.yaml
+++ b/zuul.d/project.yaml
@@ -3,7 +3,7 @@
- check-requirements
- integrated-gate-py3
- openstack-cover-jobs
- - openstack-python3-victoria-jobs
+ - openstack-python3-xena-jobs
- publish-openstack-docs-pti
- release-notes-jobs-python3
check:
@@ -109,6 +109,7 @@
irrelevant-files: *tempest-irrelevant-files
experimental:
jobs:
+ - tempest-stestr-master
- tempest-cinder-v2-api:
irrelevant-files: *tempest-irrelevant-files
- tempest-all:
@@ -133,3 +134,4 @@
jobs:
- tempest-all
- tempest-full-oslo-master
+ - tempest-stestr-master
diff --git a/zuul.d/tempest-specific.yaml b/zuul.d/tempest-specific.yaml
index fd348cc..5063d89 100644
--- a/zuul.d/tempest-specific.yaml
+++ b/zuul.d/tempest-specific.yaml
@@ -113,3 +113,19 @@
vars:
devstack_localrc:
TEMPEST_HAS_ADMIN: False
+
+- job:
+ name: tempest-stestr-master
+ parent: devstack-tempest
+ description: |
+ Smoke integration test with stestr master.
+ This ensures that new stestr release does
+ not break Temepst.
+ vars:
+ tox_envlist: stestr-master
+ devstack_services:
+ s-account: false
+ s-container: false
+ s-object: false
+ s-proxy: false
+ c-bak: false