aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-05-15 10:42:58 +0200
committerPeter Mikus <pmikus@cisco.com>2018-05-16 11:12:08 +0000
commit72813c366cdaae8ee3c7103d6c61340650245b57 (patch)
tree55845f9641a302fce48f16eb4027252892c15647 /resources/libraries/python
parenta76fb6bd39a0a6ec6183bfb6da9c3ebefb248f33 (diff)
HC tests: archive ODL logs (CSIT-1031)
Change-Id: I444a5d6cd32cb9ee68575dfdb5a208de2c4eb72a Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r--resources/libraries/python/honeycomb/HoneycombUtil.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py
index 74e0294055..52670b5390 100644
--- a/resources/libraries/python/honeycomb/HoneycombUtil.py
+++ b/resources/libraries/python/honeycomb/HoneycombUtil.py
@@ -436,6 +436,31 @@ class HoneycombUtil(object):
hc_log=Const.REMOTE_HC_LOG))
@staticmethod
+ def append_odl_log(node, odl_name, suite_name):
+ """Append ODL karaf log for the current test suite to the full log.
+
+ :param node: Honeycomb node.
+ :param odl_name: Name of ODL client version to use.
+ :param suite_name: Name of the current test suite. ${SUITE_NAME}
+ variable in robotframework.
+ :type node: dict
+ :type odl_name: str
+ :type suite_name: str
+ """
+
+ ssh = SSH()
+ ssh.connect(node)
+
+ ssh.exec_command(
+ "echo '{separator}' >> /tmp/karaf.log".format(separator="="*80))
+ ssh.exec_command(
+ "echo 'Log for suite: {suite}' >> /tmp/karaf.log".format(
+ suite=suite_name))
+ ssh.exec_command(
+ "cat /tmp/karaf_{odl_name}/data/log/karaf.log >> /tmp/karaf.log"
+ .format(odl_name=odl_name))
+
+ @staticmethod
def clear_honeycomb_log(node):
"""Delete the Honeycomb log file for the current test suite.
@@ -471,3 +496,17 @@ class HoneycombUtil(object):
get=True,
timeout=60)
ssh.exec_command("rm /tmp/honeycomb.log")
+
+ @staticmethod
+ def archive_odl_log(node):
+ """Copy ODL karaf log file from DUT node to VIRL for archiving.
+
+ :param node: Honeycomb node.
+ :type node: dict
+ """
+
+ ssh = SSH()
+ ssh.connect(node)
+
+ cmd = "cp /tmp/karaf.log /scratch/"
+ ssh.exec_command_sudo(cmd, timeout=60)