From 150481286dcf3c3c1fedd8213070cff48e5ad61d Mon Sep 17 00:00:00 2001 From: Ross Brattain Date: Wed, 1 Mar 2017 17:28:46 -0800 Subject: 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 (cherry picked from commit 99abbb424007da2e01762f3c040a39c0157cbe1f) --- .../availability/result_checker/result_checker_general.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py') diff --git a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py index 8f987a647..ff6017b88 100644 --- a/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py +++ b/yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py @@ -26,13 +26,8 @@ class GeneralResultChecker(BaseResultChecker): def setup(self): LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) - ip = host.get("ip", None) - user = host.get("user", "root") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - key_filename = host.get("key_filename", "~/.ssh/id_rsa") - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + self.connection = ssh.SSH.from_node(host, defaults={"user": "root"}) self.connection.wait(timeout=600) LOG.debug("ssh host success!") -- cgit 1.2.3-korg