# limitations under the License.
""" Vsperf specific scenario definition """
+from __future__ import absolute_import
import logging
import os
import subprocess
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:
(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)
- # copy script to host if needed
- if self.vsperf_conf:
- self.client.run("cat > ~/vsperf.conf",
- stdin=open(self.vsperf_conf, "rb"))
+ # copy script to host
+ self.client._put_file_shell(self.vsperf_conf, '~/vsperf.conf')
# execute external setup script
if self.setup_script:
# convert result.csv to JSON format
reader = csv.DictReader(stdout.split('\r\n'))
- result.update(reader.next())
+ result.update(next(reader))
# sla check; go through all defined SLAs and check if values measured
# by VSPERF are higher then those defined by SLAs