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
This commit is contained in:
Ken'ichi Ohmichi 2016-03-03 12:24:12 -08:00
parent e257898517
commit 1f52fd92df
3 changed files with 4 additions and 31 deletions

View File

@ -451,7 +451,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
# Creates 2 networks in one request # Creates 2 networks in one request
network_list = [{'name': data_utils.rand_name('network-')}, network_list = [{'name': data_utils.rand_name('network-')},
{'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'] created_networks = body['networks']
self.addCleanup(self._delete_networks, created_networks) self.addCleanup(self._delete_networks, created_networks)
# Asserting that the networks are found in the list after creation # Asserting that the networks are found in the list after creation
@ -486,7 +486,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
} }
subnets_list.append(p1) subnets_list.append(p1)
del subnets_list[1]['name'] 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'] created_subnets = body['subnets']
self.addCleanup(self._delete_subnets, created_subnets) self.addCleanup(self._delete_subnets, created_subnets)
# Asserting that the subnets are found in the list after creation # Asserting that the subnets are found in the list after creation
@ -512,7 +512,7 @@ class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
} }
port_list.append(p1) port_list.append(p1)
del port_list[1]['name'] 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'] created_ports = body['ports']
self.addCleanup(self._delete_ports, created_ports) self.addCleanup(self._delete_ports, created_ports)
# Asserting that the ports are found in the list after creation # Asserting that the ports are found in the list after creation

View File

@ -75,7 +75,7 @@ class PortsTestJSON(sec_base.BaseSecGroupTest):
network2 = self.create_network(network_name=name) network2 = self.create_network(network_name=name)
network_list = [network1['id'], network2['id']] network_list = [network1['id'], network2['id']]
port_list = [{'network_id': net_id} for net_id in network_list] 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'] created_ports = body['ports']
port1 = created_ports[0] port1 = created_ports[0]
port2 = created_ports[1] port2 = created_ports[1]

View File

@ -34,33 +34,6 @@ class NetworkClient(base.BaseNetworkClient):
quotas 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): def wait_for_resource_deletion(self, resource_type, id, client=None):
"""Waits for a resource to be deleted.""" """Waits for a resource to be deleted."""
start_time = int(time.time()) start_time = int(time.time())