Ghanshyam | bcd0910 | 2014-03-26 18:03:29 +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 | |
| 15 | import copy |
| 16 | |
| 17 | from tempest.api_schema.compute import flavors |
Ghanshyam | 639d842 | 2014-03-26 18:23:32 +0900 | [diff] [blame] | 18 | from tempest.api_schema.compute import flavors_extra_specs |
Ghanshyam | bcd0910 | 2014-03-26 18:03:29 +0900 | [diff] [blame] | 19 | |
| 20 | list_flavors_details = copy.deepcopy(flavors.common_flavor_list_details) |
| 21 | |
| 22 | # NOTE- In v3 API, 'swap' comes as '0' not empty string '""' |
| 23 | # (In V2 API, it comes as empty string) So leaving 'swap'as integer type only. |
| 24 | |
| 25 | # Defining extra attributes for V3 flavor schema |
| 26 | list_flavors_details['response_body']['properties']['flavors']['items'][ |
| 27 | 'properties'].update({'disabled': {'type': 'boolean'}, |
| 28 | 'ephemeral': {'type': 'integer'}, |
| 29 | 'flavor-access:is_public': {'type': 'boolean'}, |
| 30 | 'os-flavor-rxtx:rxtx_factor': {'type': 'number'}}) |
| 31 | # 'flavor-access' and 'os-flavor-rxtx' are API extensions. |
| 32 | # So they are not 'required'. |
| 33 | list_flavors_details['response_body']['properties']['flavors']['items'][ |
| 34 | 'required'].extend(['disabled', 'ephemeral']) |
Ghanshyam | 639d842 | 2014-03-26 18:23:32 +0900 | [diff] [blame] | 35 | |
| 36 | set_flavor_extra_specs = copy.deepcopy(flavors_extra_specs.flavor_extra_specs) |
| 37 | set_flavor_extra_specs['status_code'] = [201] |
| 38 | |
| 39 | unset_flavor_extra_specs = { |
| 40 | 'status_code': [204] |
| 41 | } |