summaryrefslogtreecommitdiffstats
path: root/utils/test/scripts/conf_utils.py
blob: cf95998580dc796be0f0476bc7b5c77cf47834e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import yaml


with open('./testcases.yaml') as f:
    testcases_yaml = yaml.safe_load(f)
f.close()


def compose_format(fmt):
    return 'format_' + fmt.strip()


def get_format(project, case):
    testcases = testcases_yaml.get(project)
    if isinstance(testcases, list):
        for case_dict in testcases:
            if case_dict['name'] == case:
                return compose_format(case_dict['format'])
    return None


if __name__ == '__main__':
    fmt = get_format('functest', 'vping_ssh')
    print fmt