blob: d2162ab109049fe446d6c037f51ff07cbdd2b637 [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
George Keishing7446eed2016-12-02 04:28:38 -060023${EVENT_RECORD} ${RECORDS_URI}events/
24${DIMM_PREFIX} ${INVENTORY_URI}system/chassis/motherboard/
25${DIMM1_URI} ${DIMM_PREFIX}dimm1
26${DIMM2_URI} ${DIMM_PREFIX}dimm2
27${DIMM3_URI} ${DIMM_PREFIX}dimm3
Chris Austenb29d2e82016-06-07 12:25:35 -050028
George Keishing7446eed2016-12-02 04:28:38 -060029${BUSCTL_PREFIX} busctl call ${OPENBMC_BASE_DBUS}.records.events
30... ${OPENBMC_BASE_URI}records/events
31... ${OPENBMC_BASE_DBUS}.recordlog
32... acceptHostMessage sssay "Error"
Chris Austenb29d2e82016-06-07 12:25:35 -050033
George Keishing7446eed2016-12-02 04:28:38 -060034${CREATE_ERROR_SINGLE_FRU} ${BUSCTL_PREFIX} "Testing failure"
35... "${DIMM1_URI}" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050036
George Keishing7446eed2016-12-02 04:28:38 -060037${CREATE_ERROR_INVALID_FRU} ${BUSCTL_PREFIX} "Testing with invalid FRU"
38... "abc" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050039
George Keishing7446eed2016-12-02 04:28:38 -060040${CREATE_ERROR_NO_FRU} ${BUSCTL_PREFIX} "Testing with no fru" "" 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050041
George Keishing7446eed2016-12-02 04:28:38 -060042${CREATE_ERROR_VIRTUAL_SENSOR} ${BUSCTL_PREFIX}
43... "Testing with a virtual sensor"
44... "${INVENTORY_URI}system/systemevent " 1 1
Chris Austenb29d2e82016-06-07 12:25:35 -050045
George Keishing7446eed2016-12-02 04:28:38 -060046&{NIL} data=@{EMPTY}
George Keishingd434c512016-10-07 06:46:29 -050047
Chris Austenb29d2e82016-06-07 12:25:35 -050048*** Test Cases ***
49
50Create error log on single FRU
51 [Documentation] ***GOOD PATH***
52 ... Create an error log on single FRU and verify
53 ... its association.\n
George Keishing97651c72016-10-04 00:44:15 -050054 [Tags] Create_error_log_on_single_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050055
George Keishingd434c512016-10-07 06:46:29 -050056 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -050057
George Keishingd434c512016-10-07 06:46:29 -050058 ${elog} ${stderr}=
59 ... Execute Command ${CREATE_ERROR_SINGLE_FRU}
60 ... return_stderr=True
61 Should Be Empty ${stderr}
Chris Austenb29d2e82016-06-07 12:25:35 -050062
Gunnar Mills1cd544d2016-12-06 11:19:22 -060063 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -050064 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -050065
George Keishing7446eed2016-12-02 04:28:38 -060066 ${association_uri}=
67 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
George Keishingd434c512016-10-07 06:46:29 -050068
George Keishing7446eed2016-12-02 04:28:38 -060069 ${association_content}=
70 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050071 Should Contain ${association_content} ${DIMM1_URI}
72
Gunnar Mills1cd544d2016-12-06 11:19:22 -060073 ${dimm1_event}= Read Attribute ${DIMM1_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050074 Should Contain ${dimm1_event} ${log_list[0]}
75
76
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060077Create Error Log On Two FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050078 [Documentation] ***GOOD PATH***
79 ... Create an error log on two FRUs and verify
80 ... its association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060081 [Tags] Create_Error_Log_On_Two_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -050082
Gunnar Mills1cd544d2016-12-06 11:19:22 -060083 ${log_uri}= Create a test log
84 ${association_uri}= catenate SEPARATOR= ${log_uri} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -050085
Gunnar Mills1cd544d2016-12-06 11:19:22 -060086 ${association_content}= Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050087 Should Contain ${association_content} ${DIMM3_URI}
88 Should Contain ${association_content} ${DIMM2_URI}
89
Gunnar Mills1cd544d2016-12-06 11:19:22 -060090 ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050091 Should Contain ${dimm3_event} ${log_uri}
92
Gunnar Mills1cd544d2016-12-06 11:19:22 -060093 ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -050094 Should Contain ${dimm2_event} ${log_uri}
95
96
Sridevi Ramesh32c93f42017-01-19 06:36:54 -060097Create Multiple Error Logs
Chris Austenb29d2e82016-06-07 12:25:35 -050098 [Documentation] ***GOOD PATH***
George Keishingd434c512016-10-07 06:46:29 -050099 ... Create multiple error logs and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500100 ... their association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600101 [Tags] Create_Multiple_Error_Logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500102
103 : FOR ${INDEX} IN RANGE 1 4
George Keishing7446eed2016-12-02 04:28:38 -0600104 \ Log ${INDEX}
105 \ ${log_uri}= Create a test log
106 \ ${association_uri}= catenate SEPARATOR= ${log_uri} /fru
107 \ ${association_content}=
108 ... Read Attribute ${association_uri} endpoints
109 \ Should Contain ${association_content} ${DIMM3_URI}
110 \ Should Contain ${association_content} ${DIMM2_URI}
111 \ ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
112 \ Should Contain ${dimm3_event} ${log_uri}
113 \ ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
114 \ Should Contain ${dimm2_event} ${log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500115
116
117Delete error log
118 [Documentation] ***BAD PATH***
George Keishingd434c512016-10-07 06:46:29 -0500119 ... Delete an error log and verify that its
Chris Austenb29d2e82016-06-07 12:25:35 -0500120 ... association is also removed.\n
George Keishing97651c72016-10-04 00:44:15 -0500121 [Tags] Delete_error_log
Chris Austenb29d2e82016-06-07 12:25:35 -0500122
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600123 ${log_uri1}= Create a test log
124 ${association_uri1}= catenate SEPARATOR= ${log_uri1} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500125
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600126 ${log_uri2}= Create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500127
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600128 ${del_uri}= catenate SEPARATOR= ${log_uri1} /action/delete
129 ${resp}= openbmc post request ${del_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500130 should be equal as strings ${resp.status_code} ${HTTP_OK}
131
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600132 ${resp}= openbmc get request ${association_uri1}
133 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500134 Should Contain ${jsondata['message']} 404 Not Found
135
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600136 ${dimm3_event}= Read Attribute ${DIMM3_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500137 Should Not Contain ${dimm3_event} ${log_uri1}
138
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600139 ${dimm2_event}= Read Attribute ${DIMM2_URI}/event endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500140 Should Not Contain ${dimm2_event} ${log_uri1}
141
142
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600143Association With Invalid FRU
Chris Austenb29d2e82016-06-07 12:25:35 -0500144 [Documentation] ***BAD PATH***
George Keishing4d6c1da2016-07-15 05:51:22 -0500145 ... Create an error log on invalid FRU and verify
Chris Austenb29d2e82016-06-07 12:25:35 -0500146 ... that its does not have any association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600147 [Tags] Association_With_Invalid_FRU
Chris Austenb29d2e82016-06-07 12:25:35 -0500148
George Keishingd434c512016-10-07 06:46:29 -0500149 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500150
George Keishingd434c512016-10-07 06:46:29 -0500151 ${elog} ${stderr}=
152 ... Execute Command ${CREATE_ERROR_INVALID_FRU}
153 ... return_stderr=True
154 Should Be Empty ${stderr}
155
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600156 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500157 Should Contain '${log_list}' ${elog.strip('q ')}
158
George Keishing7446eed2016-12-02 04:28:38 -0600159 ${association_uri}=
160 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500161
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600162 ${resp}= openbmc get request ${association_uri}
163 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500164 Should Contain ${jsondata['message']} 404 Not Found
165
166
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600167Association With No FRU Error Event
Chris Austenb29d2e82016-06-07 12:25:35 -0500168 [Documentation] ***BAD PATH***
169 ... Create an error log on no FRU and verify
170 ... that its does not have any association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600171 [Tags] Association_With_No_FRU_Error_Event
Chris Austenb29d2e82016-06-07 12:25:35 -0500172
George Keishingd434c512016-10-07 06:46:29 -0500173 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500174
George Keishingd434c512016-10-07 06:46:29 -0500175 ${elog} ${stderr}=
176 ... Execute Command ${CREATE_ERROR_NO_FRU}
177 ... return_stderr=True
178 Should Be Empty ${stderr}
179
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600180 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500181 Should Contain '${log_list}' ${elog.strip('q ')}
182
George Keishing7446eed2016-12-02 04:28:38 -0600183 ${association_uri}=
184 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
Chris Austenb29d2e82016-06-07 12:25:35 -0500185
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600186 ${resp}= openbmc get request ${association_uri}
187 ${jsondata}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500188 Should Contain ${jsondata['message']} 404 Not Found
189
190
191Association with virtual sensor
192 [Documentation] ***GOOD PATH***
193 ... Create an error log on virtual sensor and
194 ... verify its association.\n
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600195 [Tags] Association_With_Virtual_Sensor
Chris Austenb29d2e82016-06-07 12:25:35 -0500196
George Keishingd434c512016-10-07 06:46:29 -0500197 Run Keyword And Continue On Failure Clear all logs
Chris Austenb29d2e82016-06-07 12:25:35 -0500198
George Keishingd434c512016-10-07 06:46:29 -0500199 ${elog} ${stderr}=
200 ... Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR}
201 ... return_stderr=True
202 Should Be Empty ${stderr}
203
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600204 ${log_list}= Get EventList
George Keishingd434c512016-10-07 06:46:29 -0500205 Should Contain '${log_list}' ${elog.strip('q ')}
Chris Austenb29d2e82016-06-07 12:25:35 -0500206
George Keishing7446eed2016-12-02 04:28:38 -0600207 ${association_uri}=
208 ... catenate SEPARATOR= ${EVENT_RECORD}${elog.strip('q ')} /fru
George Keishingd434c512016-10-07 06:46:29 -0500209
George Keishing7446eed2016-12-02 04:28:38 -0600210 ${association_content}=
211 ... Read Attribute ${association_uri} endpoints
George Keishingd434c512016-10-07 06:46:29 -0500212 Should Contain
George Keishing7446eed2016-12-02 04:28:38 -0600213 ... ${association_content}
214 ... ${OPENBMC_BASE_URI}inventory/system/systemevent
Chris Austenb29d2e82016-06-07 12:25:35 -0500215
Sridevi Ramesh32c93f42017-01-19 06:36:54 -0600216Association Unchanged After Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500217 [Documentation] ***GOOD PATH***
218 ... This test case is to verify that error log association
219 ... does not change after open bmc reboot.\n
George Keishing930dcc02016-10-13 06:31:21 -0500220 [Tags] bmcreboot Association_Unchanged_After_Reboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500221
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600222 ${pre_reboot_log_uri}= Create a test log
George Keishing7446eed2016-12-02 04:28:38 -0600223 ${association_uri}=
George Keishing930dcc02016-10-13 06:31:21 -0500224 ... catenate SEPARATOR= ${pre_reboot_log_uri} /fru
225 ${pre_reboot_association_content} =
226 ... Read Attribute ${association_uri} endpoints
Chris Austenb29d2e82016-06-07 12:25:35 -0500227
George Keishingf88767a2016-11-17 01:58:05 -0600228 Initiate Power Off
229 Check Power Off States
230
Chris Austenb29d2e82016-06-07 12:25:35 -0500231 ${output}= Execute Command /sbin/reboot
George Keishingf4e4faf2016-09-26 00:40:06 -0500232 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500233
George Keishing17982fb2016-11-08 04:59:37 -0600234 @{states}= Create List BMC_READY HOST_POWERED_OFF
235 Wait Until Keyword Succeeds
236 ... 10 min 10 sec Verify BMC State ${states}
237
George Keishing930dcc02016-10-13 06:31:21 -0500238 ${post_reboot_association_content} =
239 ... Read Attribute ${association_uri} endpoints
240 Should Be Equal
George Keishing7446eed2016-12-02 04:28:38 -0600241 ... ${post_reboot_association_content}
242 ... ${pre_reboot_association_content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500243
George Keishing930dcc02016-10-13 06:31:21 -0500244 ${post_reboot_dimm3_event} =
245 ... Read Attribute ${DIMM3_URI}/event endpoints
246 Should Contain
247 ... ${post_reboot_dimm3_event} ${pre_reboot_log_uri}
248 ${post_reboot_dimm2_event} =
249 ... Read Attribute ${DIMM2_URI}/event endpoints
250 Should Contain
251 ... ${post_reboot_dimm2_event} ${pre_reboot_log_uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500252
253*** Keywords ***
254
255Get EventList
George Keishing7446eed2016-12-02 04:28:38 -0600256 ${resp}= openbmc get request ${EVENT_RECORD}
Chris Austenb29d2e82016-06-07 12:25:35 -0500257 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600258 ${jsondata}= to json ${resp.content}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600259 [Return] ${jsondata['data']}
Chris Austenb29d2e82016-06-07 12:25:35 -0500260
261Create a test log
Gunnar Mills38032802016-12-12 13:43:40 -0600262 [Arguments]
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600263 ${data}= create dictionary data=@{EMPTY}
George Keishing7446eed2016-12-02 04:28:38 -0600264 ${resp}= openbmc post request
265 ... ${EVENT_RECORD}action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500266 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600267 ${json}= to json ${resp.content}
268 ${LOGID}= convert to integer ${json['data']}
George Keishing7446eed2016-12-02 04:28:38 -0600269 ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600270 [Return] ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500271
Chris Austenb29d2e82016-06-07 12:25:35 -0500272Clear all logs
George Keishing7446eed2016-12-02 04:28:38 -0600273 ${resp}= openbmc post request
274 ... ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500275 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishing7446eed2016-12-02 04:28:38 -0600276 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600277 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500278 Should Be Empty ${json['data']}
George Keishingd434c512016-10-07 06:46:29 -0500279
280Suite Initialization Setup
281 Open Connection And Log In
282 Run Keyword And Continue On Failure Clear all logs