BMC reboot when PNOR update goes on

Resolves openbmc/openbmc-test-automation#1961

Change-Id: I9ef773410827463a3e7dcbed1d4ba2bbd11670bc
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/redfish/update_service/test_redfish_host_code_update.robot b/redfish/update_service/test_redfish_host_code_update.robot
index d86be23..d9b9d08 100644
--- a/redfish/update_service/test_redfish_host_code_update.robot
+++ b/redfish/update_service/test_redfish_host_code_update.robot
@@ -48,6 +48,16 @@
     Immediate
 
 
+BMC Reboot When PNOR Update Goes On
+    [Documentation]  Trigger PNOR update and do BMC reboot.
+    [Tags]  BMC_Reboot_When_PNOR_Update_Goes_On
+
+    ${bios_version_before}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  BiosVersion
+    Redfish Firmware Update And Do BMC Reboot
+    ${bios_version_after}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  BiosVersion
+    Valid Value  bios_version_after  ['${bios_version_before}']
+
+
 *** Keywords ***
 
 Suite Setup Execution
@@ -73,3 +83,15 @@
     Poweron Host And Verify Host Image  ${apply_time}
     Verify Get ApplyTime  ${apply_time}
 
+
+Redfish Firmware Update And Do BMC Reboot
+    [Documentation]  Update the firmware via redfish interface and do BMC reboot.
+
+    Set ApplyTime  policy="Immediate"
+    Redfish Upload Image  ${REDFISH_BASE_URI}UpdateService  ${IMAGE_FILE_PATH}
+    ${image_id}=  Get Latest Image ID
+    Wait Until Keyword Succeeds  1 min  10 sec
+    ...  Check Image Update Progress State  match_state='Updating'  image_id=${image_id}
+
+    # BMC reboot while PNOR update is in progress.
+    Redfish OBMC Reboot (off)