blob: dee0799ab3de64d4f7f99905784c1ebbe0a76f79 [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
Chris Austenb29d2e82016-06-07 12:25:35 -05009
George Keishing4d6c1da2016-07-15 05:51:22 -050010Library Collections
Chris Austenb29d2e82016-06-07 12:25:35 -050011
George Keishing4d6c1da2016-07-15 05:51:22 -050012Suite Setup Open Connection And Log In
13Suite Teardown Close All Connections
George Keishingd55a4be2016-08-26 03:28:17 -050014Test Teardown Log FFDC
Chris Austenb29d2e82016-06-07 12:25:35 -050015
16*** Variables ***
17&{NIL} data=@{EMPTY}
18${SYSTEM_SHUTDOWN_TIME} 1min
19${WAIT_FOR_SERVICES_UP} 3min
20
21*** Test Cases ***
22
23valid path to logs
24 [Documentation] Test list all events
Chris Austen859be602016-07-07 16:46:31 -050025 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050026 ${resp} = openbmc get request /org/openbmc/records/events/
27 should be equal as strings ${resp.status_code} ${HTTP_OK}
28
29clear any logs
30 [Documentation] Test delete all events
George Keishing97651c72016-10-04 00:44:15 -050031 [Tags] CI clear_any_logs
Chris Austenb29d2e82016-06-07 12:25:35 -050032 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
33 should be equal as strings ${resp.status_code} ${HTTP_OK}
34 ${resp} = openbmc get request /org/openbmc/records/events/
35 ${json} = to json ${resp.content}
36 Should Be Empty ${json['data']}
37
38write a log
39 [Documentation] Test create event
George Keishing97651c72016-10-04 00:44:15 -050040 [Tags] CI write_a_log
Chris Austenb29d2e82016-06-07 12:25:35 -050041 create a test log
42
43Message attribute should match
44 [Documentation] Check message attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050045 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050046 ${uri} = create a test log
47 ${content} = Read Attribute ${uri} message
48 Should Be Equal ${content} A Test event log just happened
49
50Severity attribute should match
51 [Documentation] Check severity attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050052 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050053 ${uri} = create a test log
54 ${content}= Read Attribute ${uri} severity
55 Should Be Equal ${content} Info
56
57data_bytes attribute should match
58 [Documentation] Check data_bytes attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050059 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050060 @{data_list} = Create List ${48} ${0} ${19} ${127} ${136} ${255}
61 ${uri} = create a test log
62 ${content} = Read Attribute ${uri} debug_data
63 Lists Should Be Equal ${content} ${data_list}
64
65delete the log
66 [Documentation] Test the delete event
Chris Austen859be602016-07-07 16:46:31 -050067 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050068 ${uri} = create a test log
69 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
70 ${resp} = openbmc post request ${deluri} data=${NIL}
71 should be equal as strings ${resp.status_code} ${HTTP_OK}
72 ${resp} = openbmc get request ${deluri}
73 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
74
752nd delete should fail
76 [Documentation] Negative scnenario to delete already deleted event
Chris Austen859be602016-07-07 16:46:31 -050077 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050078 ${uri} = create a test log
79 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
80 ${resp} = openbmc post request ${deluri} data=${NIL}
81 should be equal as strings ${resp.status_code} ${HTTP_OK}
82 ${resp} = openbmc post request ${deluri} data=${NIL}
83 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
84
85Intermixed delete
George Keishing70490c32016-09-20 10:55:46 -050086 [Documentation] This testcase does the following sequence
Chris Austenb29d2e82016-06-07 12:25:35 -050087 ... Steps:
88 ... write three logs
89 ... delete middle log
90 ... middle log should not exist
Chris Austen859be602016-07-07 16:46:31 -050091 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050092 ${event1}= create a test log
93 ${event2}= create a test log
94 ${event3}= create a test log
95 ${deluri} = catenate SEPARATOR= ${event2} /action/delete
96 ${resp} = openbmc post request ${deluri} data=${NIL}
97 should be equal as strings ${resp.status_code} ${HTTP_OK}
George Keishing70490c32016-09-20 10:55:46 -050098 ${resp}= openbmc get request ${event2}
99 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500100
101restarting event process retains logs
102 [Documentation] This is to test events are in place even after the
103 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500104 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500105 ${resp} = openbmc get request /org/openbmc/records/events/
106 ${json} = to json ${resp.content}
107 ${logs_pre_restart}= set variable ${json['data']}
108
Chris Austenb29d2e82016-06-07 12:25:35 -0500109 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
110 Sleep ${10}
111
112 ${resp} = openbmc get request /org/openbmc/records/events/
113 ${json} = to json ${resp.content}
114 ${logs_post_restart}= set variable ${json['data']}
115 List Should Contain Sub List ${logs_post_restart} ${logs_pre_restart} msg=Failed to find all the eventlogs which are present before restart of event service
116
117deleting log after obmc-phosphor-event.service restart
118 [Documentation] This is to test event can be deleted created prior to
119 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500120 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500121 ${uri}= create a test log
122
Chris Austenb29d2e82016-06-07 12:25:35 -0500123 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
124 Sleep ${10}
125
126 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
127 ${resp} = openbmc post request ${deluri} data=${NIL}
128 should be equal as strings ${resp.status_code} ${HTTP_OK}
129
George Keishing410b6292016-07-05 10:40:16 -0500130making new log after obmc-phosphor-event.service restart
Chris Austenb29d2e82016-06-07 12:25:35 -0500131 [Documentation] This is for testing event creation after the
132 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500133 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500134 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
135 Sleep ${10}
136
137 create a test log
138
139deleting new log after obmc-phosphor-event.service restart
140 [Documentation] This testcase is for testing deleted newly created event
141 ... after event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500142 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500143 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
144 Sleep ${10}
145
146 ${uri}= create a test log
147 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
148 ${resp} = openbmc post request ${deluri} data=${NIL}
149 should be equal as strings ${resp.status_code} ${HTTP_OK}
150
151Test events after openbmc reboot
152 [Documentation] This is to test event can be deleted created prior to
153 ... openbmc reboot
154 ... Steps:
155 ... Create event,
156 ... Reboot openbmc,
George Keishing17982fb2016-11-08 04:59:37 -0600157 ... Wait for BMC to READY or Powered OFF state
Chris Austenb29d2e82016-06-07 12:25:35 -0500158 ... Events should exist post reboot,
159 ... Create two more events,
160 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500161 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500162 ${pre_reboot_event}= create a test log
163
Chris Austenb29d2e82016-06-07 12:25:35 -0500164 ${output}= Execute Command /sbin/reboot
George Keishingc4d3dc02016-09-19 03:45:55 -0500165 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500166
George Keishing17982fb2016-11-08 04:59:37 -0600167 @{states}= Create List BMC_READY HOST_POWERED_OFF
168 Wait Until Keyword Succeeds
169 ... 10 min 10 sec Verify BMC State ${states}
170
Chris Austenb29d2e82016-06-07 12:25:35 -0500171 ${resp} = openbmc get request ${pre_reboot_event}
172 should be equal as strings ${resp.status_code} ${HTTP_OK}
173 ${post_reboot_event1}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500174
175 ${del_prereboot_uri} = catenate SEPARATOR= ${pre_reboot_event} /action/delete
176 ${resp} = openbmc post request ${del_prereboot_uri} data=${NIL}
177 should be equal as strings ${resp.status_code} ${HTTP_OK}
178 ${del_postreboot_uri} = catenate SEPARATOR= ${post_reboot_event1} /action/delete
179 ${resp} = openbmc post request ${del_postreboot_uri} data=${NIL}
180 should be equal as strings ${resp.status_code} ${HTTP_OK}
181
182clearing logs results in no logs
183 [Documentation] This testcase is for clearning the events when no logs present
Chris Austen859be602016-07-07 16:46:31 -0500184 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500185 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
186 should be equal as strings ${resp.status_code} ${HTTP_OK}
187 ${resp} = openbmc get request /org/openbmc/records/events/
188 ${json} = to json ${resp.content}
189 Should Be Empty ${json['data']}
190 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
191 should be equal as strings ${resp.status_code} ${HTTP_OK}
192
193
194*** Keywords ***
195
196create a test log
197 [arguments]
198 ${data} = create dictionary data=@{EMPTY}
199 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
200 should be equal as strings ${resp.status_code} ${HTTP_OK}
201 ${json} = to json ${resp.content}
202 ${LOGID} = convert to integer ${json['data']}
203 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
204 [return] ${uri}