Rename scenario.manager._create_port to create_port
This is to: 1. Rename scenario.manager._create_port to create_port, because it is used by testcases outside the file. 2. Remove namestart parameter from _create_port, because name is not important for scenario testcases and to use class name as the prefix of port name will be more indicative. 3. Remove self.assertIsNotNone(result, 'Unable to allocate port') because when using expect_empty_body = False, it's impossible to get a None result. http://git.openstack.org/cgit/openstack/tempest/tree/tempest/lib/services/network/base.py#n66 Change-Id: Ia1be5af5b6be33e67c5a1256208c0272ae109b39
This commit is contained in:
parent
46a0fa7cec
commit
1e446b5d67
@ -89,16 +89,14 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
# The create_[resource] functions only return body and discard the
|
||||
# resp part which is not used in scenario tests
|
||||
|
||||
def _create_port(self, network_id, client=None, namestart='port-quotatest',
|
||||
**kwargs):
|
||||
def create_port(self, network_id, client=None, **kwargs):
|
||||
if not client:
|
||||
client = self.ports_client
|
||||
name = data_utils.rand_name(namestart)
|
||||
name = data_utils.rand_name(self.__class__.__name__)
|
||||
result = client.create_port(
|
||||
name=name,
|
||||
network_id=network_id,
|
||||
**kwargs)
|
||||
self.assertIsNotNone(result, 'Unable to allocate port')
|
||||
port = result['port']
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
client.delete_port, port['id'])
|
||||
@ -147,8 +145,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
if vnic_type:
|
||||
ports = []
|
||||
|
||||
create_port_body = {'binding:vnic_type': vnic_type,
|
||||
'namestart': 'port-smoke'}
|
||||
create_port_body = {'binding:vnic_type': vnic_type}
|
||||
if kwargs:
|
||||
# Convert security group names to security group ids
|
||||
# to pass to create_port
|
||||
@ -185,9 +182,9 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
||||
for net in networks:
|
||||
net_id = net.get('uuid', net.get('id'))
|
||||
if 'port' not in net:
|
||||
port = self._create_port(network_id=net_id,
|
||||
client=clients.ports_client,
|
||||
**create_port_body)
|
||||
port = self.create_port(network_id=net_id,
|
||||
client=clients.ports_client,
|
||||
**create_port_body)
|
||||
ports.append({'port': port['id']})
|
||||
else:
|
||||
ports.append({'port': net['port']})
|
||||
|
@ -113,7 +113,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
||||
port_id = None
|
||||
if boot_with_port:
|
||||
# create a port on the network and boot with that
|
||||
port_id = self._create_port(self.network['id'])['id']
|
||||
port_id = self.create_port(self.network['id'])['id']
|
||||
self.ports.append({'port': port_id})
|
||||
|
||||
server = self._create_server(self.network, port_id)
|
||||
|
Loading…
Reference in New Issue
Block a user