Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 1 | # Copyright 2015 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 | from tempest.lib.services.network import base |
| 16 | |
| 17 | |
| 18 | class SubnetpoolsClient(base.BaseNetworkClient): |
| 19 | |
| 20 | def list_subnetpools(self, **filters): |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 21 | """Lists subnet pools to which the tenant has access. |
| 22 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 23 | For a full list of available parameters, please refer to the official |
| 24 | API reference: |
| 25 | http://developer.openstack.org/api-ref/networking/v2/index.html#list-subnet-pools |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 26 | """ |
Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 27 | uri = '/subnetpools' |
| 28 | return self.list_resources(uri, **filters) |
| 29 | |
| 30 | def create_subnetpool(self, **kwargs): |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 31 | """Creates a subnet pool. |
| 32 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 33 | For a full list of available parameters, please refer to the official |
| 34 | API reference: |
| 35 | http://developer.openstack.org/api-ref/networking/v2/index.html#create-subnet-pool |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 36 | """ |
Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 37 | uri = '/subnetpools' |
| 38 | post_data = {'subnetpool': kwargs} |
| 39 | return self.create_resource(uri, post_data) |
| 40 | |
| 41 | def show_subnetpool(self, subnetpool_id, **fields): |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 42 | """Shows information for a subnet pool. |
| 43 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 44 | For a full list of available parameters, please refer to the official |
| 45 | API reference: |
| 46 | http://developer.openstack.org/api-ref/networking/v2/index.html#show-subnet-pool |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 47 | """ |
Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 48 | uri = '/subnetpools/%s' % subnetpool_id |
| 49 | return self.show_resource(uri, **fields) |
| 50 | |
| 51 | def update_subnetpool(self, subnetpool_id, **kwargs): |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 52 | """Updates a subnet pool. |
| 53 | |
OTSUKA, Yuanying | faac571 | 2016-09-15 13:53:55 +0900 | [diff] [blame] | 54 | For a full list of available parameters, please refer to the official |
| 55 | API reference: |
| 56 | http://developer.openstack.org/api-ref/networking/v2/index.html#update-subnet-pool |
Lv Fumei | fe2c146 | 2016-07-06 17:24:37 +0800 | [diff] [blame] | 57 | """ |
Matthew Treinish | 9e26ca8 | 2016-02-23 11:43:20 -0500 | [diff] [blame] | 58 | uri = '/subnetpools/%s' % subnetpool_id |
| 59 | post_data = {'subnetpool': kwargs} |
| 60 | return self.update_resource(uri, post_data) |
| 61 | |
| 62 | def delete_subnetpool(self, subnetpool_id): |
| 63 | uri = '/subnetpools/%s' % subnetpool_id |
| 64 | return self.delete_resource(uri) |