blob: 09abaed315f72e5fb33fc2b75f3a229cbbeda256 [file] [log] [blame]
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +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
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090015import copy
16
Marc Koderer6fbd74f2014-08-04 09:38:19 +020017from tempest.api_schema.response.compute import parameter_types
18from tempest.api_schema.response.compute import servers
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090019
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090020create_server = {
21 'status_code': [202],
22 'response_body': {
23 'type': 'object',
24 'properties': {
25 'server': {
26 'type': 'object',
27 'properties': {
Ghanshyamc5b842d2014-06-10 17:06:05 +090028 'id': {'type': 'string'},
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090029 'security_groups': {'type': 'array'},
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090030 'links': parameter_types.links,
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090031 'OS-DCF:diskConfig': {'type': 'string'}
32 },
33 # NOTE: OS-DCF:diskConfig is API extension, and some
34 # environments return a response without the attribute.
35 # So it is not 'required'.
JordanP551140c2014-04-02 11:16:09 +020036 'required': ['id', 'security_groups', 'links']
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090037 }
38 },
39 'required': ['server']
40 }
41}
Ghanshyam08ce58d2014-04-04 14:51:14 +090042
Ghanshyam7f989102014-07-29 14:23:26 +090043create_server_with_admin_pass = copy.deepcopy(create_server)
44create_server_with_admin_pass['response_body']['properties']['server'][
45 'properties'].update({'adminPass': {'type': 'string'}})
46create_server_with_admin_pass['response_body']['properties']['server'][
47 'required'].append('adminPass')
48
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090049update_server = copy.deepcopy(servers.base_update_get_server)
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090050update_server['response_body']['properties']['server']['properties'].update({
51 'hostId': {'type': 'string'},
52 'OS-DCF:diskConfig': {'type': 'string'},
53 'accessIPv4': parameter_types.access_ip_v4,
54 'accessIPv6': parameter_types.access_ip_v6
55})
56update_server['response_body']['properties']['server']['required'].append(
57 # NOTE: OS-DCF:diskConfig and accessIPv4/v6 are API
58 # extensions, and some environments return a response
59 # without these attributes. So they are not 'required'.
60 'hostId'
61)
62
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090063get_server = copy.deepcopy(servers.base_update_get_server)
64get_server['response_body']['properties']['server']['properties'].update({
65 'key_name': {'type': ['string', 'null']},
66 'hostId': {'type': 'string'},
67
68 # NOTE: Non-admin users also can see "OS-SRV-USG" and "OS-EXT-AZ"
69 # attributes.
70 'OS-SRV-USG:launched_at': {'type': ['string', 'null']},
71 'OS-SRV-USG:terminated_at': {'type': ['string', 'null']},
72 'OS-EXT-AZ:availability_zone': {'type': 'string'},
73
74 # NOTE: Admin users only can see "OS-EXT-STS" and "OS-EXT-SRV-ATTR"
75 # attributes.
76 'OS-EXT-STS:task_state': {'type': ['string', 'null']},
77 'OS-EXT-STS:vm_state': {'type': 'string'},
78 'OS-EXT-STS:power_state': {'type': 'integer'},
79 'OS-EXT-SRV-ATTR:host': {'type': ['string', 'null']},
80 'OS-EXT-SRV-ATTR:instance_name': {'type': 'string'},
81 'OS-EXT-SRV-ATTR:hypervisor_hostname': {'type': ['string', 'null']},
82 'os-extended-volumes:volumes_attached': {'type': 'array'},
83 'OS-DCF:diskConfig': {'type': 'string'},
84 'accessIPv4': parameter_types.access_ip_v4,
85 'accessIPv6': parameter_types.access_ip_v6,
86 'config_drive': {'type': 'string'}
87})
88get_server['response_body']['properties']['server']['required'].append(
89 # NOTE: OS-SRV-USG, OS-EXT-AZ, OS-EXT-STS, OS-EXT-SRV-ATTR,
90 # os-extended-volumes, OS-DCF and accessIPv4/v6 are API
91 # extension, and some environments return a response without
92 # these attributes. So they are not 'required'.
93 'hostId'
94)
95
Ghanshyam08ce58d2014-04-04 14:51:14 +090096list_virtual_interfaces = {
97 'status_code': [200],
98 'response_body': {
99 'type': 'object',
100 'properties': {
101 'virtual_interfaces': {
102 'type': 'array',
103 'items': {
104 'type': 'object',
105 'properties': {
106 'id': {'type': 'string'},
107 'mac_address': parameter_types.mac_address,
108 'OS-EXT-VIF-NET:net_id': {'type': 'string'}
109 },
110 # 'OS-EXT-VIF-NET:net_id' is API extension So it is
111 # not defined as 'required'
112 'required': ['id', 'mac_address']
113 }
114 }
115 },
116 'required': ['virtual_interfaces']
117 }
118}
Ghanshyam385c4e72014-03-27 11:42:25 +0900119
Ghanshyam5c2a5582014-04-14 17:16:57 +0900120common_attach_volume_info = {
121 'type': 'object',
122 'properties': {
123 'id': {'type': 'string'},
124 'device': {'type': 'string'},
125 'volumeId': {'type': 'string'},
126 'serverId': {'type': ['integer', 'string']}
127 },
128 'required': ['id', 'device', 'volumeId', 'serverId']
129}
130
Ghanshyam385c4e72014-03-27 11:42:25 +0900131attach_volume = {
132 'status_code': [200],
133 'response_body': {
134 'type': 'object',
135 'properties': {
Ghanshyam5c2a5582014-04-14 17:16:57 +0900136 'volumeAttachment': common_attach_volume_info
Ghanshyam385c4e72014-03-27 11:42:25 +0900137 },
138 'required': ['volumeAttachment']
139 }
140}
141
142detach_volume = {
143 'status_code': [202]
144}
Ghanshyameaaa6a42014-04-25 18:38:21 +0900145
Ghanshyam5c2a5582014-04-14 17:16:57 +0900146get_volume_attachment = copy.deepcopy(attach_volume)
147get_volume_attachment['response_body']['properties'][
148 'volumeAttachment']['properties'].update({'serverId': {'type': 'string'}})
149
150list_volume_attachments = {
151 'status_code': [200],
152 'response_body': {
153 'type': 'object',
154 'properties': {
155 'volumeAttachments': {
156 'type': 'array',
157 'items': common_attach_volume_info
158 }
159 },
160 'required': ['volumeAttachments']
161 }
162}
163list_volume_attachments['response_body']['properties'][
164 'volumeAttachments']['items']['properties'].update(
165 {'serverId': {'type': 'string'}})
166
Ghanshyameaaa6a42014-04-25 18:38:21 +0900167set_get_server_metadata_item = {
168 'status_code': [200],
169 'response_body': {
170 'type': 'object',
171 'properties': {
172 'meta': {
173 'type': 'object',
174 'patternProperties': {
175 '^.+$': {'type': 'string'}
176 }
177 }
178 },
179 'required': ['meta']
180 }
181}
Ghanshyam9541ad12014-05-07 16:38:43 +0900182
183list_addresses_by_network = {
184 'status_code': [200],
185 'response_body': parameter_types.addresses
186}
Ghanshyam997c9092014-04-03 19:00:20 +0900187
188server_actions_confirm_resize = copy.deepcopy(
189 servers.server_actions_delete_password)
Ghanshyamd847c582014-05-07 16:21:36 +0900190
191list_addresses = {
192 'status_code': [200],
193 'response_body': {
194 'type': 'object',
195 'properties': {
196 'addresses': parameter_types.addresses
197 },
198 'required': ['addresses']
199 }
200}
Ghanshyamf81f9fa2014-05-23 13:38:56 +0900201
202common_server_group = {
203 'type': 'object',
204 'properties': {
205 'id': {'type': 'string'},
206 'name': {'type': 'string'},
207 'policies': {
208 'type': 'array',
209 'items': {'type': 'string'}
210 },
211 # 'members' attribute contains the array of instance's UUID of
212 # instances present in server group
213 'members': {
214 'type': 'array',
215 'items': {'type': 'string'}
216 },
217 'metadata': {'type': 'object'}
218 },
219 'required': ['id', 'name', 'policies', 'members', 'metadata']
220}
221
222create_get_server_group = {
223 'status_code': [200],
224 'response_body': {
225 'type': 'object',
226 'properties': {
227 'server_group': common_server_group
228 },
229 'required': ['server_group']
230 }
231}
232
233delete_server_group = {
234 'status_code': [204]
235}
Ghanshyam29966092014-04-07 17:27:41 +0900236
Ghanshyam438ed3b2014-06-18 17:25:41 +0900237list_server_groups = {
238 'status_code': [200],
239 'response_body': {
240 'type': 'object',
241 'properties': {
242 'server_groups': {
243 'type': 'array',
244 'items': common_server_group
245 }
246 },
247 'required': ['server_groups']
248 }
249}
250
Ghanshyam29966092014-04-07 17:27:41 +0900251instance_actions_object = copy.deepcopy(servers.common_instance_actions)
252instance_actions_object[
253 'properties'].update({'instance_uuid': {'type': 'string'}})
254instance_actions_object['required'].extend(['instance_uuid'])
255
256list_instance_actions = {
257 'status_code': [200],
258 'response_body': {
259 'type': 'object',
260 'properties': {
261 'instanceActions': {
262 'type': 'array',
263 'items': instance_actions_object
264 }
265 },
266 'required': ['instanceActions']
267 }
268}
Ghanshyam51744862014-06-13 12:56:24 +0900269
Ghanshyam4b41dfd2014-07-17 13:40:38 +0900270get_instance_actions_object = copy.deepcopy(servers.common_get_instance_action)
271get_instance_actions_object[
272 'properties'].update({'instance_uuid': {'type': 'string'}})
273get_instance_actions_object['required'].extend(['instance_uuid'])
274
275get_instance_action = {
276 'status_code': [200],
277 'response_body': {
278 'type': 'object',
279 'properties': {
280 'instanceAction': get_instance_actions_object
281 },
282 'required': ['instanceAction']
283 }
284}
285
Ghanshyam51744862014-06-13 12:56:24 +0900286list_servers_detail = copy.deepcopy(servers.base_list_servers_detail)
287list_servers_detail['response_body']['properties']['servers']['items'][
288 'properties'].update({
289 'hostId': {'type': 'string'},
290 'OS-DCF:diskConfig': {'type': 'string'},
291 'accessIPv4': parameter_types.access_ip_v4,
292 'accessIPv6': parameter_types.access_ip_v6
293 })
294# NOTE(GMann): OS-DCF:diskConfig and accessIPv4/v6 are API
295# extensions, and some environments return a response
296# without these attributes. So they are not 'required'.
297list_servers_detail['response_body']['properties']['servers']['items'][
298 'required'].append('hostId')
Ghanshyam9c2e50d2014-07-22 21:32:05 +0900299
300rebuild_server = copy.deepcopy(update_server)
301rebuild_server['status_code'] = [202]
302del rebuild_server['response_body']['properties']['server'][
303 'properties']['OS-DCF:diskConfig']
304
305rebuild_server_with_admin_pass = copy.deepcopy(rebuild_server)
306rebuild_server_with_admin_pass['response_body']['properties']['server'][
307 'properties'].update({'adminPass': {'type': 'string'}})
308rebuild_server_with_admin_pass['response_body']['properties']['server'][
309 'required'].append('adminPass')
Ghanshyam88457912014-07-25 16:02:12 +0900310
311rescue_server = {
312 'status_code': [200],
313 'response_body': {
314 'type': 'object',
315 'properties': {
316 'adminPass': {'type': 'string'}
317 },
318 'required': ['adminPass']
319 }
320}