Reading json for post code update action
Change-Id: I6636e81b44ca25c87ed92a65121cccbfebcf86a2
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/applytime_table.json b/lib/applytime_table.json
deleted file mode 100644
index 3452f18..0000000
--- a/lib/applytime_table.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "BMC image": {
- "OnReset": "Redfish OBMC Reboot (off)",
- "Immediate": "Wait For Reboot start_boot_seconds=${state['epoch_seconds']}"
- },
- "Host image": {
- "OnReset": "Redfish Host Reboot",
- "Immediate": "Wait State os_running_match_state 10 mins"
- }
-}
-
diff --git a/lib/utils.py b/lib/utils.py
index 0049cca..05bae08 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -4,6 +4,7 @@
Companion file to utils.robot.
"""
+import os
import gen_print as gp
import gen_robot_keyword as grk
import bmc_ssh_utils as bsu
@@ -18,6 +19,18 @@
import collections
+# The code base directory will be one level up from the directory containing this module.
+code_base_dir_path = os.path.dirname(os.path.dirname(__file__)) + os.sep
+
+
+def get_code_base_dir_path():
+ r"""
+ Return the dir path of our code base.
+ """
+
+ return code_base_dir_path
+
+
def set_power_policy_method():
r"""
Set the global bmc_power_policy_method to either 'Old' or 'New'.
diff --git a/lib/utils.robot b/lib/utils.robot
index ab5faec..b8d3db7 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -713,3 +713,28 @@
${resp}= Post Request openbmc ${BMC_USER_URI}root/action/SetPassword
... data=${data} headers=${headers}
Valid Value resp.status_code [${HTTP_OK}]
+
+
+Get Post Boot Action
+ [Documentation] Get post boot action.
+
+ # Post code update action dictionay.
+ #
+ # {
+ # BMC image: {
+ # OnReset: Redfish OBMC Reboot (off),
+ # Immediate: Wait For Reboot start_boot_seconds=${state['epoch_seconds']}
+ # },
+ # Host image: {
+ # OnReset: Redfish Host Reboot,
+ # Immediate: Wait State os_running_match_state 10 mins
+ # }
+ # }
+
+ ${code_base_dir_path}= Get Code Base Dir Path
+ ${post_code_update_actions}= Evaluate
+ ... json.load(open('${code_base_dir_path}data/applytime_table.json')) modules=json
+ Rprint Vars post_code_update_actions
+
+ [Return] ${post_code_update_actions}
+