Added testcase for verifying the reboot operation on reboot page

Change-Id: Iecd4f1c05beb4932ae9387831e852a3185ca0ecc
Signed-off-by: Ashwini Chandrappa <Ashwini.Chandrappa777@ibm.com>
diff --git a/gui/data/gui_variables.py b/gui/data/gui_variables.py
index 7a39ae0..b6375ba 100644
--- a/gui/data/gui_variables.py
+++ b/gui/data/gui_variables.py
@@ -72,3 +72,4 @@
 
     # Common variables
     xpath_save_settings_button = "//button[contains(text(),'Save settings')]"
+    xpath_confirm_button = "//button[contains(text(),'Confirm')]"
diff --git a/gui/gui_test/operations_menu/test_reboot_bmc_sub_menu.robot b/gui/gui_test/operations_menu/test_reboot_bmc_sub_menu.robot
index 61ee371..4afc9e0 100644
--- a/gui/gui_test/operations_menu/test_reboot_bmc_sub_menu.robot
+++ b/gui/gui_test/operations_menu/test_reboot_bmc_sub_menu.robot
@@ -3,6 +3,7 @@
 Documentation  Test OpenBMC GUI "Reboot BMC" sub-menu of "Operation" menu.
 
 Resource        ../../lib/gui_resource.robot
+Resource        ../../../lib/common_utils.robot
 
 Suite Setup     Launch Browser And Login GUI
 Suite Teardown  Close Browser
@@ -15,6 +16,7 @@
 ${xpath_reboot_bmc_button}       //button[contains(text(),'Reboot BMC')]
 ${xpath_reboot_cancel_button}    //button[contains(text(),'Cancel')]
 
+
 *** Test Cases ***
 
 Verify Navigation To Reboot BMC Page
@@ -47,6 +49,24 @@
     Wait Until Element Is Not Visible  ${xpath_reboot_cancel_button}  timeout=15
 
 
+Verify BMC Reboot Operation
+    [Documentation]  Verify BMC Reboot operation
+    [Tags]  Verify_BMC_Reboot_Operation
+
+    Click Element  ${xpath_reboot_bmc_button}
+    Click Element  ${xpath_confirm_button}
+
+    # Checks BMC gets into Unpingable state and later becomes Pingable.
+    Wait Until Keyword Succeeds  1 min  5 sec  Is BMC Unpingable  ${OPENBMC_HOST}
+    Wait For Host To Ping  ${OPENBMC_HOST}  1 min
+
+    # Checks BMC gets into ready state.
+    Wait Until Keyword Succeeds  5 min  10 sec  Is BMC Ready
+
+    Click Element  ${xpath_refresh_button}
+    Wait Until Element Is Visible  ${xpath_reboot_bmc_button}  timeout=10
+
+
 *** Keywords ***
 
 Test Setup Execution
diff --git a/lib/common_utils.robot b/lib/common_utils.robot
index e9bbfaa..6c19021 100755
--- a/lib/common_utils.robot
+++ b/lib/common_utils.robot
@@ -967,3 +967,11 @@
     ${properties}=  Read Properties  /xyz/openbmc_project/watchdog/host0
     Should Be Equal As Strings  ${properties["Enabled"]}  ${True}
     Should Not Be Equal As Strings  ${properties["TimeRemaining"]}  0
+
+
+Is BMC Unpingable
+    [Documentation]  Check if BMC is unpingable.
+
+    ${RC}  ${output}=  Run and return RC and Output  ping -c 4 ${OPENBMC_HOST}
+    Log  RC: ${RC}\nOutput:\n${output}
+    Should be equal  ${RC}  ${1}