blob: 879c531afa892b34bc391ff3c8bfe9bd872ab728 [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
13Test Teardown Close All Connections
George Keishing6eb10b82017-06-06 10:02:09 -050014Suite Teardown Delete Error Logs
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
27 [Documentation] Restart logging service and verify error logs don't exist.
28 [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.
35 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
36 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
37
38
39Test Error Persistency On Reboot
40 [Documentation] Reboot BMC and verify error logs don't exist.
41 [Tags] Test_Error_Persistency_On_Reboot
42
43 Create Test Error Log
44 Verify Test Error Log
45 Initiate BMC Reboot
46 Wait Until Keyword Succeeds 10 min 10 sec
47 ... Is BMC Ready
48 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
49 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
50
51
George Keishing04bc4812017-03-30 03:33:31 -050052Create Test Error And Verify Resolved Field
53 [Documentation] Create error log and verify "Resolved"
54 ... field is 0.
55 [Tags] Create_Test_Error_And_Verify_Resolved_Field
56
57 # Example Error log:
58 # "/xyz/openbmc_project/logging/entry/1": {
59 # "AdditionalData": [
60 # "STRING=FOO"
61 # ],
62 # "Id": 1,
63 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
64 # "Resolved": 0,
65 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
66 # "Timestamp": 1490817164983,
67 # "associations": []
68 # },
69
70 # It's work in progress, but it's mnfg need. To mark an error as
71 # resolved, without deleting the error, mfg will set this bool
72 # property.
73 # In this test context we are making sure "Resolved" field is "0"
74 # by default.
75
George Keishing6eb10b82017-06-06 10:02:09 -050076 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -050077 Create Test Error Log
78 ${resolved}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Resolved
79 Should Be True ${resolved} == 0
80
81
82Create Test Errors And Verify Time Stamp
83 [Documentation] Create error logs and verify time stamp.
84 [Tags] Create_Test_Error_And_Verify_Time_Stamp
85
86 # Example Error logs:
87 # "/xyz/openbmc_project/logging/entry/1": {
88 # "AdditionalData": [
89 # "STRING=FOO"
90 # ],
91 # "Id": 1,
92 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
93 # "Resolved": 0,
94 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
95 # "Timestamp": 1490818990051, <--- Time stamp
96 # "associations": []
97 # },
98 # "/xyz/openbmc_project/logging/entry/2": {
99 # "AdditionalData": [
100 # "STRING=FOO"
101 # ],
102 # "Id": 2,
103 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
104 # "Resolved": 0,
105 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
106 # "Timestamp": 1490818992116, <---- Time stamp
107 # "associations": []
108 # },
109
George Keishing6eb10b82017-06-06 10:02:09 -0500110 Delete Error Logs
George Keishing04bc4812017-03-30 03:33:31 -0500111 Create Test Error Log
112 Create Test Error Log
113 # The error log generated is associated with the epoc time and unique
114 # for every error and in increasing time stamp.
115 ${time_stamp1}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Timestamp
116 ${time_stamp2}= Read Attribute ${BMC_LOGGING_ENTRY}${2} Timestamp
George Keishing6eb10b82017-06-06 10:02:09 -0500117 Should Be True ${time_stamp2} > ${time_stamp1}
George Keishing04bc4812017-03-30 03:33:31 -0500118
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500119Create Test Error Log And Delete
120 [Documentation] Create an error log and delete it.
121 [Tags] Create_Test_Error_Log_And_Delete
122
123 Delete Error Logs And Verify
124 Create Test Error Log
125 Delete Error Logs And Verify
126
127Create Multiple Test Error Logs And Delete All
128 [Documentation] Create multiple error logs and delete all.
129 [Tags] Create_Multiple_Test_Error_Logs_And_Delete_All
130
131 Delete Error Logs And Verify
132 Create Test Error Log
133 Create Test Error Log
134 Create Test Error Log
135 Delete Error Logs And Verify
136
137Create Two Test Error Logs And Delete One
138 [Documentation] Create two error logs and delete the first entry.
139 [Tags] Create_Two_Test_Error_Logs_And_Delete_One
140
141 Delete Error Logs And Verify
142 Create Test Error Log
143 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Id
144 Create Test Error Log
145 Delete Error log Entry ${BMC_LOGGING_ENTRY}/${entry_id}
146 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/${entry_id}
147 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
148 Delete Error Logs And Verify
George Keishing04bc4812017-03-30 03:33:31 -0500149
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500150
151Verify IPMI SEL Version
152 [Documentation] Verify IPMI SEL's version info.
153 [Tags] Verify_IPMI_SEL_Version
154
155 ${version_info}= Get IPMI SEL Setting Version
156 ${setting_status}= Fetch From Left ${version_info} (
157 ${setting_status}= Evaluate $setting_status.replace(' ','')
158
159 Should Be True ${setting_status} >= 1.5
160 Should Contain ${version_info} v2compliant case_insensitive=True
161
162
Michael Tritz935c18e2017-03-08 11:45:41 -0600163*** Keywords ***
164
Rahul Maheshwari92972e72017-06-22 00:59:59 -0500165Get IPMI SEL Setting
166 [Documentation] Returns status for given IPMI SEL setting.
167 [Arguments] ${setting}
168 # Description of argument(s):
169 # setting SEL setting which needs to be read(e.g. "Last Add Time").
170
171 ${resp}= Run IPMI Standard Command sel info
172
173 ${setting_line}= Get Lines Containing String ${resp} ${setting}
174 ... case-insensitive
175 ${setting_status}= Fetch From Right ${setting_line} :
176 ${setting_status}= Evaluate $setting_status.replace(' ','')
177
178 [Return] ${setting_status}
179
180
Michael Tritz935c18e2017-03-08 11:45:41 -0600181Verify logging-test
182 [Documentation] Verify existence of prerequisite logging-test.
183
184 Open Connection And Log In
185 ${out} ${stderr}= Execute Command which logging-test return_stderr=True
186 Should Be Empty ${stderr}
187 Should Contain ${out} logging-test
188
189Clear Existing Error Logs
190 [Documentation] If error log isn't empty, reboot the BMC to clear the log.
191
192 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
193 Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND}
194 Initiate BMC Reboot
195 Wait Until Keyword Succeeds 10 min 10 sec
196 ... Is BMC Ready
197 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1}
198 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}
199
200Create Test Error Log
201 [Documentation] Generate test error log.
202
203 # Test error log entry example:
204 # "/xyz/openbmc_project/logging/entry/1": {
205 # "AdditionalData": [
206 # "STRING=FOO"
207 # ],
208 # "Id": 1,
209 # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple",
210 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
211 # "Timestamp": 1487743963328,
212 # "associations": []
213 # }
214
215 Execute Command On BMC logging-test -c AutoTestSimple
216
217Verify Test Error Log
218 [Documentation] Verify test error log entries.
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500219 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Message
220 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600221 ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500222 ${entry_id}= Read Attribute ${BMC_LOGGING_ENTRY}${1} Severity
223 Should Be Equal ${entry_id}
Michael Tritz935c18e2017-03-08 11:45:41 -0600224 ... xyz.openbmc_project.Logging.Entry.Level.Error
George Keishing04bc4812017-03-30 03:33:31 -0500225
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500226Delete Error Logs And Verify
227 [Documentation] Delete all error logs and verify.
228
George Keishing6eb10b82017-06-06 10:02:09 -0500229 Delete Error Logs
Sweta Potthuri9ce8eeb2017-05-08 04:20:11 -0500230 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/list
231 Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND}