blob: e97752d357dee3e1d01f910cfc5ec36103b6db97 [file] [log] [blame]
Ghanshyamd34326c2014-03-19 12:18:53 +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 Ohmichi024cdae2014-03-24 08:05:59 +090015from tempest.api_schema.compute import parameter_types
16
Ghanshyam2b14d422014-03-24 10:46:33 +090017common_image_schema = {
18 'type': 'object',
19 'properties': {
20 'id': {'type': 'string'},
21 'status': {'type': 'string'},
22 'updated': {'type': 'string'},
23 'links': parameter_types.links,
24 'name': {'type': 'string'},
25 'created': {'type': 'string'},
26 'minDisk': {'type': 'integer'},
27 'minRam': {'type': 'integer'},
28 'progress': {'type': 'integer'},
29 'metadata': {'type': 'object'},
30 'server': {
31 'type': 'object',
32 'properties': {
33 # NOTE: Now the type of 'id' is integer, but here
34 # allows 'string' also because we will be able to
35 # change it to 'uuid' in the future.
36 'id': {'type': ['integer', 'string']},
37 'links': parameter_types.links
38 },
39 'required': ['id', 'links']
40 },
41 'OS-EXT-IMG-SIZE:size': {'type': 'integer'}
42 },
43 # 'server' attributes only comes in response body if image is
44 # associated with any server. 'OS-EXT-IMG-SIZE:size' is API
45 # extension, So those are not defined as 'required'.
46 'required': ['id', 'status', 'updated', 'links', 'name',
47 'created', 'minDisk', 'minRam', 'progress',
48 'metadata']
49}
50
Ghanshyamd34326c2014-03-19 12:18:53 +090051get_image = {
52 'status_code': [200],
53 'response_body': {
54 'type': 'object',
55 'properties': {
Ghanshyam2b14d422014-03-24 10:46:33 +090056 'image': common_image_schema
Ghanshyamd34326c2014-03-19 12:18:53 +090057 },
58 'required': ['image']
59 }
60}
Ghanshyamfb67f062014-03-24 10:20:57 +090061
62list_images = {
63 'status_code': [200],
64 'response_body': {
65 'type': 'object',
66 'properties': {
67 'images': {
68 'type': 'array',
69 'items': {
70 'type': 'object',
71 'properties': {
72 'id': {'type': 'string'},
Ghanshyam2b14d422014-03-24 10:46:33 +090073 'links': parameter_types.links,
Ghanshyamfb67f062014-03-24 10:20:57 +090074 'name': {'type': 'string'}
75 },
76 'required': ['id', 'links', 'name']
77 }
78 }
79 },
80 'required': ['images']
81 }
82}
Ghanshyamfa9d39f2014-03-28 12:38:43 +090083
84create_image = {
85 'status_code': [202]
86}
87
88delete = {
89 'status_code': [204]
90}
Ghanshyamf7873b02014-03-28 12:50:57 +090091
92image_metadata = {
93 'status_code': [200],
94 'response_body': {
95 'type': 'object',
96 'properties': {
97 'metadata': {'type': 'object'}
98 },
99 'required': ['metadata']
100 }
101}
Ghanshyam76c00f02014-03-28 13:02:22 +0900102
103image_meta_item = {
104 'status_code': [200],
105 'response_body': {
106 'type': 'object',
107 'properties': {
108 'meta': {'type': 'object'}
109 },
110 'required': ['meta']
111 }
112}
Ghanshyam2b14d422014-03-24 10:46:33 +0900113
114list_images_details = {
115 'status_code': [200],
116 'response_body': {
117 'type': 'object',
118 'properties': {
119 'images': {
120 'type': 'array',
121 'items': common_image_schema
122 }
123 },
124 'required': ['images']
125 }
126}