Merge "Check RS for virtualized OpenStack/Yardstick"
[yardstick.git] / yardstick / benchmark / scenarios / networking / netperf.py
index d052882..a8d9010 100755 (executable)
@@ -65,27 +65,15 @@ class Netperf(base.Scenario):
             'yardstick.benchmark.scenarios.networking',
             Netperf.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)
-        host_key_filename = host.get('key_filename', '~/.ssh/id_rsa')
         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)
-        target_key_filename = target.get('key_filename', '~/.ssh/id_rsa')
 
         # 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,
-                              key_filename=target_key_filename,
-                              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,
-                              key_filename=host_key_filename,
-                              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
@@ -126,6 +114,10 @@ class Netperf(base.Scenario):
                 cmd_args += " %s %s" % (option_pair[1],
                                         options[option_pair[0]])
 
+        # Enable IP routing for UDP_STREAM test
+        if testname == "UDP_STREAM":
+            cmd_args += " -R 1"
+
         cmd = "sudo bash netperf.sh %s" % (cmd_args)
         LOG.debug("Executing command: %s", cmd)
         status, stdout, stderr = self.client.execute(cmd)