dir="{0}".format(directory))
else:
tmpfile = NamedTemporaryFile(suffix=".tgz", prefix="openvpp-testing-")
dir="{0}".format(directory))
else:
tmpfile = NamedTemporaryFile(suffix=".tgz", prefix="openvpp-testing-")
- split("tar --exclude-vcs -zcf {0} .".format(file_name)),
- stdout=PIPE, stderr=PIPE)
+ split("tar --sparse --exclude-vcs "
+ "--exclude=./tmp --exclude=*.deb -zcf {0} .".
+ format(file_name)), stdout=PIPE, stderr=PIPE)
(stdout, stderr) = proc.communicate()
logger.debug(stdout)
logger.debug(stderr)
return_code = proc.wait()
(stdout, stderr) = proc.communicate()
logger.debug(stdout)
logger.debug(stderr)
return_code = proc.wait()
def extract_tarball_at_node(tarball, node):
"""Extract tarball at given node.
def extract_tarball_at_node(tarball, node):
"""Extract tarball at given node.
"""
logger.console('Extracting tarball to {0} on {1}'.format(
con.REMOTE_FW_DIR, node['host']))
"""
logger.console('Extracting tarball to {0} on {1}'.format(
con.REMOTE_FW_DIR, node['host']))
cmd = 'sudo rm -rf {1}; mkdir {1} ; tar -zxf {0} -C {1}; ' \
'rm -f {0}'.format(tarball, con.REMOTE_FW_DIR)
(ret_code, _, stderr) = ssh.exec_command(cmd, timeout=30)
cmd = 'sudo rm -rf {1}; mkdir {1} ; tar -zxf {0} -C {1}; ' \
'rm -f {0}'.format(tarball, con.REMOTE_FW_DIR)
(ret_code, _, stderr) = ssh.exec_command(cmd, timeout=30)
logger.error('Unpack error: {0}'.format(stderr))
raise Exception('Failed to unpack {0} at node {1}'.format(
tarball, node['host']))
logger.error('Unpack error: {0}'.format(stderr))
raise Exception('Failed to unpack {0} at node {1}'.format(
tarball, node['host']))
- 'cd {0} && rm -rf env && virtualenv --system-site-packages env && . env/bin/activate && '
+ 'cd {0} && rm -rf env && '
+ 'virtualenv --system-site-packages --never-download env && '
+ '. env/bin/activate && '
'pip install -r requirements.txt'
.format(con.REMOTE_FW_DIR), timeout=100)
'pip install -r requirements.txt'
.format(con.REMOTE_FW_DIR), timeout=100)
logger.error('Virtualenv creation error: {0}'.format(stdout + stderr))
raise Exception('Virtualenv setup failed')
else:
logger.console('Virtualenv created on {0}'.format(node['host']))
logger.error('Virtualenv creation error: {0}'.format(stdout + stderr))
raise Exception('Virtualenv setup failed')
else:
logger.console('Virtualenv created on {0}'.format(node['host']))
def delete_local_tarball(tarball):
"""Delete local tarball to prevent disk pollution.
:param tarball: Path to tarball to upload.
:type tarball: str
def delete_local_tarball(tarball):
"""Delete local tarball to prevent disk pollution.
:param tarball: Path to tarball to upload.
:type tarball: str
"""Setup suite run on topology nodes.
Many VAT/CLI based tests need the scripts at remote hosts before executing
"""Setup suite run on topology nodes.
Many VAT/CLI based tests need the scripts at remote hosts before executing
logger.trace('Test framework copied to all topology nodes')
delete_local_tarball(tarball)
logger.console('All nodes are ready')
logger.trace('Test framework copied to all topology nodes')
delete_local_tarball(tarball)
logger.console('All nodes are ready')