aboutsummaryrefslogtreecommitdiffstats
path: root/hdv/redfish/hdv.py
blob: ac5b035e59ea36cebc4ec4a94bb460df99d5514b (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
##############################################################################
# Copyright (c) 2020 China Mobile Co.,Ltd and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
'''
hdv tools
 all config files are put under conf/
 config.yaml is the global configuration
 additional config for supporting two modes
 - excel: tools will parse the depend_id sheet and cases sheet and
 execute test case and write report back to excel
 - yaml: tools will parse depends.yaml and cases.yaml and execute test case
 and write a report.yaml
 theory:
   either test case can be finished by one restful request,
   or an additional request needed to get dependency parent resource.
   e.g a case for checking port, should get networkadaptor_id before that.
'''
import argparse
from hdv_redfish import run as run_case


def parse_args():
    '''
    parse arguments
    '''
    parser = argparse.ArgumentParser(description="hdv tool by redfish, \
    check readme under ./docs")
    parser.add_argument('--version', action='version',
                        version='%(prog)s 0.1', help="show tool version")
    parser.add_argument('--config', type=str, default="./conf/config.yaml",
                        help="given global config.yaml file")
    parser.add_argument('--case', type=str, default="./conf/cases.yaml",
                        help="case yaml file")
    args = parser.parse_args()
    return args


def main():
    '''
    main function
    '''
    args = parse_args()
    run_case(args.config, args.case)


if __name__ == "__main__":
    main()