blob: 7572029d82c8a626e206852142b942927d0c3d9a [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
57update_server = copy.deepcopy(servers.base_update_server)
58update_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
Ghanshyam385c4e72014-03-27 11:42:25 +090071attach_detach_volume = {
72 'status_code': [202]
73}
Ghanshyameaaa6a42014-04-25 18:38:21 +090074
75set_get_server_metadata_item = copy.deepcopy(servers.set_server_metadata)
Ghanshyam9541ad12014-05-07 16:38:43 +090076
77list_addresses_by_network = {
78 'status_code': [200],
79 'response_body': addresses_v3
80}
Ghanshyam997c9092014-04-03 19:00:20 +090081
82server_actions_change_password = copy.deepcopy(
83 servers.server_actions_delete_password)
Ghanshyamd847c582014-05-07 16:21:36 +090084
85list_addresses = {
86 'status_code': [200],
87 'response_body': {
88 'type': 'object',
89 'properties': {
90 'addresses': addresses_v3
91 },
92 'required': ['addresses']
93 }
94}
Ghanshyame8421062014-06-02 15:58:21 +090095
96update_server_metadata = copy.deepcopy(servers.update_server_metadata)
97# V3 API's response status_code is 201
98update_server_metadata['status_code'] = [201]
Ghanshyam29966092014-04-07 17:27:41 +090099
100server_actions_object = copy.deepcopy(servers.common_instance_actions)
101server_actions_object['properties'].update({'server_uuid': {'type': 'string'}})
102server_actions_object['required'].extend(['server_uuid'])
103
104list_server_actions = {
105 'status_code': [200],
106 'response_body': {
107 'type': 'object',
108 'properties': {
109 'server_actions': {
110 'type': 'array',
111 'items': server_actions_object
112 }
113 },
114 'required': ['server_actions']
115 }
116}