Redfish bmc code update with apply time
Change-Id: Id06602f44f7c1b2810a2b0995556e4e6df7f8c72
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/redfish/update_service/test_redfish_bmc_code_update.robot b/redfish/update_service/test_redfish_bmc_code_update.robot
new file mode 100644
index 0000000..21e96ba
--- /dev/null
+++ b/redfish/update_service/test_redfish_bmc_code_update.robot
@@ -0,0 +1,76 @@
+*** Settings ***
+Documentation Update firmware on a target BMC via Redifsh.
+
+# Test Parameters:
+# IMAGE_FILE_PATH The path to the BMC image file.
+#
+# Firmware update states:
+# Enabled Image is installed and either functional or active.
+# Disabled Image installation failed or ready for activation.
+# Updating Image installation currently in progress.
+
+Resource ../../lib/resource.robot
+Resource ../../lib/bmc_redfish_resource.robot
+Resource ../../lib/openbmc_ffdc.robot
+Resource ../../lib/common_utils.robot
+Resource ../../lib/code_update_utils.robot
+Resource ../../lib/dump_utils.robot
+Resource ../../lib/logging_utils.robot
+Resource ../../lib/redfish_code_update_utils.robot
+Library ../../lib/gen_robot_valid.py
+Library ../../lib/tftp_update_utils.py
+
+Suite Setup Suite Setup Execution
+Suite Teardown Redfish.Logout
+Test Setup Printn
+Test Teardown FFDC On Test Case Fail
+
+Force Tags BMC_Code_Update
+
+*** Test Cases ***
+
+Redfish Code Update With ApplyTime OnReset
+ [Documentation] Update the firmaware image with ApplyTime of OnReset.
+ [Tags] Redfish_Code_Update_With_ApplyTime_OnReset
+ [Template] Redfish Update Firmware
+
+ # policy
+ OnReset
+
+
+Redfish Code Update With ApplyTime Immediate
+ [Documentation] Update the firmaware image with ApplyTime of Immediate.
+ [Tags] Redfish_Code_Update_With_ApplyTime_Immediate
+ [Template] Redfish Update Firmware
+
+ # policy
+ Immediate
+
+
+*** Keywords ***
+
+Suite Setup Execution
+ [Documentation] Do the suite setup.
+
+ # Checking for file existence.
+ Valid File Path IMAGE_FILE_PATH
+ Redfish.Login
+ # Delete BMC dump and Error logs.
+ Delete All BMC Dump
+ Redfish Purge Event Log
+
+
+Redfish Update Firmware
+ [Documentation] Update the BMC firmware via redfish interface.
+ [Arguments] ${apply_time}
+
+ # Description of argument(s):
+ # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
+
+ ${state}= Get Pre Reboot State
+ Rprint Vars state
+
+ Redfish Upload Image And Check Progress State ${apply_time}
+ Reboot BMC And Verify BMC Image
+ ... ${apply_time} start_boot_seconds=${state['epoch_seconds']}
+