Merge availability_zone response schema into one file
Merge availability_zone response schema of v2 into v2_1
directory.
Partially implements blueprint rearrange-nova-response-schemas
Change-Id: Id1b69d6defe340a662b670ebe2661b1f7d22dd2f
diff --git a/tempest/api_schema/response/compute/availability_zone.py b/tempest/api_schema/response/compute/availability_zone.py
deleted file mode 100644
index ab3e2ea..0000000
--- a/tempest/api_schema/response/compute/availability_zone.py
+++ /dev/null
@@ -1,37 +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.
-
-# NOTE: This is the detail information for "get az detail" API.
-# The information is the same between v2 and v3 APIs.
-detail = {
- 'type': 'object',
- 'patternProperties': {
- # NOTE: Here is for a hostname
- '^[a-zA-Z0-9-_.]+$': {
- 'type': 'object',
- 'patternProperties': {
- # NOTE: Here is for a service name
- '^.*$': {
- 'type': 'object',
- 'properties': {
- 'available': {'type': 'boolean'},
- 'active': {'type': 'boolean'},
- 'updated_at': {'type': ['string', 'null']}
- },
- 'required': ['available', 'active', 'updated_at']
- }
- }
- }
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/availability_zone.py b/tempest/api_schema/response/compute/v2_1/availability_zone.py
index e261d3d..5c1224e 100644
--- a/tempest/api_schema/response/compute/v2_1/availability_zone.py
+++ b/tempest/api_schema/response/compute/v2_1/availability_zone.py
@@ -14,8 +14,6 @@
import copy
-from tempest.api_schema.response.compute import availability_zone as common
-
base = {
'status_code': [200],
@@ -47,8 +45,30 @@
}
}
-get_availability_zone_list = copy.deepcopy(base)
+detail = {
+ 'type': 'object',
+ 'patternProperties': {
+ # NOTE: Here is for a hostname
+ '^[a-zA-Z0-9-_.]+$': {
+ 'type': 'object',
+ 'patternProperties': {
+ # NOTE: Here is for a service name
+ '^.*$': {
+ 'type': 'object',
+ 'properties': {
+ 'available': {'type': 'boolean'},
+ 'active': {'type': 'boolean'},
+ 'updated_at': {'type': ['string', 'null']}
+ },
+ 'required': ['available', 'active', 'updated_at']
+ }
+ }
+ }
+ }
+}
-get_availability_zone_list_detail = copy.deepcopy(base)
-get_availability_zone_list_detail['response_body']['properties'][
- 'availabilityZoneInfo']['items']['properties']['hosts'] = common.detail
+list_availability_zone_list = copy.deepcopy(base)
+
+list_availability_zone_list_detail = copy.deepcopy(base)
+list_availability_zone_list_detail['response_body']['properties'][
+ 'availabilityZoneInfo']['items']['properties']['hosts'] = detail
diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py
index b541a2c..6c50398 100644
--- a/tempest/services/compute/json/availability_zone_client.py
+++ b/tempest/services/compute/json/availability_zone_client.py
@@ -25,14 +25,14 @@
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
body = json.loads(body)
- self.validate_response(schema.get_availability_zone_list, resp, body)
+ self.validate_response(schema.list_availability_zone_list, resp, body)
return service_client.ResponseBodyList(resp,
body['availabilityZoneInfo'])
def get_availability_zone_list_detail(self):
resp, body = self.get('os-availability-zone/detail')
body = json.loads(body)
- self.validate_response(schema.get_availability_zone_list_detail, resp,
+ self.validate_response(schema.list_availability_zone_list_detail, resp,
body)
return service_client.ResponseBodyList(resp,
body['availabilityZoneInfo'])