blob: 81c262bf8e590e3a40ed9189ce023d6647cdfe64 [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
Sridevi Ramesh066a7b12017-01-19 10:01:28 -060016Force Tags Association
George Keishingd55a4be2016-08-26 03:28:17 -050017
Chris Austenb29d2e82016-06-07 12:25:35 -050018*** Variables ***
19
20${SYSTEM_SHUTDOWN_TIME} 1min
21
22${WAIT_FOR_SERVICES_UP} 3min
23
George Keishing7446eed2016-12-02 04:28:38 -060024${EVENT_RECORD} ${RECORDS_URI}events/
25${DIMM_PREFIX} ${INVENTORY_URI}system/chassis/motherboard/
26${DIMM1_URI} ${DIMM_PREFIX}dimm1
27${DIMM2_URI} ${DIMM_PREFIX}dimm2
28${DIMM3_URI} ${DIMM_PREFIX}dimm3
Chris Austenb29d2e82016-06-07 12:25:35 -050029
George Keishing7446eed2016-12-02 04:28:38 -060030${BUSCTL_PREFIX} busctl call ${OPENBMC_BASE_DBUS}.records.events
31... ${OPENBMC_BASE_URI}records/events
32... ${OPENBMC_BASE_DBUS}.recordlog
33... acceptHostMessage sssay "Error"
Chris Austenb29d2e82016-06-07 12:25:35 -050034
George Keishing7446eed2016-12-02 04:28:38 -060035${CREATE_ERROR_SINGLE_FRU} ${BUSCTL_PREFIX} "Testing failure"
36... "${DIMM1_URI}" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050037
George Keishing7446eed2016-12-02 04:28:38 -060038${CREATE_ERROR_INVALID_FRU} ${BUSCTL_PREFIX} "Testing with invalid FRU"
39... "abc" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050040
George Keishing7446eed2016-12-02 04:28:38 -060041${CREATE_ERROR_NO_FRU} ${BUSCTL_PREFIX} "Testing with no fru" "" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050042
George Keishing7446eed2016-12-02 04:28:38 -060043${CREATE_ERROR_VIRTUAL_SENSOR} ${BUSCTL_PREFIX}
44... "Testing with a virtual sensor"
45... "${INVENTORY_URI}system/systemevent " 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050046
George Keishing7446eed2016-12-02 04:28:38 -060047&{NIL} data=@{EMPTY}
George Keishingd434c512016-10-07 06:46:29 -050048
Chris Austenb29d2e82016-06-07 12:25:35 -050049*** Test Cases ***
50
51Create error log on single FRU
52 [Documentation] ***GOOD PATH***
53 ... Create an error log on single FRU and verify
54 ... its association.\n
George Keishing97651c72016-10-04 00:44:15 -050055 [Tags] Create_error_log_on_single_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050056
George Keishingd434c512016-10-07 06:46:29 -050057 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -050058
George Keishingd434c512016-10-07 06:46:29 -050059 ${elog} ${stderr}=
60 ... Execute Command ${CREATE_ERROR_SINGLE_FRU}
61 ... return_stderr=True
62 Should Be Empty ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -050063
Gunnar Mills1cd544d2016-12-06 11:19:22 -060064 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -050065 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -050066
George Keishing7446eed2016-12-02 04:28:38 -060067 ${association_uri}=
68 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
George Keishingd434c512016-10-07 06:46:29 -050069
George Keishing7446eed2016-12-02 04:28:38 -060070 ${association_content}=
71 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050072 Should Contain ${association_content} ${DIMM1_URI}
73
Gunnar Mills1cd544d2016-12-06 11:19:22 -060074 ${dimm1_event}= Read Attribute ${DIMM1_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050075 Should Contain ${dimm1_event} ${log_list[0]}
76
77
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060078Create Error Log On Two FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050079 [Documentation] ***GOOD PATH***
80 ... Create an error log on two FRUs and verify
81 ... its association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060082 [Tags] Create_Error_Log_On_Two_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050083
Gunnar Mills1cd544d2016-12-06 11:19:22 -060084 ${log_uri}= Create a test log
85 ${association_uri}= catenate SEPARATOR= ${log_uri} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -050086
Gunnar Mills1cd544d2016-12-06 11:19:22 -060087 ${association_content}= Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050088 Should Contain ${association_content} ${DIMM3_URI}
89 Should Contain ${association_content} ${DIMM2_URI}
90
Gunnar Mills1cd544d2016-12-06 11:19:22 -060091 ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050092 Should Contain ${dimm3_event} ${log_uri}
93
Gunnar Mills1cd544d2016-12-06 11:19:22 -060094 ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050095 Should Contain ${dimm2_event} ${log_uri}
96
97
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060098Create Multiple Error Logs
Chris Austenb29d2e82016-06-07 12:25:35 -050099 [Documentation] ***GOOD PATH***
George Keishingd434c512016-10-07 06:46:29 -0500100 ... Create multiple error logs and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500101 ... their association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600102 [Tags] Create_Multiple_Error_Logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500103
104 : FOR ${INDEX} IN RANGE 1 4
George Keishing7446eed2016-12-02 04:28:38 -0600105 \ Log ${INDEX}
106 \ ${log_uri}= Create a test log
107 \ ${association_uri}= catenate SEPARATOR= ${log_uri} /fru
108 \ ${association_content}=
109 ... Read Attribute ${association_uri} endpoints
110 \ Should Contain ${association_content} ${DIMM3_URI}
111 \ Should Contain ${association_content} ${DIMM2_URI}
112 \ ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
113 \ Should Contain ${dimm3_event} ${log_uri}
114 \ ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
115 \ Should Contain ${dimm2_event} ${log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500116
117
118Delete error log
119 [Documentation] ***BAD PATH***
George Keishingd434c512016-10-07 06:46:29 -0500120 ... Delete an error log and verify that its
Chris Austenb29d2e82016-06-07 12:25:35 -0500121 ... association is also removed.\n
George Keishing97651c72016-10-04 00:44:15 -0500122 [Tags] Delete_error_log
Chris Austenb29d2e82016-06-07 12:25:35 -0500123
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600124 ${log_uri1}= Create a test log
125 ${association_uri1}= catenate SEPARATOR= ${log_uri1} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500126
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600127 ${log_uri2}= Create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500128
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600129 ${del_uri}= catenate SEPARATOR= ${log_uri1} /action/delete
130 ${resp}= openbmc post request ${del_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500131 should be equal as strings ${resp.status_code} ${HTTP_OK}
132
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600133 ${resp}= openbmc get request ${association_uri1}
134 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 Should Contain ${jsondata['message']} 404 Not Found
136
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600137 ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500138 Should Not Contain ${dimm3_event} ${log_uri1}
139
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600140 ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500141 Should Not Contain ${dimm2_event} ${log_uri1}
142
143
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600144Association With Invalid FRU
Chris Austenb29d2e82016-06-07 12:25:35 -0500145 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500146 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500147 ... that its does not have any association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600148 [Tags] Association_With_Invalid_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -0500149
George Keishingd434c512016-10-07 06:46:29 -0500150 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500151
George Keishingd434c512016-10-07 06:46:29 -0500152 ${elog} ${stderr}=
153 ... Execute Command ${CREATE_ERROR_INVALID_FRU}
154 ... return_stderr=True
155 Should Be Empty ${stderr}
156
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600157 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500158 Should Contain '${log_list}' ${elog.strip('q ')}
159
George Keishing7446eed2016-12-02 04:28:38 -0600160 ${association_uri}=
161 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500162
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600163 ${resp}= openbmc get request ${association_uri}
164 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500165 Should Contain ${jsondata['message']} 404 Not Found
166
167
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600168Association With No FRU Error Event
Chris Austenb29d2e82016-06-07 12:25:35 -0500169 [Documentation] ***BAD PATH***
170 ... Create an error log on no FRU and verify
171 ... that its does not have any association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600172 [Tags] Association_With_No_FRU_Error_Event
Chris Austenb29d2e82016-06-07 12:25:35 -0500173
George Keishingd434c512016-10-07 06:46:29 -0500174 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500175
George Keishingd434c512016-10-07 06:46:29 -0500176 ${elog} ${stderr}=
177 ... Execute Command ${CREATE_ERROR_NO_FRU}
178 ... return_stderr=True
179 Should Be Empty ${stderr}
180
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600181 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500182 Should Contain '${log_list}' ${elog.strip('q ')}
183
George Keishing7446eed2016-12-02 04:28:38 -0600184 ${association_uri}=
185 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500186
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600187 ${resp}= openbmc get request ${association_uri}
188 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500189 Should Contain ${jsondata['message']} 404 Not Found
190
191
192Association with virtual sensor
193 [Documentation] ***GOOD PATH***
194 ... Create an error log on virtual sensor and
195 ... verify its association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600196 [Tags] Association_With_Virtual_Sensor
Chris Austenb29d2e82016-06-07 12:25:35 -0500197
George Keishingd434c512016-10-07 06:46:29 -0500198 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500199
George Keishingd434c512016-10-07 06:46:29 -0500200 ${elog} ${stderr}=
201 ... Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
202 ... return_stderr=True
203 Should Be Empty ${stderr}
204
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600205 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500206 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -0500207
George Keishing7446eed2016-12-02 04:28:38 -0600208 ${association_uri}=
209 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
George Keishingd434c512016-10-07 06:46:29 -0500210
George Keishing7446eed2016-12-02 04:28:38 -0600211 ${association_content}=
212 ... Read Attribute ${association_uri} endpoints
George Keishingd434c512016-10-07 06:46:29 -0500213 Should Contain
George Keishing7446eed2016-12-02 04:28:38 -0600214 ... ${association_content}
215 ... ${OPENBMC_BASE_URI}inventory/system/systemevent
Chris Austenb29d2e82016-06-07 12:25:35 -0500216
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600217Association Unchanged After Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500218 [Documentation] ***GOOD PATH***
219 ... This test case is to verify that error log association
220 ... does not change after open bmc reboot.\n
George Keishing930dcc02016-10-13 06:31:21 -0500221 [Tags] bmcreboot Association_Unchanged_After_Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500222
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600223 ${pre_reboot_log_uri}= Create a test log
George Keishing7446eed2016-12-02 04:28:38 -0600224 ${association_uri}=
George Keishing930dcc02016-10-13 06:31:21 -0500225 ... catenate SEPARATOR= ${pre_reboot_log_uri} /fru
226 ${pre_reboot_association_content} =
227 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500228
George Keishingf88767a2016-11-17 01:58:05 -0600229 Initiate Power Off
230 Check Power Off States
231
Chris Austenb29d2e82016-06-07 12:25:35 -0500232 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500233 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500234
George Keishing17982fb2016-11-08 04:59:37 -0600235 @{states}= Create List BMC_READY HOST_POWERED_OFF
236 Wait Until Keyword Succeeds
237 ... 10 min 10 sec Verify BMC State ${states}
238
George Keishing930dcc02016-10-13 06:31:21 -0500239 ${post_reboot_association_content} =
240 ... Read Attribute ${association_uri} endpoints
241 Should Be Equal
George Keishing7446eed2016-12-02 04:28:38 -0600242 ... ${post_reboot_association_content}
243 ... ${pre_reboot_association_content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500244
George Keishing930dcc02016-10-13 06:31:21 -0500245 ${post_reboot_dimm3_event} =
246 ... Read Attribute ${DIMM3_URI}/event endpoints
247 Should Contain
248 ... ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
249 ${post_reboot_dimm2_event} =
250 ... Read Attribute ${DIMM2_URI}/event endpoints
251 Should Contain
252 ... ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500253
254*** Keywords ***
255
256Get EventList
George Keishing7446eed2016-12-02 04:28:38 -0600257 ${resp}= openbmc get request ${EVENT_RECORD}
Chris Austenb29d2e82016-06-07 12:25:35 -0500258 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600259 ${jsondata}= to json ${resp.content}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600260 [Return] ${jsondata['data']}
Chris Austenb29d2e82016-06-07 12:25:35 -0500261
262Create a test log
Gunnar Mills38032802016-12-12 13:43:40 -0600263 [Arguments]
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600264 ${data}= create dictionary data=@{EMPTY}
George Keishing7446eed2016-12-02 04:28:38 -0600265 ${resp}= openbmc post request
266 ... ${EVENT_RECORD}action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500267 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600268 ${json}= to json ${resp.content}
269 ${LOGID}= convert to integer ${json['data']}
George Keishing7446eed2016-12-02 04:28:38 -0600270 ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600271 [Return] ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500272
Chris Austenb29d2e82016-06-07 12:25:35 -0500273Clear all logs
George Keishing7446eed2016-12-02 04:28:38 -0600274 ${resp}= openbmc post request
275 ... ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500276 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishing7446eed2016-12-02 04:28:38 -0600277 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600278 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500279 Should Be Empty ${json['data']}
George Keishingd434c512016-10-07 06:46:29 -0500280
281Suite Initialization Setup
282 Open Connection And Log In
283 Run Keyword And Continue On Failure Clear all logs