summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-06-24 14:08:25 +0000
committerGerrit Code Review <review@openstack.org>2022-06-24 14:08:25 +0000
commit3857a50f7878fac324503d088f8715c20b83eff3 (patch)
tree83bfc4f48b9b28e04e78f63e137c95ee6733d918
parentd8a803f95f050b61da5599f19bad463f3e2cd7b0 (diff)
parentb687980fde4e4f88e2177519b63e6c61db92697a (diff)
downloadtempest-3857a50f7878fac324503d088f8715c20b83eff3.tar.gz
Merge "Update volume schema for microversion"
-rw-r--r--tempest/lib/api_schema/response/volume/v3_61/__init__.py0
-rw-r--r--tempest/lib/api_schema/response/volume/v3_61/volumes.py69
-rw-r--r--tempest/lib/api_schema/response/volume/v3_63/__init__.py0
-rw-r--r--tempest/lib/api_schema/response/volume/v3_63/volumes.py69
-rw-r--r--tempest/lib/api_schema/response/volume/v3_64/__init__.py0
-rw-r--r--tempest/lib/api_schema/response/volume/v3_64/backups.py48
-rw-r--r--tempest/lib/api_schema/response/volume/v3_64/volumes.py69
-rw-r--r--tempest/lib/services/volume/v3/backups_client.py8
-rw-r--r--tempest/lib/services/volume/v3/volumes_client.py13
9 files changed, 276 insertions, 0 deletions
diff --git a/tempest/lib/api_schema/response/volume/v3_61/__init__.py b/tempest/lib/api_schema/response/volume/v3_61/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_61/__init__.py
diff --git a/tempest/lib/api_schema/response/volume/v3_61/volumes.py b/tempest/lib/api_schema/response/volume/v3_61/volumes.py
new file mode 100644
index 000000000..2e28b7e1b
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_61/volumes.py
@@ -0,0 +1,69 @@
+# Copyright 2022 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.volume import volumes
+
+# Volume micro version 3.61:
+# 1. Add cluster_name attribute to response body of volume details
+# for admin in Active/Active HA mode.
+# https://docs.openstack.org/cinder/latest/contributor/
+# api_microversion_history.html
+
+common_show_volume = copy.deepcopy(volumes.common_show_volume)
+common_show_volume['properties'].update(
+ {'cluster_name': parameter_types.uuid_or_null})
+
+create_volume = copy.deepcopy(volumes.create_volume)
+create_volume['response_body']['properties']['volume']['properties'].update(
+ {'cluster_name': parameter_types.uuid_or_null})
+
+# copy unchanged volumes schema
+attachments = copy.deepcopy(volumes.attachments)
+list_volumes_no_detail = copy.deepcopy(volumes.list_volumes_no_detail)
+# show_volume refers to common_show_volume
+show_volume = copy.deepcopy(volumes.show_volume)
+show_volume['response_body']['properties']['volume'] = common_show_volume
+# list copy refers to latest common_show_volume
+list_volumes_detail = copy.deepcopy(common_show_volume)
+list_volumes_with_detail = copy.deepcopy(volumes.list_volumes_with_detail)
+list_volumes_with_detail['response_body']['properties']['volumes']['items'] \
+ = list_volumes_detail
+update_volume = copy.deepcopy(volumes.update_volume)
+delete_volume = copy.deepcopy(volumes.delete_volume)
+show_volume_summary = copy.deepcopy(volumes.show_volume_summary)
+attach_volume = copy.deepcopy(volumes.attach_volume)
+set_bootable_volume = copy.deepcopy(volumes.set_bootable_volume)
+detach_volume = copy.deepcopy(volumes.detach_volume)
+reserve_volume = copy.deepcopy(volumes.reserve_volume)
+unreserve_volume = copy.deepcopy(volumes.unreserve_volume)
+extend_volume = copy.deepcopy(volumes.extend_volume)
+reset_volume_status = copy.deepcopy(volumes.reset_volume_status)
+update_volume_readonly = copy.deepcopy(volumes.update_volume_readonly)
+force_delete_volume = copy.deepcopy(volumes.force_delete_volume)
+retype_volume = copy.deepcopy(volumes.retype_volume)
+force_detach_volume = copy.deepcopy(volumes.force_detach_volume)
+create_volume_metadata = copy.deepcopy(volumes.create_volume_metadata)
+show_volume_metadata = copy.deepcopy(volumes.show_volume_metadata)
+update_volume_metadata = copy.deepcopy(volumes.update_volume_metadata)
+update_volume_metadata_item = copy.deepcopy(
+ volumes.update_volume_metadata_item)
+update_volume_image_metadata = copy.deepcopy(
+ volumes.update_volume_image_metadata)
+delete_volume_image_metadata = copy.deepcopy(
+ volumes.delete_volume_image_metadata)
+unmanage_volume = copy.deepcopy(volumes.unmanage_volume)
diff --git a/tempest/lib/api_schema/response/volume/v3_63/__init__.py b/tempest/lib/api_schema/response/volume/v3_63/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_63/__init__.py
diff --git a/tempest/lib/api_schema/response/volume/v3_63/volumes.py b/tempest/lib/api_schema/response/volume/v3_63/volumes.py
new file mode 100644
index 000000000..218db9014
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_63/volumes.py
@@ -0,0 +1,69 @@
+# Copyright 2022 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.volume.v3_61 import volumes
+
+# Volume micro version 3.63:
+# 1. Includes volume type ID in the volume-show and volume-detail-list.
+# for admin in Active/Active HA mode.
+# https://docs.openstack.org/cinder/latest/contributor/
+# api_microversion_history.html
+
+common_show_volume = copy.deepcopy(volumes.common_show_volume)
+common_show_volume['properties'].update(
+ {'volume_type_id': parameter_types.uuid_or_null})
+
+create_volume = copy.deepcopy(volumes.create_volume)
+create_volume['response_body']['properties']['volume']['properties'].update(
+ {'volume_type_id': parameter_types.uuid_or_null})
+
+# copy unchanged volumes schema
+attachments = copy.deepcopy(volumes.attachments)
+list_volumes_no_detail = copy.deepcopy(volumes.list_volumes_no_detail)
+# show_volume refers to common_show_volume
+show_volume = copy.deepcopy(volumes.show_volume)
+show_volume['response_body']['properties']['volume'] = common_show_volume
+# list copy refers to latest common_show_volume
+list_volumes_detail = copy.deepcopy(common_show_volume)
+list_volumes_with_detail = copy.deepcopy(volumes.list_volumes_with_detail)
+list_volumes_with_detail['response_body']['properties']['volumes']['items'] \
+ = list_volumes_detail
+update_volume = copy.deepcopy(volumes.update_volume)
+delete_volume = copy.deepcopy(volumes.delete_volume)
+show_volume_summary = copy.deepcopy(volumes.show_volume_summary)
+attach_volume = copy.deepcopy(volumes.attach_volume)
+set_bootable_volume = copy.deepcopy(volumes.set_bootable_volume)
+detach_volume = copy.deepcopy(volumes.detach_volume)
+reserve_volume = copy.deepcopy(volumes.reserve_volume)
+unreserve_volume = copy.deepcopy(volumes.unreserve_volume)
+extend_volume = copy.deepcopy(volumes.extend_volume)
+reset_volume_status = copy.deepcopy(volumes.reset_volume_status)
+update_volume_readonly = copy.deepcopy(volumes.update_volume_readonly)
+force_delete_volume = copy.deepcopy(volumes.force_delete_volume)
+retype_volume = copy.deepcopy(volumes.retype_volume)
+force_detach_volume = copy.deepcopy(volumes.force_detach_volume)
+create_volume_metadata = copy.deepcopy(volumes.create_volume_metadata)
+show_volume_metadata = copy.deepcopy(volumes.show_volume_metadata)
+update_volume_metadata = copy.deepcopy(volumes.update_volume_metadata)
+update_volume_metadata_item = copy.deepcopy(
+ volumes.update_volume_metadata_item)
+update_volume_image_metadata = copy.deepcopy(
+ volumes.update_volume_image_metadata)
+delete_volume_image_metadata = copy.deepcopy(
+ volumes.delete_volume_image_metadata)
+unmanage_volume = copy.deepcopy(volumes.unmanage_volume)
diff --git a/tempest/lib/api_schema/response/volume/v3_64/__init__.py b/tempest/lib/api_schema/response/volume/v3_64/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_64/__init__.py
diff --git a/tempest/lib/api_schema/response/volume/v3_64/backups.py b/tempest/lib/api_schema/response/volume/v3_64/backups.py
new file mode 100644
index 000000000..01b93bc6a
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_64/backups.py
@@ -0,0 +1,48 @@
+# Copyright 2022 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.volume import backups
+
+# Volume micro version 3.64:
+# 1. Include the encryption_key_id in volume and backup
+# details when the associated volume is encrypted.
+# https://docs.openstack.org/cinder/latest/contributor/
+# api_microversion_history.html
+
+common_show_backup = copy.deepcopy(backups.common_show_backup)
+common_show_backup['properties'].update(
+ {'encryption_key_id': parameter_types.uuid_or_null})
+
+create_backup = copy.deepcopy(backups.create_backup)
+update_backup = copy.deepcopy(backups.update_backup)
+restore_backup = copy.deepcopy(backups.restore_backup)
+delete_backup = copy.deepcopy(backups.delete_backup)
+# show backup refers to common_show_backup
+show_backup = copy.deepcopy(backups.show_backup)
+show_backup['response_body']['properties']['backup'] = common_show_backup
+list_backups_no_detail = copy.deepcopy(backups.list_backups_no_detail)
+# list_backups_detail refers to latest common_show_backup
+list_backups_detail = copy.deepcopy(common_show_backup)
+list_backups_detail['properties'].update({'count': {'type': 'integer'}})
+list_backups_with_detail = copy.deepcopy(backups.list_backups_with_detail)
+# list_backups_with_detail refers to latest list_backups_detail
+list_backups_with_detail['response_body']['properties']['backups']['items'] =\
+ list_backups_detail
+export_backup = copy.deepcopy(backups.export_backup)
+import_backup = copy.deepcopy(backups.import_backup)
+reset_backup_status = copy.deepcopy(backups.reset_backup_status)
diff --git a/tempest/lib/api_schema/response/volume/v3_64/volumes.py b/tempest/lib/api_schema/response/volume/v3_64/volumes.py
new file mode 100644
index 000000000..0fbbb3fe5
--- /dev/null
+++ b/tempest/lib/api_schema/response/volume/v3_64/volumes.py
@@ -0,0 +1,69 @@
+# Copyright 2022 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.
+
+import copy
+
+from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
+from tempest.lib.api_schema.response.volume.v3_63 import volumes
+
+# Volume micro version 3.64:
+# 1. Include the encryption_key_id in volume and backup
+# details when the associated volume is encrypted.
+# https://docs.openstack.org/cinder/latest/contributor/
+# api_microversion_history.html
+
+common_show_volume = copy.deepcopy(volumes.common_show_volume)
+common_show_volume['properties'].update(
+ {'encryption_key_id': parameter_types.uuid_or_null})
+
+create_volume = copy.deepcopy(volumes.create_volume)
+create_volume['response_body']['properties']['volume']['properties'].update(
+ {'encryption_key_id': parameter_types.uuid_or_null})
+
+# copy unchanged volumes schema
+attachments = copy.deepcopy(volumes.attachments)
+list_volumes_no_detail = copy.deepcopy(volumes.list_volumes_no_detail)
+# show_volume refers to common_show_volume
+show_volume = copy.deepcopy(volumes.show_volume)
+show_volume['response_body']['properties']['volume'] = common_show_volume
+# list_volumes_detail refers to latest common_show_volume
+list_volumes_detail = copy.deepcopy(common_show_volume)
+list_volumes_with_detail = copy.deepcopy(volumes.list_volumes_with_detail)
+list_volumes_with_detail['response_body']['properties']['volumes']['items'] \
+ = list_volumes_detail
+update_volume = copy.deepcopy(volumes.update_volume)
+delete_volume = copy.deepcopy(volumes.delete_volume)
+show_volume_summary = copy.deepcopy(volumes.show_volume_summary)
+attach_volume = copy.deepcopy(volumes.attach_volume)
+set_bootable_volume = copy.deepcopy(volumes.set_bootable_volume)
+detach_volume = copy.deepcopy(volumes.detach_volume)
+reserve_volume = copy.deepcopy(volumes.reserve_volume)
+unreserve_volume = copy.deepcopy(volumes.unreserve_volume)
+extend_volume = copy.deepcopy(volumes.extend_volume)
+reset_volume_status = copy.deepcopy(volumes.reset_volume_status)
+update_volume_readonly = copy.deepcopy(volumes.update_volume_readonly)
+force_delete_volume = copy.deepcopy(volumes.force_delete_volume)
+retype_volume = copy.deepcopy(volumes.retype_volume)
+force_detach_volume = copy.deepcopy(volumes.force_detach_volume)
+create_volume_metadata = copy.deepcopy(volumes.create_volume_metadata)
+show_volume_metadata = copy.deepcopy(volumes.show_volume_metadata)
+update_volume_metadata = copy.deepcopy(volumes.update_volume_metadata)
+update_volume_metadata_item = copy.deepcopy(
+ volumes.update_volume_metadata_item)
+update_volume_image_metadata = copy.deepcopy(
+ volumes.update_volume_image_metadata)
+delete_volume_image_metadata = copy.deepcopy(
+ volumes.delete_volume_image_metadata)
+unmanage_volume = copy.deepcopy(volumes.unmanage_volume)
diff --git a/tempest/lib/services/volume/v3/backups_client.py b/tempest/lib/services/volume/v3/backups_client.py
index 4bf7ffb64..0c32c5295 100644
--- a/tempest/lib/services/volume/v3/backups_client.py
+++ b/tempest/lib/services/volume/v3/backups_client.py
@@ -18,6 +18,7 @@ from urllib import parse as urllib
from oslo_serialization import jsonutils as json
from tempest.lib.api_schema.response.volume import backups as schema
+from tempest.lib.api_schema.response.volume.v3_64 import backups as schemav364
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
from tempest.lib.services.volume import base_client
@@ -26,6 +27,11 @@ from tempest.lib.services.volume import base_client
class BackupsClient(base_client.BaseClient):
"""Volume V3 Backups client"""
+ schema_versions_info = [
+ {'min': None, 'max': '3.63', 'schema': schema},
+ {'min': '3.64', 'max': None, 'schema': schemav364}
+ ]
+
def create_backup(self, **kwargs):
"""Creates a backup of volume.
@@ -76,6 +82,7 @@ class BackupsClient(base_client.BaseClient):
url = "backups/%s" % backup_id
resp, body = self.get(url)
body = json.loads(body)
+ schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.show_backup, resp, body)
return rest_client.ResponseBody(resp, body)
@@ -88,6 +95,7 @@ class BackupsClient(base_client.BaseClient):
https://docs.openstack.org/api-ref/block-storage/v3/index.html#list-backups-with-detail
"""
url = "backups"
+ schema = self.get_schema(self.schema_versions_info)
list_backups_schema = schema.list_backups_no_detail
if detail:
url += "/detail"
diff --git a/tempest/lib/services/volume/v3/volumes_client.py b/tempest/lib/services/volume/v3/volumes_client.py
index 9c6fe6821..9934e47d6 100644
--- a/tempest/lib/services/volume/v3/volumes_client.py
+++ b/tempest/lib/services/volume/v3/volumes_client.py
@@ -17,6 +17,9 @@ from urllib import parse as urllib
from oslo_serialization import jsonutils as json
+from tempest.lib.api_schema.response.volume.v3_61 import volumes as schemav361
+from tempest.lib.api_schema.response.volume.v3_63 import volumes as schemav363
+from tempest.lib.api_schema.response.volume.v3_64 import volumes as schemav364
from tempest.lib.api_schema.response.volume import volumes as schema
from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc
@@ -26,6 +29,13 @@ from tempest.lib.services.volume import base_client
class VolumesClient(base_client.BaseClient):
"""Client class to send CRUD Volume V3 API requests"""
+ schema_versions_info = [
+ {'min': None, 'max': '3.60', 'schema': schema},
+ {'min': '3.61', 'max': '3.62', 'schema': schemav361},
+ {'min': '3.63', 'max': '3.63', 'schema': schemav363},
+ {'min': '3.64', 'max': None, 'schema': schemav364}
+ ]
+
def _prepare_params(self, params):
"""Prepares params for use in get or _ext_get methods.
@@ -56,6 +66,7 @@ class VolumesClient(base_client.BaseClient):
https://docs.openstack.org/api-ref/block-storage/v3/index.html#list-accessible-volumes
"""
url = 'volumes'
+ schema = self.get_schema(self.schema_versions_info)
list_schema = schema.list_volumes_no_detail
if detail:
list_schema = schema.list_volumes_with_detail
@@ -86,6 +97,7 @@ class VolumesClient(base_client.BaseClient):
url = "volumes/%s" % volume_id
resp, body = self.get(url)
body = json.loads(body)
+ schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.show_volume, resp, body)
return rest_client.ResponseBody(resp, body)
@@ -99,6 +111,7 @@ class VolumesClient(base_client.BaseClient):
post_body = json.dumps({'volume': kwargs})
resp, body = self.post('volumes', post_body)
body = json.loads(body)
+ schema = self.get_schema(self.schema_versions_info)
self.validate_response(schema.create_volume, resp, body)
return rest_client.ResponseBody(resp, body)