Redfish code update lab/ci usecases
Change-Id: I4b45ed9270776ba782b4d970cb8fb9df33bc8635
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/redfish_code_update_utils.robot b/lib/redfish_code_update_utils.robot
index ad091f8..ff0580f 100644
--- a/lib/redfish_code_update_utils.robot
+++ b/lib/redfish_code_update_utils.robot
@@ -3,6 +3,7 @@
Library code_update_utils.py
Library gen_robot_valid.py
+Library tftp_update_utils.py
Resource bmc_redfish_utils.robot
*** Keywords ***
@@ -99,3 +100,50 @@
# Return the first list entry.
[Return] ${software_inventory}[0]
+
+
+Redfish Upload Image And Check Progress State
+ [Documentation] Code update with ApplyTime.
+ [Arguments] ${apply_time}
+
+ # Description of argument(s):
+ # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
+
+ Set ApplyTime policy=${apply_Time}
+ Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
+
+ ${image_id}= Get Latest Image ID
+ Rprint Vars image_id
+
+ Check Image Update Progress State
+ ... match_state='Disabled', 'Updating' image_id=${image_id}
+
+ # Wait a few seconds to check if the update progress started.
+ Sleep 5s
+ Check Image Update Progress State
+ ... match_state='Updating' image_id=${image_id}
+
+ Wait Until Keyword Succeeds 8 min 20 sec
+ ... Check Image Update Progress State
+ ... match_state='Enabled' image_id=${image_id}
+
+
+Reboot BMC And Verify BMC Image
+ [Documentation] Reboot or wait for BMC standby post reboot and
+ ... verify installed image is functional.
+ [Arguments] ${apply_time} ${start_boot_seconds}
+
+ # Description of argument(s):
+ # policy ApplyTime allowed values
+ # (e.g. "OnReset", "Immediate").
+ # start_boot_seconds See 'Wait For Reboot' for details.
+
+ Run Keyword if 'OnReset' == '${apply_time}'
+ ... Run Keyword
+ ... Redfish OBMC Reboot (off)
+ ... ELSE
+ ... Run Keyword
+ ... Wait For Reboot start_boot_seconds=${start_boot_seconds}
+ Redfish.Login
+ Redfish Verify BMC Version ${IMAGE_FILE_PATH}
+