diff options
Diffstat (limited to 'yardstick/benchmark/scenarios/networking')
13 files changed, 64 insertions, 182 deletions
diff --git a/yardstick/benchmark/scenarios/networking/iperf3.py b/yardstick/benchmark/scenarios/networking/iperf3.py index 4d4c7e7ee..334f3a920 100644 --- a/yardstick/benchmark/scenarios/networking/iperf3.py +++ b/yardstick/benchmark/scenarios/networking/iperf3.py @@ -59,25 +59,14 @@ For more info see http://software.es.net/iperf def setup(self): 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') - - LOG.info("user:%s, target:%s", target_user, target_ip) - self.target = 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.target = ssh.SSH.from_node(target, defaults={"user": "ubuntu"}) self.target.wait(timeout=600) - LOG.info("user:%s, host:%s", host_user, host_ip) - self.host = 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.host = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.host.wait(timeout=600) cmd = "iperf3 -s -D" diff --git a/yardstick/benchmark/scenarios/networking/netperf.py b/yardstick/benchmark/scenarios/networking/netperf.py index d0528826f..08d5dd166 100755 --- a/yardstick/benchmark/scenarios/networking/netperf.py +++ b/yardstick/benchmark/scenarios/networking/netperf.py @@ -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 diff --git a/yardstick/benchmark/scenarios/networking/netperf_node.py b/yardstick/benchmark/scenarios/networking/netperf_node.py index fd9fa0a50..d52e6b9e1 100755 --- a/yardstick/benchmark/scenarios/networking/netperf_node.py +++ b/yardstick/benchmark/scenarios/networking/netperf_node.py @@ -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 diff --git a/yardstick/benchmark/scenarios/networking/netutilization.py b/yardstick/benchmark/scenarios/networking/netutilization.py index 37da7f895..cecb64fa0 100644 --- a/yardstick/benchmark/scenarios/networking/netutilization.py +++ b/yardstick/benchmark/scenarios/networking/netutilization.py @@ -71,14 +71,8 @@ class NetUtilization(base.Scenario): def setup(self): """Scenario setup.""" host = self.context_cfg['host'] - user = host.get('user', 'ubuntu') - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - ip = host.get('ip', None) - key_filename = host.get('key_filename', '~/.ssh/id_rsa') - - LOG.info("user:%s, host:%s", user, ip) - self.client = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + + self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.client.wait(timeout=600) self.setup_done = True diff --git a/yardstick/benchmark/scenarios/networking/networkcapacity.py b/yardstick/benchmark/scenarios/networking/networkcapacity.py index e7ce83570..63634061c 100644 --- a/yardstick/benchmark/scenarios/networking/networkcapacity.py +++ b/yardstick/benchmark/scenarios/networking/networkcapacity.py @@ -42,14 +42,8 @@ class NetworkCapacity(base.Scenario): host = self.context_cfg['host'] if host is None: raise RuntimeError('No right node.please check the configuration') - host_user = host.get('user', 'ubuntu') - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - host_ip = host.get('ip', None) - host_pwd = host.get('password', None) - - LOG.debug("user:%s, host:%s", host_user, host_ip) - self.client = ssh.SSH(host_user, host_ip, password=host_pwd, - port=ssh_port) + + self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.client.wait(timeout=600) # copy script to host diff --git a/yardstick/benchmark/scenarios/networking/nstat.py b/yardstick/benchmark/scenarios/networking/nstat.py index df96dbda7..10c560769 100644 --- a/yardstick/benchmark/scenarios/networking/nstat.py +++ b/yardstick/benchmark/scenarios/networking/nstat.py @@ -36,14 +36,8 @@ class Nstat(base.Scenario): def setup(self): """scenario setup""" host = self.context_cfg["host"] - user = host.get("user", "ubuntu") - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - ip = host.get("ip", None) - key_filename = host.get('key_filename', "~/.ssh/id_rsa") - - LOG.info("user:%s, host:%s", user, ip) - self.client = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + + self.client = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.client.wait(timeout=600) self.setup_done = True diff --git a/yardstick/benchmark/scenarios/networking/ping.py b/yardstick/benchmark/scenarios/networking/ping.py index d20814697..95367b3bb 100644 --- a/yardstick/benchmark/scenarios/networking/ping.py +++ b/yardstick/benchmark/scenarios/networking/ping.py @@ -40,22 +40,8 @@ class Ping(base.Scenario): self.target_script = pkg_resources.resource_filename( 'yardstick.benchmark.scenarios.networking', Ping.TARGET_SCRIPT) host = self.context_cfg['host'] - user = host.get('user', 'ubuntu') - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - ip = host.get('ip', None) - key_filename = host.get('key_filename', '/root/.ssh/id_rsa') - password = host.get('password', None) - - if password is not None: - LOG.info("Log in via pw, user:%s, host:%s, pw:%s", - user, ip, password) - self.connection = ssh.SSH(user, ip, password=password, - port=ssh_port) - else: - LOG.info("Log in via key, user:%s, host:%s, key_filename:%s", - user, ip, key_filename) - self.connection = ssh.SSH(user, ip, key_filename=key_filename, - port=ssh_port) + + self.connection = ssh.SSH.from_node(host, defaults={"user": "ubuntu"}) self.connection.wait(timeout=600) diff --git a/yardstick/benchmark/scenarios/networking/ping6.py b/yardstick/benchmark/scenarios/networking/ping6.py index 142a35664..74855a10f 100644 --- a/yardstick/benchmark/scenarios/networking/ping6.py +++ b/yardstick/benchmark/scenarios/networking/ping6.py @@ -51,20 +51,7 @@ class Ping6(base.Scenario): # pragma: no cover def _ssh_host(self, node_name): # ssh host node = self.nodes.get(node_name, None) - user = node.get('user', 'ubuntu') - ssh_port = node.get("ssh_port", ssh.DEFAULT_PORT) - ip = node.get('ip', None) - pwd = node.get('password', None) - key_fname = node.get('key_filename', '/root/.ssh/id_rsa') - if pwd is not None: - LOG.debug("Log in via pw, user:%s, host:%s, password:%s", - user, ip, pwd) - self.client = ssh.SSH(user, ip, password=pwd, port=ssh_port) - else: - LOG.debug("Log in via key, user:%s, host:%s, key_filename:%s", - user, ip, key_fname) - self.client = ssh.SSH(user, ip, key_filename=key_fname, - port=ssh_port) + self.client = ssh.SSH.from_node(node, defaults={"user": "ubuntu"}) self.client.wait(timeout=60) def _pre_setup(self): diff --git a/yardstick/benchmark/scenarios/networking/pktgen.py b/yardstick/benchmark/scenarios/networking/pktgen.py index 9a8725cfd..e6aa7e5fb 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen.py +++ b/yardstick/benchmark/scenarios/networking/pktgen.py @@ -52,26 +52,14 @@ class Pktgen(base.Scenario): 'yardstick.benchmark.scenarios.networking', Pktgen.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') - - 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 diff --git a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py index 7e3044dbb..f57ca843a 100644 --- a/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py +++ b/yardstick/benchmark/scenarios/networking/pktgen_dpdk.py @@ -45,28 +45,16 @@ class PktgenDPDKLatency(base.Scenario): 'yardstick.benchmark.scenarios.networking', PktgenDPDKLatency.TESTPMD_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') - 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) # copy script to host self.server._put_file_shell(self.testpmd_script, '~/testpmd_fwd.sh') - 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 diff --git a/yardstick/benchmark/scenarios/networking/sfc.py b/yardstick/benchmark/scenarios/networking/sfc.py index bf4ed5f7c..c682082d9 100644 --- a/yardstick/benchmark/scenarios/networking/sfc.py +++ b/yardstick/benchmark/scenarios/networking/sfc.py @@ -53,15 +53,12 @@ class Sfc(base.Scenario): # pragma: no cover subprocess.call(cmd_tacker, shell=True) target = self.context_cfg['target'] - target_user = target.get('user', 'root') - target_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT) - target_pwd = target.get('password', 'opnfv') - target_ip = target.get('ip', None) """ webserver 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_pwd, - port=target_ssh_port) + LOG.info("user:%s, target:%s", target['user'], target['ip']) + self.server = ssh.SSH.from_node(target, defaults={ + "user": "root", "password": "opnfv" + }) self.server.wait(timeout=600) self.server._put_file_shell(self.server_script, '~/server.sh') cmd_server = "sudo bash server.sh" @@ -72,36 +69,35 @@ class Sfc(base.Scenario): # pragma: no cover ips = sfc_openstack.get_an_IP() target = self.context_cfg['target'] - SF1_user = target.get('user', 'root') - SF1_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT) - SF1_pwd = target.get('password', 'opnfv') - SF1_ip = ips[0] - - LOG.info("user:%s, host:%s", SF1_user, SF1_ip) - self.server = ssh.SSH(SF1_user, SF1_ip, password=SF1_pwd, - port=SF1_ssh_port) + + LOG.info("user:%s, target:%s", target['user'], target['ip']) + self.server = ssh.SSH.from_node( + target, + defaults={"user": "root", "password": "opnfv"}, + # we must override ip + overrides={"ip": ips[0]} + ) self.server.wait(timeout=600) cmd_SF1 = ("nohup python vxlan_tool.py -i eth0 " "-d forward -v off -b 80 &") LOG.debug("Starting HTTP firewall in SF1") - status, stdout, stderr = self.server.execute(cmd_SF1) + self.server.execute(cmd_SF1) result = self.server.execute("ps lax | grep python") if "vxlan_tool.py" in result[1]: # pragma: no cover LOG.debug("HTTP firewall started") - SF2_user = target.get('user', 'root') - SF2_ssh_port = target.get('ssh_port', ssh.DEFAULT_PORT) - SF2_pwd = target.get('password', 'opnfv') - SF2_ip = ips[1] - - LOG.info("user:%s, host:%s", SF2_user, SF2_ip) - self.server = ssh.SSH(SF2_user, SF2_ip, password=SF2_pwd, - port=SF2_ssh_port) + LOG.info("user:%s, target:%s", target['user'], target['ip']) + self.server = ssh.SSH.from_node( + target, + defaults={"user": "root", "password": "opnfv"}, + # we must override ip + overrides={"ip": ips[1]} + ) self.server.wait(timeout=600) cmd_SF2 = ("nohup python vxlan_tool.py -i eth0 " "-d forward -v off -b 22 &") LOG.debug("Starting SSH firewall in SF2") - status, stdout, stderr = self.server.execute(cmd_SF2) + self.server.execute(cmd_SF2) result = self.server.execute("ps lax | grep python") if "vxlan_tool.py" in result[1]: # pragma: no cover @@ -112,14 +108,11 @@ class Sfc(base.Scenario): # pragma: no cover def run(self, result): """ Creating client and server VMs to perform the test""" host = self.context_cfg['host'] - host_user = host.get('user', 'root') - ssh_port = host.get("ssh_port", ssh.DEFAULT_PORT) - host_pwd = host.get('password', 'opnfv') - host_ip = host.get('ip', None) - - LOG.info("user:%s, host:%s", host_user, host_ip) - self.client = ssh.SSH(host_user, host_ip, password=host_pwd, - port=ssh_port) + + LOG.info("user:%s, host:%s", host['user'], host['ip']) + self.client = ssh.SSH.from_node(host, defaults={ + "user": "root", "password": "opnfv" + }) self.client.wait(timeout=600) if not self.setup_done: # pragma: no cover diff --git a/yardstick/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 447c550ed..be179631e 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -60,13 +60,9 @@ class SshManager(object): returns -> ssh connection ready to be used """ try: - ssh_port = self.node.get("ssh_port", ssh.DEFAULT_PORT) - self.conn = ssh.SSH(user=self.node["user"], - host=self.node["ip"], - password=self.node["password"], - port=ssh_port) + self.conn = ssh.SSH.from_node(self.node) self.conn.wait() - except (SSHError) as error: + except SSHError as error: LOG.info("connect failed to %s, due to %s", self.node["ip"], error) # self.conn defaults to None return self.conn diff --git a/yardstick/benchmark/scenarios/networking/vsperf.py b/yardstick/benchmark/scenarios/networking/vsperf.py index f2c2ea9b8..705544c41 100644 --- a/yardstick/benchmark/scenarios/networking/vsperf.py +++ b/yardstick/benchmark/scenarios/networking/vsperf.py @@ -114,10 +114,6 @@ class Vsperf(base.Scenario): def setup(self): """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) |