diff options
author | 2017-03-01 17:28:46 -0800 | |
---|---|---|
committer | 2017-05-04 12:54:00 +0000 | |
commit | 150481286dcf3c3c1fedd8213070cff48e5ad61d (patch) | |
tree | a8fc477a69e0a747612de328faaed57f55231973 /yardstick/benchmark/scenarios/compute/cyclictest.py | |
parent | 478a499e8cb048abf434559c8d47259ec238ed24 (diff) |
standardize ssh auth
we need to be following defautl paramiko rules,
first use pkey, then key_filenames (autodetecting ~/.ssh/ keys),
then password
We have too much boilerplate redudant code everywhere, we need
to standardize on a factory function that takes a node dict.
Using Python3 ChainMap we can layer overrides and defaults.
VNF descriptors have to default key_filename, password to Python None.
The only way to do this is to omit key values if the variable is not
defined, this way the dict will not have the value and it will
default to Python None
Add python2 chainmap backport
Updated unittest mocking to use ssh.SSH.from_node
Change-Id: I80b0cb606e593b33e317c9e5e8ed0b74da591514
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
(cherry picked from commit 99abbb424007da2e01762f3c040a39c0157cbe1f)
Diffstat (limited to 'yardstick/benchmark/scenarios/compute/cyclictest.py')
-rw-r--r-- | yardstick/benchmark/scenarios/compute/cyclictest.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/yardstick/benchmark/scenarios/compute/cyclictest.py b/yardstick/benchmark/scenarios/compute/cyclictest.py index 9ca3a8a37..594c6091e 100644 --- a/yardstick/benchmark/scenarios/compute/cyclictest.py +++ b/yardstick/benchmark/scenarios/compute/cyclictest.py @@ -85,24 +85,17 @@ class Cyclictest(base.Scenario): def _connect_host(self): host = self.context_cfg["host"] - user = host.get("user", "root") - ip = host.get("ip", None) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - LOG.debug("user:%s, host:%s", user, ip) - self.host = ssh.SSH(user, ip, key_filename=key_filename) + self.host = ssh.SSH.from_node(host, defaults={"user": "root"}) self.host.wait(timeout=600) def _connect_guest(self): host = self.context_cfg["host"] - user = host.get("user", "root") - ip = host.get("ip", None) - ssh_port = host.get("ssh_port", 5555) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - - LOG.debug("user:%s, host:%s", user, ip) - self.guest = ssh.SSH(user, ip, port=ssh_port, - key_filename=key_filename) + # why port 5555? + self.guest = ssh.SSH.from_node(host, + defaults={ + "user": "root", "ssh_port": 5555 + }) self.guest.wait(timeout=600) def _run_setup_cmd(self, client, cmd): |