Merge "Rename scenario.manager._create_port to create_port"
This commit is contained in:
commit
213f213d44
@ -89,16 +89,14 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||||||
# The create_[resource] functions only return body and discard the
|
# The create_[resource] functions only return body and discard the
|
||||||
# resp part which is not used in scenario tests
|
# resp part which is not used in scenario tests
|
||||||
|
|
||||||
def _create_port(self, network_id, client=None, namestart='port-quotatest',
|
def create_port(self, network_id, client=None, **kwargs):
|
||||||
**kwargs):
|
|
||||||
if not client:
|
if not client:
|
||||||
client = self.ports_client
|
client = self.ports_client
|
||||||
name = data_utils.rand_name(namestart)
|
name = data_utils.rand_name(self.__class__.__name__)
|
||||||
result = client.create_port(
|
result = client.create_port(
|
||||||
name=name,
|
name=name,
|
||||||
network_id=network_id,
|
network_id=network_id,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
self.assertIsNotNone(result, 'Unable to allocate port')
|
|
||||||
port = result['port']
|
port = result['port']
|
||||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||||
client.delete_port, port['id'])
|
client.delete_port, port['id'])
|
||||||
@ -147,8 +145,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||||||
if vnic_type:
|
if vnic_type:
|
||||||
ports = []
|
ports = []
|
||||||
|
|
||||||
create_port_body = {'binding:vnic_type': vnic_type,
|
create_port_body = {'binding:vnic_type': vnic_type}
|
||||||
'namestart': 'port-smoke'}
|
|
||||||
if kwargs:
|
if kwargs:
|
||||||
# Convert security group names to security group ids
|
# Convert security group names to security group ids
|
||||||
# to pass to create_port
|
# to pass to create_port
|
||||||
@ -185,9 +182,9 @@ class ScenarioTest(tempest.test.BaseTestCase):
|
|||||||
for net in networks:
|
for net in networks:
|
||||||
net_id = net.get('uuid', net.get('id'))
|
net_id = net.get('uuid', net.get('id'))
|
||||||
if 'port' not in net:
|
if 'port' not in net:
|
||||||
port = self._create_port(network_id=net_id,
|
port = self.create_port(network_id=net_id,
|
||||||
client=clients.ports_client,
|
client=clients.ports_client,
|
||||||
**create_port_body)
|
**create_port_body)
|
||||||
ports.append({'port': port['id']})
|
ports.append({'port': port['id']})
|
||||||
else:
|
else:
|
||||||
ports.append({'port': net['port']})
|
ports.append({'port': net['port']})
|
||||||
|
@ -113,7 +113,7 @@ class TestNetworkBasicOps(manager.NetworkScenarioTest):
|
|||||||
port_id = None
|
port_id = None
|
||||||
if boot_with_port:
|
if boot_with_port:
|
||||||
# create a port on the network and boot with that
|
# 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})
|
self.ports.append({'port': port_id})
|
||||||
|
|
||||||
server = self._create_server(self.network, port_id)
|
server = self._create_server(self.network, port_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user