aboutsummaryrefslogtreecommitdiffstats
path: root/tools/hdv/redfish/yaml_utils.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/yaml_utils.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/yaml_utils.py')
-rw-r--r--tools/hdv/redfish/yaml_utils.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/hdv/redfish/yaml_utils.py b/tools/hdv/redfish/yaml_utils.py
new file mode 100644
index 0000000..21e4fb6
--- /dev/null
+++ b/tools/hdv/redfish/yaml_utils.py
@@ -0,0 +1,28 @@
+'''
+@author: cmcc
+'''
+import os
+import yaml
+# pylint: disable=E0611
+from log_utils import LOGGER
+
+def read_yaml(file):
+ '''read a yaml file
+ '''
+ if not os.path.exists(file):
+ LOGGER.info("%s not found", file)
+ return None
+ return yaml.load(open(file, "r"))
+
+
+def write_yaml(file, dict_data):
+ '''write a yaml file
+ '''
+ #yaml.dump(dict_data, open(file, "w"), width = 80)
+ yaml.safe_dump(dict_data, open(file, "w"), explicit_start=True)
+
+
+print(read_yaml("./conf/depends.yaml"))
+print(read_yaml("./conf/cases.yaml"))
+
+write_yaml("./conf/report.yaml", read_yaml("./conf/cases.yaml"))