blob: fbf6e3e90319ff8f3d1e780ce78932c47d36d733 [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
Chris Austen859be602016-07-07 16:46:31 -050031 [Tags] CI
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
Chris Austen859be602016-07-07 16:46:31 -050040 [Tags] CI
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
86 [Documentation] This testcase is for excersicing caching impleted,
87 ... Steps:
88 ... write three logs
89 ... delete middle log
90 ... middle log should not exist
91 ... time stamp should not match between logs(1st and 3rd)
Chris Austen859be602016-07-07 16:46:31 -050092 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050093 ${event1}= create a test log
94 ${event2}= create a test log
95 ${event3}= create a test log
96 ${deluri} = catenate SEPARATOR= ${event2} /action/delete
97 ${resp} = openbmc post request ${deluri} data=${NIL}
98 should be equal as strings ${resp.status_code} ${HTTP_OK}
99 ${time_event1}= Read Attribute ${event1} time
100 ${time_event3}= Read Attribute ${event3} time
101 should not be equal ${time_event1} ${time_event3}
102
103restarting event process retains logs
104 [Documentation] This is to test events are in place even after the
105 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500106 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500107 ${resp} = openbmc get request /org/openbmc/records/events/
108 ${json} = to json ${resp.content}
109 ${logs_pre_restart}= set variable ${json['data']}
110
Chris Austenb29d2e82016-06-07 12:25:35 -0500111 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
112 Sleep ${10}
113
114 ${resp} = openbmc get request /org/openbmc/records/events/
115 ${json} = to json ${resp.content}
116 ${logs_post_restart}= set variable ${json['data']}
117 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
118
119deleting log after obmc-phosphor-event.service restart
120 [Documentation] This is to test event can be deleted created prior to
121 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500122 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500123 ${uri}= create a test log
124
Chris Austenb29d2e82016-06-07 12:25:35 -0500125 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
126 Sleep ${10}
127
128 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
129 ${resp} = openbmc post request ${deluri} data=${NIL}
130 should be equal as strings ${resp.status_code} ${HTTP_OK}
131
George Keishing410b6292016-07-05 10:40:16 -0500132making new log after obmc-phosphor-event.service restart
Chris Austenb29d2e82016-06-07 12:25:35 -0500133 [Documentation] This is for testing event creation after the
134 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500135 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500136 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
137 Sleep ${10}
138
139 create a test log
140
141deleting new log after obmc-phosphor-event.service restart
142 [Documentation] This testcase is for testing deleted newly created event
143 ... after event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500144 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500145 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
146 Sleep ${10}
147
148 ${uri}= create a test log
149 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
150 ${resp} = openbmc post request ${deluri} data=${NIL}
151 should be equal as strings ${resp.status_code} ${HTTP_OK}
152
153Test events after openbmc reboot
154 [Documentation] This is to test event can be deleted created prior to
155 ... openbmc reboot
156 ... Steps:
157 ... Create event,
158 ... Reboot openbmc,
159 ... Events should exist post reboot,
160 ... Create two more events,
161 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500162 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500163 ${pre_reboot_event}= create a test log
164
Chris Austenb29d2e82016-06-07 12:25:35 -0500165 ${output}= Execute Command /sbin/reboot
166 Sleep ${SYSTEM_SHUTDOWN_TIME}
167 Wait For Host To Ping ${OPENBMC_HOST}
168 Sleep ${WAIT_FOR_SERVICES_UP}
169
170 ${resp} = openbmc get request ${pre_reboot_event}
171 should be equal as strings ${resp.status_code} ${HTTP_OK}
172 ${post_reboot_event1}= create a test log
173 ${post_reboot_event2}= create a test log
174
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}