zhufl | 38a78be | 2018-09-19 17:28:39 +0800 | [diff] [blame] | 1 | # Copyright 2018 ZTE 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 | import copy |
| 15 | |
| 16 | from tempest.lib.api_schema.response.compute.v2_1 import parameter_types |
| 17 | |
| 18 | list_services = { |
| 19 | 'status_code': [200], |
| 20 | 'response_body': { |
| 21 | 'type': 'object', |
| 22 | 'properties': { |
| 23 | 'services': { |
| 24 | 'type': 'array', |
| 25 | 'items': { |
| 26 | 'type': 'object', |
| 27 | 'properties': { |
| 28 | 'binary': {'type': 'string'}, |
| 29 | 'disabled_reason': {'type': ['string', 'null']}, |
| 30 | 'host': {'type': 'string'}, |
| 31 | 'state': {'enum': ['up', 'down']}, |
| 32 | 'status': {'enum': ['enabled', 'disabled']}, |
| 33 | 'frozen': {'type': 'boolean'}, |
| 34 | 'updated_at': parameter_types.date_time, |
| 35 | 'zone': {'type': 'string'}, |
| 36 | # TODO(zhufl): cluster is added in 3.7, we should move |
| 37 | # it to the 3.7 schema file when microversion is |
| 38 | # supported in volume interfaces |
| 39 | 'cluster': {'type': 'string'}, |
| 40 | 'replication_status': {'type': 'string'}, |
| 41 | 'active_backend_id': {'type': ['string', 'null']}, |
| 42 | 'backend_state': {'type': 'string'}, |
| 43 | }, |
| 44 | 'additionalProperties': False, |
| 45 | 'required': ['binary', 'disabled_reason', 'host', 'state', |
| 46 | 'status', 'updated_at', 'zone'] |
| 47 | } |
| 48 | } |
| 49 | }, |
| 50 | 'additionalProperties': False, |
| 51 | 'required': ['services'] |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | enable_service = { |
| 56 | 'status_code': [200], |
| 57 | 'response_body': { |
| 58 | 'type': 'object', |
| 59 | 'properties': { |
| 60 | 'disabled': {'type': 'boolean'}, |
| 61 | 'status': {'enum': ['enabled', 'disabled']}, |
| 62 | 'host': {'type': 'string'}, |
| 63 | 'service': {'type': 'string'}, |
| 64 | 'binary': {'type': 'string'}, |
| 65 | 'disabled_reason': {'type': ['string', 'null']} |
| 66 | }, |
| 67 | 'additionalProperties': False, |
| 68 | 'required': ['disabled', 'status', 'host', 'service', |
| 69 | 'binary', 'disabled_reason'] |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | disable_service = { |
| 74 | 'status_code': [200], |
| 75 | 'response_body': { |
| 76 | 'type': 'object', |
| 77 | 'properties': { |
| 78 | 'disabled': {'type': 'boolean'}, |
| 79 | 'status': {'enum': ['enabled', 'disabled']}, |
| 80 | 'host': {'type': 'string'}, |
| 81 | 'service': {'type': 'string'}, |
| 82 | 'binary': {'type': 'string'}, |
| 83 | }, |
| 84 | 'additionalProperties': False, |
| 85 | 'required': ['disabled', 'status', 'host', 'service', 'binary'] |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | disable_log_reason = copy.deepcopy(enable_service) |
| 90 | |
| 91 | freeze_host = {'status_code': [200]} |
| 92 | thaw_host = {'status_code': [200]} |