Add random name in scenario.manager.create_server
This is to set random name in scenario.manager.create_server if
no name is provided, so some name definitions can be removed.
Change-Id: I742e6160dd654caae6a4cc0063753d4ecffb2697
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index ab388c2..d182f57 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -140,6 +140,9 @@
if clients is None:
clients = self.manager
+ if name is None:
+ name = data_utils.rand_name(self.__class__.__name__ + "-server")
+
vnic_type = CONF.network.port_vnic_type
# If vnic_type is configured create port for
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index a295b6a..a976084 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -19,7 +19,6 @@
from oslo_log import log as logging
import testtools
-from tempest.common.utils import data_utils
from tempest.common import waiters
from tempest import config
from tempest import exceptions
@@ -117,8 +116,7 @@
self.port_id = self._create_port(self.network['id'])['id']
self.ports.append({'port': self.port_id})
- name = data_utils.rand_name('server-smoke')
- server = self._create_server(name, self.network, self.port_id)
+ server = self._create_server(self.network, self.port_id)
self._check_tenant_network_connectivity()
floating_ip = self.create_floating_ip(server)
@@ -152,7 +150,7 @@
self.assertIn(self.router['id'],
seen_router_ids)
- def _create_server(self, name, network, port_id=None):
+ def _create_server(self, network, port_id=None):
keypair = self.create_keypair()
self.keypairs[keypair['name']] = keypair
security_groups = [{'name': self.security_group['name']}]
@@ -161,7 +159,6 @@
network['port'] = port_id
server = self.create_server(
- name=name,
networks=[network],
key_name=keypair['name'],
security_groups=security_groups,
@@ -220,9 +217,8 @@
def _reassociate_floating_ips(self):
floating_ip, server = self.floating_ip_tuple
- name = data_utils.rand_name('new_server-smoke')
# create a new server for the floating ip
- server = self._create_server(name, self.network)
+ server = self._create_server(self.network)
self._associate_floating_ip(floating_ip, server)
self.floating_ip_tuple = Floating_IP_tuple(
floating_ip, server)
@@ -449,8 +445,7 @@
self._check_network_internal_connectivity(network=self.network)
self._check_network_external_connectivity()
self._create_new_network(create_gateway=True)
- name = data_utils.rand_name('server-smoke')
- self._create_server(name, self.new_net)
+ self._create_server(self.new_net)
self._check_network_internal_connectivity(network=self.new_net,
should_connect=False)
router_id = self.router['id']
@@ -678,8 +673,7 @@
# Boot another server with the same port to make sure nothing was
# left around that could cause issues.
- name = data_utils.rand_name('reuse-port')
- server = self._create_server(name, self.network, port['id'])
+ server = self._create_server(self.network, port['id'])
port_list = self._list_ports(device_id=server['id'],
network_id=self.network['id'])
self.assertEqual(1, len(port_list),
@@ -803,8 +797,7 @@
ssh_client = self.get_remote_client(fip['floating_ip_address'],
private_key=private_key)
spoof_nic = ssh_client.get_nic_name_by_mac(spoof_port["mac_address"])
- name = data_utils.rand_name('peer')
- peer = self._create_server(name, self.new_net)
+ peer = self._create_server(self.new_net)
peer_address = peer['addresses'][self.new_net['name']][0]['addr']
self._check_remote_connectivity(ssh_client, dest=peer_address,
nic=spoof_nic, should_succeed=True)