Code update to wait for BMC_READY

Change-Id: I18c94a947571013eb57a2141204f803ce21df539
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/update_bmc.robot b/extended/code_update/update_bmc.robot
index 29566fe..878e561 100644
--- a/extended/code_update/update_bmc.robot
+++ b/extended/code_update/update_bmc.robot
@@ -12,6 +12,7 @@
 ...                 - Prepare for Update
 ...                 - Force reboot
 ...                 - Wait for BMC to come online clean
+...                 - Wait for BMC_READY state
 ...                 - Apply preserve BMC Network setting
 ...                 - SCP image to BMC
 ...                 - Activate the flash image
@@ -44,6 +45,9 @@
     Trigger Warm Reset via Reboot
     Check If BMC is Up    5 min   10 sec
 
+    Wait Until Keyword Succeeds
+    ...    10 min   10 sec   Verify BMC State   BMC_READY
+
     Preserve BMC Network Setting
     SCP Tar Image File to BMC   ${FILE_PATH}
 
diff --git a/lib/utils.robot b/lib/utils.robot
index 0f56d78..713000f 100644
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -293,3 +293,12 @@
     ${cur_time}=    Get Current Date   result_format=%Y%m%d%H%M%S%f
     [return]   ${cur_time}
 
+
+Verify BMC State
+    [Documentation]   Get the BMC state and verify if the current
+    ...               BMC state is as expected.
+    [Arguments]       ${expected}
+
+    ${current}=  Get BMC State
+    Should Contain  ${current}   ${expected}
+