aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark')
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index ae2166687..3af354850 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -57,29 +57,32 @@ class Ping(base.Scenario):
else:
options = ""
- destination = self.context_cfg['target'].get("ipaddr", '127.0.0.1')
+ destination = self.context_cfg['target'].get('ipaddr', '127.0.0.1')
+ dest_list = [s.strip() for s in destination.split(',')]
- LOG.debug("ping '%s' '%s'", options, destination)
+ result["rtt"] = {}
+ rtt_result = result["rtt"]
- exit_status, stdout, stderr = self.connection.execute(
- "/bin/sh -s {0} {1}".format(destination, options),
- stdin=open(self.target_script, "r"))
+ for dest in dest_list:
+ 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"))
- if exit_status != 0:
- raise RuntimeError(stderr)
+ if exit_status != 0:
+ raise RuntimeError(stderr)
- if stdout:
- result["rtt"] = float(stdout)
-
- if "sla" in self.scenario_cfg:
- sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
- assert result["rtt"] <= sla_max_rtt, \
- "rtt %f > sla:max_rtt(%f); " % (result["rtt"], sla_max_rtt)
- else:
- LOG.error("ping '%s' '%s' timeout", options, destination)
+ if stdout:
+ rtt_result[dest] = float(stdout)
+ if "sla" in self.scenario_cfg:
+ sla_max_rtt = int(self.scenario_cfg["sla"]["max_rtt"])
+ assert rtt_result[dest] <= sla_max_rtt, "rtt %f > sla:\
+ max_rtt(%f); " % (rtt_result[dest], sla_max_rtt)
+ else:
+ LOG.error("ping '%s' '%s' timeout", options, dest)
-def _test():
+def _test(): # pragma: no cover
'''internal test function'''
key_filename = pkg_resources.resource_filename("yardstick.resources",
"files/yardstick_key")
@@ -104,5 +107,5 @@ def _test():
p.run(result)
print result
-if __name__ == '__main__':
+if __name__ == '__main__': # pragma: no cover
_test()