blob: 16e94248cead261a1c7fe57ecade0afcd020226c [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
Michael Tritz935c18e2017-03-08 11:45:41 -06009
10Suite Setup Run Keywords Verify logging-test AND
George Keishing184a89a2017-06-27 07:12:16 -050011... Delete Error Logs And Verify
Michael Tritz935c18e2017-03-08 11:45:41 -060012Test Setup Open Connection And Log In
George Keishing845d9dc2017-06-16 14:49:29 -050013Test Teardown Post Test Case Execution
George Keishing184a89a2017-06-27 07:12:16 -050014Suite Teardown Delete Error Logs And Verify
Michael Tritz935c18e2017-03-08 11:45:41 -060015
16*** Test Cases ***
17
18Create Test Error And Verify
19 [Documentation] Create error logs and verify via REST.
20 [Tags] Create_Test_Error_And_Verify
21
22 Create Test Error Log
23 Verify Test Error Log
24
25
26Test Error Persistency On Restart
George Keishing184a89a2017-06-27 07:12:16 -050027 [Documentation] Restart logging service and verify error logs.
Michael Tritz935c18e2017-03-08 11:45:41 -060028 [Tags] Test_Error_Persistency_On_Restart
29
30 Create Test Error Log
31 Verify Test Error Log
32 Execute Command On BMC
33 ... systemctl restart xyz.openbmc_project.Logging.service
34 Sleep 10s reason=Wait for logging service to restart properly.
George Keishing184a89a2017-06-27 07:12:16 -050035 Verify Test Error Log
Michael Tritz935c18e2017-03-08 11:45:41 -060036
37
George Keishing742b0602017-07-28 14:20:53 -050038Test Error Entry Numbering Reset On Restart
39 [Documentation] Restarts logging service and verify error logs entry start
40 ... from entry "Id" 1.
41 # 1. Create error log.
42 # 2. Verify error log.
43 # 3. Delete error log.
44 # 4. Restart logging service.
45 # 5. Create error log.
46 # 6. Verify new error log entry starts with Id entry 1.
47
48 [Tags] Test_Error_Entry_Numbering_Reset_On_Restart
49 # Example Error logs:
50 # "/xyz/openbmc_project/logging/entry/1": {
51 # "AdditionalData": [
52 # "STRING=FOO"
53 # ],
54 # "Id": 1, <--- Entry value should be 1.
55 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
56 # "Resolved": 0,
57 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
58 # "Timestamp": 1490818990051,
59 # "associations": []
60 # },
61
62 Create Test Error Log
63 Verify Test Error Log
64 Delete Error Logs
65 Execute Command On BMC
66 ... systemctl restart xyz.openbmc_project.Logging.service
67 Sleep 10s reason=Wait for logging service to restart properly.
68 Create Test Error Log
69 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
70 ${entry_id}= Read Attribute ${elog_entry[0]} Id
71 Should Be Equal ${entry_id} ${1}
72
73
Michael Tritz935c18e2017-03-08 11:45:41 -060074Test Error Persistency On Reboot
George Keishing184a89a2017-06-27 07:12:16 -050075 [Documentation] Reboot BMC and verify error logs.
Michael Tritz935c18e2017-03-08 11:45:41 -060076 [Tags] Test_Error_Persistency_On_Reboot
77
78 Create Test Error Log
79 Verify Test Error Log
80 Initiate BMC Reboot
81 Wait Until Keyword Succeeds 10 min 10 sec
82 ... Is BMC Ready
George Keishing184a89a2017-06-27 07:12:16 -050083 Verify Test Error Log
Michael Tritz935c18e2017-03-08 11:45:41 -060084
85
George Keishing04bc4812017-03-30 03:33:31 -050086Create Test Error And Verify Resolved Field
87 [Documentation] Create error log and verify "Resolved"
88 ... field is 0.
89 [Tags] Create_Test_Error_And_Verify_Resolved_Field
90
91 # Example Error log:
92 # "/xyz/openbmc_project/logging/entry/1": {
93 # "AdditionalData": [
94 # "STRING=FOO"
95 # ],
96 # "Id": 1,
97 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
98 # "Resolved": 0,
99 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
100 # "Timestamp": 1490817164983,
101 # "associations": []
102 # },
103
104 # It's work in progress, but it's mnfg need. To mark an error as
105 # resolved, without deleting the error, mfg will set this bool
106 # property.
107 # In this test context we are making sure "Resolved" field is "0"
108 # by default.
109
George Keishing6eb10b82017-06-06 10:02:09 -0500110 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500111 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500112 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
113 ${resolved}= Read Attribute ${elog_entry[0]} Resolved
George Keishing04bc4812017-03-30 03:33:31 -0500114 Should Be True ${resolved} == 0
115
116
117Create Test Errors And Verify Time Stamp
118 [Documentation] Create error logs and verify time stamp.
119 [Tags] Create_Test_Error_And_Verify_Time_Stamp
120
121 # Example Error logs:
122 # "/xyz/openbmc_project/logging/entry/1": {
123 # "AdditionalData": [
124 # "STRING=FOO"
125 # ],
126 # "Id": 1,
127 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
128 # "Resolved": 0,
129 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
130 # "Timestamp": 1490818990051, <--- Time stamp
131 # "associations": []
132 # },
133 # "/xyz/openbmc_project/logging/entry/2": {
134 # "AdditionalData": [
135 # "STRING=FOO"
136 # ],
137 # "Id": 2,
138 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
139 # "Resolved": 0,
140 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
141 # "Timestamp": 1490818992116, <---- Time stamp
142 # "associations": []
143 # },
144
George Keishing6eb10b82017-06-06 10:02:09 -0500145 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500146 Create Test Error Log
147 Create Test Error Log
148 # The error log generated is associated with the epoc time and unique
149 # for every error and in increasing time stamp.
George Keishing184a89a2017-06-27 07:12:16 -0500150 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
151 ${time_stamp1}= Read Attribute ${elog_entry[0]} Timestamp
152 ${time_stamp2}= Read Attribute ${elog_entry[1]} Timestamp
George Keishing6eb10b82017-06-06 10:02:09 -0500153 Should Be True ${time_stamp2} > ${time_stamp1}
George Keishing04bc4812017-03-30 03:33:31 -0500154
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500155Create Test Error Log And Delete
156 [Documentation] Create an error log and delete it.
157 [Tags] Create_Test_Error_Log_And_Delete
158
159 Delete Error Logs And Verify
160 Create Test Error Log
161 Delete Error Logs And Verify
162
163Create Multiple Test Error Logs And Delete All
164 [Documentation] Create multiple error logs and delete all.
165 [Tags] Create_Multiple_Test_Error_Logs_And_Delete_All
166
167 Delete Error Logs And Verify
168 Create Test Error Log
169 Create Test Error Log
170 Create Test Error Log
171 Delete Error Logs And Verify
172
173Create Two Test Error Logs And Delete One
174 [Documentation] Create two error logs and delete the first entry.
175 [Tags] Create_Two_Test_Error_Logs_And_Delete_One
176
177 Delete Error Logs And Verify
178 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500179 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500180 Create Test Error Log
George Keishing184a89a2017-06-27 07:12:16 -0500181 Delete Error log Entry ${elog_entry[0]}
182 ${resp}= OpenBMC Get Request ${elog_entry[0]}
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500183 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing04bc4812017-03-30 03:33:31 -0500184
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500185
186Verify IPMI SEL Version
187 [Documentation] Verify IPMI SEL's version info.
188 [Tags] Verify_IPMI_SEL_Version
189
190 ${version_info}= Get IPMI SEL Setting Version
191 ${setting_status}= Fetch From Left ${version_info} (
192 ${setting_status}= Evaluate $setting_status.replace(' ','')
193
194 Should Be True ${setting_status} >= 1.5
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500195 Should Contain ${version_info} v2 compliant case_insensitive=True
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500196
197
George Keishing845d9dc2017-06-16 14:49:29 -0500198Verify Watchdog Timedout Error
199 [Documentation] Trigger watchdog timed out and verify errorlog generated.
200 [Tags] Verify_Watchdog_Timedout_Error
201
202 # Clear errors if there are any.
203 Delete Error Logs
204
205 Initiate Host Boot
206
207 # Check if the watchdog interface is created.
208 Wait Until Keyword Succeeds 3 min 10 sec
209 ... Read Properties /xyz/openbmc_project/watchdog/host0
210
211 Trigger Host Watchdog Error
212
213 Verify Watchdog Errorlog Content
214
215
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500216Verify IPMI SEL Delete
217 [Documentation] Verify IPMI SEL delete operation.
218 [Tags] Verify_IPMI_SEL_Delete
219
220 Delete Error Logs And Verify
221 Create Test Error Log
222
223 ${sel_list}= Run IPMI Standard Command sel list
224 # Example of SEL List:
225 # 4 | 04/21/2017 | 10:51:16 | System Event #0x01 | Undetermined system hardware failure | Asserted
226
227 ${sel_entry}= Fetch from Left ${sel_list} |
228 ${sel_entry}= Evaluate $sel_entry.replace(' ','')
229 ${sel_entry}= Convert To Integer 0x${sel_entry}
230
231 ${sel_delete}= Run IPMI Standard Command sel delete ${sel_entry}
232 Should Be Equal As Strings ${sel_delete} Deleted entry ${sel_entry}
233 ... case_insensitive=True
234
235 ${sel_list}= Run IPMI Standard Command sel list
236 Should Be Equal As Strings ${sel_list} SEL has no entries
237 ... case_insensitive=True
238
239
240Verify Empty SEL
241 [Documentation] Verify empty SEL list.
242 [Tags] Verify_Empty_SEL
243
244 Delete Error Logs And Verify
245
246 ${resp}= Run IPMI Standard Command sel list
247 Should Contain ${resp} SEL has no entries case_insensitive=True
248
249
250Delete Non Existing SEL Entry
251 [Documentation] Delete non existing SEL entry.
252 [Tags] Delete_Non_Existing_SEL_Entry
253
254 Delete Error Logs And Verify
255 ${sel_delete}= Run Keyword And Expect Error *
256 ... Run IPMI Standard Command sel delete 100
257 Should Contain ${sel_delete} Unable to delete entry
258 ... case_insensitive=True
259
260
261Delete Invalid SEL Entry
262 [Documentation] Delete invalid SEL entry.
263 [Tags] Delete_Invalid_SEL_Entry
264
265 ${sel_delete}= Run Keyword And Expect Error *
266 ... Run IPMI Standard Command sel delete abc
267 Should Contain ${sel_delete} Given SEL ID 'abc' is invalid
268 ... case_insensitive=True
269
270
Rahul Maheshwarie89b5092017-06-23 00:24:15 -0500271Verify IPMI SEL Entries
272 [Documentation] Verify IPMI SEL's entries info.
273 [Tags] Verify_IPMI_SEL_Entries
274
275 Delete Error Logs And Verify
276
277 # Generate error logs of random count.
278 ${count}= Evaluate random.randint(1, 5) modules=random
279 Repeat Keyword ${count} Create Test Error Log
280
281 ${sel_entries_count}= Get IPMI SEL Setting Entries
282 Should Be Equal As Strings ${sel_entries_count} ${count}
283
284
285Verify IPMI SEL Last Add Time
286 [Documentation] Verify IPMI SEL's last added timestamp.
287 [Tags] Verify_IPMI_SEL_Last_Add_Time
288
289 Create Test Error Log
290 ${sel_time}= Run IPMI Standard Command sel time get
291 ${sel_time}= Convert Date ${sel_time}
292 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True
293
294 ${sel_last_add_time}= Get IPMI SEL Setting Last Add Time
295 ${sel_last_add_time}= Convert Date ${sel_last_add_time}
296 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=True
297
298 ${time-diff}=
299 ... Subtract Date From Date ${sel_last_add_time} ${sel_time}
300
301 # Verify if the delay in current time check and last add SEL time
302 # is less or equals to 2 seconds.
303 Should Be True ${time-diff} <= 2
304
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500305
Michael Tritz935c18e2017-03-08 11:45:41 -0600306*** Keywords ***
307
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500308Get IPMI SEL Setting
309 [Documentation] Returns status for given IPMI SEL setting.
310 [Arguments] ${setting}
311 # Description of argument(s):
312 # setting SEL setting which needs to be read(e.g. "Last Add Time").
313
314 ${resp}= Run IPMI Standard Command sel info
315
316 ${setting_line}= Get Lines Containing String ${resp} ${setting}
317 ... case-insensitive
Rahul Maheshwarib44b6ec2017-07-05 00:23:03 -0500318 ${setting_status}= Fetch From Right ${setting_line} :${SPACE}
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500319
320 [Return] ${setting_status}
321
322
George Keishing845d9dc2017-06-16 14:49:29 -0500323Verify Watchdog Errorlog Content
324 [Documentation] Verify watchdog errorlog content.
325 # Example:
326 # "/xyz/openbmc_project/logging/entry/1":
327 # {
328 # "AdditionalData": [],
329 # "Id": 1,
330 # "Message": "org.open_power.Host.Error.WatchdogTimedOut",
331 # "Resolved": 0,
332 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Informational",
333 # "Timestamp": 1492715244828,
334 # "associations": []
335 # },
336
George Keishing184a89a2017-06-27 07:12:16 -0500337 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
338 ${elog}= Read Properties ${elog_entry[0]}
George Keishing845d9dc2017-06-16 14:49:29 -0500339 Should Be Equal As Strings
340 ... ${elog["Message"]} org.open_power.Host.Error.WatchdogTimedOut
341 Should Not Be Equal As Strings
342 ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Informational
343
344
Michael Tritz935c18e2017-03-08 11:45:41 -0600345Verify logging-test
346 [Documentation] Verify existence of prerequisite logging-test.
347
348 Open Connection And Log In
349 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
350 Should Be Empty ${stderr}
351 Should Contain ${out} logging-test
352
353Clear Existing Error Logs
354 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
355
356 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
357 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
358 Initiate BMC Reboot
359 Wait Until Keyword Succeeds 10 min 10 sec
360 ... Is BMC Ready
361 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
362 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
363
364Create Test Error Log
365 [Documentation] Generate test error log.
366
367 # Test error log entry example:
368 # "/xyz/openbmc_project/logging/entry/1": {
369 # "AdditionalData": [
370 # "STRING=FOO"
371 # ],
372 # "Id": 1,
373 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
374 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
375 # "Timestamp": 1487743963328,
376 # "associations": []
377 # }
378
379 Execute Command On BMC logging-test -c AutoTestSimple
380
381Verify Test Error Log
382 [Documentation] Verify test error log entries.
George Keishing184a89a2017-06-27 07:12:16 -0500383 ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY}
384 ${entry_id}= Read Attribute ${elog_entry[0]} Message
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500385 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600386 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
George Keishing184a89a2017-06-27 07:12:16 -0500387 ${entry_id}= Read Attribute ${elog_entry[0]} Severity
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500388 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600389 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishing04bc4812017-03-30 03:33:31 -0500390
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500391Delete Error Logs And Verify
392 [Documentation] Delete all error logs and verify.
393
George Keishing6eb10b82017-06-06 10:02:09 -0500394 Delete Error Logs
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500395 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list
396 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing845d9dc2017-06-16 14:49:29 -0500397
398Post Test Case Execution
399 [Documentation] Do the post test teardown.
400 # 1. Capture FFDC on test failure.
401 # 2. Delete error logs.
402 # 3. Close all open SSH connections.
403 # 4. Clear all REST sessions.
404
405 FFDC On Test Case Fail
406 Delete Error Logs
407 Close All Connections
408 Flush REST Sessions
409