diff options
author | Nikolas Hermanns <nikolas.hermanns@ericsson.com> | 2017-07-12 12:07:46 +0000 |
---|---|---|
committer | Nikolas Hermanns <nikolas.hermanns@ericsson.com> | 2017-07-12 13:20:51 +0000 |
commit | 3668645d06669e0abe44535ee3a4450a0b83709c (patch) | |
tree | cf87a89261546156d64d1cbe6943efade9687983 /sdnvpn/lib/gather_logs.py | |
parent | 74db571092ab8650d8059430ea4e4033d2269527 (diff) |
Adding log gathering
Change-Id: I0f13e5aa8aea25e549c9ffede63085a86153cdba
Signed-off-by: Nikolas Hermanns <nikolas.hermanns@ericsson.com>
Diffstat (limited to 'sdnvpn/lib/gather_logs.py')
-rw-r--r-- | sdnvpn/lib/gather_logs.py | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sdnvpn/lib/gather_logs.py b/sdnvpn/lib/gather_logs.py new file mode 100644 index 0000000..cf84f43 --- /dev/null +++ b/sdnvpn/lib/gather_logs.py @@ -0,0 +1,54 @@ +# Copyright (c) 2017 All rights reserved +# This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# performes: +# - Gather +# - odl logs +# - ovs logs +# - neutron logs +# - odl datastore state +# - ovs state (openflow and dp) +# - optional - memory dump from odl + +import os +import inspect + +import sdnvpn.lib.utils as test_utils +import functest.utils.functest_utils as ft_utils +from functest.utils.constants import CONST + +LIB_PATH = os.path.dirname( + os.path.abspath(inspect.getfile(inspect.currentframe()))) + + +def gather_logs(name): + openstack_nodes = test_utils.get_nodes() + + ft_utils.execute_command_raise('rm -rf /tmp/sdnvpn-logs/;' + 'mkdir -p /tmp/sdnvpn-logs/') + for node in openstack_nodes: + node.put_file('%s/../sh_utils/fetch-log-script.sh' + % LIB_PATH, + '/tmp/fetch-log-script.sh') + node.run_cmd('sudo bash /tmp/fetch-log-script.sh') + node.get_file('/tmp/log_output.tar.gz', + '/tmp/log_output-%s.tar.gz' + % node.get_dict()['name']) + ft_utils.execute_command_raise('mkdir -p /tmp/sdnvpn-logs/') + ft_utils.execute_command_raise( + 'cd /tmp/sdnvpn-logs/; ' + 'tar -xzvf /tmp/log_output-%s.tar.gz --strip-components=1' + % node.get_dict()['name']) + + ft_utils.execute_command_raise('cd %s;tar czvf sdnvpn-logs-%s.tar.gz' + '-C /tmp/ sdnvpn-logs/' + % (CONST.__getattribute__('dir_results'), + name)) + + +if __name__ == '__main__': + gather_logs('test') |