blob: dc800cd4d12e4866f7794bb8374140327fa72b97 [file] [log] [blame]
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +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
Ghanshyameaaa6a42014-04-25 18:38:21 +090015import copy
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090016
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090017from tempest.api_schema.compute import parameter_types
Ghanshyameaaa6a42014-04-25 18:38:21 +090018from tempest.api_schema.compute import servers
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090019
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090020create_server = {
21 'status_code': [202],
22 'response_body': {
23 'type': 'object',
24 'properties': {
25 'server': {
26 'type': 'object',
27 'properties': {
Ghanshyamc5b842d2014-06-10 17:06:05 +090028 'id': {'type': 'string'},
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090029 'os-security-groups:security_groups': {'type': 'array'},
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090030 'links': parameter_types.links,
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090031 'admin_password': {'type': 'string'},
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090032 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
33 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090034 },
35 # NOTE: os-access-ips:access_ip_v4/v6 are API extension,
36 # and some environments return a response without these
37 # attributes. So they are not 'required'.
38 'required': ['id', 'os-security-groups:security_groups',
39 'links', 'admin_password']
40 }
41 },
42 'required': ['server']
43 }
44}
Ghanshyam385c4e72014-03-27 11:42:25 +090045
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090046addresses_v3 = copy.deepcopy(parameter_types.addresses)
47addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
48 'properties'].update({
49 'type': {'type': 'string'},
50 'mac_addr': {'type': 'string'}
51 })
52addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
53 'required'].extend(
54 ['type', 'mac_addr']
55 )
56
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090057update_server = copy.deepcopy(servers.base_update_get_server)
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090058update_server['response_body']['properties']['server']['properties'].update({
59 'addresses': addresses_v3,
60 'host_id': {'type': 'string'},
61 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
62 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
63})
64update_server['response_body']['properties']['server']['required'].append(
65 # NOTE: os-access-ips:access_ip_v4/v6 are API extension,
66 # and some environments return a response without these
67 # attributes. So they are not 'required'.
68 'host_id'
69)
70
Ken'ichi Ohmichi21e4fc72014-05-08 16:46:23 +090071get_server = copy.deepcopy(servers.base_update_get_server)
72get_server['response_body']['properties']['server']['properties'].update({
73 'key_name': {'type': ['string', 'null']},
74 'host_id': {'type': 'string'},
75
76 # NOTE: Non-admin users also can see "os-server-usage" and
77 # "os-extended-availability-zone" attributes.
78 'os-server-usage:launched_at': {'type': ['string', 'null']},
79 'os-server-usage:terminated_at': {'type': ['string', 'null']},
80 'os-extended-availability-zone:availability_zone': {'type': 'string'},
81
82 # NOTE: Admin users only can see "os-extended-status" and
83 # "os-extended-server-attributes" attributes.
84 'os-extended-status:task_state': {'type': ['string', 'null']},
85 'os-extended-status:vm_state': {'type': 'string'},
86 'os-extended-status:power_state': {'type': 'integer'},
87 'os-extended-status:locked_by': {'type': ['string', 'null']},
88 'os-extended-server-attributes:host': {'type': ['string', 'null']},
89 'os-extended-server-attributes:instance_name': {'type': 'string'},
90 'os-extended-server-attributes:hypervisor_hostname': {
91 'type': ['string', 'null']
92 },
93 'os-extended-volumes:volumes_attached': {'type': 'array'},
94 'os-pci:pci_devices': {'type': 'array'},
95 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
96 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6,
97 'os-config-drive:config_drive': {'type': 'string'}
98})
99get_server['response_body']['properties']['server']['required'].append(
100 # NOTE: os-server-usage, os-extended-availability-zone,
101 # os-extended-status, os-extended-server-attributes,
102 # os-extended-volumes, os-pci, os-access-ips and
103 # os-config-driveare API extension, and some environments
104 # return a response without these attributes. So they are not 'required'.
105 'host_id'
106)
107
Ghanshyam385c4e72014-03-27 11:42:25 +0900108attach_detach_volume = {
109 'status_code': [202]
110}
Ghanshyameaaa6a42014-04-25 18:38:21 +0900111
112set_get_server_metadata_item = copy.deepcopy(servers.set_server_metadata)
Ghanshyam9541ad12014-05-07 16:38:43 +0900113
114list_addresses_by_network = {
115 'status_code': [200],
116 'response_body': addresses_v3
117}
Ghanshyam997c9092014-04-03 19:00:20 +0900118
119server_actions_change_password = copy.deepcopy(
120 servers.server_actions_delete_password)
Ghanshyamd847c582014-05-07 16:21:36 +0900121
122list_addresses = {
123 'status_code': [200],
124 'response_body': {
125 'type': 'object',
126 'properties': {
127 'addresses': addresses_v3
128 },
129 'required': ['addresses']
130 }
131}
Ghanshyame8421062014-06-02 15:58:21 +0900132
133update_server_metadata = copy.deepcopy(servers.update_server_metadata)
134# V3 API's response status_code is 201
135update_server_metadata['status_code'] = [201]
Ghanshyam29966092014-04-07 17:27:41 +0900136
137server_actions_object = copy.deepcopy(servers.common_instance_actions)
138server_actions_object['properties'].update({'server_uuid': {'type': 'string'}})
139server_actions_object['required'].extend(['server_uuid'])
140
141list_server_actions = {
142 'status_code': [200],
143 'response_body': {
144 'type': 'object',
145 'properties': {
146 'server_actions': {
147 'type': 'array',
148 'items': server_actions_object
149 }
150 },
151 'required': ['server_actions']
152 }
153}
Ghanshyam51744862014-06-13 12:56:24 +0900154
Ghanshyam4b41dfd2014-07-17 13:40:38 +0900155get_server_actions_object = copy.deepcopy(servers.common_get_instance_action)
156get_server_actions_object[
157 'properties'].update({'server_uuid': {'type': 'string'}})
158get_server_actions_object['required'].extend(['server_uuid'])
159
160get_server_action = {
161 'status_code': [200],
162 'response_body': {
163 'type': 'object',
164 'properties': {
165 'server_action': get_server_actions_object
166 },
167 'required': ['server_action']
168 }
169}
170
Ghanshyam51744862014-06-13 12:56:24 +0900171list_servers_detail = copy.deepcopy(servers.base_list_servers_detail)
172list_servers_detail['response_body']['properties']['servers']['items'][
173 'properties'].update({
174 'addresses': addresses_v3,
175 'host_id': {'type': 'string'},
176 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
177 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
178 })
179# NOTE(GMann): os-access-ips:access_ip_v4/v6 are API extension,
180# and some environments return a response without these
181# attributes. So they are not 'required'.
182list_servers_detail['response_body']['properties']['servers']['items'][
183 'required'].append('host_id')