2 ##############################################################################
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
16 bottlenecks_config = {}
20 cls.code_dir = os.path.dirname(os.path.abspath(__file__))
21 cls.root_dir = os.path.dirname(cls.code_dir)
22 cls.test_dir = os.path.join(cls.root_dir, 'testsuites')
23 config_dir = os.path.join(
28 with open(config_dir) as file:
29 config_info = yaml.load(file)
30 common_config = config_info['common_config']
31 cls.bottlenecks_config["releng_dir"] = common_config["releng_dir"]
32 cls.bottlenecks_config["fetch_os"] = common_config["fetch_os_file"]
33 cls.bottlenecks_config["log_dir"] = common_config['log_dir']
34 cls.bottlenecks_config["rc_dir"] = common_config['rc_dir']
35 cls.config_dir_check(cls.bottlenecks_config["log_dir"])
38 def config_read(cls, testcase, story_name):
39 story_dir = os.path.join(
44 with open(story_dir) as file:
45 story_parser = yaml.load(file)
46 for case_name in story_parser['testcase']:
47 testcase_dir = os.path.join(
52 with open(testcase_dir) as f:
53 cls.bottlenecks_config[case_name] = yaml.load(f)
55 return cls.bottlenecks_config
58 def config_dir_check(cls, dirname):
61 if not os.path.exists(dirname):
65 def config_parser(testcase_cfg, parameters):
66 test_cfg = testcase_cfg['test_config']
67 stack_cfg = testcase_cfg['stack_config']
68 # TO-DO add cli parameters to stack_config.
69 return test_cfg, stack_cfg