From 00b3bd55d956f9d8d8d5fb7b96de025e5c6c22be Mon Sep 17 00:00:00 2001 From: Felipe Monteiro Date: Fri, 3 Aug 2018 02:18:13 -0400 Subject: [PATCH] Add server schema for microversion 2.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds servers schema for microversion 2.8 [0]: Add ‘mks’ protocol and ‘webmks’ type for remote consoles. The appropriate api_schema files are updated with the 2.8 microversion changes. Note that no test is added to cover this new microversion since it isn't possible to test mks protocol in Tempest gates so as per REVIEWING documentation [1] we shouldn't add such a test. So, we could only cover the vnc protocol for 2.8 but this would also not be of much value since the vnc value (instead of mks) would be returned by the server. [0] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id7 [1] https://docs.openstack.org/tempest/latest/REVIEWING.html#ensuring-code-is-executed partially-implements: blueprint full-schema-for-all-microversions Change-Id: I5a6d2852db8e2a67013eee71a094e9b521a92524 --- doc/source/microversion_testing.rst | 4 ++ .../response/compute/v2_8/__init__.py | 0 .../response/compute/v2_8/servers.py | 37 +++++++++++++++++++ .../response/compute/v2_9/servers.py | 25 ++++++------- .../lib/services/compute/servers_client.py | 4 +- 5 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 tempest/lib/api_schema/response/compute/v2_8/__init__.py create mode 100644 tempest/lib/api_schema/response/compute/v2_8/servers.py diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst index 6677d0a24d..8a3993b759 100644 --- a/doc/source/microversion_testing.rst +++ b/doc/source/microversion_testing.rst @@ -306,6 +306,10 @@ Microversion tests implemented in Tempest .. _2.6: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id5 + * `2.8`_ + + .. _2.8: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id7 + * `2.9`_ .. _2.9: https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#id8 diff --git a/tempest/lib/api_schema/response/compute/v2_8/__init__.py b/tempest/lib/api_schema/response/compute/v2_8/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tempest/lib/api_schema/response/compute/v2_8/servers.py b/tempest/lib/api_schema/response/compute/v2_8/servers.py new file mode 100644 index 0000000000..df7847f9b0 --- /dev/null +++ b/tempest/lib/api_schema/response/compute/v2_8/servers.py @@ -0,0 +1,37 @@ +# Copyright 2018 AT&T Corporation. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import copy + +from tempest.lib.api_schema.response.compute.v2_6 import servers + +# 2.8: Add 'mks' protocol and 'webmks' type for remote consoles. +get_remote_consoles = copy.deepcopy(servers.get_remote_consoles) +get_remote_consoles['response_body']['properties']['remote_console'][ + 'properties']['protocol']['enum'].append('mks') +get_remote_consoles['response_body']['properties']['remote_console'][ + 'properties']['type']['enum'].append('webmks') + +# 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.6 ****** +list_servers = copy.deepcopy(servers.list_servers) +get_server = copy.deepcopy(servers.get_server) +list_servers_detail = copy.deepcopy(servers.list_servers_detail) +update_server = copy.deepcopy(servers.update_server) +rebuild_server = copy.deepcopy(servers.rebuild_server) +rebuild_server_with_admin_pass = copy.deepcopy( + servers.rebuild_server_with_admin_pass) +show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics) diff --git a/tempest/lib/api_schema/response/compute/v2_9/servers.py b/tempest/lib/api_schema/response/compute/v2_9/servers.py index f412839465..55f8e7502d 100644 --- a/tempest/lib/api_schema/response/compute/v2_9/servers.py +++ b/tempest/lib/api_schema/response/compute/v2_9/servers.py @@ -14,16 +14,7 @@ import copy -from tempest.lib.api_schema.response.compute.v2_1 import servers as servers_21 -from tempest.lib.api_schema.response.compute.v2_6 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.6 ****** -list_servers = copy.deepcopy(servers.list_servers) -show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics) -get_remote_consoles = copy.deepcopy(servers.get_remote_consoles) +from tempest.lib.api_schema.response.compute.v2_8 import servers get_server = copy.deepcopy(servers.get_server) get_server['response_body']['properties']['server'][ @@ -37,21 +28,29 @@ list_servers_detail['response_body']['properties']['servers']['items'][ list_servers_detail['response_body']['properties']['servers']['items'][ 'required'].append('locked') -update_server = copy.deepcopy(servers_21.update_server) +update_server = copy.deepcopy(servers.update_server) update_server['response_body']['properties']['server'][ 'properties'].update({'locked': {'type': 'boolean'}}) update_server['response_body']['properties']['server'][ 'required'].append('locked') -rebuild_server = copy.deepcopy(servers_21.rebuild_server) +rebuild_server = copy.deepcopy(servers.rebuild_server) rebuild_server['response_body']['properties']['server'][ 'properties'].update({'locked': {'type': 'boolean'}}) rebuild_server['response_body']['properties']['server'][ 'required'].append('locked') rebuild_server_with_admin_pass = copy.deepcopy( - servers_21.rebuild_server_with_admin_pass) + servers.rebuild_server_with_admin_pass) rebuild_server_with_admin_pass['response_body']['properties']['server'][ 'properties'].update({'locked': {'type': 'boolean'}}) rebuild_server_with_admin_pass['response_body']['properties']['server'][ 'required'].append('locked') + +# 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.8 ****** +list_servers = copy.deepcopy(servers.list_servers) +show_server_diagnostics = copy.deepcopy(servers.show_server_diagnostics) +get_remote_consoles = copy.deepcopy(servers.get_remote_consoles) diff --git a/tempest/lib/services/compute/servers_client.py b/tempest/lib/services/compute/servers_client.py index 031435621e..9eed4b347f 100644 --- a/tempest/lib/services/compute/servers_client.py +++ b/tempest/lib/services/compute/servers_client.py @@ -33,6 +33,7 @@ from tempest.lib.api_schema.response.compute.v2_54 import servers as schemav254 from tempest.lib.api_schema.response.compute.v2_57 import servers as schemav257 from tempest.lib.api_schema.response.compute.v2_6 import servers as schemav26 from tempest.lib.api_schema.response.compute.v2_63 import servers as schemav263 +from tempest.lib.api_schema.response.compute.v2_8 import servers as schemav28 from tempest.lib.api_schema.response.compute.v2_9 import servers as schemav29 from tempest.lib.common import rest_client from tempest.lib.services.compute import base_compute_client @@ -44,7 +45,8 @@ class ServersClient(base_compute_client.BaseComputeClient): schema_versions_info = [ {'min': None, 'max': '2.2', 'schema': schema}, {'min': '2.3', 'max': '2.5', 'schema': schemav23}, - {'min': '2.6', 'max': '2.8', 'schema': schemav26}, + {'min': '2.6', 'max': '2.7', 'schema': schemav26}, + {'min': '2.8', 'max': '2.8', 'schema': schemav28}, {'min': '2.9', 'max': '2.15', 'schema': schemav29}, {'min': '2.16', 'max': '2.18', 'schema': schemav216}, {'min': '2.19', 'max': '2.25', 'schema': schemav219},