Skip to content

Commit

Permalink
Use tempest.lib clients for bulk ops
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ken'ichi Ohmichi committed Mar 3, 2016
1 parent e257898 commit 1f52fd9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
6 changes: 3 additions & 3 deletions tempest/api/network/test_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ def test_bulk_create_delete_network(self):
# 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
Expand Down Expand Up @@ -486,7 +486,7 @@ def test_bulk_create_delete_subnet(self):
}
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
Expand All @@ -512,7 +512,7 @@ def test_bulk_create_delete_port(self):
}
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
Expand Down
2 changes: 1 addition & 1 deletion tempest/api/network/test_ports.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_create_bulk_port(self):
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]
Expand Down
27 changes: 0 additions & 27 deletions tempest/services/network/json/network_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 1f52fd9

Please sign in to comment.