blob: 7e77e3026781508ac62f4e508c64ff6ac0c19d40 [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# 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
15from tempest.lib.services.network import base
16
17
18class SubnetpoolsClient(base.BaseNetworkClient):
19
20 def list_subnetpools(self, **filters):
Lv Fumeife2c1462016-07-06 17:24:37 +080021 """Lists subnet pools to which the tenant has access.
22
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090023 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 Fumeife2c1462016-07-06 17:24:37 +080026 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050027 uri = '/subnetpools'
28 return self.list_resources(uri, **filters)
29
30 def create_subnetpool(self, **kwargs):
Lv Fumeife2c1462016-07-06 17:24:37 +080031 """Creates a subnet pool.
32
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090033 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 Fumeife2c1462016-07-06 17:24:37 +080036 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050037 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 Fumeife2c1462016-07-06 17:24:37 +080042 """Shows information for a subnet pool.
43
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090044 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 Fumeife2c1462016-07-06 17:24:37 +080047 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050048 uri = '/subnetpools/%s' % subnetpool_id
49 return self.show_resource(uri, **fields)
50
51 def update_subnetpool(self, subnetpool_id, **kwargs):
Lv Fumeife2c1462016-07-06 17:24:37 +080052 """Updates a subnet pool.
53
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090054 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 Fumeife2c1462016-07-06 17:24:37 +080057 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050058 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)