summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwantwatering <yun.wang2@hp.com>2015-03-27 15:17:42 +0800
committerWang Yun <yun.wang2@hp.com>2015-04-01 09:59:40 +0000
commit896300ca7cd13749ad10609ade557b3140b2c269 (patch)
tree746f1d91b2709d07ae43ac946ec10a490a919f75
parent609f6030a21c94618ff3fffe8ec47fba7435b868 (diff)
downloadtempest-896300ca7cd13749ad10609ade557b3140b2c269.tar.gz
Allow SSH instance with username and password in scenario cases
Current scenario test cases only allow SSH with keypair. Here we change the entrance where call SSH client: scenario.manager.get_remote_client(). Check the ssh_auth_method to decide which way should be picked, pass a None private to paramiko if username/password has been chosen and vice versa. Since disable ssh_auth_method makes most of the scenario test cases meaningless, here the disable flag is not checked and the SSH method is either username/password or private key. TO test the modification for username/password authentication with cirros, set tempest.conf as below and run senario test cases: [compute] ... image_ssh_user = cirros image_ssh_password = cubswin:) ssh_auth_method = configured #default is keypair run_ssh = True #If want to test scenario.test_server_basic_opts ... [scenario] ... ssh_user = cirros ... TODO in the next: SSH username and password come from different config options. e.g. some of the scenario cases use compute.image_ssh_password and compute.image_ssh_user, some of them use scenario.ssh_user or input-scenario.ssh_user_regex. And the rest use all of them. It's hard for user to configure for all the cases since they need to modify many places for username, password etc. It's better to use the same place to configure them. Change-Id: I48e3689c4040b18e887284b8eec3a6537c6adb50 Closes-Bug: #1400638
-rw-r--r--tempest/scenario/manager.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index bae829677..c0374e6b8 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -313,10 +313,18 @@ class ScenarioTest(tempest.test.BaseTestCase):
if username is None:
username = CONF.scenario.ssh_user
- if private_key is None:
- private_key = self.keypair['private_key']
+ # Set this with 'keypair' or others to log in with keypair or
+ # username/password.
+ if CONF.compute.ssh_auth_method == 'keypair':
+ password = None
+ if private_key is None:
+ private_key = self.keypair['private_key']
+ else:
+ password = CONF.compute.image_ssh_password
+ private_key = None
linux_client = remote_client.RemoteClient(ip, username,
- pkey=private_key)
+ pkey=private_key,
+ password=password)
try:
linux_client.validate_authentication()
except Exception: