Correct timestamp output 85/23185/1
authorBryan Sullivan <bryan.sullivan@att.com>
Sat, 15 Oct 2016 18:57:30 +0000 (11:57 -0700)
committerBryan Sullivan <bryan.sullivan@att.com>
Sat, 15 Oct 2016 18:57:30 +0000 (11:57 -0700)
JIRA: VES-1

Change-Id: I4eaf24b9b9861fb9b8a8130d94fbf90cce797e2c
Signed-off-by: Bryan Sullivan <bryan.sullivan@att.com>
tests/blueprints/tosca-vnfd-hello-ves/monitor.py

index ec4a00d..d861f05 100644 (file)
@@ -29,13 +29,20 @@ with open('/home/ubuntu/ves.log') as f:
   while True:
     line = f.readline()
     if line:
-#      print line,
+#        print "line: ", line,
 
       if "lastEpochMicrosec" in line:
-#....5....1....5....2....5....3....5
+#0....5....1....5....2....5....3....5....4....5....5
 #            "lastEpochMicrosec": 1476552393091008,
-        report_time = line[34:-2]
-        report_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1347517370))
+# Note: the above is expected, but sometimes it's in a different position or
+# corrupted with other output for some reason...
+
+        fields = line.split( )
+        e = fields[1][0:-1]
+        if e.isdigit():
+#          print "report_time: ", e, "\n"
+          report_time = time.strftime('%Y-%m-%d %H:%M:%S', 
+            time.localtime(int(e)/1000000))
 
       if "requestRate" in line:
 #....5....1....5....2....5....3....5