Pass custom args to create_port through create_server

Allow consumers of create_server to pass custom arguments to
create_port method which is called from create_server one.

Fix namestart var usage in create_port - as the name of the var
suggests, it should be used to generate a name from. Therefore
the patch also adds rand_name call which we accidentaly removed

Implements: blueprint tempest-scenario-manager-stable
Change-Id: I724e0f37d4381a493217a077492046f7a4b0a2a2
Martin Kopec 2 years ago
parent 0e0264636f
commit 9c87441724

@ -143,10 +143,20 @@ class ScenarioTest(tempest.test.BaseTestCase):
# resp part which is not used in scenario tests
def create_port(self, network_id, client=None, **kwargs):
"""Creates port for the respective network_id"""
"""Creates port for the respective network_id
:param network_id: the id of the network
:param client: the client to use, defaults to self.ports_client
:param kwargs: additional arguments such as:
- namestart - a string to generate a name for the port from
- default is self.__class__.__name__
- 'binding:vnic_type' - defaults to
- 'binding:profile' - defaults to
if not client:
client = self.ports_client
name = kwargs.pop('namestart', self.__class__.__name__)
name = data_utils.rand_name(
kwargs.pop('namestart', self.__class__.__name__))
if and 'binding:vnic_type' not in kwargs:
kwargs['binding:vnic_type'] =
if and 'binding:profile' not in kwargs:
@ -216,6 +226,9 @@ class ScenarioTest(tempest.test.BaseTestCase):
the port.
example: port_profile = "capabilities:[switchdev]"
Defaults to ````.
* *create_port_body* (``dict``) --
This attribute is a dictionary of additional arguments to be
passed to create_port method.
# NOTE(jlanoux): As a first step, ssh checks in the scenario
@ -241,7 +254,7 @@ class ScenarioTest(tempest.test.BaseTestCase):
# every network
if vnic_type or profile:
ports = []
create_port_body = {}
create_port_body = kwargs.pop('create_port_body', {})
if vnic_type:
create_port_body['binding:vnic_type'] = vnic_type