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