aboutsummaryrefslogtreecommitdiffstats
path: root/tools/hdv/redfish/hdv.py
diff options
context:
space:
mode:
authorchenliangyjy <chenliangyjy@chinamobile.com>2020-03-11 17:36:10 +0800
committerchenliangyjy <chenliangyjy@chinamobile.com>2020-03-13 15:46:21 +0800
commit74b31a2b17e18740dafcf883c2d2ddef37a6504c (patch)
tree7c540dc9c3541861c051400b512a3c783034908a /tools/hdv/redfish/hdv.py
parent10d5e51457478e1024f3f61b2678d0f69adf16a1 (diff)
introduce hdv implementation by redfish support yaml and excel
Signed-off-by: chenliangyjy <chenliangyjy@chinamobile.com> Change-Id: I2c5bfbc23e603418f99946c0ad6417b0589496b0
Diffstat (limited to 'tools/hdv/redfish/hdv.py')
-rw-r--r--tools/hdv/redfish/hdv.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/hdv/redfish/hdv.py b/tools/hdv/redfish/hdv.py
new file mode 100644
index 0000000..80db3c9
--- /dev/null
+++ b/tools/hdv/redfish/hdv.py
@@ -0,0 +1,59 @@
+##############################################################################
+# 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('--file_type', type=str, default="excel", \
+ help="config file type, [yaml|excel],default is excel")
+ parser.add_argument('--case_yaml', type=str, default="./conf/cases.yaml", \
+ help="case yaml file, uesd if file_type = yaml")
+ parser.add_argument('--depends_yaml', type=str, \
+ default="./conf/depends.yaml",\
+ help="depends yaml file,uesd if file_type = yaml")
+ parser.add_argument('--case_excel', type=str, default="./conf/cases.xlsx", \
+ help="excel case file used if file_type = excel")
+ args = parser.parse_args()
+ return args
+
+
+def main():
+ '''
+ main function
+ '''
+ args = parse_args()
+ run_case(args.config, args.case_excel, args.depends_yaml, args.case_yaml,\
+ args.file_type)
+
+
+if __name__ == "__main__":
+ main()