blob: b843f840a2faedd11f0aa7bf9c450223120bff7c [file] [log] [blame]
Matthew Treinish9e26ca82016-02-23 11:43:20 -05001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
13from tempest.lib.services.network import base
14
15
16class SubnetsClient(base.BaseNetworkClient):
17
18 def create_subnet(self, **kwargs):
Lv Fumeifbfe20f2016-07-06 13:42:27 +080019 """Creates a subnet on a network.
20
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090021 For a full list of available parameters, please refer to the official
22 API reference:
23 http://developer.openstack.org/api-ref/networking/v2/index.html#create-subnet
Lv Fumeifbfe20f2016-07-06 13:42:27 +080024 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050025 uri = '/subnets'
26 post_data = {'subnet': kwargs}
27 return self.create_resource(uri, post_data)
28
29 def update_subnet(self, subnet_id, **kwargs):
Lv Fumeifbfe20f2016-07-06 13:42:27 +080030 """Updates a subnet.
31
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090032 For a full list of available parameters, please refer to the official
33 API reference:
34 http://developer.openstack.org/api-ref/networking/v2/index.html#update-subnet
Lv Fumeifbfe20f2016-07-06 13:42:27 +080035 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050036 uri = '/subnets/%s' % subnet_id
37 post_data = {'subnet': kwargs}
38 return self.update_resource(uri, post_data)
39
40 def show_subnet(self, subnet_id, **fields):
Lv Fumei8efac682016-07-08 16:49:52 +080041 """Shows details for a subnet.
42
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090043 For a full list of available parameters, please refer to the official
44 API reference:
45 http://developer.openstack.org/api-ref/networking/v2/index.html#show-subnet-details
Lv Fumei8efac682016-07-08 16:49:52 +080046 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050047 uri = '/subnets/%s' % subnet_id
48 return self.show_resource(uri, **fields)
49
50 def delete_subnet(self, subnet_id):
51 uri = '/subnets/%s' % subnet_id
52 return self.delete_resource(uri)
53
54 def list_subnets(self, **filters):
Lv Fumei8efac682016-07-08 16:49:52 +080055 """Lists subnets to which the tenant has access.
56
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090057 For a full list of available parameters, please refer to the official
58 API reference:
59 http://developer.openstack.org/api-ref/networking/v2/index.html#list-subnets
Lv Fumei8efac682016-07-08 16:49:52 +080060 """
Matthew Treinish9e26ca82016-02-23 11:43:20 -050061 uri = '/subnets'
62 return self.list_resources(uri, **filters)
63
64 def create_bulk_subnets(self, **kwargs):
65 """Create multiple subnets in a single request.
66
OTSUKA, Yuanyingfaac5712016-09-15 13:53:55 +090067 For a full list of available parameters, please refer to the official
68 API reference:
69 http://developer.openstack.org/api-ref/networking/v2/index.html#bulk-create-subnet
Matthew Treinish9e26ca82016-02-23 11:43:20 -050070 """
71 uri = '/subnets'
72 return self.create_resource(uri, kwargs)