blob: c78221e8187874280051077166bb17e523650775 [file] [log] [blame]
Michael Tritz935c18e2017-03-08 11:45:41 -06001*** Settings ***
2Documentation Test Error logging.
3
4Resource ../lib/connection_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/utils.robot
7Resource ../lib/state_manager.robot
Rahul Maheshwari92972e72017-06-22 00:59:59 -05008Resource ../lib/ipmi_client.robot
George Keishing1d82dd12017-07-24 01:16:23 -05009Resource ../lib/boot_utils.robot
Michael Tritz935c18e2017-03-08 11:45:41 -060010
11Suite Setup Run Keywords Verify logging-test AND
George Keishing184a89a2017-06-27 07:12:16 -050012... Delete Error Logs And Verify
Michael Tritz935c18e2017-03-08 11:45:41 -060013Test Setup Open Connection And Log In
George Keishing845d9dc2017-06-16 14:49:29 -050014Test Teardown Post Test Case Execution
George Keishing184a89a2017-06-27 07:12:16 -050015Suite Teardown Delete Error Logs And Verify
Michael Tritz935c18e2017-03-08 11:45:41 -060016
George Keishing1d82dd12017-07-24 01:16:23 -050017*** Variables ***
18
19${stack_mode} skip
20
Michael Tritz935c18e2017-03-08 11:45:41 -060021*** Test Cases ***
22
George Keishing1d82dd12017-07-24 01:16:23 -050023Error Log Check After BMC Reboot
24 [Documentation] Check error log after BMC rebooted.
25 [Tags] Error_Log_Check_At_BMC_Ready
26 # 1. Power off.
27 # 2. Delete error logs.
28 # 3. Reboot BMC.
29 # 4. Check if eror log exists.
30
31 REST Power Off
32 Delete Error Logs And Verify
George Keishing3286eb32017-09-05 12:52:05 -050033 OBMC Reboot (off)
George Keishing1d82dd12017-07-24 01:16:23 -050034 Error Logs Should Not Exist
35
36
37Error Log Check After Host Poweron
38 [Documentation] Check error log after host has booted.
39 [Tags] Error_Log_Check_At_Host_Booted
40 # 1. Delete error logs
41 # 1. Power on.
42 # 3. Check if eror log exists.
43
44 Delete Error Logs And Verify
45 REST Power On
46 Error Logs Should Not Exist
47
48
Michael Tritz935c18e2017-03-08 11:45:41 -060049Create Test Error And Verify
50 [Documentation] Create error logs and verify via REST.
51 [Tags] Create_Test_Error_And_Verify
52
53 Create Test Error Log
54 Verify Test Error Log
55
56
57Test Error Persistency On Restart
George Keishing184a89a2017-06-27 07:12:16 -050058 [Documentation] Restart logging service and verify error logs.
Michael Tritz935c18e2017-03-08 11:45:41 -060059 [Tags] Test_Error_Persistency_On_Restart
60
61 Create Test Error Log
62 Verify Test Error Log
63 Execute Command On BMC
64 ... systemctl restart xyz.openbmc_project.Logging.service
65 Sleep 10s reason=Wait for logging service to restart properly.
George Keishing184a89a2017-06-27 07:12:16 -050066 Verify Test Error Log
Michael Tritz935c18e2017-03-08 11:45:41 -060067
68
George Keishing742b0602017-07-28 14:20:53 -050069Test Error Entry Numbering Reset On Restart
70 [Documentation] Restarts logging service and verify error logs entry start
71 ... from entry "Id" 1.
72 # 1. Create error log.
73 # 2. Verify error log.
74 # 3. Delete error log.
75 # 4. Restart logging service.
76 # 5. Create error log.
77 # 6. Verify new error log entry starts with Id entry 1.
78
79 [Tags] Test_Error_Entry_Numbering_Reset_On_Restart
80 # Example Error logs:
81 # "/xyz/openbmc_project/logging/entry/1": {
82 # "AdditionalData": [
83 # "STRING=FOO"
84 # ],
85 # "Id": 1, <--- Entry value should be 1.
86 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
87 # "Resolved": 0,
88 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
89 # "Timestamp": 1490818990051,
90 # "associations": []
91 # },
92
93 Create Test Error Log
94 Verify Test Error Log
95 Delete Error Logs
96 Execute Command On BMC
97 ... systemctl restart xyz.openbmc_project.Logging.service
98 Sleep 10s reason=Wait for logging service to restart properly.
99 Create Test Error Log
100 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
101 ${entry_id}= Read Attribute ${elog_entry[0]} Id
102 Should Be Equal ${entry_id} ${1}
103
104
Michael Tritz935c18e2017-03-08 11:45:41 -0600105Test Error Persistency On Reboot
George Keishing184a89a2017-06-27 07:12:16 -0500106 [Documentation] Reboot BMC and verify error logs.
Michael Tritz935c18e2017-03-08 11:45:41 -0600107 [Tags] Test_Error_Persistency_On_Reboot
108
109 Create Test Error Log
110 Verify Test Error Log
111 Initiate BMC Reboot
112 Wait Until Keyword Succeeds 10 min 10 sec
113 ... Is BMC Ready
George Keishing184a89a2017-06-27 07:12:16 -0500114 Verify Test Error Log
Michael Tritz935c18e2017-03-08 11:45:41 -0600115
116
George Keishing04bc4812017-03-30 03:33:31 -0500117Create Test Error And Verify Resolved Field
118 [Documentation] Create error log and verify "Resolved"
119 ... field is 0.
120 [Tags] Create_Test_Error_And_Verify_Resolved_Field
121
122 # Example Error log:
123 # "/xyz/openbmc_project/logging/entry/1": {
124 # "AdditionalData": [
125 # "STRING=FOO"
126 # ],
127 # "Id": 1,
128 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
129 # "Resolved": 0,
130 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
131 # "Timestamp": 1490817164983,
132 # "associations": []
133 # },
134
135 # It's work in progress, but it's mnfg need. To mark an error as
136 # resolved, without deleting the error, mfg will set this bool
137 # property.
138 # In this test context we are making sure "Resolved" field is "0"
139 # by default.
140
George Keishing6eb10b82017-06-06 10:02:09 -0500141 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500142 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500143 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
144 ${resolved}= Read Attribute ${elog_entry[0]} Resolved
George Keishing04bc4812017-03-30 03:33:31 -0500145 Should Be True ${resolved} == 0
146
147
148Create Test Errors And Verify Time Stamp
149 [Documentation] Create error logs and verify time stamp.
150 [Tags] Create_Test_Error_And_Verify_Time_Stamp
151
152 # Example Error logs:
153 # "/xyz/openbmc_project/logging/entry/1": {
154 # "AdditionalData": [
155 # "STRING=FOO"
156 # ],
157 # "Id": 1,
158 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
159 # "Resolved": 0,
160 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
161 # "Timestamp": 1490818990051, <--- Time stamp
162 # "associations": []
163 # },
164 # "/xyz/openbmc_project/logging/entry/2": {
165 # "AdditionalData": [
166 # "STRING=FOO"
167 # ],
168 # "Id": 2,
169 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
170 # "Resolved": 0,
171 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
172 # "Timestamp": 1490818992116, <---- Time stamp
173 # "associations": []
174 # },
175
George Keishing6eb10b82017-06-06 10:02:09 -0500176 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500177 Create Test Error Log
178 Create Test Error Log
179 # The error log generated is associated with the epoc time and unique
180 # for every error and in increasing time stamp.
George Keishing184a89a2017-06-27 07:12:16 -0500181 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
182 ${time_stamp1}= Read Attribute ${elog_entry[0]} Timestamp
183 ${time_stamp2}= Read Attribute ${elog_entry[1]} Timestamp
George Keishing6eb10b82017-06-06 10:02:09 -0500184 Should Be True ${time_stamp2} > ${time_stamp1}
George Keishing04bc4812017-03-30 03:33:31 -0500185
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500186Create Test Error Log And Delete
187 [Documentation] Create an error log and delete it.
188 [Tags] Create_Test_Error_Log_And_Delete
189
190 Delete Error Logs And Verify
191 Create Test Error Log
192 Delete Error Logs And Verify
193
194Create Multiple Test Error Logs And Delete All
195 [Documentation] Create multiple error logs and delete all.
196 [Tags] Create_Multiple_Test_Error_Logs_And_Delete_All
197
198 Delete Error Logs And Verify
199 Create Test Error Log
200 Create Test Error Log
201 Create Test Error Log
202 Delete Error Logs And Verify
203
204Create Two Test Error Logs And Delete One
205 [Documentation] Create two error logs and delete the first entry.
206 [Tags] Create_Two_Test_Error_Logs_And_Delete_One
207
208 Delete Error Logs And Verify
209 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500210 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500211 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500212 Delete Error log Entry ${elog_entry[0]}
213 ${resp}= OpenBMC Get Request ${elog_entry[0]}
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500214 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing04bc4812017-03-30 03:33:31 -0500215
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500216
217Verify IPMI SEL Version
218 [Documentation] Verify IPMI SEL's version info.
219 [Tags] Verify_IPMI_SEL_Version
220
221 ${version_info}= Get IPMI SEL Setting Version
222 ${setting_status}= Fetch From Left ${version_info} (
223 ${setting_status}= Evaluate $setting_status.replace(' ','')
224
225 Should Be True ${setting_status} >= 1.5
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500226 Should Contain ${version_info} v2 compliant case_insensitive=True
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500227
228
George Keishing845d9dc2017-06-16 14:49:29 -0500229Verify Watchdog Timedout Error
230 [Documentation] Trigger watchdog timed out and verify errorlog generated.
231 [Tags] Verify_Watchdog_Timedout_Error
232
233 # Clear errors if there are any.
234 Delete Error Logs
235
236 Initiate Host Boot
237
238 # Check if the watchdog interface is created.
239 Wait Until Keyword Succeeds 3 min 10 sec
240 ... Read Properties /xyz/openbmc_project/watchdog/host0
241
242 Trigger Host Watchdog Error
243
244 Verify Watchdog Errorlog Content
245
246
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500247Verify IPMI SEL Delete
248 [Documentation] Verify IPMI SEL delete operation.
249 [Tags] Verify_IPMI_SEL_Delete
250
251 Delete Error Logs And Verify
252 Create Test Error Log
253
254 ${sel_list}= Run IPMI Standard Command sel list
255 # Example of SEL List:
256 # 4 | 04/21/2017 | 10:51:16 | System Event #0x01 | Undetermined system hardware failure | Asserted
257
258 ${sel_entry}= Fetch from Left ${sel_list} |
259 ${sel_entry}= Evaluate $sel_entry.replace(' ','')
260 ${sel_entry}= Convert To Integer 0x${sel_entry}
261
262 ${sel_delete}= Run IPMI Standard Command sel delete ${sel_entry}
263 Should Be Equal As Strings ${sel_delete} Deleted entry ${sel_entry}
264 ... case_insensitive=True
265
266 ${sel_list}= Run IPMI Standard Command sel list
267 Should Be Equal As Strings ${sel_list} SEL has no entries
268 ... case_insensitive=True
269
270
271Verify Empty SEL
272 [Documentation] Verify empty SEL list.
273 [Tags] Verify_Empty_SEL
274
275 Delete Error Logs And Verify
276
277 ${resp}= Run IPMI Standard Command sel list
278 Should Contain ${resp} SEL has no entries case_insensitive=True
279
280
281Delete Non Existing SEL Entry
282 [Documentation] Delete non existing SEL entry.
283 [Tags] Delete_Non_Existing_SEL_Entry
284
285 Delete Error Logs And Verify
286 ${sel_delete}= Run Keyword And Expect Error *
287 ... Run IPMI Standard Command sel delete 100
288 Should Contain ${sel_delete} Unable to delete entry
289 ... case_insensitive=True
290
291
292Delete Invalid SEL Entry
293 [Documentation] Delete invalid SEL entry.
294 [Tags] Delete_Invalid_SEL_Entry
295
296 ${sel_delete}= Run Keyword And Expect Error *
297 ... Run IPMI Standard Command sel delete abc
298 Should Contain ${sel_delete} Given SEL ID 'abc' is invalid
299 ... case_insensitive=True
300
301
Rahul Maheshwarie89b5092017-06-23 00:24:15 -0500302Verify IPMI SEL Entries
303 [Documentation] Verify IPMI SEL's entries info.
304 [Tags] Verify_IPMI_SEL_Entries
305
306 Delete Error Logs And Verify
307
308 # Generate error logs of random count.
309 ${count}= Evaluate random.randint(1, 5) modules=random
310 Repeat Keyword ${count} Create Test Error Log
311
312 ${sel_entries_count}= Get IPMI SEL Setting Entries
313 Should Be Equal As Strings ${sel_entries_count} ${count}
314
315
316Verify IPMI SEL Last Add Time
317 [Documentation] Verify IPMI SEL's last added timestamp.
318 [Tags] Verify_IPMI_SEL_Last_Add_Time
319
320 Create Test Error Log
321 ${sel_time}= Run IPMI Standard Command sel time get
322 ${sel_time}= Convert Date ${sel_time}
323 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True
324
325 ${sel_last_add_time}= Get IPMI SEL Setting Last Add Time
326 ${sel_last_add_time}= Convert Date ${sel_last_add_time}
327 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True
328
329 ${time-diff}=
330 ... Subtract Date From Date ${sel_last_add_time} ${sel_time}
331
332 # Verify if the delay in current time check and last add SEL time
333 # is less or equals to 2 seconds.
334 Should Be True ${time-diff} <= 2
335
Sweta Potthuri96d82492017-08-23 09:03:38 -0500336Verify Error Logs Capping
337 [Documentation] Verify error logs capping.
338 [Tags] Verify_Error_Logs_Capping
339
340 Delete Error Logs And Verify
341 ${cmd}= Set Variable
342 ... for i in {1..101}; do logging-test -c AutoTestSimple;done
343 Execute Command On BMC ${cmd}
344 ${count}= Count Error Entries
345 Run Keyword If ${count} > 100
346 ... Fail Error logs created exceeded max capacity 100.
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500347
Michael Tritz935c18e2017-03-08 11:45:41 -0600348*** Keywords ***
349
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500350Get IPMI SEL Setting
351 [Documentation] Returns status for given IPMI SEL setting.
352 [Arguments] ${setting}
353 # Description of argument(s):
354 # setting SEL setting which needs to be read(e.g. "Last Add Time").
355
356 ${resp}= Run IPMI Standard Command sel info
357
358 ${setting_line}= Get Lines Containing String ${resp} ${setting}
359 ... case-insensitive
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500360 ${setting_status}= Fetch From Right ${setting_line} :${SPACE}
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500361
362 [Return] ${setting_status}
363
364
George Keishing845d9dc2017-06-16 14:49:29 -0500365Verify Watchdog Errorlog Content
366 [Documentation] Verify watchdog errorlog content.
367 # Example:
368 # "/xyz/openbmc_project/logging/entry/1":
369 # {
370 # "AdditionalData": [],
371 # "Id": 1,
372 # "Message": "org.open_power.Host.Error.WatchdogTimedOut",
373 # "Resolved": 0,
374 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Informational",
375 # "Timestamp": 1492715244828,
376 # "associations": []
377 # },
378
George Keishing184a89a2017-06-27 07:12:16 -0500379 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
380 ${elog}= Read Properties ${elog_entry[0]}
George Keishing845d9dc2017-06-16 14:49:29 -0500381 Should Be Equal As Strings
382 ... ${elog["Message"]} org.open_power.Host.Error.WatchdogTimedOut
383 Should Not Be Equal As Strings
384 ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Informational
385
386
Michael Tritz935c18e2017-03-08 11:45:41 -0600387Verify logging-test
388 [Documentation] Verify existence of prerequisite logging-test.
389
390 Open Connection And Log In
391 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
392 Should Be Empty ${stderr}
393 Should Contain ${out} logging-test
394
395Clear Existing Error Logs
396 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
397
398 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
399 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
400 Initiate BMC Reboot
401 Wait Until Keyword Succeeds 10 min 10 sec
402 ... Is BMC Ready
403 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
404 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
405
406Create Test Error Log
407 [Documentation] Generate test error log.
408
409 # Test error log entry example:
410 # "/xyz/openbmc_project/logging/entry/1": {
411 # "AdditionalData": [
412 # "STRING=FOO"
413 # ],
414 # "Id": 1,
415 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
416 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
417 # "Timestamp": 1487743963328,
418 # "associations": []
419 # }
420
421 Execute Command On BMC logging-test -c AutoTestSimple
422
Sweta Potthuri96d82492017-08-23 09:03:38 -0500423Count Error Entries
424 [Documentation] Count Error entries.
425
426 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}
427 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
428 ${jsondata}= To JSON ${resp.content}
429 ${count}= Get Length ${jsondata["data"]}
430 [Return] ${count}
431
Michael Tritz935c18e2017-03-08 11:45:41 -0600432Verify Test Error Log
433 [Documentation] Verify test error log entries.
George Keishing184a89a2017-06-27 07:12:16 -0500434 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
435 ${entry_id}= Read Attribute ${elog_entry[0]} Message
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500436 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600437 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
George Keishing184a89a2017-06-27 07:12:16 -0500438 ${entry_id}= Read Attribute ${elog_entry[0]} Severity
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500439 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600440 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishing04bc4812017-03-30 03:33:31 -0500441
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500442Delete Error Logs And Verify
443 [Documentation] Delete all error logs and verify.
444
George Keishing6eb10b82017-06-06 10:02:09 -0500445 Delete Error Logs
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500446 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list
447 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing845d9dc2017-06-16 14:49:29 -0500448
449Post Test Case Execution
450 [Documentation] Do the post test teardown.
451 # 1. Capture FFDC on test failure.
452 # 2. Delete error logs.
453 # 3. Close all open SSH connections.
454 # 4. Clear all REST sessions.
455
456 FFDC On Test Case Fail
457 Delete Error Logs
458 Close All Connections