blob: 18172399a9a55459c60185e5c650171da3a2bbc1 [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 Keishing6eb10b82017-06-06 10:02:09 -050011... Delete Error Logs
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
Michael Tritz935c18e2017-03-08 11:45:41 -060014
15*** Test Cases ***
16
17Create Test Error And Verify
18 [Documentation] Create error logs and verify via REST.
19 [Tags] Create_Test_Error_And_Verify
20
21 Create Test Error Log
22 Verify Test Error Log
23
24
25Test Error Persistency On Restart
26 [Documentation] Restart logging service and verify error logs don't exist.
27 [Tags] Test_Error_Persistency_On_Restart
28
29 Create Test Error Log
30 Verify Test Error Log
31 Execute Command On BMC
32 ... systemctl restart xyz.openbmc_project.Logging.service
33 Sleep 10s reason=Wait for logging service to restart properly.
34 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
35 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
36
37
38Test Error Persistency On Reboot
39 [Documentation] Reboot BMC and verify error logs don't exist.
40 [Tags] Test_Error_Persistency_On_Reboot
41
42 Create Test Error Log
43 Verify Test Error Log
44 Initiate BMC Reboot
45 Wait Until Keyword Succeeds 10 min 10 sec
46 ... Is BMC Ready
47 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
48 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
49
50
George Keishing04bc4812017-03-30 03:33:31 -050051Create Test Error And Verify Resolved Field
52 [Documentation] Create error log and verify "Resolved"
53 ... field is 0.
54 [Tags] Create_Test_Error_And_Verify_Resolved_Field
55
56 # Example Error log:
57 # "/xyz/openbmc_project/logging/entry/1": {
58 # "AdditionalData": [
59 # "STRING=FOO"
60 # ],
61 # "Id": 1,
62 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
63 # "Resolved": 0,
64 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
65 # "Timestamp": 1490817164983,
66 # "associations": []
67 # },
68
69 # It's work in progress, but it's mnfg need. To mark an error as
70 # resolved, without deleting the error, mfg will set this bool
71 # property.
72 # In this test context we are making sure "Resolved" field is "0"
73 # by default.
74
George Keishing6eb10b82017-06-06 10:02:09 -050075 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -050076 Create Test Error Log
77 ${resolved}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Resolved
78 Should Be True ${resolved} == 0
79
80
81Create Test Errors And Verify Time Stamp
82 [Documentation] Create error logs and verify time stamp.
83 [Tags] Create_Test_Error_And_Verify_Time_Stamp
84
85 # Example Error logs:
86 # "/xyz/openbmc_project/logging/entry/1": {
87 # "AdditionalData": [
88 # "STRING=FOO"
89 # ],
90 # "Id": 1,
91 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
92 # "Resolved": 0,
93 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
94 # "Timestamp": 1490818990051, <--- Time stamp
95 # "associations": []
96 # },
97 # "/xyz/openbmc_project/logging/entry/2": {
98 # "AdditionalData": [
99 # "STRING=FOO"
100 # ],
101 # "Id": 2,
102 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
103 # "Resolved": 0,
104 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
105 # "Timestamp": 1490818992116, <---- Time stamp
106 # "associations": []
107 # },
108
George Keishing6eb10b82017-06-06 10:02:09 -0500109 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500110 Create Test Error Log
111 Create Test Error Log
112 # The error log generated is associated with the epoc time and unique
113 # for every error and in increasing time stamp.
114 ${time_stamp1}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Timestamp
115 ${time_stamp2}= Read Attribute ${BMC_LOGGING_ENTRY}${2} Timestamp
George Keishing6eb10b82017-06-06 10:02:09 -0500116 Should Be True ${time_stamp2} > ${time_stamp1}
George Keishing04bc4812017-03-30 03:33:31 -0500117
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500118Create Test Error Log And Delete
119 [Documentation] Create an error log and delete it.
120 [Tags] Create_Test_Error_Log_And_Delete
121
122 Delete Error Logs And Verify
123 Create Test Error Log
124 Delete Error Logs And Verify
125
126Create Multiple Test Error Logs And Delete All
127 [Documentation] Create multiple error logs and delete all.
128 [Tags] Create_Multiple_Test_Error_Logs_And_Delete_All
129
130 Delete Error Logs And Verify
131 Create Test Error Log
132 Create Test Error Log
133 Create Test Error Log
134 Delete Error Logs And Verify
135
136Create Two Test Error Logs And Delete One
137 [Documentation] Create two error logs and delete the first entry.
138 [Tags] Create_Two_Test_Error_Logs_And_Delete_One
139
140 Delete Error Logs And Verify
141 Create Test Error Log
142 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Id
143 Create Test Error Log
144 Delete Error log Entry ${BMC_LOGGING_ENTRY}/${entry_id}
145 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/${entry_id}
146 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
147 Delete Error Logs And Verify
George Keishing04bc4812017-03-30 03:33:31 -0500148
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500149
150Verify IPMI SEL Version
151 [Documentation] Verify IPMI SEL's version info.
152 [Tags] Verify_IPMI_SEL_Version
153
154 ${version_info}= Get IPMI SEL Setting Version
155 ${setting_status}= Fetch From Left ${version_info} (
156 ${setting_status}= Evaluate $setting_status.replace(' ','')
157
158 Should Be True ${setting_status} >= 1.5
159 Should Contain ${version_info} v2compliant case_insensitive=True
160
161
George Keishing845d9dc2017-06-16 14:49:29 -0500162Verify Watchdog Timedout Error
163 [Documentation] Trigger watchdog timed out and verify errorlog generated.
164 [Tags] Verify_Watchdog_Timedout_Error
165
166 # Clear errors if there are any.
167 Delete Error Logs
168
169 Initiate Host Boot
170
171 # Check if the watchdog interface is created.
172 Wait Until Keyword Succeeds 3 min 10 sec
173 ... Read Properties /xyz/openbmc_project/watchdog/host0
174
175 Trigger Host Watchdog Error
176
177 Verify Watchdog Errorlog Content
178
179
Michael Tritz935c18e2017-03-08 11:45:41 -0600180*** Keywords ***
181
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500182Get IPMI SEL Setting
183 [Documentation] Returns status for given IPMI SEL setting.
184 [Arguments] ${setting}
185 # Description of argument(s):
186 # setting SEL setting which needs to be read(e.g. "Last Add Time").
187
188 ${resp}= Run IPMI Standard Command sel info
189
190 ${setting_line}= Get Lines Containing String ${resp} ${setting}
191 ... case-insensitive
192 ${setting_status}= Fetch From Right ${setting_line} :
193 ${setting_status}= Evaluate $setting_status.replace(' ','')
194
195 [Return] ${setting_status}
196
197
George Keishing845d9dc2017-06-16 14:49:29 -0500198Verify Watchdog Errorlog Content
199 [Documentation] Verify watchdog errorlog content.
200 # Example:
201 # "/xyz/openbmc_project/logging/entry/1":
202 # {
203 # "AdditionalData": [],
204 # "Id": 1,
205 # "Message": "org.open_power.Host.Error.WatchdogTimedOut",
206 # "Resolved": 0,
207 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Informational",
208 # "Timestamp": 1492715244828,
209 # "associations": []
210 # },
211
212 ${elog}= Read Properties /xyz/openbmc_project/logging/entry/1
213 Should Be Equal As Strings
214 ... ${elog["Message"]} org.open_power.Host.Error.WatchdogTimedOut
215 Should Not Be Equal As Strings
216 ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Informational
217
218
Michael Tritz935c18e2017-03-08 11:45:41 -0600219Verify logging-test
220 [Documentation] Verify existence of prerequisite logging-test.
221
222 Open Connection And Log In
223 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
224 Should Be Empty ${stderr}
225 Should Contain ${out} logging-test
226
227Clear Existing Error Logs
228 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
229
230 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
231 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
232 Initiate BMC Reboot
233 Wait Until Keyword Succeeds 10 min 10 sec
234 ... Is BMC Ready
235 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
236 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
237
238Create Test Error Log
239 [Documentation] Generate test error log.
240
241 # Test error log entry example:
242 # "/xyz/openbmc_project/logging/entry/1": {
243 # "AdditionalData": [
244 # "STRING=FOO"
245 # ],
246 # "Id": 1,
247 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
248 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
249 # "Timestamp": 1487743963328,
250 # "associations": []
251 # }
252
253 Execute Command On BMC logging-test -c AutoTestSimple
254
255Verify Test Error Log
256 [Documentation] Verify test error log entries.
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500257 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message
258 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600259 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500260 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity
261 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600262 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishing04bc4812017-03-30 03:33:31 -0500263
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500264Delete Error Logs And Verify
265 [Documentation] Delete all error logs and verify.
266
George Keishing6eb10b82017-06-06 10:02:09 -0500267 Delete Error Logs
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500268 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list
269 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
George Keishing845d9dc2017-06-16 14:49:29 -0500270
271Post Test Case Execution
272 [Documentation] Do the post test teardown.
273 # 1. Capture FFDC on test failure.
274 # 2. Delete error logs.
275 # 3. Close all open SSH connections.
276 # 4. Clear all REST sessions.
277
278 FFDC On Test Case Fail
279 Delete Error Logs
280 Close All Connections
281 Flush REST Sessions
282