blob: cba7981cab5f0e219772cc71a34d0b6eaedd28a8 [file] [log] [blame]
zhufl93a047f2018-11-08 14:35:49 +08001# Copyright 2015 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
15import copy
16
17from tempest.lib.api_schema.response.compute.v2_1 import parameter_types
18
19common_show_backup = {
20 'type': 'object',
21 'properties': {
22 'status': {'type': 'string'},
23 'object_count': {'type': 'integer'},
24 'container': {'type': ['string', 'null']},
25 'description': {'type': ['string', 'null']},
26 'links': parameter_types.links,
27 'availability_zone': {'type': ['string', 'null']},
28 'created_at': parameter_types.date_time,
29 'updated_at': parameter_types.date_time_or_null,
30 'name': {'type': ['string', 'null']},
31 'has_dependent_backups': {'type': 'boolean'},
32 'volume_id': {'type': 'string', 'format': 'uuid'},
33 'fail_reason': {'type': ['string', 'null']},
34 'size': {'type': 'integer'},
35 'id': {'type': 'string', 'format': 'uuid'},
36 'is_incremental': {'type': 'boolean'},
37 'data_timestamp': parameter_types.date_time_or_null,
38 'snapshot_id': {'type': ['string', 'null']},
39 # TODO(zhufl): os-backup-project-attr:project_id is added
40 # in 3.18, we should move it to the 3.18 schema file when
41 # microversion is supported in volume interfaces.
42 'os-backup-project-attr:project_id': {
43 'type': 'string', 'format': 'uuid'},
44 # TODO(zhufl): metadata is added in 3.43, we should move it
45 # to the 3.43 schema file when microversion is supported
46 # in volume interfaces.
47 'metadata': {'^.+$': {'type': 'string'}},
48 # TODO(zhufl): user_id is added in 3.56, we should move it
49 # to the 3.56 schema file when microversion is supported
50 # in volume interfaces.
51 'user_id': {'type': 'string'},
52 },
53 'additionalProperties': False,
54 'required': ['status', 'object_count', 'fail_reason', 'links',
55 'created_at', 'updated_at', 'name', 'volume_id', 'size', 'id',
56 'data_timestamp']
57}
58
59create_backup = {
60 'status_code': [202],
61 'response_body': {
62 'type': 'object',
63 'properties': {
64 'backup': {
65 'type': 'object',
66 'properties': {
67 'id': {'type': 'string', 'format': 'uuid'},
68 'links': parameter_types.links,
Brian Rosmaitacfddd402020-09-08 09:20:44 -040069 'name': {'type': ['string', 'null']},
zhufl93a047f2018-11-08 14:35:49 +080070 # TODO(zhufl): metadata is added in 3.43, we should move it
71 # to the 3.43 schema file when microversion is supported
72 # in volume interfaces.
73 'metadata': {'^.+$': {'type': 'string'}},
74 },
75 'additionalProperties': False,
76 'required': ['id', 'links', 'name']
77 }
78 },
79 'additionalProperties': False,
80 'required': ['backup']
81 }
82}
83
84update_backup = {
85 'status_code': [200],
86 'response_body': {
87 'type': 'object',
88 'properties': {
89 'backup': {
90 'type': 'object',
91 'properties': {
92 'id': {'type': 'string', 'format': 'uuid'},
93 'links': parameter_types.links,
Brian Rosmaitacfddd402020-09-08 09:20:44 -040094 'name': {'type': ['string', 'null']},
zhufl93a047f2018-11-08 14:35:49 +080095 'metadata': {'^.+$': {'type': 'string'}}
96 },
97 'additionalProperties': False,
98 'required': ['id', 'links', 'name']
99 }
100 },
101 'additionalProperties': False,
102 'required': ['backup']
103 }
104}
105
106restore_backup = {
107 'status_code': [202],
108 'response_body': {
109 'type': 'object',
110 'properties': {
111 'restore': {
112 'type': 'object',
113 'properties': {
114 'backup_id': {'type': 'string', 'format': 'uuid'},
115 'volume_id': {'type': 'string', 'format': 'uuid'},
116 'volume_name': {'type': 'string'},
117 },
118 'additionalProperties': False,
119 'required': ['backup_id', 'volume_id', 'volume_name']
120 }
121 },
122 'additionalProperties': False,
123 'required': ['restore']
124 }
125}
126
127delete_backup = {'status_code': [202]}
128
129show_backup = {
130 'status_code': [200],
131 'response_body': {
132 'type': 'object',
133 'properties': {
134 'backup': common_show_backup
135 },
136 'additionalProperties': False,
137 'required': ['backup']
138 }
139}
140
141list_backups_no_detail = {
142 'status_code': [200],
143 'response_body': {
144 'type': 'object',
145 'properties': {
146 'backups': {
147 'type': 'array',
148 'items': {
149 'type': 'object',
150 'properties': {
151 'links': parameter_types.links,
152 'id': {'type': 'string', 'format': 'uuid'},
153 'name': {'type': ['string', 'null']},
154 # TODO(zhufl): count is added in 3.45, we should move
155 # it to the 3.45 schema file when microversion is
156 # supported in volume interfaces
157 'count': {'type': 'integer'}
158 },
159 'additionalProperties': False,
160 'required': ['links', 'id', 'name']
161 }
162 }
163 },
164 'additionalProperties': False,
165 'required': ['backups'],
166 }
167}
168
169list_backups_detail = copy.deepcopy(common_show_backup)
170# TODO(zhufl): count is added in 3.45, we should move it to the 3.45 schema
171# file when microversion is supported in volume interfaces
172list_backups_detail['properties'].update({'count': {'type': 'integer'}})
173list_backups_with_detail = {
174 'status_code': [200],
175 'response_body': {
176 'type': 'object',
177 'properties': {
178 'backups': {
179 'type': 'array',
180 'items': list_backups_detail
181 }
182 },
183 'additionalProperties': False,
184 'required': ['backups'],
185 }
186}
187
188export_backup = {
189 'status_code': [200],
190 'response_body': {
191 'type': 'object',
192 'properties': {
193 'backup-record': {
194 'type': 'object',
195 'properties': {
196 'backup_service': {'type': 'string'},
197 'backup_url': {'type': 'string'}
198 },
199 'additionalProperties': False,
200 'required': ['backup_service', 'backup_url']
201 }
202 },
203 'additionalProperties': False,
204 'required': ['backup-record']
205 }
206}
207
208import_backup = {
209 'status_code': [201],
210 'response_body': {
211 'type': 'object',
212 'properties': {
213 'backup': {
214 'type': 'object',
215 'properties': {
216 'id': {'type': 'string', 'format': 'uuid'},
217 'links': parameter_types.links,
218 'name': {'type': ['string', 'null']},
219 },
220 'additionalProperties': False,
221 'required': ['id', 'links', 'name']
222 }
223 },
224 'additionalProperties': False,
225 'required': ['backup']
226 }
227}
228
229reset_backup_status = {'status_code': [202]}