New watchdog interface util keyword

Fixes:
   - Replace old org method with new REST interface
   - Remove poweroff test use case as the watchdog interface is
     only applicable when powered on

Resolves  openbmc/openbmc-test-automation#707

Change-Id: I1dec84029d66c0e9fc4fd6ee61cc8e129765d639
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index ce51f2e..517322a 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -165,25 +165,8 @@
 
     # Set the auto reboot policy.
     Set Auto Reboot  yes
-
-    SSHLibrary.Open connection  ${openbmc_host}
-    Login  ${openbmc_username}  ${openbmc_password}
-
     # Set the watchdog timer.  Note: 5000 = milliseconds which is 5 seconds.
-    ${cmd_buf}=  Catenate  /usr/sbin/mapper call /org/openbmc/watchdog/host0
-    ...  org.openbmc.Watchdog set i 5000
-    ${output}  ${stderr}  ${rc}=  Execute Command  ${cmd_buf}
-    ...  return_stderr=True  return_rc=True
-    Should Be Empty  ${stderr}
-    Should be equal  ${rc}  ${0}
-
-    # Start the watchdog.
-    ${cmd_buf}=  Catenate  /usr/sbin/mapper call /org/openbmc/watchdog/host0
-    ...  org.openbmc.Watchdog start
-    ${output}  ${stderr}  ${rc}=  Execute Command  ${cmd_buf}
-    ...  return_stderr=True  return_rc=True
-    Should Be Empty  ${stderr}
-    Should be equal  ${rc}  ${0}
+    Trigger Host Watchdog Error  5000
 
 Trigger Warm Reset
     log to console    "Triggering warm reset"
@@ -816,7 +799,7 @@
     ...  Log  **Warning** BMC core dump files exist  level=WARN
 
 Trigger Host Watchdog Error
-    [Documentation]  Inject host watchdog error using BMC.
+    [Documentation]  Inject host watchdog timeout error via REST.
     [Arguments]  ${milliseconds}=1000  ${sleep_time}=5s
     # Description of argument(s):
     # milliseconds  The time watchdog timer value in milliseconds (e.g. 1000 =
@@ -824,10 +807,12 @@
     # sleep_time    Time delay for host watchdog error to get injected.
     #               Default is 5 seconds.
 
-    Execute Command On BMC
-    ...  /usr/sbin/mapper call /org/openbmc/watchdog/host0 org.openbmc.Watchdog set i ${milliseconds}
-    Execute Command On BMC
-    ...  /usr/sbin/mapper call /org/openbmc/watchdog/host0 org.openbmc.Watchdog start
+    ${data}=  Create Dictionary  data=${True}
+    Write Attribute  /xyz/openbmc_project/watchdog/host0  Enabled  data=${data}
+
+    ${data}=  Create Dictionary  data=${milliseconds}
+    Write Attribute  /xyz/openbmc_project/watchdog/host0  TimeRemaining  data=${data}
+
     Sleep  ${sleep_time}
 
 Login To OS Host
diff --git a/tests/test_host_auto_reboot.robot b/tests/test_host_auto_reboot.robot
index e19b5e1..9e469cc 100644
--- a/tests/test_host_auto_reboot.robot
+++ b/tests/test_host_auto_reboot.robot
@@ -14,22 +14,6 @@
 
 *** Test Cases ***
 
-Verify Host Quiesce State Without Auto Reboot
-    # Description of template fields:
-    # Auto Reboot   Host State     Expected Host Action
-    no              Off            No Reboot
-    [Documentation]  Validate "Quiesce" state without auto reboot.
-    [Tags]  Verify_Host_Quiesce_State_Without_Auto_Reboot
-    [Template]  Verify Host Quiesce State
-
-Verify Host Quiesce State With Auto Reboot
-    # Description of template fields:
-    # Auto Reboot   Host State     Expected Host Action
-    yes             Off            Reboot
-    [Documentation]  Validate "Quiesce" state with auto reboot.
-    [Tags]  Verify_Host_Quiesce_State_With_Auto_Reboot
-    [Template]  Verify Host Quiesce State
-
 Verify Host Quiesce State Without Auto Reboot During Boot
     # Description of template fields:
     # Auto Reboot   Host State     Expected Host Action
@@ -38,6 +22,7 @@
     [Tags]  Verify_Host_Quiesce_State_Without_Auto_Reboot_During_Boot
     [Template]  Verify Host Quiesce State
 
+
 Verify Host Quiesce State With Auto Reboot During Boot
     # Description of template fields:
     # Auto Reboot   Host State     Expected Host Action
@@ -60,7 +45,7 @@
 
     Set Auto Reboot  ${auto_reboot}
 
-    Run Keyword If  '${host_state}' == 'Off'  Initiate Host PowerOff
+    Run Keyword If  '${host_state}' == 'Off'  Initiate Host PowerOn
     ...  ELSE IF  '${host_state}' == 'Booting'
     ...  Run Keywords  Initiate Host PowerOff  AND  Initiate Host Boot