blob: f9c957baff64b9e2ccb46e63324776ccb4aaca1c [file] [log] [blame]
Ghanshyam7fa397c2014-04-01 19:32:38 +09001# Copyright 2014 NEC Corporation. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
Ghanshyama8f66532014-04-23 17:18:14 +090015import copy
16
Marc Koderer6fbd74f2014-08-04 09:38:19 +020017from tempest.api_schema.response.compute import parameter_types
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090018
Ghanshyam7fa397c2014-04-01 19:32:38 +090019get_password = {
20 'status_code': [200],
21 'response_body': {
22 'type': 'object',
23 'properties': {
24 'password': {'type': 'string'}
25 },
26 'required': ['password']
27 }
28}
Ghanshyamd6d30402014-04-02 15:28:37 +090029
30get_vnc_console = {
31 'status_code': [200],
32 'response_body': {
33 'type': 'object',
34 'properties': {
35 'console': {
36 'type': 'object',
37 'properties': {
38 'type': {'type': 'string'},
39 'url': {
40 'type': 'string',
41 'format': 'uri'
42 }
43 },
44 'required': ['type', 'url']
45 }
46 },
47 'required': ['console']
48 }
49}
Ghanshyam4ac02742014-04-17 19:15:47 +090050
Ghanshyam51744862014-06-13 12:56:24 +090051common_show_server = {
52 'type': 'object',
53 'properties': {
54 'id': {'type': 'string'},
55 'name': {'type': 'string'},
56 'status': {'type': 'string'},
Joseph Lanouxeef192f2014-08-01 14:32:53 +000057 'image': {'oneOf': [
58 {'type': 'object',
59 'properties': {
60 'id': {'type': 'string'},
61 'links': parameter_types.links
62 },
63 'required': ['id', 'links']},
64 {'type': ['string', 'null']}
65 ]},
Ghanshyam51744862014-06-13 12:56:24 +090066 'flavor': {
67 'type': 'object',
68 'properties': {
69 'id': {'type': 'string'},
70 'links': parameter_types.links
71 },
72 'required': ['id', 'links']
73 },
74 'user_id': {'type': 'string'},
75 'tenant_id': {'type': 'string'},
76 'created': {'type': 'string'},
77 'updated': {'type': 'string'},
78 'progress': {'type': 'integer'},
79 'metadata': {'type': 'object'},
80 'links': parameter_types.links,
81 'addresses': parameter_types.addresses,
82 },
83 # NOTE(GMann): 'progress' attribute is present in the response
84 # only when server's status is one of the progress statuses
85 # ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE")
86 # So it is not defined as 'required'.
87 'required': ['id', 'name', 'status', 'image', 'flavor',
88 'user_id', 'tenant_id', 'created', 'updated',
89 'metadata', 'links', 'addresses']
90}
91
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090092base_update_get_server = {
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090093 'status_code': [200],
94 'response_body': {
95 'type': 'object',
96 'properties': {
Ghanshyam51744862014-06-13 12:56:24 +090097 'server': common_show_server
Ghanshyamc079a022014-06-11 18:52:55 +090098 },
99 'required': ['server']
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +0900100 }
101}
102
Ghanshyam4ac02742014-04-17 19:15:47 +0900103delete_server = {
104 'status_code': [204],
105}
Haiwei Xu3d2b7af2014-04-12 02:50:26 +0900106
107set_server_metadata = {
108 'status_code': [200],
109 'response_body': {
110 'type': 'object',
111 'properties': {
Ghanshyameaaa6a42014-04-25 18:38:21 +0900112 'metadata': {
113 'type': 'object',
114 'patternProperties': {
115 '^.+$': {'type': 'string'}
116 }
117 }
Haiwei Xu3d2b7af2014-04-12 02:50:26 +0900118 },
119 'required': ['metadata']
120 }
121}
Ghanshyama8f66532014-04-23 17:18:14 +0900122
123list_server_metadata = copy.deepcopy(set_server_metadata)
Ghanshyameaaa6a42014-04-25 18:38:21 +0900124
Ghanshyame8421062014-06-02 15:58:21 +0900125update_server_metadata = copy.deepcopy(set_server_metadata)
126
Ghanshyameaaa6a42014-04-25 18:38:21 +0900127delete_server_metadata_item = {
128 'status_code': [204]
129}
Ghanshyam623c38f2014-04-21 17:16:21 +0900130
131list_servers = {
132 'status_code': [200],
133 'response_body': {
134 'type': 'object',
135 'properties': {
136 'servers': {
137 'type': 'array',
138 'items': {
139 'type': 'object',
140 'properties': {
141 'id': {'type': 'string'},
142 'links': parameter_types.links,
143 'name': {'type': 'string'}
144 },
145 'required': ['id', 'links', 'name']
146 }
147 }
148 },
149 'required': ['servers']
150 }
151}
Ghanshyam997c9092014-04-03 19:00:20 +0900152
153server_actions_common_schema = {
154 'status_code': [202]
155}
156
157server_actions_delete_password = {
158 'status_code': [204]
159}
Ghanshyam7ee264a2014-04-02 16:37:57 +0900160
161get_console_output = {
162 'status_code': [200],
163 'response_body': {
164 'type': 'object',
165 'properties': {
166 'output': {'type': 'string'}
167 },
168 'required': ['output']
169 }
170}
Ghanshyam29966092014-04-07 17:27:41 +0900171
172common_instance_actions = {
173 'type': 'object',
174 'properties': {
175 'action': {'type': 'string'},
176 'request_id': {'type': 'string'},
177 'user_id': {'type': 'string'},
178 'project_id': {'type': 'string'},
179 'start_time': {'type': 'string'},
180 'message': {'type': ['string', 'null']}
181 },
182 'required': ['action', 'request_id', 'user_id', 'project_id',
183 'start_time', 'message']
184}
Ghanshyam51744862014-06-13 12:56:24 +0900185
Ghanshyam4b41dfd2014-07-17 13:40:38 +0900186instance_action_events = {
187 'type': 'array',
188 'items': {
189 'type': 'object',
190 'properties': {
191 'event': {'type': 'string'},
192 'start_time': {'type': 'string'},
193 'finish_time': {'type': 'string'},
194 'result': {'type': 'string'},
195 'traceback': {'type': ['string', 'null']}
196 },
197 'required': ['event', 'start_time', 'finish_time', 'result',
198 'traceback']
199 }
200}
201
202common_get_instance_action = copy.deepcopy(common_instance_actions)
203
204common_get_instance_action['properties'].update({
205 'events': instance_action_events})
206# 'events' does not come in response body always so it is not
207# defined as 'required'
208
Ghanshyam51744862014-06-13 12:56:24 +0900209base_list_servers_detail = {
210 'status_code': [200],
211 'response_body': {
212 'type': 'object',
213 'properties': {
214 'servers': {
215 'type': 'array',
216 'items': common_show_server
217 }
218 },
219 'required': ['servers']
220 }
221}