blob: be6ce240b02bfe69b0b002a82e45dc47cc3beb26 [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 the error logging
3... capability from the host
Chris Austenb29d2e82016-06-07 12:25:35 -05004
George Keishing4d6c1da2016-07-15 05:51:22 -05005Resource ../lib/rest_client.robot
6Resource ../lib/utils.robot
7Resource ../lib/connection_client.robot
George Keishingd55a4be2016-08-26 03:28:17 -05008Resource ../lib/openbmc_ffdc.robot
George Keishingf88767a2016-11-17 01:58:05 -06009Resource ../lib/boot/boot_resource_master.robot
Chris Austenb29d2e82016-06-07 12:25:35 -050010
George Keishing4d6c1da2016-07-15 05:51:22 -050011Library Collections
Chris Austenb29d2e82016-06-07 12:25:35 -050012
George Keishing4d6c1da2016-07-15 05:51:22 -050013Suite Setup Open Connection And Log In
14Suite Teardown Close All Connections
Gunnar Millseac1af22016-11-14 15:30:09 -060015Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050016
Sridevi Ramesh066a7b12017-01-19 10:01:28 -060017Force Tags Event_Logging
18
Chris Austenb29d2e82016-06-07 12:25:35 -050019*** Variables ***
20&{NIL} data=@{EMPTY}
21${SYSTEM_SHUTDOWN_TIME} 1min
22${WAIT_FOR_SERVICES_UP} 3min
23
George Keishingec807372016-12-05 03:54:51 -060024${EVENT_RECORD} ${RECORDS_URI}events/
25
Chris Austenb29d2e82016-06-07 12:25:35 -050026*** Test Cases ***
27
28valid path to logs
29 [Documentation] Test list all events
Chris Austen859be602016-07-07 16:46:31 -050030 [Tags] CI
George Keishingec807372016-12-05 03:54:51 -060031 ${resp}= openbmc get request ${EVENT_RECORD}
Chris Austenb29d2e82016-06-07 12:25:35 -050032 should be equal as strings ${resp.status_code} ${HTTP_OK}
33
34clear any logs
35 [Documentation] Test delete all events
George Keishing97651c72016-10-04 00:44:15 -050036 [Tags] CI clear_any_logs
George Keishingec807372016-12-05 03:54:51 -060037 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050038 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishingec807372016-12-05 03:54:51 -060039 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060040 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050041 Should Be Empty ${json['data']}
42
43write a log
44 [Documentation] Test create event
George Keishing97651c72016-10-04 00:44:15 -050045 [Tags] CI write_a_log
Chris Austenb29d2e82016-06-07 12:25:35 -050046 create a test log
47
48Message attribute should match
49 [Documentation] Check message attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050050 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060051 ${uri}= create a test log
52 ${content}= Read Attribute ${uri} message
Chris Austenb29d2e82016-06-07 12:25:35 -050053 Should Be Equal ${content} A Test event log just happened
54
55Severity attribute should match
56 [Documentation] Check severity attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050057 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060058 ${uri}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -050059 ${content}= Read Attribute ${uri} severity
60 Should Be Equal ${content} Info
61
62data_bytes attribute should match
63 [Documentation] Check data_bytes attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050064 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060065 @{data_list}= Create List ${48} ${0} ${19} ${127} ${136} ${255}
66 ${uri}= create a test log
67 ${content}= Read Attribute ${uri} debug_data
Chris Austenb29d2e82016-06-07 12:25:35 -050068 Lists Should Be Equal ${content} ${data_list}
69
70delete the log
71 [Documentation] Test the delete event
Chris Austen859be602016-07-07 16:46:31 -050072 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060073 ${uri}= create a test log
74 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
75 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050076 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060077 ${resp}= openbmc get request ${deluri}
Chris Austenb29d2e82016-06-07 12:25:35 -050078 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
79
802nd delete should fail
81 [Documentation] Negative scnenario to delete already deleted event
Chris Austen859be602016-07-07 16:46:31 -050082 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060083 ${uri}= create a test log
84 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
85 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050086 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060087 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050088 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
89
90Intermixed delete
George Keishing70490c32016-09-20 10:55:46 -050091 [Documentation] This testcase does the following sequence
Chris Austenb29d2e82016-06-07 12:25:35 -050092 ... Steps:
93 ... write three logs
94 ... delete middle log
95 ... middle log should not exist
Chris Austen859be602016-07-07 16:46:31 -050096 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050097 ${event1}= create a test log
98 ${event2}= create a test log
99 ${event3}= create a test log
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600100 ${deluri}= catenate SEPARATOR= ${event2} /action/delete
101 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500102 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishing70490c32016-09-20 10:55:46 -0500103 ${resp}= openbmc get request ${event2}
104 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500105
George Keishingbf5442c2016-12-06 01:57:44 -0600106Test Event Logs Persistency
107 [Documentation] Create event logs, restart the event service
108 ... and verify if logs persist.
109 [Tags] CI Test_Event_Logs_Persistency
George Keishingec807372016-12-05 03:54:51 -0600110 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600111 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500112 ${logs_pre_restart}= set variable ${json['data']}
113
George Keishingbf5442c2016-12-06 01:57:44 -0600114 ${output} ${stderr} ${rc}= Execute Command
115 ... systemctl restart org.openbmc.records.events.service
116 ... return_stderr=True return_rc=True
117 Should Be Empty ${stderr}
118 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500119 Sleep ${10}
120
George Keishingec807372016-12-05 03:54:51 -0600121 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600122 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500123 ${logs_post_restart}= set variable ${json['data']}
George Keishingbf5442c2016-12-06 01:57:44 -0600124 List Should Contain Sub List
125 ... ${logs_post_restart} ${logs_pre_restart}
126 ... msg=The event logs are mismatched.
Chris Austenb29d2e82016-06-07 12:25:35 -0500127
Chris Austenb29d2e82016-06-07 12:25:35 -0500128
George Keishingbf5442c2016-12-06 01:57:44 -0600129Test Event Deletion Post Restarting Event Manager
130 [Documentation] Create event log, restart event service and
131 ... delete the event created earlier.
132 [Tags] CI Test_Event_Deletion Post_Restarting_Event_Manager
133
134 ${uri}= create a test log
135
136 ${output} ${stderr} ${rc}= Execute Command
137 ... systemctl restart org.openbmc.records.events.service
138 ... return_stderr=True return_rc=True
139 Should Be Empty ${stderr}
140 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500141 Sleep ${10}
142
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600143 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
144 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500145 should be equal as strings ${resp.status_code} ${HTTP_OK}
146
George Keishing410b6292016-07-05 10:40:16 -0500147making new log after obmc-phosphor-event.service restart
Chris Austenb29d2e82016-06-07 12:25:35 -0500148 [Documentation] This is for testing event creation after the
149 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500150 [Tags] CI
George Keishingbf5442c2016-12-06 01:57:44 -0600151 ${output} ${stderr} ${rc}= Execute Command
152 ... systemctl restart org.openbmc.records.events.service
153 ... return_stderr=True return_rc=True
154 Should Be Empty ${stderr}
155 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500156 Sleep ${10}
157
158 create a test log
159
160deleting new log after obmc-phosphor-event.service restart
George Keishingbf5442c2016-12-06 01:57:44 -0600161 [Documentation] This testcase is for testing deleted newly created event
162 ... after event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500163 [Tags] CI
George Keishingbf5442c2016-12-06 01:57:44 -0600164 ${output} ${stderr} ${rc}= Execute Command
165 ... systemctl restart org.openbmc.records.events.service
166 ... return_stderr=True return_rc=True
167 Should Be Empty ${stderr}
168 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500169 Sleep ${10}
170
171 ${uri}= create a test log
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600172 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
173 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500174 should be equal as strings ${resp.status_code} ${HTTP_OK}
175
176Test events after openbmc reboot
177 [Documentation] This is to test event can be deleted created prior to
178 ... openbmc reboot
179 ... Steps:
180 ... Create event,
George Keishingf88767a2016-11-17 01:58:05 -0600181 ... Power off if ON else no-op
Chris Austenb29d2e82016-06-07 12:25:35 -0500182 ... Reboot openbmc,
George Keishing17982fb2016-11-08 04:59:37 -0600183 ... Wait for BMC to READY or Powered OFF state
Chris Austenb29d2e82016-06-07 12:25:35 -0500184 ... Events should exist post reboot,
185 ... Create two more events,
186 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500187 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500188 ${pre_reboot_event}= create a test log
189
George Keishingf88767a2016-11-17 01:58:05 -0600190 Initiate Power Off
191 Check Power Off States
192
Chris Austenb29d2e82016-06-07 12:25:35 -0500193 ${output}= Execute Command /sbin/reboot
George Keishingc4d3dc02016-09-19 03:45:55 -0500194 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500195
George Keishing17982fb2016-11-08 04:59:37 -0600196 @{states}= Create List BMC_READY HOST_POWERED_OFF
197 Wait Until Keyword Succeeds
198 ... 10 min 10 sec Verify BMC State ${states}
199
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600200 ${resp}= openbmc get request ${pre_reboot_event}
Chris Austenb29d2e82016-06-07 12:25:35 -0500201 should be equal as strings ${resp.status_code} ${HTTP_OK}
202 ${post_reboot_event1}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500203
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600204 ${del_prereboot_uri}= catenate SEPARATOR= ${pre_reboot_event} /action/delete
205 ${resp}= openbmc post request ${del_prereboot_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500206 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600207 ${del_postreboot_uri}= catenate SEPARATOR= ${post_reboot_event1} /action/delete
208 ${resp}= openbmc post request ${del_postreboot_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500209 should be equal as strings ${resp.status_code} ${HTTP_OK}
210
211clearing logs results in no logs
212 [Documentation] This testcase is for clearning the events when no logs present
Chris Austen859be602016-07-07 16:46:31 -0500213 [Tags] CI
George Keishingec807372016-12-05 03:54:51 -0600214 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500215 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishingec807372016-12-05 03:54:51 -0600216 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600217 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500218 Should Be Empty ${json['data']}
George Keishingbf5442c2016-12-06 01:57:44 -0600219 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500220 should be equal as strings ${resp.status_code} ${HTTP_OK}
221
222
223*** Keywords ***
224
225create a test log
Gunnar Mills38032802016-12-12 13:43:40 -0600226 [Arguments]
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600227 ${data}= create dictionary data=@{EMPTY}
George Keishingec807372016-12-05 03:54:51 -0600228 ${resp}= openbmc post request ${EVENT_RECORD}action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500229 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600230 ${json}= to json ${resp.content}
231 ${LOGID}= convert to integer ${json['data']}
George Keishingec807372016-12-05 03:54:51 -0600232 ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600233 [Return] ${uri}