summaryrefslogtreecommitdiffstats
path: root/utils/parser.py
diff options
context:
space:
mode:
authorliyin <liyin11@huawei.com>2017-01-24 17:26:21 +0800
committerAce Lee <liyin11@huawei.com>2017-02-07 02:00:00 +0000
commitc6755e612b322facefc4edc32e948ab2b00bb3b0 (patch)
treef3796ea159c10c9e9690c8b9072f37ebc0ea1f9c /utils/parser.py
parentca641fcdaa919afb072a9625eb9ba3848b9e3805 (diff)
Bottlenecks POSCA testing code reconstruction
JIRA:BOTTLENECK-103 This is the foundation of adding stack samples. This code change a lot code. but it's a basic. Those code will be changed in the furture. Change-Id: I8d5bbb9cc401b1aaac54ec4dffc4c005a42d17ac Signed-off-by: liyin <liyin11@huawei.com>
Diffstat (limited to 'utils/parser.py')
-rw-r--r--utils/parser.py33
1 files changed, 24 insertions, 9 deletions
diff --git a/utils/parser.py b/utils/parser.py
index ce5096a3..c8715859 100644
--- a/utils/parser.py
+++ b/utils/parser.py
@@ -7,6 +7,11 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+'''This file realize the function of how to parser a config file.
+This contain Two part:
+Frist is Init some variables the will be used.
+Second is reading config file.'''
+
import os
import yaml
@@ -14,6 +19,7 @@ import yaml
class Parser():
bottlenecks_config = {}
+ bottlenecks_test = {}
@classmethod
def config_init(cls):
@@ -35,7 +41,7 @@ class Parser():
cls.config_dir_check(cls.bottlenecks_config["log_dir"])
@classmethod
- def config_read(cls, testcase, story_name):
+ def story_read(cls, testcase, story_name):
story_dir = os.path.join(
cls.test_dir,
testcase,
@@ -44,15 +50,23 @@ class Parser():
with open(story_dir) as file:
story_parser = yaml.load(file)
for case_name in story_parser['testcase']:
- testcase_dir = os.path.join(
- cls.test_dir,
- testcase,
- 'testcase_cfg',
- case_name)
- with open(testcase_dir) as f:
- cls.bottlenecks_config[case_name] = yaml.load(f)
+ Parser.testcase_read(cls, testcase, case_name)
+
+ return cls.bottlenecks_test
+
+ @classmethod
+ def testcase_read(cls, testcase, testcase_name):
- return cls.bottlenecks_config
+ testcase_dir = os.path.join(
+ cls.test_dir,
+ testcase,
+ 'testcase_cfg',
+ testcase_name)
+ testcase_local = testcase_dir + ".yaml"
+ with open(testcase_local) as f:
+ cls.bottlenecks_test[testcase_name] = yaml.load(f)
+
+ return cls.bottlenecks_test
@classmethod
def config_dir_check(cls, dirname):
@@ -67,3 +81,4 @@ class Parser():
stack_cfg = testcase_cfg['stack_config']
# TO-DO add cli parameters to stack_config.
return test_cfg, stack_cfg
+