leet | de9356e | 2022-03-23 01:39:29 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Module to test out of band IPMI watchdog functionality. |
| 4 | Resource ../lib/ipmi_client.robot |
| 5 | Resource ../lib/openbmc_ffdc.robot |
| 6 | Resource ../lib/boot_utils.robot |
| 7 | Library ../lib/ipmi_utils.py |
| 8 | Library String |
| 9 | Library Collections |
| 10 | Variables ../data/ipmi_raw_cmd_table.py |
| 11 | |
| 12 | *** Variables *** |
| 13 | |
| 14 | ${TIMER_DELAY} 3 |
| 15 | ${POWER_STATE_CHANGE} 20 |
| 16 | |
| 17 | *** Test Cases *** |
| 18 | |
| 19 | Test IPMI Watchdog Timer Does Not Log Bit |
| 20 | [Documentation] Execute out of band set/get do not log bit for watchdog timer. |
| 21 | [Tags] Test_IPMI_Watchdog_Timer_Does_Not_Log_Bit |
| 22 | [Template] Execute IPMI Raw Command And Verify Response Data |
| 23 | |
| 24 | # set_raw_cmd get_raw_cmd resp_expect |
| 25 | ${IPMI_RAW_CMD['Watchdog']['Set'][0]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 26 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][1]} |
| 27 | ${IPMI_RAW_CMD['Watchdog']['Set'][3]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 28 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][3]} |
| 29 | |
| 30 | Test IPMI Watchdog Timer Stop Bit |
| 31 | [Documentation] Execute out of band set/get stop/resume timer stop bit for watchdog timer. |
| 32 | [Tags] Test_IPMI_Watchdog_Timer_Stop_Bit |
| 33 | [Template] Execute IPMI Raw Command And Verify Response Data After Watchdog Expires |
| 34 | |
| 35 | # set_raw_cmd get_raw_cmd resp_expect |
| 36 | ${IPMI_RAW_CMD['Watchdog']['Set'][6]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 37 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][5]} |
| 38 | ${IPMI_RAW_CMD['Watchdog']['Set'][9]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 39 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][7]} |
| 40 | |
| 41 | Test IPMI Watchdog Timer Use Bits |
| 42 | [Documentation] Execute out of band set/get timer use bits for watchdog timer. |
| 43 | [Tags] Test_IPMI_Watchdog_Timer_Use_Bits |
| 44 | [Template] Execute IPMI Raw Command And Verify Response Data |
| 45 | |
| 46 | # set_raw_cmd get_raw_cmd resp_expect |
| 47 | ${IPMI_RAW_CMD['Watchdog']['Set'][12]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 48 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][9]} |
| 49 | ${IPMI_RAW_CMD['Watchdog']['Set'][15]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 50 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][11]} |
| 51 | ${IPMI_RAW_CMD['Watchdog']['Set'][18]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 52 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][13]} |
| 53 | ${IPMI_RAW_CMD['Watchdog']['Set'][21]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 54 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][15]} |
| 55 | ${IPMI_RAW_CMD['Watchdog']['Set'][24]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 56 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][17]} |
| 57 | |
| 58 | Test IPMI Watchdog Timer Pre-Timeout Interrupt Bits |
| 59 | [Documentation] Execute out of band set/get pre-timeout interrupt bits for watchdog timer. |
| 60 | [Tags] Test_IPMI_Watchdog_Timer_Pre-Timeout_Interrupt_Bits |
| 61 | [Template] Execute IPMI Raw Command And Verify Response Data |
| 62 | |
| 63 | # set_raw_cmd get_raw_cmd resp_expect |
| 64 | ${IPMI_RAW_CMD['Watchdog']['Set'][27]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 65 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][19]} |
| 66 | ${IPMI_RAW_CMD['Watchdog']['Set'][30]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 67 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][21]} |
| 68 | |
| 69 | Test IPMI Watchdog Timer Timeout Action Bits |
| 70 | [Documentation] Execute out of band set/get timer timeout bits for watchdog timer. |
| 71 | [Tags] Test_IPMI_Watchdog_Timer_Timeout_Action_Bits |
| 72 | [Template] Execute IPMI Raw Command And Verify Response Data |
| 73 | |
| 74 | # set_raw_cmd get_raw_cmd resp_expect |
| 75 | ${IPMI_RAW_CMD['Watchdog']['Set'][33]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 76 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][23]} |
| 77 | ${IPMI_RAW_CMD['Watchdog']['Set'][36]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 78 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][25]} |
| 79 | ${IPMI_RAW_CMD['Watchdog']['Set'][39]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 80 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][27]} |
| 81 | ${IPMI_RAW_CMD['Watchdog']['Set'][42]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 82 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][29]} |
| 83 | |
| 84 | Test IPMI Watchdog Timer Timeout Flag Bits |
| 85 | [Documentation] Execute out of band set/get timer timeout flag bits for watchdog timer. |
| 86 | [Tags] Test_IPMI_Watchdog_Timer_Timeout_Flag_Bits |
| 87 | [Template] Execute IPMI Raw Command And Verify Timer Expiration Data |
| 88 | |
| 89 | # set_raw_cmd get_raw_cmd resp_expect |
| 90 | ${IPMI_RAW_CMD['Watchdog']['Set'][45]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 91 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][31]} |
| 92 | ${IPMI_RAW_CMD['Watchdog']['Set'][48]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 93 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][33]} |
| 94 | ${IPMI_RAW_CMD['Watchdog']['Set'][51]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 95 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][35]} |
| 96 | ${IPMI_RAW_CMD['Watchdog']['Set'][54]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 97 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][37]} |
| 98 | ${IPMI_RAW_CMD['Watchdog']['Set'][57]} ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 99 | ... ${IPMI_RAW_CMD['Watchdog']['Get'][39]} |
| 100 | |
| 101 | |
| 102 | Verify Timer Action For State Change |
| 103 | [Documentation] Set Watchdog via IPMI raw command and verify timer actions. |
George Keishing | 71fd671 | 2022-03-28 09:56:14 -0500 | [diff] [blame] | 104 | [Tags] Verify_Timer_Action_For_State_Change |
leet | de9356e | 2022-03-23 01:39:29 +0000 | [diff] [blame] | 105 | [Template] Validate Watchdog Timer Actions And SEL Events |
| 106 | |
| 107 | # set action command power state SEL event |
ganesanb | df75fea | 2023-04-28 18:06:02 +0000 | [diff] [blame] | 108 | ${IPMI_RAW_CMD['Watchdog']['Set'][60]} ['off'] Power down |
| 109 | ${IPMI_RAW_CMD['Watchdog']['Set'][63]} ['on'] Hard reset |
leet | de9356e | 2022-03-23 01:39:29 +0000 | [diff] [blame] | 110 | ${IPMI_RAW_CMD['Watchdog']['Set'][66]} ['on'] Power cycle |
| 111 | ${IPMI_RAW_CMD['Watchdog']['Set'][69]} ['on'] Timer expired |
| 112 | |
| 113 | |
| 114 | Verify Reset Timer |
| 115 | [Documentation] Set Watchdog via IPMI raw command and verify Reset Timer functions as expected. |
| 116 | [Tags] Verify_Reset_Timer |
| 117 | |
| 118 | # Check the chassis status. |
| 119 | Power On Host And Verify |
| 120 | |
| 121 | # Set Watchdog Timer initCount(0x3530). |
| 122 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Set'][72]} |
| 123 | |
| 124 | # Get Watchdog Timer. |
| 125 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 126 | Should Contain ${resp} ${IPMI_RAW_CMD['Watchdog']['Get'][41]} |
| 127 | |
| 128 | @{start_timer_value}= Split String ${resp} |
| 129 | |
| 130 | # Convert start value to integer. |
| 131 | # Example: Get watchdog response is 0x06 0x24 0x05 0x00 0x64 0x00 0x64 0x00. |
| 132 | # Start_timer_value is bits 6 - 7; set to 0x64 0x00 (100 ms decimal). |
| 133 | # Reverse bits 6 - 7 due to BMC being little endian; new value is 0x00 0x64. |
| 134 | # Convert hex value 0x00 0x64 to integer; start_timer_integer = 100. |
| 135 | ${value}= Get Slice From List ${start_timer_value} 6 |
| 136 | Reverse List ${value} |
| 137 | ${start_timer_string}= Evaluate "".join(${value}) |
| 138 | ${start_timer_integer} = Convert To Integer ${start_timer_string} 16 |
| 139 | |
| 140 | # Delay. |
| 141 | Sleep ${TIMER_DELAY} |
| 142 | |
| 143 | # Get Watchdog Timer before reset watchdog timer. |
| 144 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 145 | Should Contain ${resp} ${IPMI_RAW_CMD['Watchdog']['Get'][41]} |
| 146 | |
| 147 | FOR ${1} IN ${3} |
| 148 | |
| 149 | # Reset Watchdog Timer. |
| 150 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][0]} |
| 151 | # Delay. |
| 152 | Sleep ${TIMER_DELAY} |
| 153 | Get Watchdog Timer And Compare To Start Value ${start_timer_integer} |
| 154 | |
| 155 | END |
| 156 | |
| 157 | |
| 158 | Verify Pre-timeout Values |
| 159 | [Documentation] Set Watchdog Pre-timeout via IPMI raw command and verify via Get Watchdog Timer. |
| 160 | [Tags] Verify_Pre-timeout_Values |
| 161 | [Template] Validate Watchdog Pre-timeout |
| 162 | |
| 163 | # command response |
| 164 | ${IPMI_RAW_CMD['Watchdog']['Set'][75]} ${EMPTY} |
| 165 | ${IPMI_RAW_CMD['Watchdog']['Set'][81]} ${EMPTY} |
| 166 | ${IPMI_RAW_CMD['Watchdog']['Get'][0]} ${IPMI_RAW_CMD['Watchdog']['Get'][43]} |
| 167 | |
| 168 | Verify Failure For Pre-Timeout Interval Greater Than Initial Count |
| 169 | [Documentation] Set Watchdog Pre-timeout via IPMI raw command and verify via Get Watchdog Timer. |
| 170 | [Tags] Verify_Failure_For_Pre-Timeout_Interval_Greater_Than_Initial_Count |
| 171 | |
| 172 | # Expected to fail: pre-timeout interval (4000) > initial count (1000). |
| 173 | Run Keyword and Expect Error *Invalid data field* |
| 174 | ... Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Set'][78]} |
| 175 | |
| 176 | Verify Invalid Request Data Length |
| 177 | [Documentation] Set Watchdog via IPMI raw command and verify via Get Watchdog Timer. |
| 178 | [Tags] Verify_Invalid_Request_Data_Length |
| 179 | [Template] Watchdog Invalid Request Data Length |
| 180 | |
| 181 | # command |
| 182 | ${IPMI_RAW_CMD['Watchdog']['Set'][84]} |
| 183 | ${IPMI_RAW_CMD['Watchdog']['Set'][87]} |
| 184 | ${IPMI_RAW_CMD['Watchdog']['Get'][45]} |
| 185 | |
| 186 | Verify Invalid Reset Timer Request Data |
| 187 | [Documentation] Set Watchdog via IPMI raw command and verify via Get Watchdog Timer. |
| 188 | [Tags] Verify_Invalid_Reset_Timer_Request_Data |
| 189 | |
| 190 | # Reset Watchdog Timer with one extra byte. |
| 191 | Run Keyword and Expect Error *Request data length* |
| 192 | ... Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][3]} |
| 193 | |
| 194 | # Reset BMC. |
| 195 | Run External IPMI Standard Command mc reset cold -N 10 -R 1 |
| 196 | Check If BMC is Up |
| 197 | |
| 198 | # Reset Watchdog Timer without initialized watchdog. |
| 199 | Run Keyword and Expect Error *Unknown* |
| 200 | ... Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][6]} |
| 201 | |
| 202 | *** Keywords *** |
| 203 | |
| 204 | Execute IPMI Raw Command And Verify Response Data After Watchdog Expires |
| 205 | [Documentation] Execute out of band IPMI raw command and verify response data after watchdog expires. |
| 206 | [Arguments] ${set_raw_cmd} ${get_raw_cmd} ${resp_expect} |
| 207 | # Description of argument(s): |
| 208 | # set_raw_cmd The request bytes for the command. |
| 209 | # get_raw_cmd The response bytes for the command. |
| 210 | # resp_expect The expected response bytes for the command. |
| 211 | |
| 212 | Run IPMI Standard Command raw ${set_raw_cmd} |
| 213 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][0]} |
| 214 | Run IPMI Standard Command raw ${set_raw_cmd} |
| 215 | ${resp}= Run IPMI Standard Command raw ${get_raw_cmd} |
| 216 | Should Contain ${resp} ${resp_expect} msg=Expecting ${resp_expect} but got ${resp}. |
| 217 | |
| 218 | Execute IPMI Raw Command And Verify Response Data |
| 219 | [Documentation] Execute out of band IPMI raw command and verify response data. |
| 220 | [Arguments] ${set_raw_cmd} ${get_raw_cmd} ${resp_expect} |
| 221 | |
| 222 | # Description of argument(s): |
| 223 | # set_raw_cmd The request bytes for the command. |
| 224 | # get_raw_cmd The response bytes for the command. |
| 225 | # resp_expect The expected response bytes for the command. |
| 226 | |
| 227 | Run IPMI Standard Command raw ${set_raw_cmd} |
| 228 | ${resp}= Run IPMI Standard Command raw ${get_raw_cmd} |
| 229 | Should Contain ${resp} ${resp_expect} msg=Expecting ${resp_expect} but got ${resp}. |
| 230 | |
| 231 | Execute IPMI Raw Command And Verify Timer Expiration Data |
| 232 | [Documentation] Execute out of band IPMI raw command and verify timer expiration response data. |
| 233 | [Arguments] ${set_raw_cmd} ${get_raw_cmd} ${resp_expect} |
| 234 | |
| 235 | # Description of argument(s): |
| 236 | # set_raw_cmd The request bytes for the command. |
| 237 | # get_raw_cmd The response bytes for the command. |
| 238 | # resp_expect The expected response bytes for the command. |
| 239 | |
| 240 | Run IPMI Standard Command raw ${set_raw_cmd} |
| 241 | Run IPMI Standard Command raw ${get_raw_cmd} |
| 242 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][0]} |
| 243 | ${resp}= Run IPMI Standard Command raw ${get_raw_cmd} |
| 244 | Should Contain ${resp} ${resp_expect} msg=Expecting ${resp_expect} but got ${resp}. |
| 245 | |
| 246 | Validate Watchdog Timer Actions And SEL Events |
| 247 | [Documentation] Verify the watchdog timer actions and the associated SEL events. |
| 248 | [Arguments] ${set_raw_cmd} ${power_state} ${sel_event} |
| 249 | |
| 250 | # Description of argument(s): |
| 251 | # set_raw_cmd The set timeout action request bytes for the command. |
| 252 | # power_state The expected power state of the host. |
| 253 | # sel_event The response bytes for the command. |
| 254 | |
| 255 | # Check the chassis status. |
| 256 | Power On Host And Verify |
| 257 | |
| 258 | # Clear SEL. |
| 259 | Run IPMI Standard Command sel clear |
| 260 | |
| 261 | # Set watchdog timer action to perform action. |
| 262 | Run IPMI Standard Command raw ${set_raw_cmd} |
| 263 | |
| 264 | # Reset Watchdog Timer. |
| 265 | Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Reset'][0]} |
| 266 | |
| 267 | # Delay for power state. |
| 268 | Sleep ${POWER_STATE_CHANGE} |
| 269 | |
| 270 | Verify Host Power State ${power_state} |
| 271 | Verify Watchdog Timer Action SEL Event ${sel_event} |
| 272 | |
| 273 | |
| 274 | Verify Host Power State |
| 275 | [Documentation] Get host power state using external IPMI command and verify. |
| 276 | [Arguments] ${power_state} |
| 277 | |
| 278 | # Description of argument(s): |
| 279 | # power_state Value of Host power state: "on" or "off". |
| 280 | |
| 281 | ${ipmi_state}= Get Host State Via External IPMI |
| 282 | Valid Value ipmi_state ${power_state} |
| 283 | |
| 284 | Verify Watchdog Timer Action SEL Event |
| 285 | [Documentation] Verify_Watchdog_Timer_Action_SEL_Event. |
| 286 | [Arguments] ${sel_event} |
| 287 | |
| 288 | # Description of argument(s): |
| 289 | # sel_event Text of SEL event after timer action. |
| 290 | |
| 291 | ${resp}= Run IPMI Standard Command sel elist |
| 292 | ${power_status}= Get Lines Containing String ${resp} Watchdog |
| 293 | Should Contain ${power_status} ${sel_event} |
| 294 | |
| 295 | Power On Host And Verify |
| 296 | [Documentation] Power the host on and verify. |
| 297 | |
| 298 | IPMI Power On stack_mode=skip quiet=1 |
| 299 | ${ipmi_state}= Get Host State Via External IPMI |
| 300 | Valid Value ipmi_state ['on'] |
| 301 | |
| 302 | Watchdog Invalid Request Data Length |
| 303 | [Documentation] Verify invalid request bytes for set watchdog returns correct error. |
| 304 | [Arguments] ${watchdog_command} |
| 305 | |
| 306 | # Description of argument(s): |
| 307 | # watchdog_command The raw watchdog IPMI command request bytes. |
| 308 | |
| 309 | Run Keyword and Expect Error *Request data length* |
| 310 | ... Run IPMI Standard Command raw ${watchdog_command} |
| 311 | |
| 312 | Validate Watchdog Pre-timeout |
| 313 | [Documentation] Verify watchdog pre-timeout valid request bytes. |
| 314 | [Arguments] ${watchdog_command} ${response} |
| 315 | |
| 316 | # Description of argument(s): |
| 317 | # watchdog_command The raw watchdog IPMI command request bytes. |
| 318 | # response The expected response bytes. |
| 319 | |
| 320 | ${resp}= Run IPMI Standard Command raw ${watchdog_command} |
| 321 | Should Contain ${resp} ${response} |
| 322 | |
| 323 | Get Watchdog Timer And Compare To Start Value |
| 324 | [Documentation] Get watchdog value, convert to integer, and compare to original start value. |
| 325 | [Arguments] ${start_timer_integer} |
| 326 | |
| 327 | # Description of argument(s): |
| 328 | # start_timer_integer The initial value for the watchdog timer. |
| 329 | |
| 330 | # Get Watchdog Timer. |
| 331 | ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Watchdog']['Get'][0]} |
| 332 | @{timer_value}= Split String ${resp} |
| 333 | |
| 334 | # Convert to integer and compare with start value. |
| 335 | # Example: Get watchdog response is 0x06 0x24 0x05 0x00 0x64 0x00 0x64 0x00. |
| 336 | # Start_timer_value is bits 6 - 7; set to 0x64 0x00 (100 ms decimal). |
| 337 | # Reverse bits 6 - 7 due to BMC being little endian; new value is 0x00 0x64. |
| 338 | # Convert hex value 0x00 0x64 to integer; start_timer_integer = 100. |
| 339 | ${value}= Get Slice From List ${timer_value} 6 |
| 340 | Reverse List ${value} |
| 341 | ${timer_string}= Evaluate "".join(${value}) |
| 342 | ${current_timer_integer}= Convert To Integer ${timer_string} 16 |
George Keishing | 71fd671 | 2022-03-28 09:56:14 -0500 | [diff] [blame] | 343 | Should Be True ${current_timer_integer} < ${start_timer_integer} |