blob: 28809ad2537c14d7b3f2b4fd5f422ef99fd84751 [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
George Keishingf88767a2016-11-17 01:58:05 -06008Resource ../lib/boot/boot_resource_master.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Library Collections
11
George Keishingd434c512016-10-07 06:46:29 -050012Suite Setup Suite Initialization Setup
George Keishing4d6c1da2016-07-15 05:51:22 -050013Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050014
Gunnar Millseac1af22016-11-14 15:30:09 -060015Test Teardown FFDC On Test Case Fail
George Keishingd55a4be2016-08-26 03:28:17 -050016
Chris Austenb29d2e82016-06-07 12:25:35 -050017*** Variables ***
18
19${SYSTEM_SHUTDOWN_TIME} 1min
20
21${WAIT_FOR_SERVICES_UP} 3min
22
23${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
24
25${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
26
27${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
28
29${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
30
31${DIMM1_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm1
32
33${DIMM2_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm2
34
35${DIMM3_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm3
36
37&{NIL} data=@{EMPTY}
38
George Keishingd434c512016-10-07 06:46:29 -050039${EVENT_RECORD} /org/openbmc/records/events
40
Chris Austenb29d2e82016-06-07 12:25:35 -050041*** Test Cases ***
42
43Create error log on single FRU
44 [Documentation] ***GOOD PATH***
45 ... Create an error log on single FRU and verify
46 ... its association.\n
George Keishing97651c72016-10-04 00:44:15 -050047 [Tags] Create_error_log_on_single_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050048
George Keishingd434c512016-10-07 06:46:29 -050049 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -050050
George Keishingd434c512016-10-07 06:46:29 -050051 ${elog} ${stderr}=
52 ... Execute Command ${CREATE_ERROR_SINGLE_FRU}
53 ... return_stderr=True
54 Should Be Empty ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -050055
56 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -050057 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -050058
George Keishingd434c512016-10-07 06:46:29 -050059 ${association_uri} =
60 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
61
62 ${association_content} =
63 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050064 Should Contain ${association_content} ${DIMM1_URI}
65
66 ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints
67 Should Contain ${dimm1_event} ${log_list[0]}
68
69
70Create error log on two FRU
71 [Documentation] ***GOOD PATH***
72 ... Create an error log on two FRUs and verify
73 ... its association.\n
74
75 ${log_uri} = Create a test log
76 ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
77
78 ${association_content} = Read Attribute ${association_uri} endpoints
79 Should Contain ${association_content} ${DIMM3_URI}
80 Should Contain ${association_content} ${DIMM2_URI}
81
82 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
83 Should Contain ${dimm3_event} ${log_uri}
84
85 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
86 Should Contain ${dimm2_event} ${log_uri}
87
88
89Create multiple error logs
90 [Documentation] ***GOOD PATH***
George Keishingd434c512016-10-07 06:46:29 -050091 ... Create multiple error logs and verify
Chris Austenb29d2e82016-06-07 12:25:35 -050092 ... their association.\n
93
94 : FOR ${INDEX} IN RANGE 1 4
95 \ Log ${INDEX}
96 \ ${log_uri} = Create a test log
97 \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru
98
99 \ ${association_content} = Read Attribute ${association_uri} endpoints
100 \ Should Contain ${association_content} ${DIMM3_URI}
101 \ Should Contain ${association_content} ${DIMM2_URI}
102
103 \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
104 \ Should Contain ${dimm3_event} ${log_uri}
105
106 \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
107 \ Should Contain ${dimm2_event} ${log_uri}
108
109
110Delete error log
111 [Documentation] ***BAD PATH***
George Keishingd434c512016-10-07 06:46:29 -0500112 ... Delete an error log and verify that its
Chris Austenb29d2e82016-06-07 12:25:35 -0500113 ... association is also removed.\n
George Keishing97651c72016-10-04 00:44:15 -0500114 [Tags] Delete_error_log
Chris Austenb29d2e82016-06-07 12:25:35 -0500115
116 ${log_uri1} = Create a test log
117 ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru
118
119 ${log_uri2} = Create a test log
120
121 ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete
122 ${resp} = openbmc post request ${del_uri} data=${NIL}
123 should be equal as strings ${resp.status_code} ${HTTP_OK}
124
125 ${resp} = openbmc get request ${association_uri1}
126 ${jsondata} = to json ${resp.content}
127 Should Contain ${jsondata['message']} 404 Not Found
128
129 ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints
130 Should Not Contain ${dimm3_event} ${log_uri1}
131
132 ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints
133 Should Not Contain ${dimm2_event} ${log_uri1}
134
135
136Association with invalid FRU
137 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500138 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500139 ... that its does not have any association.\n
140
George Keishingd434c512016-10-07 06:46:29 -0500141 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500142
George Keishingd434c512016-10-07 06:46:29 -0500143 ${elog} ${stderr}=
144 ... Execute Command ${CREATE_ERROR_INVALID_FRU}
145 ... return_stderr=True
146 Should Be Empty ${stderr}
147
Chris Austenb29d2e82016-06-07 12:25:35 -0500148 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500149 Should Contain '${log_list}' ${elog.strip('q ')}
150
151 ${association_uri} =
152 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500153
154 ${resp} = openbmc get request ${association_uri}
155 ${jsondata} = to json ${resp.content}
156 Should Contain ${jsondata['message']} 404 Not Found
157
158
159Assocition with no FRU error event
160 [Documentation] ***BAD PATH***
161 ... Create an error log on no FRU and verify
162 ... that its does not have any association.\n
163
George Keishingd434c512016-10-07 06:46:29 -0500164 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500165
George Keishingd434c512016-10-07 06:46:29 -0500166 ${elog} ${stderr}=
167 ... Execute Command ${CREATE_ERROR_NO_FRU}
168 ... return_stderr=True
169 Should Be Empty ${stderr}
170
Chris Austenb29d2e82016-06-07 12:25:35 -0500171 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500172 Should Contain '${log_list}' ${elog.strip('q ')}
173
174 ${association_uri} =
175 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500176
177 ${resp} = openbmc get request ${association_uri}
178 ${jsondata} = to json ${resp.content}
179 Should Contain ${jsondata['message']} 404 Not Found
180
181
182Association with virtual sensor
183 [Documentation] ***GOOD PATH***
184 ... Create an error log on virtual sensor and
185 ... verify its association.\n
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500186 [Tags] Association_with_virtual_sensor
Chris Austenb29d2e82016-06-07 12:25:35 -0500187
George Keishingd434c512016-10-07 06:46:29 -0500188 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500189
George Keishingd434c512016-10-07 06:46:29 -0500190 ${elog} ${stderr}=
191 ... Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
192 ... return_stderr=True
193 Should Be Empty ${stderr}
194
Chris Austenb29d2e82016-06-07 12:25:35 -0500195 ${log_list} = Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500196 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -0500197
George Keishingd434c512016-10-07 06:46:29 -0500198 ${association_uri} =
199 ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru
200
201 ${association_content} =
202 ... Read Attribute ${association_uri} endpoints
203 Should Contain
204 ... ${association_content} /org/openbmc/inventory/system/systemevent
Chris Austenb29d2e82016-06-07 12:25:35 -0500205
206Association unchanged after reboot
207 [Documentation] ***GOOD PATH***
208 ... This test case is to verify that error log association
209 ... does not change after open bmc reboot.\n
George Keishing930dcc02016-10-13 06:31:21 -0500210 [Tags] bmcreboot Association_Unchanged_After_Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500211
212 ${pre_reboot_log_uri} = Create a test log
George Keishing930dcc02016-10-13 06:31:21 -0500213 ${association_uri} =
214 ... catenate SEPARATOR= ${pre_reboot_log_uri} /fru
215 ${pre_reboot_association_content} =
216 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500217
George Keishingf88767a2016-11-17 01:58:05 -0600218 Initiate Power Off
219 Check Power Off States
220
Chris Austenb29d2e82016-06-07 12:25:35 -0500221 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500222 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500223
George Keishing17982fb2016-11-08 04:59:37 -0600224 @{states}= Create List BMC_READY HOST_POWERED_OFF
225 Wait Until Keyword Succeeds
226 ... 10 min 10 sec Verify BMC State ${states}
227
George Keishing930dcc02016-10-13 06:31:21 -0500228 ${post_reboot_association_content} =
229 ... Read Attribute ${association_uri} endpoints
230 Should Be Equal
231 ... ${post_reboot_association_content} ${pre_reboot_association_content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500232
George Keishing930dcc02016-10-13 06:31:21 -0500233 ${post_reboot_dimm3_event} =
234 ... Read Attribute ${DIMM3_URI}/event endpoints
235 Should Contain
236 ... ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
237 ${post_reboot_dimm2_event} =
238 ... Read Attribute ${DIMM2_URI}/event endpoints
239 Should Contain
240 ... ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500241
242*** Keywords ***
243
244Get EventList
245 ${resp} = openbmc get request /org/openbmc/records/events/
246 should be equal as strings ${resp.status_code} ${HTTP_OK}
247 ${jsondata} = to json ${resp.content}
248 [return] ${jsondata['data']}
249
250Create a test log
251 [arguments]
252 ${data} = create dictionary data=@{EMPTY}
253 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
254 should be equal as strings ${resp.status_code} ${HTTP_OK}
255 ${json} = to json ${resp.content}
256 ${LOGID} = convert to integer ${json['data']}
257 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
258 [return] ${uri}
259
Chris Austenb29d2e82016-06-07 12:25:35 -0500260Clear all logs
261 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
262 should be equal as strings ${resp.status_code} ${HTTP_OK}
263 ${resp} = openbmc get request /org/openbmc/records/events/
264 ${json} = to json ${resp.content}
265 Should Be Empty ${json['data']}
George Keishingd434c512016-10-07 06:46:29 -0500266
267Suite Initialization Setup
268 Open Connection And Log In
269 Run Keyword And Continue On Failure Clear all logs