summaryrefslogtreecommitdiffstats
path: root/yardstick
diff options
context:
space:
mode:
authorJingLu5 <lvjing5@huawei.com>2016-07-22 08:36:37 +0800
committerJingLu5 <lvjing5@huawei.com>2016-07-26 09:17:15 +0800
commit96e996ff5a8e214b5e8ef46fe06d3595a6ac4b1a (patch)
tree052209a8535b96991b84f421321f2ee43f63571b /yardstick
parentebb9bc33134a90ea707f163950487056dc64e729 (diff)
Modify ping scenario output format
Change-Id: I38455fd42afaa965612edfaa46e385c7934ff7e7 Signed-off-by: JingLu5 <lvjing5@huawei.com>
Diffstat (limited to 'yardstick')
-rw-r--r--yardstick/benchmark/scenarios/networking/ping.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py
index 08755a08b..54c192294 100644
--- a/yardstick/benchmark/scenarios/networking/ping.py
+++ b/yardstick/benchmark/scenarios/networking/ping.py
@@ -69,7 +69,12 @@ class Ping(base.Scenario):
result["rtt"] = {}
rtt_result = result["rtt"]
- for dest in dest_list:
+ for pos, dest in enumerate(dest_list):
+ if 'targets' in self.scenario_cfg:
+ target_vm = self.scenario_cfg['targets'][pos]
+ else:
+ 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),
@@ -79,13 +84,15 @@ class Ping(base.Scenario):
raise RuntimeError(stderr)
if stdout:
- rtt_result[dest] = float(stdout)
+ target_vm_name = target_vm.split('.')[0]
+ rtt_result[target_vm_name] = 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)
+ assert rtt_result[target_vm_name] <= sla_max_rtt,\
+ "rtt %f > sla: max_rtt(%f); " % \
+ (rtt_result[target_vm_name], sla_max_rtt)
else:
- LOG.error("ping '%s' '%s' timeout", options, dest)
+ LOG.error("ping '%s' '%s' timeout", options, target_vm)
def _test(): # pragma: no cover