Automated BMC reset reload with force restart

Changes:
    - Test case
      "Redfish BMC Manager ForceRestart When Host Off"

Change-Id: I0f8f272283c1f1d8a168afc628bb024f659d0430
Signed-off-by: Sushil Singh <susilsi7@in.ibm.com>
diff --git a/lib/bmc_redfish_utils.robot b/lib/bmc_redfish_utils.robot
index dc7ba5d..4b5af5b 100644
--- a/lib/bmc_redfish_utils.robot
+++ b/lib/bmc_redfish_utils.robot
@@ -10,6 +10,7 @@
 Redfish Power Operation
     [Documentation]  Do Redfish host power operation.
     [Arguments]      ${reset_type}
+
     # Description of arguments:
     # reset_type     Type of power operation.
     #                (e.g. On/ForceOff/GracefulRestart/GracefulShutdown)
@@ -38,21 +39,20 @@
 
 Redfish BMC Reset Operation
     [Documentation]  Do Redfish BMC reset operation.
+    [Arguments]  ${reset_type}=GracefulRestart
 
     # Example:
     # "Actions": {
     # "#Manager.Reset": {
     #  "ResetType@Redfish.AllowableValues": [
-    #    "GracefulRestart"
+    #    "GracefulRestart",
+    #    "ForceRestart"
     #  ],
     #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
     # }
 
-    ${session_info}=  Redfish.Get Session Info
-    Log  ${session_info}
-
     ${target}=  redfish_utils.Get Target Actions  /redfish/v1/Managers/bmc/  Manager.Reset
-    ${payload}=  Create Dictionary  ResetType=GracefulRestart
+    ${payload}=  Create Dictionary  ResetType=${reset_type}
     Redfish.Post  ${target}  body=&{payload}
 
 
diff --git a/lib/utils.robot b/lib/utils.robot
index b1d2d56..81f8914 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -933,7 +933,7 @@
 
     Wait Until Keyword Succeeds  3 min  10 sec  Redfish Get States
 
-    Wait Until Keyword Succeeds  1 min  10 sec  Match State  ${standby_states}
+    Wait Until Keyword Succeeds  2 min  10 sec  Match State  ${standby_states}
 
 
 Match State
diff --git a/redfish/managers/test_managers_bmc.robot b/redfish/managers/test_managers_bmc.robot
index 1336062..c780e13 100644
--- a/redfish/managers/test_managers_bmc.robot
+++ b/redfish/managers/test_managers_bmc.robot
@@ -106,7 +106,8 @@
     # "Actions": {
     # "#Manager.Reset": {
     #  "ResetType@Redfish.AllowableValues": [
-    #    "GracefulRestart"
+    #    "GracefulRestart",
+    #    "ForceRestart"
     #  ],
     #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
     # }
@@ -114,7 +115,40 @@
     ${test_file_path}=  Set Variable  /tmp/before_bmcreboot
     BMC Execute Command  touch ${test_file_path}
 
-    Redfish OBMC Reboot (off)
+    Redfish Power Off  stack_mode=skip
+
+    Redfish BMC Reset Operation  reset_type=GracefulRestart
+
+    Is BMC Standby
+
+    BMC Execute Command  if [ -f ${test_file_path} ] ; then false ; fi
+    Verify BMC RTC And UTC Time Drift
+
+    # Check for journald persistency post reboot.
+    Check For Regex In Journald  ${REBOOT_REGEX}  error_check=${1}
+
+
+Redfish BMC Manager ForceRestart When Host Off
+    [Documentation]  BMC force restart when host is powered off.
+    [Tags]  Redfish_BMC_Manager_ForceRestart_When_Host_Off
+
+    # "Actions": {
+    # "#Manager.Reset": {
+    #  "ResetType@Redfish.AllowableValues": [
+    #    "GracefulRestart",
+    #    "ForceRestart"
+    #  ],
+    #  "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset"
+    # }
+
+    ${test_file_path}=  Set Variable  /tmp/before_bmcreboot
+    BMC Execute Command  touch ${test_file_path}
+
+    Redfish Power Off  stack_mode=skip
+
+    Redfish BMC Reset Operation  reset_type=ForceRestart
+
+    Is BMC Standby
 
     BMC Execute Command  if [ -f ${test_file_path} ] ; then false ; fi
     Verify BMC RTC And UTC Time Drift