John Warren | 3961acd | 2015-10-02 14:38:53 -0400 | [diff] [blame] | 1 | # 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 | |
| 13 | from tempest.services.network.json import base |
| 14 | |
| 15 | |
| 16 | class SubnetsClient(base.BaseNetworkClient): |
| 17 | |
| 18 | def create_subnet(self, **kwargs): |
| 19 | uri = '/subnets' |
| 20 | post_data = {'subnet': kwargs} |
| 21 | return self.create_resource(uri, post_data) |
| 22 | |
| 23 | def update_subnet(self, subnet_id, **kwargs): |
| 24 | uri = '/subnets/%s' % subnet_id |
| 25 | post_data = {'subnet': kwargs} |
| 26 | return self.update_resource(uri, post_data) |
| 27 | |
| 28 | def show_subnet(self, subnet_id, **fields): |
| 29 | uri = '/subnets/%s' % subnet_id |
| 30 | return self.show_resource(uri, **fields) |
| 31 | |
| 32 | def delete_subnet(self, subnet_id): |
| 33 | uri = '/subnets/%s' % subnet_id |
| 34 | return self.delete_resource(uri) |
| 35 | |
| 36 | def list_subnets(self, **filters): |
| 37 | uri = '/subnets' |
| 38 | return self.list_resources(uri, **filters) |