blob: 6716249f792090c61ace58c6305a1da6363535a5 [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': {
28 # NOTE: Now the type of 'id' is uuid, but here allows
29 # 'integer' also because old OpenStack uses 'integer'
30 # as a server id.
31 'id': {'type': ['integer', 'string']},
32 'os-security-groups:security_groups': {'type': 'array'},
Ken'ichi Ohmichi024cdae2014-03-24 08:05:59 +090033 'links': parameter_types.links,
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090034 'admin_password': {'type': 'string'},
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090035 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
36 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
Ken'ichi Ohmichi02604582014-03-14 16:23:41 +090037 },
38 # NOTE: os-access-ips:access_ip_v4/v6 are API extension,
39 # and some environments return a response without these
40 # attributes. So they are not 'required'.
41 'required': ['id', 'os-security-groups:security_groups',
42 'links', 'admin_password']
43 }
44 },
45 'required': ['server']
46 }
47}
Ghanshyam385c4e72014-03-27 11:42:25 +090048
Ken'ichi Ohmichi29cd5122014-04-28 11:04:52 +090049addresses_v3 = copy.deepcopy(parameter_types.addresses)
50addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
51 'properties'].update({
52 'type': {'type': 'string'},
53 'mac_addr': {'type': 'string'}
54 })
55addresses_v3['patternProperties']['^[a-zA-Z0-9-_.]+$']['items'][
56 'required'].extend(
57 ['type', 'mac_addr']
58 )
59
60update_server = copy.deepcopy(servers.base_update_server)
61update_server['response_body']['properties']['server']['properties'].update({
62 'addresses': addresses_v3,
63 'host_id': {'type': 'string'},
64 'os-access-ips:access_ip_v4': parameter_types.access_ip_v4,
65 'os-access-ips:access_ip_v6': parameter_types.access_ip_v6
66})
67update_server['response_body']['properties']['server']['required'].append(
68 # NOTE: os-access-ips:access_ip_v4/v6 are API extension,
69 # and some environments return a response without these
70 # attributes. So they are not 'required'.
71 'host_id'
72)
73
Ghanshyam385c4e72014-03-27 11:42:25 +090074attach_detach_volume = {
75 'status_code': [202]
76}
Ghanshyameaaa6a42014-04-25 18:38:21 +090077
78set_get_server_metadata_item = copy.deepcopy(servers.set_server_metadata)
Ghanshyam9541ad12014-05-07 16:38:43 +090079
80list_addresses_by_network = {
81 'status_code': [200],
82 'response_body': addresses_v3
83}
Ghanshyam997c9092014-04-03 19:00:20 +090084
85server_actions_change_password = copy.deepcopy(
86 servers.server_actions_delete_password)
Ghanshyamd847c582014-05-07 16:21:36 +090087
88list_addresses = {
89 'status_code': [200],
90 'response_body': {
91 'type': 'object',
92 'properties': {
93 'addresses': addresses_v3
94 },
95 'required': ['addresses']
96 }
97}
Ghanshyame8421062014-06-02 15:58:21 +090098
99update_server_metadata = copy.deepcopy(servers.update_server_metadata)
100# V3 API's response status_code is 201
101update_server_metadata['status_code'] = [201]