blob: c30db8774d1b3075aef71be651d30b5158e76a6e [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
George Keishing930dcc02016-10-13 06:31:21 -0500209 [Tags] bmcreboot Association_Unchanged_After_Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500210
211 ${pre_reboot_log_uri} = Create a test log
George Keishing930dcc02016-10-13 06:31:21 -0500212 ${association_uri} =
213 ... catenate SEPARATOR= ${pre_reboot_log_uri} /fru
214 ${pre_reboot_association_content} =
215 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500216
Chris Austenb29d2e82016-06-07 12:25:35 -0500217 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500218 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500219
George Keishing930dcc02016-10-13 06:31:21 -0500220 ${post_reboot_association_content} =
221 ... Read Attribute ${association_uri} endpoints
222 Should Be Equal
223 ... ${post_reboot_association_content} ${pre_reboot_association_content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500224
George Keishing930dcc02016-10-13 06:31:21 -0500225 ${post_reboot_dimm3_event} =
226 ... Read Attribute ${DIMM3_URI}/event endpoints
227 Should Contain
228 ... ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
229 ${post_reboot_dimm2_event} =
230 ... Read Attribute ${DIMM2_URI}/event endpoints
231 Should Contain
232 ... ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500233
234*** Keywords ***
235
236Get EventList
237 ${resp} = openbmc get request /org/openbmc/records/events/
238 should be equal as strings ${resp.status_code} ${HTTP_OK}
239 ${jsondata} = to json ${resp.content}
240 [return] ${jsondata['data']}
241
242Create a test log
243 [arguments]
244 ${data} = create dictionary data=@{EMPTY}
245 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
246 should be equal as strings ${resp.status_code} ${HTTP_OK}
247 ${json} = to json ${resp.content}
248 ${LOGID} = convert to integer ${json['data']}
249 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
250 [return] ${uri}
251
Chris Austenb29d2e82016-06-07 12:25:35 -0500252Clear all logs
253 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
254 should be equal as strings ${resp.status_code} ${HTTP_OK}
255 ${resp} = openbmc get request /org/openbmc/records/events/
256 ${json} = to json ${resp.content}
257 Should Be Empty ${json['data']}
George Keishingd434c512016-10-07 06:46:29 -0500258
259Suite Initialization Setup
260 Open Connection And Log In
261 Run Keyword And Continue On Failure Clear all logs