HC Test: exception handling for restconf GET operation
[csit.git] / resources / libraries / python / honeycomb / HoneycombUtil.py
index 39c076d..76bb5b3 100644 (file)
@@ -302,7 +302,14 @@ class HoneycombUtil(object):
         base_path = HoneycombUtil.read_path_from_url_file(url_file)
         path = base_path + path
         status_code, resp = HTTPRequest.get(node, path)
-        return status_code, loads(resp)
+
+        try:
+            data = loads(resp)
+        except ValueError:
+            logger.debug("Failed to deserialize JSON data.")
+            data = None
+
+        return status_code, data
 
     @staticmethod
     def put_honeycomb_data(node, url_file, data, path="",
@@ -448,10 +455,11 @@ class HoneycombUtil(object):
 
         if not perf:
             cmd = "cp /tmp/honeycomb.log /scratch/"
-            ssh.exec_command_sudo(cmd)
+            ssh.exec_command_sudo(cmd, timeout=60)
         else:
             ssh.scp(
                 ".",
                 "/tmp/honeycomb.log",
-                get=True)
+                get=True,
+                timeout=60)
             ssh.exec_command("rm /tmp/honeycomb.log")