Add compute response schema for microversion 2.98
Compute microversion 2.98 added the image properties field to the
following API responses:
* GET /servers/{server_id}
* GET /servers/detail
* POST /servers/{server_id}/action (rebuild)
While testing this it was discovered that microversion 2.96 is missing
an API response schema for:
* POST /servers/{server_id}/action (rebuild)
so this is also fixed in this patch.
Change-Id: If42a8a1e3b8866e48c17853a8774dd8aec0ff184
diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst
index 33e75ff..9701cbc 100644
--- a/doc/source/microversion_testing.rst
+++ b/doc/source/microversion_testing.rst
@@ -458,6 +458,10 @@
.. _2.96: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-2024-1-caracal-and-2024-2-dalmatian
+ * `2.98`_
+
+ .. _2.98: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#microversion-2-98
+
* Volume
* `3.3`_
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index e7e84d6..af88a15 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -277,8 +277,31 @@
@decorators.idempotent_id('4eee1ffe-9e00-4c99-a431-0d3e0f323a8f')
def test_list_show_server_296(self):
- server = self.create_test_server()
+ server = self.create_test_server(wait_until='ACTIVE')
# Checking list API response schema.
self.servers_client.list_servers(detail=True)
# Checking show API response schema
self.servers_client.show_server(server['id'])
+ # Check rebuild API response schema
+ self.servers_client.rebuild_server(server['id'], self.image_ref_alt)
+ waiters.wait_for_server_status(self.servers_client,
+ server['id'], 'ACTIVE')
+
+
+class ServersListShow298Test(base.BaseV2ComputeTest):
+ """Test compute server with microversion >= 2.98"""
+
+ min_microversion = '2.98'
+ max_microversion = 'latest'
+
+ @decorators.idempotent_id('3981e496-3bf7-4015-b807-63ffee7c520c')
+ def test_list_show_rebuild_server_298(self):
+ server = self.create_test_server(wait_until='ACTIVE')
+ # Check list details API response schema
+ self.servers_client.list_servers(detail=True)
+ # Check show API response schema
+ self.servers_client.show_server(server['id'])
+ # Check rebuild API response schema
+ self.servers_client.rebuild_server(server['id'], self.image_ref_alt)
+ waiters.wait_for_server_status(self.servers_client,
+ server['id'], 'ACTIVE')
diff --git a/tempest/lib/api_schema/response/compute/v2_96/servers.py b/tempest/lib/api_schema/response/compute/v2_96/servers.py
index 7036a11..2e24192 100644
--- a/tempest/lib/api_schema/response/compute/v2_96/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_96/servers.py
@@ -38,6 +38,17 @@
'properties'].update(
{'pinned_availability_zone': {'type': ['string', 'null']}})
+rebuild_server = copy.deepcopy(servers289.rebuild_server)
+rebuild_server['response_body']['properties']['server'][
+ 'properties'].update(
+ {'pinned_availability_zone': {'type': ['string', 'null']}})
+
+rebuild_server_with_admin_pass = copy.deepcopy(
+ servers289.rebuild_server_with_admin_pass)
+rebuild_server_with_admin_pass['response_body']['properties']['server'][
+ 'properties'].update(
+ {'pinned_availability_zone': {'type': ['string', 'null']}})
+
# NOTE(zhufl): Below are the unchanged schema in this microversion. We
# need to keep this schema in this file to have the generic way to select the
# right schema based on self.schema_versions_info mapping in service client.
@@ -45,9 +56,6 @@
attach_volume = copy.deepcopy(servers289.attach_volume)
show_volume_attachment = copy.deepcopy(servers289.show_volume_attachment)
list_volume_attachments = copy.deepcopy(servers289.list_volume_attachments)
-rebuild_server = copy.deepcopy(servers289.rebuild_server)
-rebuild_server_with_admin_pass = copy.deepcopy(
- servers289.rebuild_server_with_admin_pass)
update_server = copy.deepcopy(servers289.update_server)
list_servers = copy.deepcopy(servers289.list_servers)
show_server_diagnostics = copy.deepcopy(servers289.show_server_diagnostics)
diff --git a/tempest/lib/api_schema/response/compute/v2_98/__init__.py b/tempest/lib/api_schema/response/compute/v2_98/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_98/__init__.py
diff --git a/tempest/lib/api_schema/response/compute/v2_98/servers.py b/tempest/lib/api_schema/response/compute/v2_98/servers.py
new file mode 100644
index 0000000..5c96d8b
--- /dev/null
+++ b/tempest/lib/api_schema/response/compute/v2_98/servers.py
@@ -0,0 +1,81 @@
+# 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_96 import servers as servers296
+
+
+###########################################################################
+#
+# 2.98:
+#
+# The image properties parameter is now returned in the response body of the
+# following calls:
+#
+# - GET /servers/detail
+# - GET /servers/{server_id}
+# - POST /servers/{server_id}/action (rebuild)
+#
+###########################################################################
+
+image_properties = {
+ 'type': 'object',
+ 'patternProperties': {
+ '^[a-zA-Z0-9_:. ]{1,255}$': {
+ 'oneOf': [
+ {'type': 'string', 'maxLength': 255},
+ {'type': 'null'},
+ ]
+ },
+ },
+ 'additionalProperties': False,
+}
+
+get_server = copy.deepcopy(servers296.get_server)
+get_server['response_body']['properties']['server']['properties'][
+ 'image']['oneOf'][0]['properties'].update({'properties': image_properties})
+
+list_servers_detail = copy.deepcopy(servers296.list_servers_detail)
+list_servers_detail['response_body']['properties']['servers']['items'][
+ 'properties']['image']['oneOf'][0]['properties'].update(
+ {'properties': image_properties})
+
+rebuild_server = copy.deepcopy(servers296.rebuild_server)
+rebuild_server['response_body']['properties']['server']['properties'][
+ 'image']['oneOf'][0]['properties'].update({'properties': image_properties})
+
+rebuild_server_with_admin_pass = copy.deepcopy(
+ servers296.rebuild_server_with_admin_pass)
+rebuild_server_with_admin_pass['response_body']['properties']['server'][
+ 'properties']['image']['oneOf'][0]['properties'].update(
+ {'properties': image_properties})
+
+# Below are the unchanged schema in this microversion. We need to keep this
+# schema in this file to have the generic way to select the right schema based
+# on self.schema_versions_info mapping in service client.
+# ****** Schemas unchanged since microversion 2.96***
+attach_volume = copy.deepcopy(servers296.attach_volume)
+show_volume_attachment = copy.deepcopy(servers296.show_volume_attachment)
+list_volume_attachments = copy.deepcopy(servers296.list_volume_attachments)
+update_server = copy.deepcopy(servers296.update_server)
+list_servers = copy.deepcopy(servers296.list_servers)
+show_server_diagnostics = copy.deepcopy(servers296.show_server_diagnostics)
+get_remote_consoles = copy.deepcopy(servers296.get_remote_consoles)
+list_tags = copy.deepcopy(servers296.list_tags)
+update_all_tags = copy.deepcopy(servers296.update_all_tags)
+delete_all_tags = copy.deepcopy(servers296.delete_all_tags)
+check_tag_existence = copy.deepcopy(servers296.check_tag_existence)
+update_tag = copy.deepcopy(servers296.update_tag)
+delete_tag = copy.deepcopy(servers296.delete_tag)
+show_instance_action = copy.deepcopy(servers296.show_instance_action)
+create_backup = copy.deepcopy(servers296.create_backup)
diff --git a/tempest/lib/api_schema/response/compute/v2_99/servers.py b/tempest/lib/api_schema/response/compute/v2_99/servers.py
index 828dda1..e667321 100644
--- a/tempest/lib/api_schema/response/compute/v2_99/servers.py
+++ b/tempest/lib/api_schema/response/compute/v2_99/servers.py
@@ -12,12 +12,12 @@
import copy
-from tempest.lib.api_schema.response.compute.v2_96 import servers
+from tempest.lib.api_schema.response.compute.v2_98 import servers
# NOTE: Below are the unchanged schema in this microversion. We need
# to keep this schema in this file to have the generic way to select the
# right schema based on self.schema_versions_info mapping in service client.
-# ****** Schemas unchanged since microversion 2.96 ******
+# ****** Schemas unchanged since microversion 2.98 ******
list_servers = copy.deepcopy(servers.list_servers)
get_server = copy.deepcopy(servers.get_server)
list_servers_detail = copy.deepcopy(servers.list_servers_detail)
diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py
index faab413..dffafef 100644
--- a/tempest/lib/services/compute/servers_client.py
+++ b/tempest/lib/services/compute/servers_client.py
@@ -46,6 +46,7 @@
from tempest.lib.api_schema.response.compute.v2_89 import servers as schemav289
from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29
from tempest.lib.api_schema.response.compute.v2_96 import servers as schemav296
+from tempest.lib.api_schema.response.compute.v2_98 import servers as schemav298
from tempest.lib.api_schema.response.compute.v2_99 import servers as schemav299
from tempest.lib.common import rest_client
from tempest.lib.services.compute import base_compute_client
@@ -79,6 +80,7 @@
{'min': '2.79', 'max': '2.88', 'schema': schemav279},
{'min': '2.89', 'max': '2.95', 'schema': schemav289},
{'min': '2.96', 'max': '2.97', 'schema': schemav296},
+ {'min': '2.98', 'max': '2.98', 'schema': schemav298},
{'min': '2.99', 'max': None, 'schema': schemav299},
]