Force reboot and wait for BMC
This addresses the following:
- Rectify force reboot rc check
- Added warm rest verification for general use case
- Wait for BMC using Ping and REST authentication method
Resolves openbmc/openbmc-test-automation#92
Resolves openbmc/openbmc-test-automation#80
Change-Id: Ic391168c222c41986c0f01d92a26608c0b732521
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/extended/code_update/code_update_utils.robot b/extended/code_update/code_update_utils.robot
index 6c33092..640e421 100644
--- a/extended/code_update/code_update_utils.robot
+++ b/extended/code_update/code_update_utils.robot
@@ -44,15 +44,6 @@
scp.Put File ${filepath} /tmp/flashimg
-Check If warmReset is Initiated
- # Ping would be still alive, so try SSH to connect if fails
- # the ports are down indicating reboot in progress
- ${alive}= Run Keyword and Return Status
- ... Open Connection And Log In
- Return From Keyword If '${alive}' == '${False}' ${False}
- [return] ${True}
-
-
Check If File Exist
[Arguments] ${filepath}
Log \n PATH: ${filepath}
@@ -68,10 +59,10 @@
... Fail msg=System not in ideal state to use [ERROR]
-Wait for BMC to respond
- # Average code update takes from 15 -20 minutes
- # For worse case 30 minutes, check every 1 min
- Wait For Host To Ping ${OPENBMC_HOST} 30 min 1 min
+Check If BMC is Up
+ ${status}= Verify Ping and REST Authentication
+ Run Keyword If '${status}' == '${False}'
+ ... Fail msg=Ping and REST auth failed
Validate BMC Version
@@ -91,8 +82,10 @@
Trigger Warm Reset via Reboot
+ [Documentation] The reboot commands execute successfully but
+ ... returns negative value 1
Open Connection And Log In
${rc}= SSHLibrary.Execute Command
... /sbin/reboot return_stdout=False return_rc=True
- Should Be Equal As Integers ${rc} 0
+ Should Be Equal As Integers ${rc} ${-1}
diff --git a/extended/code_update/update_bmc.robot b/extended/code_update/update_bmc.robot
index 80faf9b..6c22803 100644
--- a/extended/code_update/update_bmc.robot
+++ b/extended/code_update/update_bmc.robot
@@ -35,12 +35,13 @@
Activate BMC flash image
- Trigger Warm Reset
# TODO: openbmc/openbmc#519
+ Run Keyword And Ignore Error Trigger Warm Reset
${session_active}= Check If warmReset is Initiated
Run Keyword If '${session_active}' == '${True}'
... Trigger Warm Reset via Reboot
- Wait for BMC to respond
+ Wait Until Keyword Succeeds
+ ... 30 min 10 sec Check If BMC is Up
Sleep 1 min
Validate BMC Version
diff --git a/lib/utils.robot b/lib/utils.robot
index c5a45ec..2a4a01f 100644
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -61,6 +61,10 @@
${data} = create dictionary data=@{EMPTY}
${resp} = openbmc post request /org/openbmc/control/bmc0/action/warmReset data=${data}
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ ${session_active}= Check If warmReset is Initiated
+ Run Keyword If '${session_active}' == '${True}'
+ ... Fail msg=warm reset didn't occur
+
Sleep ${SYSTEM_SHUTDOWN_TIME}min
Wait For Host To Ping ${OPENBMC_HOST}
@@ -193,3 +197,14 @@
Should Be Empty ${stderr}
[return] ${True}
+
+Check If warmReset is Initiated
+ [Documentation] Ping would be still alive, so try SSH to connect
+ ... if fails the ports are down indicating reboot
+ ... is in progress
+ ${alive}= Run Keyword and Return Status
+ ... Open Connection And Log In
+ Return From Keyword If '${alive}' == '${False}' ${False}
+ [return] ${True}
+
+