blob: f4f8595550c05292a479b1e8794a1ee42cd5b999 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing4d6c1da2016-07-15 05:51:22 -05002Documentation This suite is used for testing eventlog association.
Chris Austenb29d2e82016-06-07 12:25:35 -05003
George Keishing4d6c1da2016-07-15 05:51:22 -05004Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
6Resource ../lib/connection_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Library Collections
10
George Keishingd434c512016-10-07 06:46:29 -050011Suite Setup Suite Initialization Setup
George Keishing4d6c1da2016-07-15 05:51:22 -050012Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050013
George Keishingd55a4be2016-08-26 03:28:17 -050014Test Teardown Log FFDC
15
Chris Austenb29d2e82016-06-07 12:25:35 -050016*** Variables ***
17
18${SYSTEM_SHUTDOWN_TIME} 1min
19
20${WAIT_FOR_SERVICES_UP} 3min
21
22${CREATE_ERROR_SINGLE_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing failure" "/org/openbmc/inventory/system/chassis/motherboard/dimm1" 1 1
23
24${CREATE_ERROR_INVALID_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with invalid FRU" "abc" 1 1
25
26${CREATE_ERROR_NO_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with no fru" "" 1 1
27
28${CREATE_ERROR_VIRTUAL_SENSOR} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with a virtual sensor" "/org/openbmc/inventory/system/systemevent " 1 1
29
30${DIMM1_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm1
31
32${DIMM2_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm2
33
34${DIMM3_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm3
35
36&{NIL} data=@{EMPTY}
37
George Keishingd434c512016-10-07 06:46:29 -050038${EVENT_RECORD} /org/openbmc/records/events
39
Chris Austenb29d2e82016-06-07 12:25:35 -050040*** Test Cases ***
41
42Create error log on single FRU
43 [Documentation] ***GOOD PATH***
44 ... Create an error log on single FRU and verify
45 ... its association.\n
George Keishing97651c72016-10-04 00:44:15 -050046 [Tags] Create_error_log_on_single_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050047
George Keishingd434c512016-10-07 06:46:29 -050048 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -050049
George Keishingd434c512016-10-07 06:46:29 -050050 ${elog} ${stderr}=
51 ... Execute Command ${CREATE_ERROR_SINGLE_FRU}
52 ... return_stderr=True
53 Should Be Empty ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -050054
55 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -050056 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -050057
George Keishingd434c512016-10-07 06:46:29 -050058 ${association_uri} =
59 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
60
61 ${association_content} =
62 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050063 Should Contain ${association_content} ${DIMM1_URI}
64
65 ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints
66 Should Contain ${dimm1_event} ${log_list[0]}
67
68
69Create error log on two FRU
70 [Documentation] ***GOOD PATH***
71 ... Create an error log on two FRUs and verify
72 ... its association.\n
73
74 ${log_uri} = Create a test log
75 ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
76
77 ${association_content} = Read Attribute ${association_uri} endpoints
78 Should Contain ${association_content} ${DIMM3_URI}
79 Should Contain ${association_content} ${DIMM2_URI}
80
81 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
82 Should Contain ${dimm3_event} ${log_uri}
83
84 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
85 Should Contain ${dimm2_event} ${log_uri}
86
87
88Create multiple error logs
89 [Documentation] ***GOOD PATH***
George Keishingd434c512016-10-07 06:46:29 -050090 ... Create multiple error logs and verify
Chris Austenb29d2e82016-06-07 12:25:35 -050091 ... their association.\n
92
93 : FOR ${INDEX} IN RANGE 1 4
94 \ Log ${INDEX}
95 \ ${log_uri} = Create a test log
96 \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
97
98 \ ${association_content} = Read Attribute ${association_uri} endpoints
99 \ Should Contain ${association_content} ${DIMM3_URI}
100 \ Should Contain ${association_content} ${DIMM2_URI}
101
102 \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
103 \ Should Contain ${dimm3_event} ${log_uri}
104
105 \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
106 \ Should Contain ${dimm2_event} ${log_uri}
107
108
109Delete error log
110 [Documentation] ***BAD PATH***
George Keishingd434c512016-10-07 06:46:29 -0500111 ... Delete an error log and verify that its
Chris Austenb29d2e82016-06-07 12:25:35 -0500112 ... association is also removed.\n
George Keishing97651c72016-10-04 00:44:15 -0500113 [Tags] Delete_error_log
Chris Austenb29d2e82016-06-07 12:25:35 -0500114
115 ${log_uri1} = Create a test log
116 ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru
117
118 ${log_uri2} = Create a test log
119
120 ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete
121 ${resp} = openbmc post request ${del_uri} data=${NIL}
122 should be equal as strings ${resp.status_code} ${HTTP_OK}
123
124 ${resp} = openbmc get request ${association_uri1}
125 ${jsondata} = to json ${resp.content}
126 Should Contain ${jsondata['message']} 404 Not Found
127
128 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
129 Should Not Contain ${dimm3_event} ${log_uri1}
130
131 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
132 Should Not Contain ${dimm2_event} ${log_uri1}
133
134
135Association with invalid FRU
136 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500137 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500138 ... that its does not have any association.\n
139
George Keishingd434c512016-10-07 06:46:29 -0500140 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500141
George Keishingd434c512016-10-07 06:46:29 -0500142 ${elog} ${stderr}=
143 ... Execute Command ${CREATE_ERROR_INVALID_FRU}
144 ... return_stderr=True
145 Should Be Empty ${stderr}
146
Chris Austenb29d2e82016-06-07 12:25:35 -0500147 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500148 Should Contain '${log_list}' ${elog.strip('q ')}
149
150 ${association_uri} =
151 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500152
153 ${resp} = openbmc get request ${association_uri}
154 ${jsondata} = to json ${resp.content}
155 Should Contain ${jsondata['message']} 404 Not Found
156
157
158Assocition with no FRU error event
159 [Documentation] ***BAD PATH***
160 ... Create an error log on no FRU and verify
161 ... that its does not have any association.\n
162
George Keishingd434c512016-10-07 06:46:29 -0500163 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500164
George Keishingd434c512016-10-07 06:46:29 -0500165 ${elog} ${stderr}=
166 ... Execute Command ${CREATE_ERROR_NO_FRU}
167 ... return_stderr=True
168 Should Be Empty ${stderr}
169
Chris Austenb29d2e82016-06-07 12:25:35 -0500170 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500171 Should Contain '${log_list}' ${elog.strip('q ')}
172
173 ${association_uri} =
174 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500175
176 ${resp} = openbmc get request ${association_uri}
177 ${jsondata} = to json ${resp.content}
178 Should Contain ${jsondata['message']} 404 Not Found
179
180
181Association with virtual sensor
182 [Documentation] ***GOOD PATH***
183 ... Create an error log on virtual sensor and
184 ... verify its association.\n
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500185 [Tags] Association_with_virtual_sensor
Chris Austenb29d2e82016-06-07 12:25:35 -0500186
George Keishingd434c512016-10-07 06:46:29 -0500187 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500188
George Keishingd434c512016-10-07 06:46:29 -0500189 ${elog} ${stderr}=
190 ... Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
191 ... return_stderr=True
192 Should Be Empty ${stderr}
193
Chris Austenb29d2e82016-06-07 12:25:35 -0500194 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500195 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -0500196
George Keishingd434c512016-10-07 06:46:29 -0500197 ${association_uri} =
198 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
199
200 ${association_content} =
201 ... Read Attribute ${association_uri} endpoints
202 Should Contain
203 ... ${association_content} /org/openbmc/inventory/system/systemevent
Chris Austenb29d2e82016-06-07 12:25:35 -0500204
205Association unchanged after reboot
206 [Documentation] ***GOOD PATH***
207 ... This test case is to verify that error log association
208 ... does not change after open bmc reboot.\n
causten147f5752016-08-11 16:24:45 -0500209 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500210
211 ${pre_reboot_log_uri} = Create a test log
212 ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru
213 ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints
214
Chris Austenb29d2e82016-06-07 12:25:35 -0500215 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500216 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500217
218 ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints
219 Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content}
220
221 ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
222 Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
223 ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
224 Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
225
226*** Keywords ***
227
228Get EventList
229 ${resp} = openbmc get request /org/openbmc/records/events/
230 should be equal as strings ${resp.status_code} ${HTTP_OK}
231 ${jsondata} = to json ${resp.content}
232 [return] ${jsondata['data']}
233
234Create a test log
235 [arguments]
236 ${data} = create dictionary data=@{EMPTY}
237 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
238 should be equal as strings ${resp.status_code} ${HTTP_OK}
239 ${json} = to json ${resp.content}
240 ${LOGID} = convert to integer ${json['data']}
241 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
242 [return] ${uri}
243
Chris Austenb29d2e82016-06-07 12:25:35 -0500244Clear all logs
245 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
246 should be equal as strings ${resp.status_code} ${HTTP_OK}
247 ${resp} = openbmc get request /org/openbmc/records/events/
248 ${json} = to json ${resp.content}
249 Should Be Empty ${json['data']}
George Keishingd434c512016-10-07 06:46:29 -0500250
251Suite Initialization Setup
252 Open Connection And Log In
253 Run Keyword And Continue On Failure Clear all logs