ssh instance validation add options for Neutron

This is the first part of the patch series which
 implements multiple ssh instance validation strategy.

This patch adds the new config options and have the effected
test classes to prepare the basic neutron resources for usage.

The default is using the fixed ips for connection, but
on the devstack side the configuration options are configured,
for neutron usage.

Change-Id: Ic5fc9bd1f7407d3430fcd33b03a226deed696d57
Implements: blueprint ssh-auth-strategy
This commit is contained in:
Attila Fazekas
2014-03-14 17:33:13 +01:00
parent bd8c04021b
commit 423834d26b
9 changed files with 41 additions and 0 deletions

View File

@@ -250,6 +250,19 @@
# Should the tests ssh to instances? (boolean value)
#run_ssh=false
# Auth method used for authenticate to the instance. Valid
# choices are: keypair, configured, adminpass. keypair: start
# the servers with an ssh keypair. configured: use the
# configured user and password. adminpass: use the injected
# adminPass. disabled: avoid using ssh when it is an option.
# (string value)
#ssh_auth_method=keypair
# How to connect to the instance? fixed: using the first ip
# belongs the fixed network floating: creating and using a
# floating ip (string value)
#ssh_connect_method=fixed
# User name used to authenticate to an instance. (string
# value)
#ssh_user=root

View File

@@ -203,6 +203,13 @@ class BaseComputeTest(tempest.test.BaseTestCase):
LOG.warn("Unable to delete volume '%s' since it was not found. "
"Maybe it was already deleted?" % volume_id)
@classmethod
def prepare_instance_network(cls):
if (CONF.compute.ssh_auth_method != 'disabled' and
CONF.compute.ssh_connect_method == 'floating'):
cls.set_network_resources(network=True, subnet=True, router=True,
dhcp=True)
class BaseV2ComputeTest(BaseComputeTest):

View File

@@ -32,6 +32,7 @@ class ServersTestJSON(base.BaseV2ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServersTestJSON, cls).setUpClass()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'
@@ -114,6 +115,7 @@ class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServersWithSpecificFlavorTestJSON, cls).setUpClass()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'

View File

@@ -44,6 +44,7 @@ class ServerActionsTestJSON(base.BaseV2ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServerActionsTestJSON, cls).setUpClass()
cls.client = cls.servers_client
cls.server_id = cls.rebuild_server(None)

View File

@@ -33,6 +33,7 @@ class AttachVolumeV3Test(base.BaseV3ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(AttachVolumeV3Test, cls).setUpClass()
cls.device = CONF.compute.volume_device_name
if not CONF.service_available.cinder:

View File

@@ -32,6 +32,7 @@ class ServersV3Test(base.BaseV3ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServersV3Test, cls).setUpClass()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'
@@ -115,6 +116,7 @@ class ServersWithSpecificFlavorV3Test(base.BaseV3ComputeAdminTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServersWithSpecificFlavorV3Test, cls).setUpClass()
cls.meta = {'hello': 'world'}
cls.accessIPv4 = '1.1.1.1'

View File

@@ -41,6 +41,7 @@ class ServerActionsV3Test(base.BaseV3ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(ServerActionsV3Test, cls).setUpClass()
cls.client = cls.servers_client
cls.server_id = cls.rebuild_server(None)

View File

@@ -33,6 +33,7 @@ class AttachVolumeTestJSON(base.BaseV2ComputeTest):
@classmethod
def setUpClass(cls):
cls.prepare_instance_network()
super(AttachVolumeTestJSON, cls).setUpClass()
cls.device = CONF.compute.volume_device_name
if not CONF.service_available.cinder:

View File

@@ -159,6 +159,19 @@ ComputeGroup = [
cfg.BoolOpt('run_ssh',
default=False,
help="Should the tests ssh to instances?"),
cfg.StrOpt('ssh_auth_method',
default='keypair',
help="Auth method used for authenticate to the instance. "
"Valid choices are: keypair, configured, adminpass. "
"keypair: start the servers with an ssh keypair. "
"configured: use the configured user and password. "
"adminpass: use the injected adminPass. "
"disabled: avoid using ssh when it is an option."),
cfg.StrOpt('ssh_connect_method',
default='fixed',
help="How to connect to the instance? "
"fixed: using the first ip belongs the fixed network "
"floating: creating and using a floating ip"),
cfg.StrOpt('ssh_user',
default='root',
help="User name used to authenticate to an instance."),