Merge "Make security group configurable - dovetail"
[yardstick.git] / yardstick / benchmark / scenarios / networking / netperf_node.py
index fd9fa0a..0ad2ecf 100755 (executable)
@@ -66,27 +66,16 @@ class NetperfNode(base.Scenario):
             'yardstick.benchmark.scenarios.networking',
             NetperfNode.TARGET_SCRIPT)
         host = self.context_cfg['host']
-        host_user = host.get('user', 'ubuntu')
-        host_ssh_port = host.get('ssh_port', ssh.DEFAULT_PORT)
-        host_ip = host.get('ip', None)
         target = self.context_cfg['target']
-        target_user = target.get('user', 'ubuntu')
-        target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT)
-        target_ip = target.get('ip', None)
-        self.target_ip = target.get('ip', None)
-        host_password = host.get('password', None)
-        target_password = target.get('password', None)
-
-        LOG.info("host_pw:%s, target_pw:%s", host_password, target_password)
+        self.target_ip = target['ip']
+
         # netserver start automatically during the vm boot
-        LOG.info("user:%s, target:%s", target_user, target_ip)
-        self.server = ssh.SSH(target_user, target_ip,
-                              password=target_password, port=target_ssh_port)
+        LOG.info("user:%s, target:%s", target['user'], target['ip'])
+        self.server = ssh.SSH.from_node(target, defaults={"user": "ubuntu"})
         self.server.wait(timeout=600)
 
-        LOG.info("user:%s, host:%s", host_user, host_ip)
-        self.client = ssh.SSH(host_user, host_ip,
-                              password=host_password, port=host_ssh_port)
+        LOG.info("user:%s, host:%s", host['user'], host['ip'])
+        self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"})
         self.client.wait(timeout=600)
 
         # copy script to host
@@ -167,9 +156,10 @@ class NetperfNode(base.Scenario):
             sla_max_mean_latency = int(
                 self.scenario_cfg["sla"]["mean_latency"])
 
-            assert mean_latency <= sla_max_mean_latency, \
-                "mean_latency %f > sla_max_mean_latency(%f); " % \
-                (mean_latency, sla_max_mean_latency)
+            self.verify_SLA(
+                mean_latency <= sla_max_mean_latency,
+                "mean_latency %f > sla_max_mean_latency(%f); "
+                % (mean_latency, sla_max_mean_latency))
 
     def teardown(self):
         """remove netperf from nodes after test"""