blob: c15f7f1c31c29df53770b15e0741e7150f1d4f29 [file] [log] [blame]
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -05001*** Settings ***
2Documentation This suite tests HOST watchdog timer in Open BMC.
3
4Resource ../lib/rest_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/utils.robot
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06007Resource ../lib/resource.robot
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -05008Resource ../lib/boot_utils.robot
George Keishing1be85f52017-10-30 00:56:17 -05009Resource ../lib/state_manager.robot
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050010
Steven Sombarfac31e92017-12-15 09:40:34 -060011Suite Setup Suite Setup Execution
12Suite Teardown Suite Teardown Execution
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050013Test Teardown FFDC On Test Case Fail
14
15*** Variables ***
16# "skip" boots that aren't needed to get to desired state.
17${stack_mode} skip
18
19*** Test Cases ***
George Keishing98eaba22018-09-07 10:52:20 -050020
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050021Verify Watchdog Setting With Watchdog Disabled
22 [Documentation] Disable watchdog timer and verify watchdog settings
23 ... i.e Enabled, Interval, TimeRemaining.
24 [Tags] Verify_Watchdog_Setting_With_Watchdog_Disabled
25
26 ${initial_interval}= Read Attribute ${HOST_WATCH_DOG_URI} Interval
27 Set Watchdog Setting Using REST Enabled ${False}
28
29 # Check if watchdog has default settings.
30 ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0
George Keishing98eaba22018-09-07 10:52:20 -050031 Should Be Equal As Strings ${properties["Enabled"]} ${False}
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050032 Should Be Equal As Strings ${properties["Interval"]} ${initial_interval}
33 Should Be Equal As Strings ${properties["TimeRemaining"]} 0
34
George Keishing98eaba22018-09-07 10:52:20 -050035
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050036Verify Watchdog Setting With Watchdog Enabled
37 [Documentation] Enable watchdog timer and check if host OS is rebooted
38 ... and verify hostdog settings are reset to default when
39 ... host OS is up.
40 [Tags] Verify_Watchdog_Setting_With_Watchdog_Enabled
41
42 ${initial_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval
43
Sridevi Rameshd5f82ff2018-01-23 03:58:14 -060044 Trigger Host Watchdog Error 2000 30
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050045
George Keishing03c13a42017-11-24 10:52:11 -060046 Wait Until Keyword Succeeds 3 min 10 sec Watchdog Object Should Exist
47
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050048 # Verify if watchdog settings are enabled and timeremaining is reduced.
Rahul Maheshwari3b3843e2018-11-15 04:38:04 -060049 Wait Until Keyword Succeeds 3 min 10 sec Verify Watchdog Enabled
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050050
Anusha Dathatria6300372019-02-19 00:37:30 -060051 Wait Until Keyword Succeeds 300 sec 20 sec Is Host Rebooted
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050052 Wait For Host To Ping ${OS_HOST} 5min 10
53 Wait for OS
54
55 # Check if watchdog settings are reset when host OS is up.
56 ${properties}= Read Properties /xyz/openbmc_project/watchdog/host0
George Keishing98eaba22018-09-07 10:52:20 -050057 Should Be Equal As Strings ${properties["Enabled"]} ${False}
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050058 Should Be Equal As Strings ${properties["Interval"]} ${initial_interval}
59 Should Be Equal As Strings ${properties["TimeRemaining"]} 0
60
George Keishing98eaba22018-09-07 10:52:20 -050061
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050062Modify And Verify Watchdog Timer Interval
63 [Documentation] Modify and verify watchdog timer interval.
64 [Tags] Modify_And_Verify_Watchdog_Timer_Interval
65 [Teardown] Set Watchdog Setting Using REST Interval ${initial_interval}
66
67 ${initial_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval
68 ${random_int}= Evaluate random.randint(10000, 20000) modules=random
69 Set Watchdog Setting Using REST Interval ${random_int}
70 ${modified_time_interval}= Read Attribute ${HOST_WATCHDOG_URI} Interval
71 Should Be Equal As Strings ${modified_time_interval} ${random_int}
72
George Keishing98eaba22018-09-07 10:52:20 -050073
George Keishingb98036a2022-01-31 12:39:47 -060074Modify And Verify Watchdog TimeRemaining
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050075 [Documentation] Modify and verify watchdog 'TimeRemaining'.
76 [Tags] Modify_And_Verify_Watchdog_TimeRemaining
77
78 ${random_int}= Evaluate random.randint(10000, 20000) modules=random
79 Set Watchdog Setting Using REST TimeRemaining ${random_int}
80 ${modified_timeremain}=
81 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
82 Should Not Be Equal As Strings ${random_int} ${modified_timeremain}
83
George Keishing98eaba22018-09-07 10:52:20 -050084
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050085Verify Watchdog URL When Host Is On And Off
86 [Documentation] Verify watchdog URL when host is running
87 ... and when host is off.
88 [Tags] Verify_Watchdog_URL_When_Host_Is_On_And_Off
89
90 ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI}
91 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
92
93 REST Power Off
94 ${resp}= OpenBMC Get Request ${HOST_WATCHDOG_URI}
95 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
96
Peter D Phan49739b22021-09-29 14:30:08 -050097
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -050098*** Keywords ***
99
Steven Sombarfac31e92017-12-15 09:40:34 -0600100Suite Setup Execution
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -0500101 [Documentation] Do test initialization setup.
102 # Check input parameters & check if host OS is up.
103
104 Should Not Be Empty
105 ... ${OS_HOST} msg=You must provide the host name/host IP address.
106 Should Not Be Empty
107 ... ${OS_USERNAME} msg=You must provide OS host user name.
108 Should Not Be Empty
109 ... ${OS_PASSWORD} msg=You must provide OS host user password.
110
111 # Boot to OS.
112 REST Power On
113
Anusha Dathatria6300372019-02-19 00:37:30 -0600114 # Enable auto reboot
115 Set Auto Reboot ${1}
116
Steven Sombarfac31e92017-12-15 09:40:34 -0600117Suite Teardown Execution
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -0500118 [Documentation] Restore watchdog Default setting.
119
120 # Boot to OS.
121 REST Power On
122 Set Watchdog Setting Using REST Enabled ${False}
123
124 Close All Connections
125
126Set Watchdog Setting Using REST
127 [Documentation] Set watchdog setting using REST with a given input
128 ... attribute values.
129 [Arguments] ${setting_name} ${value}
130
131 # Description of argument(s):
132 # setting_name The name of the watchdog setting
133 # (e.g. "Enabled", "Interval", etc.).
134 # value Watchdog setting value(e.g. "Enabled":boolean,
135 # "Interval":Integer, "TimeRemaining":Integer)
136
137 ${valueDict}= Create Dictionary data=${value}
Steven Sombaraaaab222018-12-19 13:16:23 -0600138 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}attr/${setting_name}
Sridevi Ramesh0a7c0aa2017-06-26 13:03:02 -0500139 ... data=${valueDict}
140 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishing03c13a42017-11-24 10:52:11 -0600141
142
143Watchdog Object Should Exist
144 [Documentation] Check if watchdog object exist.
145
George Keishing98253bf2017-12-05 02:08:15 -0600146 ${resp}= OpenBMC Get Request ${WATCHDOG_URI}host0
George Keishing03c13a42017-11-24 10:52:11 -0600147 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
Peter D Phan49739b22021-09-29 14:30:08 -0500148