Code update method BMC using REST

Update work flow sequence:
    - File exist check
    - Ping Test and REST authentication
    - Preserve BMC Network setting
    - SCP image to BMC
    - Activate the flash image
    - Warm Reset BMC
    - Wait for BMC to come online
    - Version check

Resolves openbmc/openbmc-test-automation#81

Change-Id: I071fcca1b58d5a4d250697efa7a1e7aec84070bb
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index 190e4fc..c5a45ec 100644
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -1,6 +1,7 @@
 *** Settings ***
 Resource                ../lib/resource.txt
 Resource                ../lib/rest_client.robot
+Resource                ../lib/connection_client.robot
 
 Library                 OperatingSystem
 
@@ -176,3 +177,19 @@
     [Documentation]  Checks whether system state is HOST_BOOTED.
     ${state}=    Get BMC State
     should be equal as strings     ${state}     HOST_BOOTED
+
+Verify Ping and REST Authentication
+    ${l_ping} =   Run Keyword And Return Status
+    ...    Ping Host  ${OPENBMC_HOST}
+    Return From Keyword If  '${l_ping}' == '${False}'    ${False}
+
+    ${l_rest} =   Run Keyword And Return Status
+    ...    Initialize OpenBMC
+    Return From Keyword If  '${l_rest}' == '${False}'    ${False}
+
+    # Just to make sure the SSH is working for SCP
+    Open Connection And Log In
+    ${system}   ${stderr}=    Execute Command   hostname   return_stderr=True
+    Should Be Empty     ${stderr}
+
+    [return]    ${True}