blob: c2f5b25238ebe9a25593d50fb0f3cc9d1c4c92b6 [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
Chris Austenb29d2e82016-06-07 12:25:35 -05008
George Keishing4d6c1da2016-07-15 05:51:22 -05009Library Collections
Chris Austenb29d2e82016-06-07 12:25:35 -050010
George Keishing4d6c1da2016-07-15 05:51:22 -050011Suite Setup Open Connection And Log In
12Suite Teardown Close All Connections
Chris Austenb29d2e82016-06-07 12:25:35 -050013
14*** Variables ***
15&{NIL} data=@{EMPTY}
16${SYSTEM_SHUTDOWN_TIME} 1min
17${WAIT_FOR_SERVICES_UP} 3min
18
19*** Test Cases ***
20
21valid path to logs
22 [Documentation] Test list all events
Chris Austen859be602016-07-07 16:46:31 -050023 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050024 ${resp} = openbmc get request /org/openbmc/records/events/
25 should be equal as strings ${resp.status_code} ${HTTP_OK}
26
27clear any logs
28 [Documentation] Test delete all events
Chris Austen859be602016-07-07 16:46:31 -050029 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050030 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
31 should be equal as strings ${resp.status_code} ${HTTP_OK}
32 ${resp} = openbmc get request /org/openbmc/records/events/
33 ${json} = to json ${resp.content}
34 Should Be Empty ${json['data']}
35
36write a log
37 [Documentation] Test create event
Chris Austen859be602016-07-07 16:46:31 -050038 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050039 create a test log
40
41Message attribute should match
42 [Documentation] Check message attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050043 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050044 ${uri} = create a test log
45 ${content} = Read Attribute ${uri} message
46 Should Be Equal ${content} A Test event log just happened
47
48Severity attribute should match
49 [Documentation] Check severity attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050050 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050051 ${uri} = create a test log
52 ${content}= Read Attribute ${uri} severity
53 Should Be Equal ${content} Info
54
55data_bytes attribute should match
56 [Documentation] Check data_bytes attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050057 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050058 @{data_list} = Create List ${48} ${0} ${19} ${127} ${136} ${255}
59 ${uri} = create a test log
60 ${content} = Read Attribute ${uri} debug_data
61 Lists Should Be Equal ${content} ${data_list}
62
63delete the log
64 [Documentation] Test the delete event
Chris Austen859be602016-07-07 16:46:31 -050065 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050066 ${uri} = create a test log
67 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
68 ${resp} = openbmc post request ${deluri} data=${NIL}
69 should be equal as strings ${resp.status_code} ${HTTP_OK}
70 ${resp} = openbmc get request ${deluri}
71 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
72
732nd delete should fail
74 [Documentation] Negative scnenario to delete already deleted event
Chris Austen859be602016-07-07 16:46:31 -050075 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050076 ${uri} = create a test log
77 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
78 ${resp} = openbmc post request ${deluri} data=${NIL}
79 should be equal as strings ${resp.status_code} ${HTTP_OK}
80 ${resp} = openbmc post request ${deluri} data=${NIL}
81 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
82
83Intermixed delete
84 [Documentation] This testcase is for excersicing caching impleted,
85 ... Steps:
86 ... write three logs
87 ... delete middle log
88 ... middle log should not exist
89 ... time stamp should not match between logs(1st and 3rd)
Chris Austen859be602016-07-07 16:46:31 -050090 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050091 ${event1}= create a test log
92 ${event2}= create a test log
93 ${event3}= create a test log
94 ${deluri} = catenate SEPARATOR= ${event2} /action/delete
95 ${resp} = openbmc post request ${deluri} data=${NIL}
96 should be equal as strings ${resp.status_code} ${HTTP_OK}
97 ${time_event1}= Read Attribute ${event1} time
98 ${time_event3}= Read Attribute ${event3} time
99 should not be equal ${time_event1} ${time_event3}
100
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,
157 ... Events should exist post reboot,
158 ... Create two more events,
159 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500160 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500161 ${pre_reboot_event}= create a test log
162
Chris Austenb29d2e82016-06-07 12:25:35 -0500163 ${output}= Execute Command /sbin/reboot
164 Sleep ${SYSTEM_SHUTDOWN_TIME}
165 Wait For Host To Ping ${OPENBMC_HOST}
166 Sleep ${WAIT_FOR_SERVICES_UP}
167
168 ${resp} = openbmc get request ${pre_reboot_event}
169 should be equal as strings ${resp.status_code} ${HTTP_OK}
170 ${post_reboot_event1}= create a test log
171 ${post_reboot_event2}= create a test log
172
173 ${del_prereboot_uri} = catenate SEPARATOR= ${pre_reboot_event} /action/delete
174 ${resp} = openbmc post request ${del_prereboot_uri} data=${NIL}
175 should be equal as strings ${resp.status_code} ${HTTP_OK}
176 ${del_postreboot_uri} = catenate SEPARATOR= ${post_reboot_event1} /action/delete
177 ${resp} = openbmc post request ${del_postreboot_uri} data=${NIL}
178 should be equal as strings ${resp.status_code} ${HTTP_OK}
179
180clearing logs results in no logs
181 [Documentation] This testcase is for clearning the events when no logs present
Chris Austen859be602016-07-07 16:46:31 -0500182 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500183 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
184 should be equal as strings ${resp.status_code} ${HTTP_OK}
185 ${resp} = openbmc get request /org/openbmc/records/events/
186 ${json} = to json ${resp.content}
187 Should Be Empty ${json['data']}
188 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
189 should be equal as strings ${resp.status_code} ${HTTP_OK}
190
191
192*** Keywords ***
193
194create a test log
195 [arguments]
196 ${data} = create dictionary data=@{EMPTY}
197 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
198 should be equal as strings ${resp.status_code} ${HTTP_OK}
199 ${json} = to json ${resp.content}
200 ${LOGID} = convert to integer ${json['data']}
201 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
202 [return] ${uri}