Watchdog: Add Redfish Initiate Auto Reboot
Redfish Initiate Auto Reboot using busctl command.
- Patchset #1: Initial commit.
- Patchset #2: Change per review comments.
Change-Id: I943c5086f87d133ac4b47e3bf5ade7c5849053f2
Signed-off-by: Peter D Phan <peterp@us.ibm.com>
diff --git a/extended/test_watchdog.robot b/extended/test_watchdog.robot
index c11db31..d800191 100644
--- a/extended/test_watchdog.robot
+++ b/extended/test_watchdog.robot
@@ -94,6 +94,7 @@
${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI}
Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
+
*** Keywords ***
Suite Setup Execution
@@ -144,3 +145,4 @@
${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0
Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+
diff --git a/lib/utils.robot b/lib/utils.robot
index 0a8f1cf..6783410 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -944,3 +944,32 @@
${current_state}= Redfish Get States
Dictionaries Should Be Equal ${match_state} ${current_state}
+
+
+Redfish Initiate Auto Reboot
+ [Documentation] Initiate an auto reboot.
+ [Arguments] ${interval}=2000
+
+ # Description of argument(s):
+ # interval Value in milliseconds to set Watchdog interval
+
+ # Set auto reboot policy
+ Redfish Set Auto Reboot RetryAttempts
+
+ # Set watchdog timer
+ Set Watchdog Interval Using Busctl ${interval}
+
+
+
+Set Watchdog Interval Using Busctl
+ [Documentation] Set Watchdog time interval.
+ [Arguments] ${milliseconds}=1000
+
+ # Description of argument(s):
+ # miliseconds Time interval for watchdog timer
+
+ ${cmd}= Set Variable busctl set-property xyz.openbmc_project.Watchdog
+ ... ${HOST_WATCHDOG_URI}
+ ... xyz.openbmc_project.State.Watchdog Interval t ${milliseconds}
+ BMC Execute Command ${cmd}
+