aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios')
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py28
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_general.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/attacker/attacker_process.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_command.py8
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_general.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_process.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/operation/operation_general.py7
-rw-r--r--yardstick/benchmark/scenarios/availability/result_checker/result_checker_general.py7
-rw-r--r--yardstick/benchmark/scenarios/compute/cachestat.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/computecapacity.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/cpuload.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/cyclictest.py19
-rw-r--r--yardstick/benchmark/scenarios/compute/lmbench.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/memload.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/perf.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/plugintest.py11
-rw-r--r--yardstick/benchmark/scenarios/compute/ramspeed.py10
-rw-r--r--yardstick/benchmark/scenarios/compute/unixbench.py10
-rw-r--r--yardstick/benchmark/scenarios/networking/iperf3.py21
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf.py20
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf_node.py23
-rw-r--r--yardstick/benchmark/scenarios/networking/netutilization.py10
-rw-r--r--yardstick/benchmark/scenarios/networking/networkcapacity.py10
-rw-r--r--yardstick/benchmark/scenarios/networking/nstat.py10
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py18
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6.py15
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen.py22
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen_dpdk.py20
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc.py59
-rw-r--r--yardstick/benchmark/scenarios/networking/vnf_generic.py8
-rw-r--r--yardstick/benchmark/scenarios/networking/vsperf.py10
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py10
-rw-r--r--yardstick/benchmark/scenarios/storage/storagecapacity.py12
33 files changed, 116 insertions, 340 deletions
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
index 1d632799d..f7683fd84 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py
@@ -39,16 +39,11 @@ class BaremetalAttacker(BaseAttacker):
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!")
- self.host_ip = ip
+ self.host_ip = host['ip']
self.ipmi_ip = host.get("ipmi_ip", None)
self.ipmi_user = host.get("ipmi_user", "root")
@@ -90,25 +85,24 @@ class BaremetalAttacker(BaseAttacker):
self.jump_connection = None
if jump_host_name is not None:
host = self._context.get(jump_host_name, None)
- ip = host.get("ip", None)
- user = host.get("user", "root")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- pwd = host.get("pwd", None)
-
- LOG.debug("jump_host ip:%s user:%s", ip, user)
- self.jump_connection = ssh.SSH(user, ip, password=pwd,
- port=ssh_port)
+
+ LOG.debug("jump_host ip:%s user:%s", host['ip'], host['user'])
+ self.jump_connection = ssh.SSH.from_node(
+ host,
+ # why do we allow pwd for password?
+ defaults={"user": "root", "password": host.get("pwd")}
+ )
self.jump_connection.wait(timeout=600)
LOG.debug("ssh jump host success!")
if self.jump_connection is not None:
with open(self.recovery_script, "r") as stdin_file:
- exit_status, stdout, stderr = self.jump_connection.execute(
+ self.jump_connection.execute(
"/bin/bash -s {0} {1} {2} {3}".format(
self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
stdin=stdin_file)
else:
- exit_status, stdout = _execute_shell_command(
+ _execute_shell_command(
"/bin/bash -s {0} {1} {2} {3}".format(
self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
stdin=open(self.recovery_script, "r"))
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
index ab5e99860..35cbccd6e 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_general.py
@@ -24,13 +24,8 @@ class GeneralAttacker(BaseAttacker):
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!")
diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
index 66934afeb..93375a6dc 100644
--- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
+++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py
@@ -23,13 +23,8 @@ class ProcessAttacker(BaseAttacker):
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!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
index 084f80225..033a2d721 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_command.py
@@ -42,13 +42,9 @@ class MonitorOpenstackCmd(basemonitor.BaseMonitor):
node_name = self._config.get("host", None)
if node_name:
host = self._context[node_name]
- 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!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
index 78a603193..c6c5a75a1 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_general.py
@@ -24,10 +24,6 @@ class GeneralMonitor(basemonitor.BaseMonitor):
def setup(self):
host = self._context[self._config["host"]]
- 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.key = self._config["key"]
self.monitor_key = self._config["monitor_key"]
self.monitor_type = self._config["monitor_type"]
@@ -42,8 +38,7 @@ class GeneralMonitor(basemonitor.BaseMonitor):
self.monitor_key)
self.monitor_script = self.get_script_fullpath(
self.monitor_cfg['monitor_script'])
- 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!")
diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
index 91b6ba31a..ca5cac1ff 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_process.py
@@ -22,13 +22,8 @@ class MonitorProcess(basemonitor.BaseMonitor):
def setup(self):
host = self._context[self._config["host"]]
- 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!")
self.check_script = self.get_script_fullpath(
diff --git a/yardstick/benchmark/scenarios/availability/operation/operation_general.py b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
index bfd7d04b0..49c63cc75 100644
--- a/yardstick/benchmark/scenarios/availability/operation/operation_general.py
+++ b/yardstick/benchmark/scenarios/availability/operation/operation_general.py
@@ -26,13 +26,8 @@ class GeneralOperaion(BaseOperation):
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!")
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!")
diff --git a/yardstick/benchmark/scenarios/compute/cachestat.py b/yardstick/benchmark/scenarios/compute/cachestat.py
index 8873b9683..40f6ed773 100644
--- a/yardstick/benchmark/scenarios/compute/cachestat.py
+++ b/yardstick/benchmark/scenarios/compute/cachestat.py
@@ -76,14 +76,8 @@ class CACHEstat(base.Scenario):
CACHEstat.TARGET_SCRIPT)
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get('ip', None)
- key_filename = host.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/computecapacity.py b/yardstick/benchmark/scenarios/compute/computecapacity.py
index 9d518f7a0..688661c5f 100644
--- a/yardstick/benchmark/scenarios/compute/computecapacity.py
+++ b/yardstick/benchmark/scenarios/compute/computecapacity.py
@@ -42,13 +42,9 @@ class ComputeCapacity(base.Scenario):
nodes = self.context_cfg['nodes']
node = nodes.get('host', None)
- host_user = node.get('user', 'ubuntu')
- ssh_port = node.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = node.get('ip', None)
- host_pwd = node.get('password', 'root')
- LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
- port=ssh_port)
+ self.client = ssh.SSH.from_node(node, defaults={
+ "user": "ubuntu", "password": "root"
+ })
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/compute/cpuload.py b/yardstick/benchmark/scenarios/compute/cpuload.py
index 121d5a75d..c65396185 100644
--- a/yardstick/benchmark/scenarios/compute/cpuload.py
+++ b/yardstick/benchmark/scenarios/compute/cpuload.py
@@ -68,14 +68,8 @@ class CPULoad(base.Scenario):
def setup(self):
"""Scenario setup."""
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ip = host.get('ip', None)
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- key_filename = host.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# Check if mpstat prog is installed
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):
diff --git a/yardstick/benchmark/scenarios/compute/lmbench.py b/yardstick/benchmark/scenarios/compute/lmbench.py
index 6a17ae8a1..c99fc988d 100644
--- a/yardstick/benchmark/scenarios/compute/lmbench.py
+++ b/yardstick/benchmark/scenarios/compute/lmbench.py
@@ -80,14 +80,8 @@ class Lmbench(base.Scenario):
"yardstick.benchmark.scenarios.compute",
Lmbench.LATENCY_CACHE_SCRIPT)
host = self.context_cfg["host"]
- user = host.get("user", "ubuntu")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get("ip", None)
- key_filename = host.get('key_filename', "~/.ssh/id_rsa")
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/memload.py b/yardstick/benchmark/scenarios/compute/memload.py
index 2ef5a6302..93d10c0b5 100644
--- a/yardstick/benchmark/scenarios/compute/memload.py
+++ b/yardstick/benchmark/scenarios/compute/memload.py
@@ -49,14 +49,8 @@ class MEMLoad(base.Scenario):
def setup(self):
"""Scenario setup."""
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get('ip', None)
- key_filename = host.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/compute/perf.py b/yardstick/benchmark/scenarios/compute/perf.py
index ae4990688..0b8ed9b28 100644
--- a/yardstick/benchmark/scenarios/compute/perf.py
+++ b/yardstick/benchmark/scenarios/compute/perf.py
@@ -50,14 +50,8 @@ class Perf(base.Scenario):
self.target_script = pkg_resources.resource_filename(
'yardstick.benchmark.scenarios.compute', Perf.TARGET_SCRIPT)
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get('ip', None)
- key_filename = host.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/compute/plugintest.py b/yardstick/benchmark/scenarios/compute/plugintest.py
index c9d025964..0ddf6b4a2 100644
--- a/yardstick/benchmark/scenarios/compute/plugintest.py
+++ b/yardstick/benchmark/scenarios/compute/plugintest.py
@@ -32,13 +32,10 @@ class PluginTest(base.Scenario):
nodes = self.context_cfg['nodes']
node = nodes.get('host1', None)
- host_user = node.get('user', 'ubuntu')
- host_ssh_port = node.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = node.get('ip', None)
- host_pwd = node.get('password', 'root')
- LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
- port=host_ssh_port)
+
+ self.client = ssh.SSH.from_node(node, defaults={
+ "user": "ubuntu", "password": "root"
+ })
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/compute/ramspeed.py b/yardstick/benchmark/scenarios/compute/ramspeed.py
index 4330202de..850ee5934 100644
--- a/yardstick/benchmark/scenarios/compute/ramspeed.py
+++ b/yardstick/benchmark/scenarios/compute/ramspeed.py
@@ -89,14 +89,8 @@ class Ramspeed(base.Scenario):
Ramspeed.RAMSPEED_MEM_SCRIPT)
host = self.context_cfg["host"]
- user = host.get("user", "ubuntu")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get("ip", None)
- key_filename = host.get('key_filename', "~/.ssh/id_rsa")
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/compute/unixbench.py b/yardstick/benchmark/scenarios/compute/unixbench.py
index 4a2eb9766..cdb345717 100644
--- a/yardstick/benchmark/scenarios/compute/unixbench.py
+++ b/yardstick/benchmark/scenarios/compute/unixbench.py
@@ -70,14 +70,8 @@ class Unixbench(base.Scenario):
Unixbench.TARGET_SCRIPT)
host = self.context_cfg["host"]
- user = host.get("user", "ubuntu")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get("ip", None)
- key_filename = host.get('key_filename', "~/.ssh/id_rsa")
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy scripts to host
diff --git a/yardstick/benchmark/scenarios/networking/iperf3.py b/yardstick/benchmark/scenarios/networking/iperf3.py
index 4d4c7e7ee..334f3a920 100644
--- a/yardstick/benchmark/scenarios/networking/iperf3.py
+++ b/yardstick/benchmark/scenarios/networking/iperf3.py
@@ -59,25 +59,14 @@ For more info see http://software.es.net/iperf
def setup(self):
host = self.context_cfg['host']
- host_user = host.get('user', 'ubuntu')
- host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
- target_user = target.get('user', 'ubuntu')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_ip = target.get('ip', None)
- target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.target = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename,
- port=target_ssh_port)
+
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.target = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
self.target.wait(timeout=600)
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.host = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename, port=host_ssh_port)
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.host = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.host.wait(timeout=600)
cmd = "iperf3 -s -D"
diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py
index d0528826f..08d5dd166 100755
--- a/yardstick/benchmark/scenarios/networking/netperf.py
+++ b/yardstick/benchmark/scenarios/networking/netperf.py
@@ -65,27 +65,15 @@ class Netperf(base.Scenario):
'yardstick.benchmark.scenarios.networking',
Netperf.TARGET_SCRIPT)
host = self.context_cfg['host']
- host_user = host.get('user', 'ubuntu')
- host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
- target_user = target.get('user', 'ubuntu')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_ip = target.get('ip', None)
- target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
# netserver start automatically during the vm boot
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename,
- port=target_ssh_port)
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
self.server.wait(timeout=600)
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename,
- port=host_ssh_port)
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/netperf_node.py b/yardstick/benchmark/scenarios/networking/netperf_node.py
index fd9fa0a50..d52e6b9e1 100755
--- a/yardstick/benchmark/scenarios/networking/netperf_node.py
+++ b/yardstick/benchmark/scenarios/networking/netperf_node.py
@@ -66,27 +66,16 @@ class NetperfNode(base.Scenario):
'yardstick.benchmark.scenarios.networking',
NetperfNode.TARGET_SCRIPT)
host = self.context_cfg['host']
- host_user = host.get('user', 'ubuntu')
- host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
target = self.context_cfg['target']
- target_user = target.get('user', 'ubuntu')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_ip = target.get('ip', None)
- self.target_ip = target.get('ip', None)
- host_password = host.get('password', None)
- target_password = target.get('password', None)
-
- LOG.info("host_pw:%s, target_pw:%s", host_password, target_password)
+ self.target_ip = target['ip']
+
# netserver start automatically during the vm boot
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip,
- password=target_password, port=target_ssh_port)
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
self.server.wait(timeout=600)
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip,
- password=host_password, port=host_ssh_port)
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/netutilization.py b/yardstick/benchmark/scenarios/networking/netutilization.py
index 37da7f895..cecb64fa0 100644
--- a/yardstick/benchmark/scenarios/networking/netutilization.py
+++ b/yardstick/benchmark/scenarios/networking/netutilization.py
@@ -71,14 +71,8 @@ class NetUtilization(base.Scenario):
def setup(self):
"""Scenario setup."""
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get('ip', None)
- key_filename = host.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.py b/yardstick/benchmark/scenarios/networking/networkcapacity.py
index e7ce83570..63634061c 100644
--- a/yardstick/benchmark/scenarios/networking/networkcapacity.py
+++ b/yardstick/benchmark/scenarios/networking/networkcapacity.py
@@ -42,14 +42,8 @@ class NetworkCapacity(base.Scenario):
host = self.context_cfg['host']
if host is None:
raise RuntimeError('No right node.please check the configuration')
- host_user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_pwd = host.get('password', None)
-
- LOG.debug("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/nstat.py b/yardstick/benchmark/scenarios/networking/nstat.py
index df96dbda7..10c560769 100644
--- a/yardstick/benchmark/scenarios/networking/nstat.py
+++ b/yardstick/benchmark/scenarios/networking/nstat.py
@@ -36,14 +36,8 @@ class Nstat(base.Scenario):
def setup(self):
"""scenario setup"""
host = self.context_cfg["host"]
- user = host.get("user", "ubuntu")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get("ip", None)
- key_filename = host.get('key_filename', "~/.ssh/id_rsa")
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index d20814697..95367b3bb 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -40,22 +40,8 @@ class Ping(base.Scenario):
self.target_script = pkg_resources.resource_filename(
'yardstick.benchmark.scenarios.networking', Ping.TARGET_SCRIPT)
host = self.context_cfg['host']
- user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get('ip', None)
- key_filename = host.get('key_filename', '/root/.ssh/id_rsa')
- password = host.get('password', None)
-
- if password is not None:
- LOG.info("Log in via pw, user:%s, host:%s, pw:%s",
- user, ip, password)
- self.connection = ssh.SSH(user, ip, password=password,
- port=ssh_port)
- else:
- LOG.info("Log in via key, user:%s, host:%s, key_filename:%s",
- user, ip, key_filename)
- self.connection = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.connection = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.connection.wait(timeout=600)
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
index 142a35664..74855a10f 100644
--- a/yardstick/benchmark/scenarios/networking/ping6.py
+++ b/yardstick/benchmark/scenarios/networking/ping6.py
@@ -51,20 +51,7 @@ class Ping6(base.Scenario): # pragma: no cover
def _ssh_host(self, node_name):
# ssh host
node = self.nodes.get(node_name, None)
- user = node.get('user', 'ubuntu')
- ssh_port = node.get("ssh_port", ssh.DEFAULT_PORT)
- ip = node.get('ip', None)
- pwd = node.get('password', None)
- key_fname = node.get('key_filename', '/root/.ssh/id_rsa')
- if pwd is not None:
- LOG.debug("Log in via pw, user:%s, host:%s, password:%s",
- user, ip, pwd)
- self.client = ssh.SSH(user, ip, password=pwd, port=ssh_port)
- else:
- LOG.debug("Log in via key, user:%s, host:%s, key_filename:%s",
- user, ip, key_fname)
- self.client = ssh.SSH(user, ip, key_filename=key_fname,
- port=ssh_port)
+ self.client = ssh.SSH.from_node(node, defaults={"user": "ubuntu"})
self.client.wait(timeout=60)
def _pre_setup(self):
diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py
index 9a8725cfd..e6aa7e5fb 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen.py
@@ -52,26 +52,14 @@ class Pktgen(base.Scenario):
'yardstick.benchmark.scenarios.networking',
Pktgen.TARGET_SCRIPT)
host = self.context_cfg['host']
- host_user = host.get('user', 'ubuntu')
- host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
- target_user = target.get('user', 'ubuntu')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_ip = target.get('ip', None)
- target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
-
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename,
- port=target_ssh_port)
+
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
self.server.wait(timeout=600)
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename,
- port=host_ssh_port)
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
index 7e3044dbb..f57ca843a 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
@@ -45,28 +45,16 @@ class PktgenDPDKLatency(base.Scenario):
'yardstick.benchmark.scenarios.networking',
PktgenDPDKLatency.TESTPMD_SCRIPT)
host = self.context_cfg['host']
- host_user = host.get('user', 'ubuntu')
- host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
target = self.context_cfg['target']
- target_user = target.get('user', 'ubuntu')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_ip = target.get('ip', None)
- target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip,
- key_filename=target_key_filename,
- port=target_ssh_port)
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
self.server.wait(timeout=600)
# copy script to host
self.server._put_file_shell(self.testpmd_script, '~/testpmd_fwd.sh')
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip,
- key_filename=host_key_filename,
- port=host_ssh_port)
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py
index bf4ed5f7c..c682082d9 100644
--- a/yardstick/benchmark/scenarios/networking/sfc.py
+++ b/yardstick/benchmark/scenarios/networking/sfc.py
@@ -53,15 +53,12 @@ class Sfc(base.Scenario): # pragma: no cover
subprocess.call(cmd_tacker, shell=True)
target = self.context_cfg['target']
- target_user = target.get('user', 'root')
- target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- target_pwd = target.get('password', 'opnfv')
- target_ip = target.get('ip', None)
""" webserver start automatically during the vm boot """
- LOG.info("user:%s, target:%s", target_user, target_ip)
- self.server = ssh.SSH(target_user, target_ip, password=target_pwd,
- port=target_ssh_port)
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(target, defaults={
+ "user": "root", "password": "opnfv"
+ })
self.server.wait(timeout=600)
self.server._put_file_shell(self.server_script, '~/server.sh')
cmd_server = "sudo bash server.sh"
@@ -72,36 +69,35 @@ class Sfc(base.Scenario): # pragma: no cover
ips = sfc_openstack.get_an_IP()
target = self.context_cfg['target']
- SF1_user = target.get('user', 'root')
- SF1_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- SF1_pwd = target.get('password', 'opnfv')
- SF1_ip = ips[0]
-
- LOG.info("user:%s, host:%s", SF1_user, SF1_ip)
- self.server = ssh.SSH(SF1_user, SF1_ip, password=SF1_pwd,
- port=SF1_ssh_port)
+
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(
+ target,
+ defaults={"user": "root", "password": "opnfv"},
+ # we must override ip
+ overrides={"ip": ips[0]}
+ )
self.server.wait(timeout=600)
cmd_SF1 = ("nohup python vxlan_tool.py -i eth0 "
"-d forward -v off -b 80 &")
LOG.debug("Starting HTTP firewall in SF1")
- status, stdout, stderr = self.server.execute(cmd_SF1)
+ self.server.execute(cmd_SF1)
result = self.server.execute("ps lax | grep python")
if "vxlan_tool.py" in result[1]: # pragma: no cover
LOG.debug("HTTP firewall started")
- SF2_user = target.get('user', 'root')
- SF2_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
- SF2_pwd = target.get('password', 'opnfv')
- SF2_ip = ips[1]
-
- LOG.info("user:%s, host:%s", SF2_user, SF2_ip)
- self.server = ssh.SSH(SF2_user, SF2_ip, password=SF2_pwd,
- port=SF2_ssh_port)
+ LOG.info("user:%s, target:%s", target['user'], target['ip'])
+ self.server = ssh.SSH.from_node(
+ target,
+ defaults={"user": "root", "password": "opnfv"},
+ # we must override ip
+ overrides={"ip": ips[1]}
+ )
self.server.wait(timeout=600)
cmd_SF2 = ("nohup python vxlan_tool.py -i eth0 "
"-d forward -v off -b 22 &")
LOG.debug("Starting SSH firewall in SF2")
- status, stdout, stderr = self.server.execute(cmd_SF2)
+ self.server.execute(cmd_SF2)
result = self.server.execute("ps lax | grep python")
if "vxlan_tool.py" in result[1]: # pragma: no cover
@@ -112,14 +108,11 @@ class Sfc(base.Scenario): # pragma: no cover
def run(self, result):
""" Creating client and server VMs to perform the test"""
host = self.context_cfg['host']
- host_user = host.get('user', 'root')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- host_pwd = host.get('password', 'opnfv')
- host_ip = host.get('ip', None)
-
- LOG.info("user:%s, host:%s", host_user, host_ip)
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
- port=ssh_port)
+
+ LOG.info("user:%s, host:%s", host['user'], host['ip'])
+ self.client = ssh.SSH.from_node(host, defaults={
+ "user": "root", "password": "opnfv"
+ })
self.client.wait(timeout=600)
if not self.setup_done: # pragma: no cover
diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py
index 447c550ed..be179631e 100644
--- a/yardstick/benchmark/scenarios/networking/vnf_generic.py
+++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py
@@ -60,13 +60,9 @@ class SshManager(object):
returns -> ssh connection ready to be used
"""
try:
- ssh_port = self.node.get("ssh_port", ssh.DEFAULT_PORT)
- self.conn = ssh.SSH(user=self.node["user"],
- host=self.node["ip"],
- password=self.node["password"],
- port=ssh_port)
+ self.conn = ssh.SSH.from_node(self.node)
self.conn.wait()
- except (SSHError) as error:
+ except SSHError as error:
LOG.info("connect failed to %s, due to %s", self.node["ip"], error)
# self.conn defaults to None
return self.conn
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py
index f2c2ea9b8..705544c41 100644
--- a/yardstick/benchmark/scenarios/networking/vsperf.py
+++ b/yardstick/benchmark/scenarios/networking/vsperf.py
@@ -114,10 +114,6 @@ class Vsperf(base.Scenario):
def setup(self):
"""scenario setup"""
vsperf = self.context_cfg['host']
- vsperf_user = vsperf.get('user', 'ubuntu')
- vsperf_ssh_port = vsperf.get('ssh_port', ssh.DEFAULT_PORT)
- vsperf_password = vsperf.get('password', 'ubuntu')
- vsperf_ip = vsperf.get('ip', None)
# add trafficgen interfaces to the external bridge
if self.tg_port1:
@@ -128,9 +124,9 @@ class Vsperf(base.Scenario):
(self.br_ex, self.tg_port2), shell=True)
# copy vsperf conf to VM
- LOG.info("user:%s, host:%s", vsperf_user, vsperf_ip)
- self.client = ssh.SSH(vsperf_user, vsperf_ip,
- password=vsperf_password, port=vsperf_ssh_port)
+ self.client = ssh.SSH.from_node(vsperf, defaults={
+ "user": "ubuntu", "password": "ubuntu"
+ })
# traffic generation could last long
self.client.wait(timeout=1800)
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py
index e28bd7bcc..ad34817a7 100644
--- a/yardstick/benchmark/scenarios/storage/fio.py
+++ b/yardstick/benchmark/scenarios/storage/fio.py
@@ -63,14 +63,8 @@ class Fio(base.Scenario):
"yardstick.benchmark.scenarios.storage",
Fio.TARGET_SCRIPT)
host = self.context_cfg["host"]
- user = host.get("user", "root")
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- ip = host.get("ip", None)
- key_filename = host.get("key_filename", "~/.ssh/id_rsa")
-
- LOG.info("user:%s, host:%s", user, ip)
- self.client = ssh.SSH(user, ip, key_filename=key_filename,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={"user": "root"})
self.client.wait(timeout=600)
# copy script to host
diff --git a/yardstick/benchmark/scenarios/storage/storagecapacity.py b/yardstick/benchmark/scenarios/storage/storagecapacity.py
index c437f22c0..b6c403f47 100644
--- a/yardstick/benchmark/scenarios/storage/storagecapacity.py
+++ b/yardstick/benchmark/scenarios/storage/storagecapacity.py
@@ -57,14 +57,10 @@ class StorageCapacity(base.Scenario):
host = self.context_cfg['host']
if host is None:
raise RuntimeError('No right node.Please check the configuration')
- host_user = host.get('user', 'ubuntu')
- ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT)
- host_ip = host.get('ip', None)
- host_pwd = host.get('password', 'root')
- LOG.debug("user:%s, host:%s", host_user, host_ip)
-
- self.client = ssh.SSH(host_user, host_ip, password=host_pwd,
- port=ssh_port)
+
+ self.client = ssh.SSH.from_node(host, defaults={
+ "user": "ubuntu", "password": "root"
+ })
self.client.wait(timeout=600)
# copy script to host