aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/networking
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/scenarios/networking')
-rwxr-xr-xyardstick/benchmark/scenarios/networking/netperf.py3
-rw-r--r--yardstick/benchmark/scenarios/networking/networkcapacity.py3
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py7
-rw-r--r--yardstick/benchmark/scenarios/networking/ping6.py33
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen.py3
-rw-r--r--yardstick/benchmark/scenarios/networking/pktgen_dpdk.py9
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc.py3
-rw-r--r--yardstick/benchmark/scenarios/networking/vsperf.py6
8 files changed, 29 insertions, 38 deletions
diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py
index 08901e12b..28f5bea56 100755
--- a/yardstick/benchmark/scenarios/networking/netperf.py
+++ b/yardstick/benchmark/scenarios/networking/netperf.py
@@ -85,8 +85,7 @@ class Netperf(base.Scenario):
self.client.wait(timeout=600)
# copy script to host
- self.client.run("cat > ~/netperf.sh",
- stdin=open(self.target_script, "rb"))
+ self.client._put_file_shell(self.target_script, '~/netperf.sh')
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.py b/yardstick/benchmark/scenarios/networking/networkcapacity.py
index 438452e40..250f7eaf0 100644
--- a/yardstick/benchmark/scenarios/networking/networkcapacity.py
+++ b/yardstick/benchmark/scenarios/networking/networkcapacity.py
@@ -50,8 +50,7 @@ class NetworkCapacity(base.Scenario):
self.client.wait(timeout=600)
# copy script to host
- self.client.run("cat > ~/networkcapacity.sh",
- stdin=open(self.target_script, 'rb'))
+ self.client._put_file_shell(self.target_script, '~/networkcapacity.sh')
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 2becdaf36..b41aa0d94 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -79,9 +79,10 @@ class Ping(base.Scenario):
target_vm = self.scenario_cfg['target']
LOG.debug("ping '%s' '%s'", options, dest)
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0} {1}".format(dest, options),
- stdin=open(self.target_script, "r"))
+ with open(self.target_script, "r") as stdin_file:
+ exit_status, stdout, stderr = self.connection.execute(
+ "/bin/sh -s {0} {1}".format(dest, options),
+ stdin=stdin_file)
if exit_status != 0:
raise RuntimeError(stderr)
diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py
index 9aa94c40c..f4d23ce7b 100644
--- a/yardstick/benchmark/scenarios/networking/ping6.py
+++ b/yardstick/benchmark/scenarios/networking/ping6.py
@@ -69,8 +69,8 @@ class Ping6(base.Scenario): # pragma: no cover
def _pre_setup(self):
for node_name in self.host_list:
self._ssh_host(node_name)
- self.client.run("cat > ~/pre_setup.sh",
- stdin=open(self.pre_setup_script, "rb"))
+ self.client._put_file_shell(
+ self.pre_setup_script, '~/pre_setup.sh')
status, stdout, stderr = self.client.execute(
"sudo bash pre_setup.sh")
@@ -117,20 +117,19 @@ class Ping6(base.Scenario): # pragma: no cover
if controller_node_name is None:
LOG.exception("Can't find controller node in the context!!!")
self._ssh_host(controller_node_name)
- self.client.run("cat > ~/metadata.txt",
- stdin=open(self.ping6_metadata_script, "rb"))
+ self.client._put_file_shell(
+ self.ping6_metadata_script, '~/metadata.txt')
# run script to setup ipv6 with nosdn or odl
sdn = self.options.get("sdn", 'nosdn')
if 'odl' in sdn:
- self.client.run("cat > ~/br-ex.radvd.conf",
- stdin=open(self.ping6_radvd_script, "rb"))
- self.client.run("cat > ~/setup_odl.sh",
- stdin=open(self.setup_odl_script, "rb"))
+ self.client._put_file_shell(
+ self.ping6_radvd_script, '~/br-ex.radvd.conf')
+ self.client._put_file_shell(
+ self.setup_odl_script, '~/setup_odl.sh')
setup_bash_file = "setup_odl.sh"
else:
- self.client.run("cat > ~/setup.sh",
- stdin=open(self.setup_script, "rb"))
+ self.client._put_file_shell(self.setup_script, '~/setup.sh')
setup_bash_file = "setup.sh"
cmd = "sudo bash %s %s %s" % \
(setup_bash_file, self.openrc, self.external_network)
@@ -156,8 +155,8 @@ class Ping6(base.Scenario): # pragma: no cover
self._ssh_host(self.host_list[0])
# find ipv4-int-network1 to ssh VM
- self.client.run("cat > ~/find_host.sh",
- stdin=open(self.ping6_find_host_script, "rb"))
+ self.client._put_file_shell(
+ self.ping6_find_host_script, '~/find_host.sh')
cmd = "sudo bash find_host.sh %s" % self.openrc
LOG.debug("Executing find_host command: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
@@ -171,8 +170,7 @@ class Ping6(base.Scenario): # pragma: no cover
stdin=open("/tmp/vRouterKey", "rb"))
# run ping6 benchmark
- self.client.run("cat > ~/ping6.sh",
- stdin=open(self.ping6_script, "rb"))
+ self.client._put_file_shell(self.ping6_script, '~/ping6.sh')
cmd = "sudo bash ping6.sh %s %s" % (self.openrc, self.ping_options)
LOG.debug("Executing ping6 command: %s", cmd)
status, stdout, stderr = self.client.execute(cmd)
@@ -208,8 +206,7 @@ class Ping6(base.Scenario): # pragma: no cover
self.teardown_script = pkg_resources.resource_filename(
'yardstick.benchmark.scenarios.networking',
Ping6.TEARDOWN_SCRIPT)
- self.client.run("cat > ~/teardown.sh",
- stdin=open(self.teardown_script, "rb"))
+ self.client._put_file_shell(self.teardown_script, '~/teardown.sh')
cmd = "sudo bash teardown.sh %s %s" % \
(self.openrc, self.external_network)
status, stdout, stderr = self.client.execute(cmd)
@@ -229,7 +226,7 @@ class Ping6(base.Scenario): # pragma: no cover
def _post_teardown(self):
for node_name in self.host_list:
self._ssh_host(node_name)
- self.client.run("cat > ~/post_teardown.sh",
- stdin=open(self.post_teardown_script, "rb"))
+ self.client._put_file_shell(
+ self.post_teardown_script, '~/post_teardown.sh')
status, stdout, stderr = self.client.execute(
"sudo bash post_teardown.sh")
diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py
index 3e105767a..e2df706a2 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen.py
@@ -71,8 +71,7 @@ class Pktgen(base.Scenario):
self.client.wait(timeout=600)
# copy script to host
- self.client.run("cat > ~/pktgen.sh",
- stdin=open(self.target_script, "rb"))
+ self.client._put_file_shell(self.target_script, '~/pktgen.sh')
self.setup_done = True
diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
index 189cc7895..503ea97e1 100644
--- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
+++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py
@@ -60,8 +60,7 @@ class PktgenDPDKLatency(base.Scenario):
self.server.wait(timeout=600)
# copy script to host
- self.server.run("cat > ~/testpmd_fwd.sh",
- stdin=open(self.testpmd_script, "rb"))
+ 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,
@@ -70,8 +69,8 @@ class PktgenDPDKLatency(base.Scenario):
self.client.wait(timeout=600)
# copy script to host
- self.client.run("cat > ~/pktgen_dpdk.sh",
- stdin=open(self.pktgen_dpdk_script, "rb"))
+ self.client._put_file_shell(
+ self.pktgen_dpdk_script, '~/pktgen_dpdk.sh')
self.setup_done = True
self.testpmd_args = ''
@@ -153,7 +152,7 @@ class PktgenDPDKLatency(base.Scenario):
latency_sum = 0
for i in latency_list:
latency_sum += int(i)
- avg_latency = latency_sum/len(latency_list)
+ avg_latency = latency_sum / len(latency_list)
result.update({"avg_latency": avg_latency})
diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py
index 9494e70d2..1bd99b957 100644
--- a/yardstick/benchmark/scenarios/networking/sfc.py
+++ b/yardstick/benchmark/scenarios/networking/sfc.py
@@ -50,8 +50,7 @@ class Sfc(base.Scenario): # pragma: no cover
self.server = ssh.SSH(target_user, target_ip, password=target_pwd,
port=target_ssh_port)
self.server.wait(timeout=600)
- self.server.run("cat > ~/server.sh",
- stdin=open(self.server_script, "rb"))
+ self.server._put_file_shell(self.server_script, '~/server.sh')
cmd_server = "sudo bash server.sh"
LOG.debug("Executing command: %s", cmd_server)
status, stdout, stderr = self.server.execute(cmd_server)
diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py
index 39912a95a..4f4ef21eb 100644
--- a/yardstick/benchmark/scenarios/networking/vsperf.py
+++ b/yardstick/benchmark/scenarios/networking/vsperf.py
@@ -133,10 +133,8 @@ class Vsperf(base.Scenario):
# traffic generation could last long
self.client.wait(timeout=1800)
- # copy script to host if needed
- if self.vsperf_conf:
- self.client.run("cat > ~/vsperf.conf",
- stdin=open(self.vsperf_conf, "rb"))
+ # copy script to host
+ self.client._put_file_shell(self.vsperf_conf, '~/vsperf.conf')
# execute external setup script
if self.setup_script: