Performance fix for test warm reset failure

Before this fix the test case will wait for 5 minutes even when
the BMC reboot request has failed. With this change, the test case
will fail and exit if the reboot didn't occur. The wait and ping
host is already in place as part of the keyword "Trigger Warm Reset".

Resolves openbmc/openbmc-test-automation#103

Change-Id: I1cc5c6a61d0078b2c8fd6f1589a814df3094c2de
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tests/test_warmreset.robot b/tests/test_warmreset.robot
index 0d999ec..5f38d05 100644
--- a/tests/test_warmreset.robot
+++ b/tests/test_warmreset.robot
@@ -20,32 +20,26 @@
 Test WarmReset via REST
     ${warm_test_file}=  Set Variable    /tmp/before_warmreset
     Open Connection And Log In
-    ${stdout}   ${stderr}   ${rc}=  Execute Command     touch ${warm_test_file}     return_stderr=True  return_rc=True
-    Should Be Equal     ${rc}   ${0}    Unable to create file - ${warm_test_file}
+    ${stdout}   ${stderr}   ${rc}=
+    ...   Execute Command   touch ${warm_test_file}
+    ...   return_stderr=True  return_rc=True
+    Should Be Equal   ${rc}   ${0}   Unable to create file - ${warm_test_file}
 
-    ${bmc_uri}=     Get BMC Link
-    ${data} =   create dictionary   data=@{EMPTY}
-    ${resp} =   openbmc post request    ${bmc_uri}/action/warmReset     data=${data}
-    Should Be Equal As Strings      ${resp.status_code}     ${HTTP_OK}
-    Sleep   ${SYSTEM_SHUTDOWN_TIME}min
-    Wait For Host To Ping   ${OPENBMC_HOST}
-    ${max_wait_time}=   Evaluate    ${SYSTEM_SHUTDOWN_TIME}+${OPENBMC_REBOOT_TIMEOUT}
+    Trigger Warm Reset
+    ${max_wait_time}=
+    ...   Evaluate    ${SYSTEM_SHUTDOWN_TIME}+${OPENBMC_REBOOT_TIMEOUT}
 
     Open Connection And Log In
-    ${uptime}=  Execute Command    cut -d " " -f 1 /proc/uptime| cut -d "." -f 1
+    ${uptime}=
+    ...   Execute Command    cut -d " " -f 1 /proc/uptime| cut -d "." -f 1
     ${uptime}=  Convert To Integer  ${uptime}
     ${uptime}=  Evaluate   ${uptime}/60
     Should Be True  ${uptime}<${max_wait_time}
     Open Connection And Log In
-    ${stdout}   ${stderr}   ${rc}=  Execute Command     ls ${warm_test_file}    return_stderr=True  return_rc=True
-    Should Be Equal     ${rc}   ${1}    File ${warm_test_file} does exist even after reboot of BMC, error:${stderr}, stdput: ${stdout}
+    ${stdout}   ${stderr}   ${rc}=
+    ...   Execute Command     ls ${warm_test_file}
+    ...   return_stderr=True  return_rc=True
+    Should Be Equal    ${rc}   ${1}
+    ...    File ${warm_test_file} persist after BMC rebooted
 
 *** Keywords ***
-Get BMC Link
-    ${resp}=    OpenBMC Get Request     /org/openbmc/control/
-    ${jsondata}=   To Json    ${resp.content}
-    log     ${jsondata}
-    : FOR    ${ELEMENT}    IN    @{jsondata["data"]}
-    \   log     ${ELEMENT}
-    \   ${found}=   Get Lines Matching Pattern      ${ELEMENT}      *control/bmc*
-    \   Return From Keyword If     '${found}' != ''     ${found}