jeremy.zhang | 79a1cbf | 2017-05-07 16:09:17 +0800 | [diff] [blame] | 1 | # Copyright 2017 FiberHome Telecommunication Technologies CO.,LTD |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
| 15 | |
| 16 | from oslo_serialization import jsonutils as json |
| 17 | from six.moves.urllib import parse as urllib |
| 18 | |
| 19 | from tempest.lib.common import rest_client |
| 20 | from tempest.lib.services.volume.v2 import volumes_client |
jeremy.zhang | 79a1cbf | 2017-05-07 16:09:17 +0800 | [diff] [blame] | 21 | |
| 22 | |
zhufl | 0273652 | 2017-06-19 13:57:28 +0800 | [diff] [blame] | 23 | class VolumesClient(volumes_client.VolumesClient): |
jeremy.zhang | 79a1cbf | 2017-05-07 16:09:17 +0800 | [diff] [blame] | 24 | """Client class to send CRUD Volume V3 API requests""" |
| 25 | api_version = "v3" |
| 26 | |
| 27 | def show_volume_summary(self, **params): |
| 28 | """Get volumes summary. |
| 29 | |
| 30 | For a full list of available parameters, please refer to the official |
| 31 | API reference: |
| 32 | https://developer.openstack.org/api-ref/block-storage/v3/#get-volumes-summary |
| 33 | """ |
| 34 | url = 'volumes/summary' |
| 35 | if params: |
| 36 | url += '?%s' % urllib.urlencode(params) |
| 37 | resp, body = self.get(url) |
| 38 | body = json.loads(body) |
| 39 | self.expected_success(200, resp.status) |
| 40 | return rest_client.ResponseBody(resp, body) |