Merge "Move "read_yaml_file" to common.yaml_loader"
[yardstick.git] / yardstick / benchmark / scenarios / compute / ramspeed.py
index 850ee59..4daf776 100644 (file)
@@ -14,6 +14,7 @@ import pkg_resources
 from oslo_serialization import jsonutils
 
 import yardstick.ssh as ssh
+from yardstick.common import utils
 from yardstick.benchmark.scenarios import base
 
 LOG = logging.getLogger(__name__)
@@ -120,22 +121,23 @@ class Ramspeed(base.Scenario):
                   (test_id, load, block_size)
         # only the test_id 1-6 will be used in this scenario
         else:
-            raise RuntimeError("No such type_id: %s for Ramspeed scenario",
-                               test_id)
+            raise RuntimeError("No such type_id: %s for Ramspeed scenario"
+                               test_id)
 
         LOG.debug("Executing command: %s", cmd)
         status, stdout, stderr = self.client.execute(cmd)
         if status:
             raise RuntimeError(stderr)
 
-        result.update(jsonutils.loads(stdout))
+        ramspeed_result = jsonutils.loads(stdout)
+        result.update(utils.flatten_dict_key(ramspeed_result))
 
         if "sla" in self.scenario_cfg:
             sla_error = ""
             sla_min_bw = int(self.scenario_cfg['sla']['min_bandwidth'])
-            for i in result["Result"]:
+            for i in ramspeed_result["Result"]:
                 bw = i["Bandwidth(MBps)"]
                 if bw < sla_min_bw:
                     sla_error += "Bandwidth %f < " \
                         "sla:min_bandwidth(%f)" % (bw, sla_min_bw)
-            assert sla_error == "", sla_error
+            self.verify_SLA(sla_error == "", sla_error)