From 1f52fd92dfebb8f38e18ac1ffa291d61cce23752 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Thu, 3 Mar 2016 12:24:12 -0800 Subject: [PATCH] Use tempest.lib clients for bulk ops We have duplicated bulk ops code on tempest.lib and network_client module. So this patch removes these methods from the module and makes tests use tempest.lib ones for the code cleanup. Change-Id: I685be88bbd47837d99b49938cfaa66ff2e199cb3 --- tempest/api/network/test_networks.py | 6 ++--- tempest/api/network/test_ports.py | 2 +- .../services/network/json/network_client.py | 27 ------------------- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py index ffe0336542..a31a4f0a35 100644 --- a/tempest/api/network/test_networks.py +++ b/tempest/api/network/test_networks.py @@ -451,7 +451,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest): # Creates 2 networks in one request network_list = [{'name': data_utils.rand_name('network-')}, {'name': data_utils.rand_name('network-')}] - body = self.client.create_bulk_network(networks=network_list) + body = self.networks_client.create_bulk_networks(networks=network_list) created_networks = body['networks'] self.addCleanup(self._delete_networks, created_networks) # Asserting that the networks are found in the list after creation @@ -486,7 +486,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest): } subnets_list.append(p1) del subnets_list[1]['name'] - body = self.client.create_bulk_subnet(subnets=subnets_list) + body = self.subnets_client.create_bulk_subnets(subnets=subnets_list) created_subnets = body['subnets'] self.addCleanup(self._delete_subnets, created_subnets) # Asserting that the subnets are found in the list after creation @@ -512,7 +512,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest): } port_list.append(p1) del port_list[1]['name'] - body = self.client.create_bulk_port(ports=port_list) + body = self.ports_client.create_bulk_ports(ports=port_list) created_ports = body['ports'] self.addCleanup(self._delete_ports, created_ports) # Asserting that the ports are found in the list after creation diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py index d7b220b081..0088a4d884 100644 --- a/tempest/api/network/test_ports.py +++ b/tempest/api/network/test_ports.py @@ -75,7 +75,7 @@ class PortsTestJSON(sec_base.BaseSecGroupTest): network2 = self.create_network(network_name=name) network_list = [network1['id'], network2['id']] port_list = [{'network_id': net_id} for net_id in network_list] - body = self.client.create_bulk_port(ports=port_list) + body = self.ports_client.create_bulk_ports(ports=port_list) created_ports = body['ports'] port1 = created_ports[0] port2 = created_ports[1] diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py index 5106b731e9..8b1a388f6a 100644 --- a/tempest/services/network/json/network_client.py +++ b/tempest/services/network/json/network_client.py @@ -34,33 +34,6 @@ class NetworkClient(base.BaseNetworkClient): quotas """ - def create_bulk_network(self, **kwargs): - """create bulk network - - Available params: see http://developer.openstack.org/ - api-ref-networking-v2.html#bulkCreateNetwork - """ - uri = '/networks' - return self.create_resource(uri, kwargs) - - def create_bulk_subnet(self, **kwargs): - """create bulk subnet - - Available params: see http://developer.openstack.org/ - api-ref-networking-v2.html#bulkCreateSubnet - """ - uri = '/subnets' - return self.create_resource(uri, kwargs) - - def create_bulk_port(self, **kwargs): - """create bulk port - - Available params: see http://developer.openstack.org/ - api-ref-networking-v2.html#bulkCreatePorts - """ - uri = '/ports' - return self.create_resource(uri, kwargs) - def wait_for_resource_deletion(self, resource_type, id, client=None): """Waits for a resource to be deleted.""" start_time = int(time.time())