summaryrefslogtreecommitdiffstats
path: root/utils/parser.py
diff options
context:
space:
mode:
authorliyin <liyin11@huawei.com>2017-02-14 10:42:07 +0800
committerliyin <liyin11@huawei.com>2017-02-14 10:49:54 +0800
commitbe6453bb485c720278c5f6a45a5194391e454ce4 (patch)
tree2cec6d1d42c07de5cefc258399150557f1dcb8d7 /utils/parser.py
parent9c22cd768a161ec0eab4da24f40a4c626275c746 (diff)
Dashboard and output file code reconstruction
JIRA:BOTTLENECK-134 Those code will change the way to create dashboard. And dashboard as a spare function to show data. And we add log system to dashboard creation. The output file is created anyway. Change-Id: Ia3c4d5a8ada27005702e3eed08757f61610da22f Signed-off-by: liyin <liyin11@huawei.com>
Diffstat (limited to 'utils/parser.py')
-rw-r--r--utils/parser.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/utils/parser.py b/utils/parser.py
index a9098a98..b5f29679 100644
--- a/utils/parser.py
+++ b/utils/parser.py
@@ -14,6 +14,8 @@ Second is reading config file.'''
import os
import yaml
+import json
+import time
from pyroute2 import IPDB
@@ -76,6 +78,13 @@ class Parser():
if not os.path.exists(dirname):
os.makedirs(dirname)
+ @classmethod
+ def testcase_out_dir(cls, testcase):
+ file_time = time.strftime('%H_%M', time.localtime(time.time()))
+ out_name = cls.bottlenecks_config["log_dir"] + testcase + file_time
+ outfile_name = out_name + ".out"
+ return outfile_name
+
@staticmethod
def config_parser(testcase_cfg, parameters):
test_cfg = testcase_cfg['test_config']
@@ -93,6 +102,12 @@ class Parser():
TEST_IP = GATEWAY_IP + ":8888"
return TEST_IP
+ @staticmethod
+ def result_to_file(data, file_name):
+ with open(file_name, "a") as f:
+ f.write(json.dumps(data, f))
+ f.write("\n")
+
class HeatTemplate_Parser():
"""parser a Heat template and a method to deploy template to a stack"""