Ken'ichi Ohmichi | 0260458 | 2014-03-14 16:23:41 +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 | |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 15 | import copy |
| 16 | |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 17 | from tempest.api_schema.compute import parameter_types |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 18 | from tempest.api_schema.compute import servers |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 19 | |
Ken'ichi Ohmichi | 0260458 | 2014-03-14 16:23:41 +0900 | [diff] [blame] | 20 | create_server = { |
| 21 | 'status_code': [202], |
| 22 | 'response_body': { |
| 23 | 'type': 'object', |
| 24 | 'properties': { |
| 25 | 'server': { |
| 26 | 'type': 'object', |
| 27 | 'properties': { |
Ghanshyam | c5b842d | 2014-06-10 17:06:05 +0900 | [diff] [blame^] | 28 | 'id': {'type': 'string'}, |
Ken'ichi Ohmichi | 0260458 | 2014-03-14 16:23:41 +0900 | [diff] [blame] | 29 | 'security_groups': {'type': 'array'}, |
Ken'ichi Ohmichi | 024cdae | 2014-03-24 08:05:59 +0900 | [diff] [blame] | 30 | 'links': parameter_types.links, |
Ken'ichi Ohmichi | 0260458 | 2014-03-14 16:23:41 +0900 | [diff] [blame] | 31 | 'adminPass': {'type': 'string'}, |
| 32 | 'OS-DCF:diskConfig': {'type': 'string'} |
| 33 | }, |
| 34 | # NOTE: OS-DCF:diskConfig is API extension, and some |
| 35 | # environments return a response without the attribute. |
| 36 | # So it is not 'required'. |
JordanP | 551140c | 2014-04-02 11:16:09 +0200 | [diff] [blame] | 37 | # NOTE: adminPass is not required because it can be deactivated |
| 38 | # with nova API flag enable_instance_password=False |
| 39 | 'required': ['id', 'security_groups', 'links'] |
Ken'ichi Ohmichi | 0260458 | 2014-03-14 16:23:41 +0900 | [diff] [blame] | 40 | } |
| 41 | }, |
| 42 | 'required': ['server'] |
| 43 | } |
| 44 | } |
Ghanshyam | 08ce58d | 2014-04-04 14:51:14 +0900 | [diff] [blame] | 45 | |
Ken'ichi Ohmichi | 29cd512 | 2014-04-28 11:04:52 +0900 | [diff] [blame] | 46 | update_server = copy.deepcopy(servers.base_update_server) |
| 47 | update_server['response_body']['properties']['server']['properties'].update({ |
| 48 | 'hostId': {'type': 'string'}, |
| 49 | 'OS-DCF:diskConfig': {'type': 'string'}, |
| 50 | 'accessIPv4': parameter_types.access_ip_v4, |
| 51 | 'accessIPv6': parameter_types.access_ip_v6 |
| 52 | }) |
| 53 | update_server['response_body']['properties']['server']['required'].append( |
| 54 | # NOTE: OS-DCF:diskConfig and accessIPv4/v6 are API |
| 55 | # extensions, and some environments return a response |
| 56 | # without these attributes. So they are not 'required'. |
| 57 | 'hostId' |
| 58 | ) |
| 59 | |
Ghanshyam | 08ce58d | 2014-04-04 14:51:14 +0900 | [diff] [blame] | 60 | list_virtual_interfaces = { |
| 61 | 'status_code': [200], |
| 62 | 'response_body': { |
| 63 | 'type': 'object', |
| 64 | 'properties': { |
| 65 | 'virtual_interfaces': { |
| 66 | 'type': 'array', |
| 67 | 'items': { |
| 68 | 'type': 'object', |
| 69 | 'properties': { |
| 70 | 'id': {'type': 'string'}, |
| 71 | 'mac_address': parameter_types.mac_address, |
| 72 | 'OS-EXT-VIF-NET:net_id': {'type': 'string'} |
| 73 | }, |
| 74 | # 'OS-EXT-VIF-NET:net_id' is API extension So it is |
| 75 | # not defined as 'required' |
| 76 | 'required': ['id', 'mac_address'] |
| 77 | } |
| 78 | } |
| 79 | }, |
| 80 | 'required': ['virtual_interfaces'] |
| 81 | } |
| 82 | } |
Ghanshyam | 385c4e7 | 2014-03-27 11:42:25 +0900 | [diff] [blame] | 83 | |
| 84 | attach_volume = { |
| 85 | 'status_code': [200], |
| 86 | 'response_body': { |
| 87 | 'type': 'object', |
| 88 | 'properties': { |
| 89 | 'volumeAttachment': { |
| 90 | 'type': 'object', |
| 91 | 'properties': { |
| 92 | 'id': {'type': 'string'}, |
| 93 | 'device': {'type': 'string'}, |
| 94 | 'volumeId': {'type': 'string'}, |
| 95 | 'serverId': {'type': ['integer', 'string']} |
| 96 | }, |
| 97 | 'required': ['id', 'device', 'volumeId', 'serverId'] |
| 98 | } |
| 99 | }, |
| 100 | 'required': ['volumeAttachment'] |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | detach_volume = { |
| 105 | 'status_code': [202] |
| 106 | } |
Ghanshyam | eaaa6a4 | 2014-04-25 18:38:21 +0900 | [diff] [blame] | 107 | |
| 108 | set_get_server_metadata_item = { |
| 109 | 'status_code': [200], |
| 110 | 'response_body': { |
| 111 | 'type': 'object', |
| 112 | 'properties': { |
| 113 | 'meta': { |
| 114 | 'type': 'object', |
| 115 | 'patternProperties': { |
| 116 | '^.+$': {'type': 'string'} |
| 117 | } |
| 118 | } |
| 119 | }, |
| 120 | 'required': ['meta'] |
| 121 | } |
| 122 | } |
Ghanshyam | 9541ad1 | 2014-05-07 16:38:43 +0900 | [diff] [blame] | 123 | |
| 124 | list_addresses_by_network = { |
| 125 | 'status_code': [200], |
| 126 | 'response_body': parameter_types.addresses |
| 127 | } |
Ghanshyam | 997c909 | 2014-04-03 19:00:20 +0900 | [diff] [blame] | 128 | |
| 129 | server_actions_confirm_resize = copy.deepcopy( |
| 130 | servers.server_actions_delete_password) |
Ghanshyam | d847c58 | 2014-05-07 16:21:36 +0900 | [diff] [blame] | 131 | |
| 132 | list_addresses = { |
| 133 | 'status_code': [200], |
| 134 | 'response_body': { |
| 135 | 'type': 'object', |
| 136 | 'properties': { |
| 137 | 'addresses': parameter_types.addresses |
| 138 | }, |
| 139 | 'required': ['addresses'] |
| 140 | } |
| 141 | } |