blob: a16e425b2d8b88b416acd9df6bcf98c74c346ff6 [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
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090017from tempest.api_schema.compute import parameter_types
18
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'},
57 'image': {
58 'type': 'object',
59 'properties': {
60 'id': {'type': 'string'},
61 'links': parameter_types.links
62 },
63 'required': ['id', 'links']
64 },
65 'flavor': {
66 'type': 'object',
67 'properties': {
68 'id': {'type': 'string'},
69 'links': parameter_types.links
70 },
71 'required': ['id', 'links']
72 },
73 'user_id': {'type': 'string'},
74 'tenant_id': {'type': 'string'},
75 'created': {'type': 'string'},
76 'updated': {'type': 'string'},
77 'progress': {'type': 'integer'},
78 'metadata': {'type': 'object'},
79 'links': parameter_types.links,
80 'addresses': parameter_types.addresses,
81 },
82 # NOTE(GMann): 'progress' attribute is present in the response
83 # only when server's status is one of the progress statuses
84 # ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE")
85 # So it is not defined as 'required'.
86 'required': ['id', 'name', 'status', 'image', 'flavor',
87 'user_id', 'tenant_id', 'created', 'updated',
88 'metadata', 'links', 'addresses']
89}
90
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090091base_update_get_server = {
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090092 'status_code': [200],
93 'response_body': {
94 'type': 'object',
95 'properties': {
Ghanshyam51744862014-06-13 12:56:24 +090096 'server': common_show_server
Ghanshyamc079a022014-06-11 18:52:55 +090097 },
98 'required': ['server']
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090099 }
100}
101
Ghanshyam4ac02742014-04-17 19:15:47 +0900102delete_server = {
103 'status_code': [204],
104}
Haiwei Xu3d2b7af2014-04-12 02:50:26 +0900105
106set_server_metadata = {
107 'status_code': [200],
108 'response_body': {
109 'type': 'object',
110 'properties': {
Ghanshyameaaa6a42014-04-25 18:38:21 +0900111 'metadata': {
112 'type': 'object',
113 'patternProperties': {
114 '^.+$': {'type': 'string'}
115 }
116 }
Haiwei Xu3d2b7af2014-04-12 02:50:26 +0900117 },
118 'required': ['metadata']
119 }
120}
Ghanshyama8f66532014-04-23 17:18:14 +0900121
122list_server_metadata = copy.deepcopy(set_server_metadata)
Ghanshyameaaa6a42014-04-25 18:38:21 +0900123
Ghanshyame8421062014-06-02 15:58:21 +0900124update_server_metadata = copy.deepcopy(set_server_metadata)
125
Ghanshyameaaa6a42014-04-25 18:38:21 +0900126delete_server_metadata_item = {
127 'status_code': [204]
128}
Ghanshyam623c38f2014-04-21 17:16:21 +0900129
130list_servers = {
131 'status_code': [200],
132 'response_body': {
133 'type': 'object',
134 'properties': {
135 'servers': {
136 'type': 'array',
137 'items': {
138 'type': 'object',
139 'properties': {
140 'id': {'type': 'string'},
141 'links': parameter_types.links,
142 'name': {'type': 'string'}
143 },
144 'required': ['id', 'links', 'name']
145 }
146 }
147 },
148 'required': ['servers']
149 }
150}
Ghanshyam997c9092014-04-03 19:00:20 +0900151
152server_actions_common_schema = {
153 'status_code': [202]
154}
155
156server_actions_delete_password = {
157 'status_code': [204]
158}
Ghanshyam7ee264a2014-04-02 16:37:57 +0900159
160get_console_output = {
161 'status_code': [200],
162 'response_body': {
163 'type': 'object',
164 'properties': {
165 'output': {'type': 'string'}
166 },
167 'required': ['output']
168 }
169}
Ghanshyam29966092014-04-07 17:27:41 +0900170
171common_instance_actions = {
172 'type': 'object',
173 'properties': {
174 'action': {'type': 'string'},
175 'request_id': {'type': 'string'},
176 'user_id': {'type': 'string'},
177 'project_id': {'type': 'string'},
178 'start_time': {'type': 'string'},
179 'message': {'type': ['string', 'null']}
180 },
181 'required': ['action', 'request_id', 'user_id', 'project_id',
182 'start_time', 'message']
183}
Ghanshyam51744862014-06-13 12:56:24 +0900184
Ghanshyam4b41dfd2014-07-17 13:40:38 +0900185instance_action_events = {
186 'type': 'array',
187 'items': {
188 'type': 'object',
189 'properties': {
190 'event': {'type': 'string'},
191 'start_time': {'type': 'string'},
192 'finish_time': {'type': 'string'},
193 'result': {'type': 'string'},
194 'traceback': {'type': ['string', 'null']}
195 },
196 'required': ['event', 'start_time', 'finish_time', 'result',
197 'traceback']
198 }
199}
200
201common_get_instance_action = copy.deepcopy(common_instance_actions)
202
203common_get_instance_action['properties'].update({
204 'events': instance_action_events})
205# 'events' does not come in response body always so it is not
206# defined as 'required'
207
Ghanshyam51744862014-06-13 12:56:24 +0900208base_list_servers_detail = {
209 'status_code': [200],
210 'response_body': {
211 'type': 'object',
212 'properties': {
213 'servers': {
214 'type': 'array',
215 'items': common_show_server
216 }
217 },
218 'required': ['servers']
219 }
220}