blob: 60083e07c51a543b1efb1686e9c3ee3d954d974a [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
17*** Variables ***
18&{NIL} data=@{EMPTY}
19${SYSTEM_SHUTDOWN_TIME} 1min
20${WAIT_FOR_SERVICES_UP} 3min
21
George Keishingec807372016-12-05 03:54:51 -060022${EVENT_RECORD} ${RECORDS_URI}events/
23
Chris Austenb29d2e82016-06-07 12:25:35 -050024*** Test Cases ***
25
26valid path to logs
27 [Documentation] Test list all events
Chris Austen859be602016-07-07 16:46:31 -050028 [Tags] CI
George Keishingec807372016-12-05 03:54:51 -060029 ${resp}= openbmc get request ${EVENT_RECORD}
Chris Austenb29d2e82016-06-07 12:25:35 -050030 should be equal as strings ${resp.status_code} ${HTTP_OK}
31
32clear any logs
33 [Documentation] Test delete all events
George Keishing97651c72016-10-04 00:44:15 -050034 [Tags] CI clear_any_logs
George Keishingec807372016-12-05 03:54:51 -060035 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050036 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishingec807372016-12-05 03:54:51 -060037 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060038 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -050039 Should Be Empty ${json['data']}
40
41write a log
42 [Documentation] Test create event
George Keishing97651c72016-10-04 00:44:15 -050043 [Tags] CI write_a_log
Chris Austenb29d2e82016-06-07 12:25:35 -050044 create a test log
45
46Message attribute should match
47 [Documentation] Check message attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050048 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060049 ${uri}= create a test log
50 ${content}= Read Attribute ${uri} message
Chris Austenb29d2e82016-06-07 12:25:35 -050051 Should Be Equal ${content} A Test event log just happened
52
53Severity attribute should match
54 [Documentation] Check severity attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050055 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060056 ${uri}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -050057 ${content}= Read Attribute ${uri} severity
58 Should Be Equal ${content} Info
59
60data_bytes attribute should match
61 [Documentation] Check data_bytes attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050062 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060063 @{data_list}= Create List ${48} ${0} ${19} ${127} ${136} ${255}
64 ${uri}= create a test log
65 ${content}= Read Attribute ${uri} debug_data
Chris Austenb29d2e82016-06-07 12:25:35 -050066 Lists Should Be Equal ${content} ${data_list}
67
68delete the log
69 [Documentation] Test the delete event
Chris Austen859be602016-07-07 16:46:31 -050070 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060071 ${uri}= create a test log
72 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
73 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050074 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060075 ${resp}= openbmc get request ${deluri}
Chris Austenb29d2e82016-06-07 12:25:35 -050076 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
77
782nd delete should fail
79 [Documentation] Negative scnenario to delete already deleted event
Chris Austen859be602016-07-07 16:46:31 -050080 [Tags] CI
Gunnar Mills1cd544d2016-12-06 11:19:22 -060081 ${uri}= create a test log
82 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
83 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050084 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -060085 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -050086 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
87
88Intermixed delete
George Keishing70490c32016-09-20 10:55:46 -050089 [Documentation] This testcase does the following sequence
Chris Austenb29d2e82016-06-07 12:25:35 -050090 ... Steps:
91 ... write three logs
92 ... delete middle log
93 ... middle log should not exist
Chris Austen859be602016-07-07 16:46:31 -050094 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050095 ${event1}= create a test log
96 ${event2}= create a test log
97 ${event3}= create a test log
Gunnar Mills1cd544d2016-12-06 11:19:22 -060098 ${deluri}= catenate SEPARATOR= ${event2} /action/delete
99 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500100 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishing70490c32016-09-20 10:55:46 -0500101 ${resp}= openbmc get request ${event2}
102 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500103
George Keishingbf5442c2016-12-06 01:57:44 -0600104Test Event Logs Persistency
105 [Documentation] Create event logs, restart the event service
106 ... and verify if logs persist.
107 [Tags] CI Test_Event_Logs_Persistency
George Keishingec807372016-12-05 03:54:51 -0600108 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600109 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500110 ${logs_pre_restart}= set variable ${json['data']}
111
George Keishingbf5442c2016-12-06 01:57:44 -0600112 ${output} ${stderr} ${rc}= Execute Command
113 ... systemctl restart org.openbmc.records.events.service
114 ... return_stderr=True return_rc=True
115 Should Be Empty ${stderr}
116 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500117 Sleep ${10}
118
George Keishingec807372016-12-05 03:54:51 -0600119 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600120 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500121 ${logs_post_restart}= set variable ${json['data']}
George Keishingbf5442c2016-12-06 01:57:44 -0600122 List Should Contain Sub List
123 ... ${logs_post_restart} ${logs_pre_restart}
124 ... msg=The event logs are mismatched.
Chris Austenb29d2e82016-06-07 12:25:35 -0500125
Chris Austenb29d2e82016-06-07 12:25:35 -0500126
George Keishingbf5442c2016-12-06 01:57:44 -0600127Test Event Deletion Post Restarting Event Manager
128 [Documentation] Create event log, restart event service and
129 ... delete the event created earlier.
130 [Tags] CI Test_Event_Deletion Post_Restarting_Event_Manager
131
132 ${uri}= create a test log
133
134 ${output} ${stderr} ${rc}= Execute Command
135 ... systemctl restart org.openbmc.records.events.service
136 ... return_stderr=True return_rc=True
137 Should Be Empty ${stderr}
138 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500139 Sleep ${10}
140
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600141 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
142 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500143 should be equal as strings ${resp.status_code} ${HTTP_OK}
144
George Keishing410b6292016-07-05 10:40:16 -0500145making new log after obmc-phosphor-event.service restart
Chris Austenb29d2e82016-06-07 12:25:35 -0500146 [Documentation] This is for testing event creation after the
147 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500148 [Tags] CI
George Keishingbf5442c2016-12-06 01:57:44 -0600149 ${output} ${stderr} ${rc}= Execute Command
150 ... systemctl restart org.openbmc.records.events.service
151 ... return_stderr=True return_rc=True
152 Should Be Empty ${stderr}
153 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500154 Sleep ${10}
155
156 create a test log
157
158deleting new log after obmc-phosphor-event.service restart
George Keishingbf5442c2016-12-06 01:57:44 -0600159 [Documentation] This testcase is for testing deleted newly created event
160 ... after event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500161 [Tags] CI
George Keishingbf5442c2016-12-06 01:57:44 -0600162 ${output} ${stderr} ${rc}= Execute Command
163 ... systemctl restart org.openbmc.records.events.service
164 ... return_stderr=True return_rc=True
165 Should Be Empty ${stderr}
166 Should Be Equal ${rc} ${0}
Chris Austenb29d2e82016-06-07 12:25:35 -0500167 Sleep ${10}
168
169 ${uri}= create a test log
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600170 ${deluri}= catenate SEPARATOR= ${uri} /action/delete
171 ${resp}= openbmc post request ${deluri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500172 should be equal as strings ${resp.status_code} ${HTTP_OK}
173
174Test events after openbmc reboot
175 [Documentation] This is to test event can be deleted created prior to
176 ... openbmc reboot
177 ... Steps:
178 ... Create event,
George Keishingf88767a2016-11-17 01:58:05 -0600179 ... Power off if ON else no-op
Chris Austenb29d2e82016-06-07 12:25:35 -0500180 ... Reboot openbmc,
George Keishing17982fb2016-11-08 04:59:37 -0600181 ... Wait for BMC to READY or Powered OFF state
Chris Austenb29d2e82016-06-07 12:25:35 -0500182 ... Events should exist post reboot,
183 ... Create two more events,
184 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500185 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500186 ${pre_reboot_event}= create a test log
187
George Keishingf88767a2016-11-17 01:58:05 -0600188 Initiate Power Off
189 Check Power Off States
190
Chris Austenb29d2e82016-06-07 12:25:35 -0500191 ${output}= Execute Command /sbin/reboot
George Keishingc4d3dc02016-09-19 03:45:55 -0500192 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500193
George Keishing17982fb2016-11-08 04:59:37 -0600194 @{states}= Create List BMC_READY HOST_POWERED_OFF
195 Wait Until Keyword Succeeds
196 ... 10 min 10 sec Verify BMC State ${states}
197
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600198 ${resp}= openbmc get request ${pre_reboot_event}
Chris Austenb29d2e82016-06-07 12:25:35 -0500199 should be equal as strings ${resp.status_code} ${HTTP_OK}
200 ${post_reboot_event1}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500201
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600202 ${del_prereboot_uri}= catenate SEPARATOR= ${pre_reboot_event} /action/delete
203 ${resp}= openbmc post request ${del_prereboot_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500204 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600205 ${del_postreboot_uri}= catenate SEPARATOR= ${post_reboot_event1} /action/delete
206 ${resp}= openbmc post request ${del_postreboot_uri} data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500207 should be equal as strings ${resp.status_code} ${HTTP_OK}
208
209clearing logs results in no logs
210 [Documentation] This testcase is for clearning the events when no logs present
Chris Austen859be602016-07-07 16:46:31 -0500211 [Tags] CI
George Keishingec807372016-12-05 03:54:51 -0600212 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500213 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishingec807372016-12-05 03:54:51 -0600214 ${resp}= openbmc get request ${EVENT_RECORD}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600215 ${json}= to json ${resp.content}
Chris Austenb29d2e82016-06-07 12:25:35 -0500216 Should Be Empty ${json['data']}
George Keishingbf5442c2016-12-06 01:57:44 -0600217 ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL}
Chris Austenb29d2e82016-06-07 12:25:35 -0500218 should be equal as strings ${resp.status_code} ${HTTP_OK}
219
220
221*** Keywords ***
222
223create a test log
Gunnar Mills38032802016-12-12 13:43:40 -0600224 [Arguments]
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600225 ${data}= create dictionary data=@{EMPTY}
George Keishingec807372016-12-05 03:54:51 -0600226 ${resp}= openbmc post request ${EVENT_RECORD}action/acceptTestMessage data=${data}
Chris Austenb29d2e82016-06-07 12:25:35 -0500227 should be equal as strings ${resp.status_code} ${HTTP_OK}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600228 ${json}= to json ${resp.content}
229 ${LOGID}= convert to integer ${json['data']}
George Keishingec807372016-12-05 03:54:51 -0600230 ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600231 [Return] ${uri}