blob: 5fc200814107da727180bf1e76f4796d05fbb067 [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
120attach_volume = {
121 'status_code': [200],
122 'response_body': {
123 'type': 'object',
124 'properties': {
125 'volumeAttachment': {
126 'type': 'object',
127 'properties': {
128 'id': {'type': 'string'},
129 'device': {'type': 'string'},
130 'volumeId': {'type': 'string'},
131 'serverId': {'type': ['integer', 'string']}
132 },
133 'required': ['id', 'device', 'volumeId', 'serverId']
134 }
135 },
136 'required': ['volumeAttachment']
137 }
138}
139
140detach_volume = {
141 'status_code': [202]
142}
Ghanshyameaaa6a42014-04-25 18:38:21 +0900143
144set_get_server_metadata_item = {
145 'status_code': [200],
146 'response_body': {
147 'type': 'object',
148 'properties': {
149 'meta': {
150 'type': 'object',
151 'patternProperties': {
152 '^.+$': {'type': 'string'}
153 }
154 }
155 },
156 'required': ['meta']
157 }
158}
Ghanshyam9541ad12014-05-07 16:38:43 +0900159
160list_addresses_by_network = {
161 'status_code': [200],
162 'response_body': parameter_types.addresses
163}
Ghanshyam997c9092014-04-03 19:00:20 +0900164
165server_actions_confirm_resize = copy.deepcopy(
166 servers.server_actions_delete_password)
Ghanshyamd847c582014-05-07 16:21:36 +0900167
168list_addresses = {
169 'status_code': [200],
170 'response_body': {
171 'type': 'object',
172 'properties': {
173 'addresses': parameter_types.addresses
174 },
175 'required': ['addresses']
176 }
177}
Ghanshyamf81f9fa2014-05-23 13:38:56 +0900178
179common_server_group = {
180 'type': 'object',
181 'properties': {
182 'id': {'type': 'string'},
183 'name': {'type': 'string'},
184 'policies': {
185 'type': 'array',
186 'items': {'type': 'string'}
187 },
188 # 'members' attribute contains the array of instance's UUID of
189 # instances present in server group
190 'members': {
191 'type': 'array',
192 'items': {'type': 'string'}
193 },
194 'metadata': {'type': 'object'}
195 },
196 'required': ['id', 'name', 'policies', 'members', 'metadata']
197}
198
199create_get_server_group = {
200 'status_code': [200],
201 'response_body': {
202 'type': 'object',
203 'properties': {
204 'server_group': common_server_group
205 },
206 'required': ['server_group']
207 }
208}
209
210delete_server_group = {
211 'status_code': [204]
212}
Ghanshyam29966092014-04-07 17:27:41 +0900213
Ghanshyam438ed3b2014-06-18 17:25:41 +0900214list_server_groups = {
215 'status_code': [200],
216 'response_body': {
217 'type': 'object',
218 'properties': {
219 'server_groups': {
220 'type': 'array',
221 'items': common_server_group
222 }
223 },
224 'required': ['server_groups']
225 }
226}
227
Ghanshyam29966092014-04-07 17:27:41 +0900228instance_actions_object = copy.deepcopy(servers.common_instance_actions)
229instance_actions_object[
230 'properties'].update({'instance_uuid': {'type': 'string'}})
231instance_actions_object['required'].extend(['instance_uuid'])
232
233list_instance_actions = {
234 'status_code': [200],
235 'response_body': {
236 'type': 'object',
237 'properties': {
238 'instanceActions': {
239 'type': 'array',
240 'items': instance_actions_object
241 }
242 },
243 'required': ['instanceActions']
244 }
245}
Ghanshyam51744862014-06-13 12:56:24 +0900246
Ghanshyam4b41dfd2014-07-17 13:40:38 +0900247get_instance_actions_object = copy.deepcopy(servers.common_get_instance_action)
248get_instance_actions_object[
249 'properties'].update({'instance_uuid': {'type': 'string'}})
250get_instance_actions_object['required'].extend(['instance_uuid'])
251
252get_instance_action = {
253 'status_code': [200],
254 'response_body': {
255 'type': 'object',
256 'properties': {
257 'instanceAction': get_instance_actions_object
258 },
259 'required': ['instanceAction']
260 }
261}
262
Ghanshyam51744862014-06-13 12:56:24 +0900263list_servers_detail = copy.deepcopy(servers.base_list_servers_detail)
264list_servers_detail['response_body']['properties']['servers']['items'][
265 'properties'].update({
266 'hostId': {'type': 'string'},
267 'OS-DCF:diskConfig': {'type': 'string'},
268 'accessIPv4': parameter_types.access_ip_v4,
269 'accessIPv6': parameter_types.access_ip_v6
270 })
271# NOTE(GMann): OS-DCF:diskConfig and accessIPv4/v6 are API
272# extensions, and some environments return a response
273# without these attributes. So they are not 'required'.
274list_servers_detail['response_body']['properties']['servers']['items'][
275 'required'].append('hostId')
Ghanshyam9c2e50d2014-07-22 21:32:05 +0900276
277rebuild_server = copy.deepcopy(update_server)
278rebuild_server['status_code'] = [202]
279del rebuild_server['response_body']['properties']['server'][
280 'properties']['OS-DCF:diskConfig']
281
282rebuild_server_with_admin_pass = copy.deepcopy(rebuild_server)
283rebuild_server_with_admin_pass['response_body']['properties']['server'][
284 'properties'].update({'adminPass': {'type': 'string'}})
285rebuild_server_with_admin_pass['response_body']['properties']['server'][
286 'required'].append('adminPass')
Ghanshyam88457912014-07-25 16:02:12 +0900287
288rescue_server = {
289 'status_code': [200],
290 'response_body': {
291 'type': 'object',
292 'properties': {
293 'adminPass': {'type': 'string'}
294 },
295 'required': ['adminPass']
296 }
297}