Merge changes from topics 'YARDSTICK-1250', 'YARDSTICK-1249'
[yardstick.git] / yardstick / benchmark / scenarios / networking / vsperf.py
index 9d6db7c..2b34740 100644 (file)
@@ -112,12 +112,8 @@ class Vsperf(base.Scenario):
                                                             None)
 
     def setup(self):
-        '''scenario setup'''
+        """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)
 
@@ -219,15 +215,15 @@ class Vsperf(base.Scenario):
         if 'sla' in self.scenario_cfg and \
            'metrics' in self.scenario_cfg['sla']:
             for metric in self.scenario_cfg['sla']['metrics'].split(','):
-                assert metric in result, \
-                    '%s is not collected by VSPERF' % (metric)
-                assert metric in self.scenario_cfg['sla'], \
-                    '%s is not defined in SLA' % (metric)
+                self.verify_SLA(metric in result,
+                                '%s was not collected by VSPERF' % metric)
+                self.verify_SLA(metric in self.scenario_cfg['sla'],
+                                '%s is not defined in SLA' % metric)
                 vs_res = float(result[metric])
                 sla_res = float(self.scenario_cfg['sla'][metric])
-                assert vs_res >= sla_res, \
-                    'VSPERF_%s(%f) < SLA_%s(%f)' % \
-                    (metric, vs_res, metric, sla_res)
+                self.verify_SLA(vs_res >= sla_res,
+                                'VSPERF_%s(%f) < SLA_%s(%f)'
+                                % (metric, vs_res, metric, sla_res))
 
     def teardown(self):
         """cleanup after the test execution"""