Ghanshyam | 7fa397c | 2014-04-01 19:32:38 +0900 | [diff] [blame] | 1 | # 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 | |
Ghanshyam | a8f6653 | 2014-04-23 17:18:14 +0900 | [diff] [blame] | 15 | import copy |
| 16 | |
Marc Koderer | 6fbd74f | 2014-08-04 09:38:19 +0200 | [diff] [blame] | 17 | from tempest.api_schema.response.compute import parameter_types |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 18 | |
Ghanshyam | 7fa397c | 2014-04-01 19:32:38 +0900 | [diff] [blame] | 19 | get_password = { |
| 20 | 'status_code': [200], |
| 21 | 'response_body': { |
| 22 | 'type': 'object', |
| 23 | 'properties': { |
| 24 | 'password': {'type': 'string'} |
| 25 | }, |
| 26 | 'required': ['password'] |
| 27 | } |
| 28 | } |
Ghanshyam | d6d3040 | 2014-04-02 15:28:37 +0900 | [diff] [blame] | 29 | |
| 30 | get_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 | } |
Ghanshyam | 4ac0274 | 2014-04-17 19:15:47 +0900 | [diff] [blame] | 50 | |
Ghanshyam | 5174486 | 2014-06-13 12:56:24 +0900 | [diff] [blame] | 51 | common_show_server = { |
| 52 | 'type': 'object', |
| 53 | 'properties': { |
| 54 | 'id': {'type': 'string'}, |
| 55 | 'name': {'type': 'string'}, |
| 56 | 'status': {'type': 'string'}, |
Joseph Lanoux | eef192f | 2014-08-01 14:32:53 +0000 | [diff] [blame] | 57 | 'image': {'oneOf': [ |
| 58 | {'type': 'object', |
| 59 | 'properties': { |
| 60 | 'id': {'type': 'string'}, |
| 61 | 'links': parameter_types.links |
| 62 | }, |
| 63 | 'required': ['id', 'links']}, |
| 64 | {'type': ['string', 'null']} |
| 65 | ]}, |
Ghanshyam | 5174486 | 2014-06-13 12:56:24 +0900 | [diff] [blame] | 66 | 'flavor': { |
| 67 | 'type': 'object', |
| 68 | 'properties': { |
| 69 | 'id': {'type': 'string'}, |
| 70 | 'links': parameter_types.links |
| 71 | }, |
| 72 | 'required': ['id', 'links'] |
| 73 | }, |
| 74 | 'user_id': {'type': 'string'}, |
| 75 | 'tenant_id': {'type': 'string'}, |
| 76 | 'created': {'type': 'string'}, |
| 77 | 'updated': {'type': 'string'}, |
| 78 | 'progress': {'type': 'integer'}, |
| 79 | 'metadata': {'type': 'object'}, |
| 80 | 'links': parameter_types.links, |
| 81 | 'addresses': parameter_types.addresses, |
| 82 | }, |
| 83 | # NOTE(GMann): 'progress' attribute is present in the response |
| 84 | # only when server's status is one of the progress statuses |
| 85 | # ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE") |
| 86 | # So it is not defined as 'required'. |
| 87 | 'required': ['id', 'name', 'status', 'image', 'flavor', |
| 88 | 'user_id', 'tenant_id', 'created', 'updated', |
| 89 | 'metadata', 'links', 'addresses'] |
| 90 | } |
| 91 | |
Ken'ichi Ohmichi | 21e4fc7 | 2014-05-08 16:46:23 +0900 | [diff] [blame] | 92 | base_update_get_server = { |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 93 | 'status_code': [200], |
| 94 | 'response_body': { |
| 95 | 'type': 'object', |
| 96 | 'properties': { |
Ghanshyam | 5174486 | 2014-06-13 12:56:24 +0900 | [diff] [blame] | 97 | 'server': common_show_server |
Ghanshyam | c079a02 | 2014-06-11 18:52:55 +0900 | [diff] [blame] | 98 | }, |
| 99 | 'required': ['server'] |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 100 | } |
| 101 | } |
| 102 | |
Ghanshyam | 4ac0274 | 2014-04-17 19:15:47 +0900 | [diff] [blame] | 103 | delete_server = { |
| 104 | 'status_code': [204], |
| 105 | } |
Haiwei Xu | 3d2b7af | 2014-04-12 02:50:26 +0900 | [diff] [blame] | 106 | |
| 107 | set_server_metadata = { |
| 108 | 'status_code': [200], |
| 109 | 'response_body': { |
| 110 | 'type': 'object', |
| 111 | 'properties': { |
Ghanshyam | eaaa6a4 | 2014-04-25 18:38:21 +0900 | [diff] [blame] | 112 | 'metadata': { |
| 113 | 'type': 'object', |
| 114 | 'patternProperties': { |
| 115 | '^.+$': {'type': 'string'} |
| 116 | } |
| 117 | } |
Haiwei Xu | 3d2b7af | 2014-04-12 02:50:26 +0900 | [diff] [blame] | 118 | }, |
| 119 | 'required': ['metadata'] |
| 120 | } |
| 121 | } |
Ghanshyam | a8f6653 | 2014-04-23 17:18:14 +0900 | [diff] [blame] | 122 | |
| 123 | list_server_metadata = copy.deepcopy(set_server_metadata) |
Ghanshyam | eaaa6a4 | 2014-04-25 18:38:21 +0900 | [diff] [blame] | 124 | |
Ghanshyam | e842106 | 2014-06-02 15:58:21 +0900 | [diff] [blame] | 125 | update_server_metadata = copy.deepcopy(set_server_metadata) |
| 126 | |
Ghanshyam | eaaa6a4 | 2014-04-25 18:38:21 +0900 | [diff] [blame] | 127 | delete_server_metadata_item = { |
| 128 | 'status_code': [204] |
| 129 | } |
Ghanshyam | 623c38f | 2014-04-21 17:16:21 +0900 | [diff] [blame] | 130 | |
| 131 | list_servers = { |
| 132 | 'status_code': [200], |
| 133 | 'response_body': { |
| 134 | 'type': 'object', |
| 135 | 'properties': { |
| 136 | 'servers': { |
| 137 | 'type': 'array', |
| 138 | 'items': { |
| 139 | 'type': 'object', |
| 140 | 'properties': { |
| 141 | 'id': {'type': 'string'}, |
| 142 | 'links': parameter_types.links, |
| 143 | 'name': {'type': 'string'} |
| 144 | }, |
| 145 | 'required': ['id', 'links', 'name'] |
| 146 | } |
| 147 | } |
| 148 | }, |
| 149 | 'required': ['servers'] |
| 150 | } |
| 151 | } |
Ghanshyam | 997c909 | 2014-04-03 19:00:20 +0900 | [diff] [blame] | 152 | |
| 153 | server_actions_common_schema = { |
| 154 | 'status_code': [202] |
| 155 | } |
| 156 | |
| 157 | server_actions_delete_password = { |
| 158 | 'status_code': [204] |
| 159 | } |
Ghanshyam | 7ee264a | 2014-04-02 16:37:57 +0900 | [diff] [blame] | 160 | |
| 161 | get_console_output = { |
| 162 | 'status_code': [200], |
| 163 | 'response_body': { |
| 164 | 'type': 'object', |
| 165 | 'properties': { |
| 166 | 'output': {'type': 'string'} |
| 167 | }, |
| 168 | 'required': ['output'] |
| 169 | } |
| 170 | } |
Ghanshyam | 2996609 | 2014-04-07 17:27:41 +0900 | [diff] [blame] | 171 | |
| 172 | common_instance_actions = { |
| 173 | 'type': 'object', |
| 174 | 'properties': { |
| 175 | 'action': {'type': 'string'}, |
| 176 | 'request_id': {'type': 'string'}, |
| 177 | 'user_id': {'type': 'string'}, |
| 178 | 'project_id': {'type': 'string'}, |
| 179 | 'start_time': {'type': 'string'}, |
| 180 | 'message': {'type': ['string', 'null']} |
| 181 | }, |
| 182 | 'required': ['action', 'request_id', 'user_id', 'project_id', |
| 183 | 'start_time', 'message'] |
| 184 | } |
Ghanshyam | 5174486 | 2014-06-13 12:56:24 +0900 | [diff] [blame] | 185 | |
Ghanshyam | 4b41dfd | 2014-07-17 13:40:38 +0900 | [diff] [blame] | 186 | instance_action_events = { |
| 187 | 'type': 'array', |
| 188 | 'items': { |
| 189 | 'type': 'object', |
| 190 | 'properties': { |
| 191 | 'event': {'type': 'string'}, |
| 192 | 'start_time': {'type': 'string'}, |
| 193 | 'finish_time': {'type': 'string'}, |
| 194 | 'result': {'type': 'string'}, |
| 195 | 'traceback': {'type': ['string', 'null']} |
| 196 | }, |
| 197 | 'required': ['event', 'start_time', 'finish_time', 'result', |
| 198 | 'traceback'] |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | common_get_instance_action = copy.deepcopy(common_instance_actions) |
| 203 | |
| 204 | common_get_instance_action['properties'].update({ |
| 205 | 'events': instance_action_events}) |
| 206 | # 'events' does not come in response body always so it is not |
| 207 | # defined as 'required' |
| 208 | |
Ghanshyam | 5174486 | 2014-06-13 12:56:24 +0900 | [diff] [blame] | 209 | base_list_servers_detail = { |
| 210 | 'status_code': [200], |
| 211 | 'response_body': { |
| 212 | 'type': 'object', |
| 213 | 'properties': { |
| 214 | 'servers': { |
| 215 | 'type': 'array', |
| 216 | 'items': common_show_server |
| 217 | } |
| 218 | }, |
| 219 | 'required': ['servers'] |
| 220 | } |
| 221 | } |