3 # Copyright (c) 2017 All rights reserved
4 # This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
15 # - odl datastore state
16 # - ovs state (openflow and dp)
17 # - optional - memory dump from odl
22 import sdnvpn.lib.utils as test_utils
23 import functest.utils.functest_utils as ft_utils
24 from functest.utils import config
26 LIB_PATH = os.path.dirname(
27 os.path.abspath(inspect.getfile(inspect.currentframe())))
30 def gather_logs(name):
31 openstack_nodes = test_utils.get_nodes()
33 ft_utils.execute_command_raise('rm -rf /tmp/sdnvpn-logs/;'
34 'mkdir -p /tmp/sdnvpn-logs/')
35 for node in openstack_nodes:
36 node.put_file('%s/../sh_utils/fetch-log-script.sh'
38 '/tmp/fetch-log-script.sh')
39 node.run_cmd('sudo bash /tmp/fetch-log-script.sh')
40 node.get_file('/tmp/log_output.tar.gz',
41 '/tmp/log_output-%s.tar.gz'
42 % node.get_dict()['name'])
43 ft_utils.execute_command_raise('mkdir -p /tmp/sdnvpn-logs/')
44 ft_utils.execute_command_raise(
45 'cd /tmp/sdnvpn-logs/; '
46 'tar -xzvf /tmp/log_output-%s.tar.gz --strip-components=1'
47 % node.get_dict()['name'])
49 ft_utils.execute_command_raise(
50 'cd %s;tar czvf sdnvpn-logs-%s.tar.gz /tmp/sdnvpn-logs/' % (
51 getattr(config.CONF, 'dir_results'), name))
54 if __name__ == '__main__':