-# Copyright (c) 2017 Cisco and/or its affiliates.
+# Copyright (c) 2018 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
from resources.libraries.python.ssh import SSH
from resources.libraries.python.TLDK.TLDKConstants import TLDKConstants as con
-from resources.libraries.python.topology import NodeType
+from resources.libraries.python.topology import NodeType, Topology
from resources.libraries.python.TLDK.gen_pcap import gen_all_pcap
__all__ = ["SetupTLDKTest"]
:param node: Dictionary created from topology.
:type tarball: str
:type node: dict
- :return: nothing
+ :returns: nothing
:raises RuntimeError: If extract tarball failed.
"""
logger.console('Extracting tarball to {0} on {1}'.format(
ssh.connect(node)
(ret_code, stdout, stderr) = ssh.exec_command(
'cd {0} && rm -rf env && '
- '. virtualenv --system-site-packages --never-download env && '
+ 'virtualenv --system-site-packages --never-download env && '
'. env/bin/activate && pip install -r requirements.txt'
.format(con.REMOTE_FW_DIR), timeout=100)
if ret_code != 0:
:returns: nothing.
:raises RuntimeError: If install tldk failed.
"""
- logger.console('Install the TLDK on {0}'.format(node['host']))
+
+ arch = Topology.get_node_arch(node)
+ logger.console('Install the TLDK on {0} ({1})'.format(node['host'],
+ arch))
ssh = SSH()
ssh.connect(node)
(ret_code, _, stderr) = ssh.exec_command(
- 'cd {0}/{1} && ./install_tldk.sh'
- .format(con.REMOTE_FW_DIR, con.TLDK_SCRIPTS), timeout=600)
+ 'cd {0}/{1} && ./install_tldk.sh {2}'
+ .format(con.REMOTE_FW_DIR, con.TLDK_SCRIPTS, arch), timeout=600)
if ret_code != 0:
logger.error('Install the TLDK error: {0}'.format(stderr))
:raises RuntimeError: If node setup failed.
"""
tarball, remote_tarball, node = args
+
+ # if unset, arch defaults to x86_64
+ Topology.get_node_arch(node)
+
try:
copy_tarball_to_node(tarball, node)
extract_tarball_at_node(remote_tarball, node)
'Executed node setups in parallel, waiting for processes to end')
result.wait()
- logger.info('Results: {0}'.format(result.get()))
+ results = result.get()
+ node_setup_success = all(results)
+ logger.info('Results: {0}'.format(results))
logger.trace('Test framework copied to all topology nodes')
delete_local_tarball(tarball)
- logger.console('All nodes are ready')
+ if node_setup_success:
+ logger.console('All nodes are ready')
+ else:
+ logger.console('Failed to setup dpdk on all the nodes')