Ghanshyam | 028044c | 2014-03-26 19:20:28 +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 | from tempest.api_schema.compute import hypervisors |
| 17 | |
| 18 | list_hypervisors_detail = copy.deepcopy( |
| 19 | hypervisors.common_list_hypervisors_detail) |
| 20 | # Defining extra attributes for V3 show hypervisor schema |
| 21 | list_hypervisors_detail['response_body']['properties']['hypervisors'][ |
| 22 | 'items']['properties']['os-pci:pci_stats'] = {'type': 'array'} |
Ghanshyam | 3495c4f | 2014-03-24 09:22:57 +0900 | [diff] [blame] | 23 | |
| 24 | show_hypervisor = copy.deepcopy(hypervisors.common_show_hypervisor) |
| 25 | # Defining extra attributes for V3 show hypervisor schema |
| 26 | show_hypervisor['response_body']['properties']['hypervisor']['properties'][ |
| 27 | 'os-pci:pci_stats'] = {'type': 'array'} |
Ghanshyam | 8676fa6 | 2014-03-26 20:00:37 +0900 | [diff] [blame] | 28 | |
| 29 | hypervisors_servers = copy.deepcopy(hypervisors.common_hypervisors_info) |
| 30 | |
| 31 | # Defining extra attributes for V3 show hypervisor schema |
| 32 | hypervisors_servers['response_body']['properties']['hypervisor']['properties'][ |
| 33 | 'servers'] = { |
| 34 | 'type': 'array', |
| 35 | 'items': { |
| 36 | 'type': 'object', |
| 37 | 'properties': { |
| 38 | # NOTE: Now the type of 'id' is integer, |
| 39 | # but here allows 'string' also because we |
| 40 | # will be able to change it to 'uuid' in |
| 41 | # the future. |
| 42 | 'id': {'type': ['integer', 'string']}, |
| 43 | 'name': {'type': 'string'} |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | # V3 API response body always contains the 'servers' attribute even there |
| 48 | # is no server (VM) are present on Hypervisor host. |
| 49 | hypervisors_servers['response_body']['properties']['hypervisor'][ |
| 50 | 'required'] = ['id', 'hypervisor_hostname', 'servers'] |