Add compute response schema for microversion 2.96

Compute microversion 2.96 added the pinned_availability_zone field to
the GET /servers/detail and GET /servers/{server_id} responses.

https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-2024-1-caracal-and-2024-2-dalmatian

Change-Id: I7b1e32b7ac3622029336f1919fb5cc2731050a2d
This commit is contained in:
melanie witt 2024-10-03 23:21:53 +00:00
parent da14e29722
commit d8e4894956
5 changed files with 88 additions and 1 deletions

View File

@ -454,6 +454,10 @@ Microversion tests implemented in Tempest
.. _2.86: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id79
* `2.96`_
.. _2.96: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-2024-1-caracal-and-2024-2-dalmatian
* Volume
* `3.3`_

View File

@ -263,3 +263,22 @@ class ServerShowV263Test(base.BaseV2ComputeTest):
servers = self.servers_client.list_servers(
detail=True, **params)['servers']
self.assertNotEmpty(servers)
class ServersListShow296Test(base.BaseV2ComputeTest):
"""Test compute server with microversion >= than 2.96
This test tests the Server APIs response schema for 2.96 microversion.
No specific assert or behaviour verification is needed.
"""
min_microversion = '2.96'
max_microversion = 'latest'
@decorators.idempotent_id('4eee1ffe-9e00-4c99-a431-0d3e0f323a8f')
def test_list_show_server_296(self):
server = self.create_test_server()
# Checking list API response schema.
self.servers_client.list_servers(detail=True)
# Checking show API response schema
self.servers_client.show_server(server['id'])

View File

@ -0,0 +1,62 @@
# 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_89 import servers as servers289
###########################################################################
#
# 2.96:
#
# The attachment_id and bdm_uuid parameter is now returned in the response body
# of the following calls:
# The pinned_availability_zone parameter is now returned in the response body
# of the following calls:
#
# - GET /servers/detail
# - GET /servers/{server_id}
###########################################################################
get_server = copy.deepcopy(servers289.get_server)
get_server['response_body']['properties']['server'][
'properties'].update(
{'pinned_availability_zone': {'type': ['string', 'null']}})
list_servers_detail = copy.deepcopy(servers289.list_servers_detail)
list_servers_detail['response_body']['properties']['servers']['items'][
'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.
# ****** Schemas unchanged since microversion 2.89***
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)
get_remote_consoles = copy.deepcopy(servers289.get_remote_consoles)
list_tags = copy.deepcopy(servers289.list_tags)
update_all_tags = copy.deepcopy(servers289.update_all_tags)
delete_all_tags = copy.deepcopy(servers289.delete_all_tags)
check_tag_existence = copy.deepcopy(servers289.check_tag_existence)
update_tag = copy.deepcopy(servers289.update_tag)
delete_tag = copy.deepcopy(servers289.delete_tag)
show_instance_action = copy.deepcopy(servers289.show_instance_action)
create_backup = copy.deepcopy(servers289.create_backup)

View File

@ -45,6 +45,7 @@ from tempest.lib.api_schema.response.compute.v2_79 import servers as schemav279
from tempest.lib.api_schema.response.compute.v2_8 import servers as schemav28
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.common import rest_client
from tempest.lib.services.compute import base_compute_client
@ -75,7 +76,8 @@ class ServersClient(base_compute_client.BaseComputeClient):
{'min': '2.73', 'max': '2.74', 'schema': schemav273},
{'min': '2.75', 'max': '2.78', 'schema': schemav275},
{'min': '2.79', 'max': '2.88', 'schema': schemav279},
{'min': '2.89', 'max': None, 'schema': schemav289}]
{'min': '2.89', 'max': '2.95', 'schema': schemav289},
{'min': '2.96', 'max': None, 'schema': schemav296}]
def __init__(self, auth_provider, service, region,
enable_instance_password=True, **kwargs):