Split out Neutron subnetpools client
Splitting out a subnetpools client for Neutron.
Partially implements blueprint consistent-service-method-names
Change-Id: Id968946d174779e0b3bab88f9de93dfc66d79209
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index d0580d8..2a1776a 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -73,6 +73,7 @@
cls.client = cls.os.network_client
cls.agents_client = cls.os.network_agents_client
cls.networks_client = cls.os.networks_client
+ cls.subnetpools_client = cls.os.subnetpools_client
cls.subnets_client = cls.os.subnets_client
cls.ports_client = cls.os.ports_client
cls.quotas_client = cls.os.network_quotas_client
diff --git a/tempest/api/network/test_subnetpools_extensions.py b/tempest/api/network/test_subnetpools_extensions.py
index 8a61ff8..29d1d89 100644
--- a/tempest/api/network/test_subnetpools_extensions.py
+++ b/tempest/api/network/test_subnetpools_extensions.py
@@ -50,27 +50,28 @@
subnetpool_name = data_utils.rand_name('subnetpools')
# create subnet pool
prefix = CONF.network.default_network
- body = self.client.create_subnetpools(name=subnetpool_name,
- prefixes=prefix)
+ body = self.subnetpools_client.create_subnetpools(name=subnetpool_name,
+ prefixes=prefix)
subnetpool_id = body["subnetpool"]["id"]
self.addCleanup(self._cleanup_subnetpools, subnetpool_id)
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# get detail about subnet pool
- body = self.client.show_subnetpools(subnetpool_id)
+ body = self.subnetpools_client.show_subnetpools(subnetpool_id)
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# update the subnet pool
subnetpool_name = data_utils.rand_name('subnetpools_update')
- body = self.client.update_subnetpools(subnetpool_id,
- name=subnetpool_name)
+ body = self.subnetpools_client.update_subnetpools(subnetpool_id,
+ name=subnetpool_name)
self.assertEqual(subnetpool_name, body["subnetpool"]["name"])
# delete subnet pool
- body = self.client.delete_subnetpools(subnetpool_id)
- self.assertRaises(lib_exc.NotFound, self.client.show_subnetpools,
+ body = self.subnetpools_client.delete_subnetpools(subnetpool_id)
+ self.assertRaises(lib_exc.NotFound,
+ self.subnetpools_client.show_subnetpools,
subnetpool_id)
def _cleanup_subnetpools(self, subnetpool_id):
# this is used to cleanup the resources
try:
- self.client.delete_subnetpools(subnetpool_id)
+ self.subnetpools_client.delete_subnetpools(subnetpool_id)
except lib_exc.NotFound:
pass
diff --git a/tempest/clients.py b/tempest/clients.py
index ce05944..393815c 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -123,6 +123,7 @@
as NetworkQuotasClient
from tempest.services.network.json.security_groups_client import \
SecurityGroupsClient
+from tempest.services.network.json.subnetpools_client import SubnetpoolsClient
from tempest.services.network.json.subnets_client import SubnetsClient
from tempest.services.object_storage.account_client import AccountClient
from tempest.services.object_storage.container_client import ContainerClient
@@ -230,6 +231,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.subnetpools_client = SubnetpoolsClient(
+ self.auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **self.default_params)
self.subnets_client = SubnetsClient(
self.auth_provider,
CONF.network.catalog_type,
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 7705fc4..e8e21d2 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -255,25 +255,3 @@
}
}
return self.update_resource(uri, put_body)
-
- def list_subnetpools(self, **filters):
- uri = '/subnetpools'
- return self.list_resources(uri, **filters)
-
- def create_subnetpools(self, **kwargs):
- uri = '/subnetpools'
- post_data = {'subnetpool': kwargs}
- return self.create_resource(uri, post_data)
-
- def show_subnetpools(self, subnetpool_id, **fields):
- uri = '/subnetpools/%s' % subnetpool_id
- return self.show_resource(uri, **fields)
-
- def update_subnetpools(self, subnetpool_id, **kwargs):
- uri = '/subnetpools/%s' % subnetpool_id
- post_data = {'subnetpool': kwargs}
- return self.update_resource(uri, post_data)
-
- def delete_subnetpools(self, subnetpool_id):
- uri = '/subnetpools/%s' % subnetpool_id
- return self.delete_resource(uri)
diff --git a/tempest/services/network/json/subnetpools_client.py b/tempest/services/network/json/subnetpools_client.py
new file mode 100644
index 0000000..b5aec47
--- /dev/null
+++ b/tempest/services/network/json/subnetpools_client.py
@@ -0,0 +1,40 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.services.network.json import base
+
+
+class SubnetpoolsClient(base.BaseNetworkClient):
+
+ def list_subnetpools(self, **filters):
+ uri = '/subnetpools'
+ return self.list_resources(uri, **filters)
+
+ def create_subnetpools(self, **kwargs):
+ uri = '/subnetpools'
+ post_data = {'subnetpool': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def show_subnetpools(self, subnetpool_id, **fields):
+ uri = '/subnetpools/%s' % subnetpool_id
+ return self.show_resource(uri, **fields)
+
+ def update_subnetpools(self, subnetpool_id, **kwargs):
+ uri = '/subnetpools/%s' % subnetpool_id
+ post_data = {'subnetpool': kwargs}
+ return self.update_resource(uri, post_data)
+
+ def delete_subnetpools(self, subnetpool_id):
+ uri = '/subnetpools/%s' % subnetpool_id
+ return self.delete_resource(uri)