blob: 5bb59f62105e9efb17a5675852d08f4a3db8a5b0 [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
22*** Test Cases ***
23
24valid path to logs
25 [Documentation] Test list all events
Chris Austen859be602016-07-07 16:46:31 -050026 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050027 ${resp} = openbmc get request /org/openbmc/records/events/
28 should be equal as strings ${resp.status_code} ${HTTP_OK}
29
30clear any logs
31 [Documentation] Test delete all events
George Keishing97651c72016-10-04 00:44:15 -050032 [Tags] CI clear_any_logs
Chris Austenb29d2e82016-06-07 12:25:35 -050033 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
34 should be equal as strings ${resp.status_code} ${HTTP_OK}
35 ${resp} = openbmc get request /org/openbmc/records/events/
36 ${json} = to json ${resp.content}
37 Should Be Empty ${json['data']}
38
39write a log
40 [Documentation] Test create event
George Keishing97651c72016-10-04 00:44:15 -050041 [Tags] CI write_a_log
Chris Austenb29d2e82016-06-07 12:25:35 -050042 create a test log
43
44Message attribute should match
45 [Documentation] Check message attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050046 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050047 ${uri} = create a test log
48 ${content} = Read Attribute ${uri} message
49 Should Be Equal ${content} A Test event log just happened
50
51Severity attribute should match
52 [Documentation] Check severity attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050053 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050054 ${uri} = create a test log
55 ${content}= Read Attribute ${uri} severity
56 Should Be Equal ${content} Info
57
58data_bytes attribute should match
59 [Documentation] Check data_bytes attribute for created event
Chris Austen859be602016-07-07 16:46:31 -050060 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050061 @{data_list} = Create List ${48} ${0} ${19} ${127} ${136} ${255}
62 ${uri} = create a test log
63 ${content} = Read Attribute ${uri} debug_data
64 Lists Should Be Equal ${content} ${data_list}
65
66delete the log
67 [Documentation] Test the delete event
Chris Austen859be602016-07-07 16:46:31 -050068 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050069 ${uri} = create a test log
70 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
71 ${resp} = openbmc post request ${deluri} data=${NIL}
72 should be equal as strings ${resp.status_code} ${HTTP_OK}
73 ${resp} = openbmc get request ${deluri}
74 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
75
762nd delete should fail
77 [Documentation] Negative scnenario to delete already deleted event
Chris Austen859be602016-07-07 16:46:31 -050078 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -050079 ${uri} = create a test log
80 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
81 ${resp} = openbmc post request ${deluri} data=${NIL}
82 should be equal as strings ${resp.status_code} ${HTTP_OK}
83 ${resp} = openbmc post request ${deluri} data=${NIL}
84 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
85
86Intermixed delete
George Keishing70490c32016-09-20 10:55:46 -050087 [Documentation] This testcase does the following sequence
Chris Austenb29d2e82016-06-07 12:25:35 -050088 ... Steps:
89 ... write three logs
90 ... delete middle log
91 ... middle log should not exist
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}
George Keishing70490c32016-09-20 10:55:46 -050099 ${resp}= openbmc get request ${event2}
100 should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND}
Chris Austenb29d2e82016-06-07 12:25:35 -0500101
102restarting event process retains logs
103 [Documentation] This is to test events are in place even after the
104 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500105 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500106 ${resp} = openbmc get request /org/openbmc/records/events/
107 ${json} = to json ${resp.content}
108 ${logs_pre_restart}= set variable ${json['data']}
109
Chris Austenb29d2e82016-06-07 12:25:35 -0500110 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
111 Sleep ${10}
112
113 ${resp} = openbmc get request /org/openbmc/records/events/
114 ${json} = to json ${resp.content}
115 ${logs_post_restart}= set variable ${json['data']}
116 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
117
118deleting log after obmc-phosphor-event.service restart
119 [Documentation] This is to test event can be deleted created prior to
120 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500121 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500122 ${uri}= create a test log
123
Chris Austenb29d2e82016-06-07 12:25:35 -0500124 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
125 Sleep ${10}
126
127 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
128 ${resp} = openbmc post request ${deluri} data=${NIL}
129 should be equal as strings ${resp.status_code} ${HTTP_OK}
130
George Keishing410b6292016-07-05 10:40:16 -0500131making new log after obmc-phosphor-event.service restart
Chris Austenb29d2e82016-06-07 12:25:35 -0500132 [Documentation] This is for testing event creation after the
133 ... event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500134 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500135 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
136 Sleep ${10}
137
138 create a test log
139
140deleting new log after obmc-phosphor-event.service restart
141 [Documentation] This testcase is for testing deleted newly created event
142 ... after event service is restarted.
Chris Austen859be602016-07-07 16:46:31 -0500143 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500144 ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service
145 Sleep ${10}
146
147 ${uri}= create a test log
148 ${deluri} = catenate SEPARATOR= ${uri} /action/delete
149 ${resp} = openbmc post request ${deluri} data=${NIL}
150 should be equal as strings ${resp.status_code} ${HTTP_OK}
151
152Test events after openbmc reboot
153 [Documentation] This is to test event can be deleted created prior to
154 ... openbmc reboot
155 ... Steps:
156 ... Create event,
George Keishingf88767a2016-11-17 01:58:05 -0600157 ... Power off if ON else no-op
Chris Austenb29d2e82016-06-07 12:25:35 -0500158 ... Reboot openbmc,
George Keishing17982fb2016-11-08 04:59:37 -0600159 ... Wait for BMC to READY or Powered OFF state
Chris Austenb29d2e82016-06-07 12:25:35 -0500160 ... Events should exist post reboot,
161 ... Create two more events,
162 ... Delete old and new event
causten147f5752016-08-11 16:24:45 -0500163 [Tags] bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -0500164 ${pre_reboot_event}= create a test log
165
George Keishingf88767a2016-11-17 01:58:05 -0600166 Initiate Power Off
167 Check Power Off States
168
Chris Austenb29d2e82016-06-07 12:25:35 -0500169 ${output}= Execute Command /sbin/reboot
George Keishingc4d3dc02016-09-19 03:45:55 -0500170 Check If BMC is Up 5 min 10 sec
Chris Austenb29d2e82016-06-07 12:25:35 -0500171
George Keishing17982fb2016-11-08 04:59:37 -0600172 @{states}= Create List BMC_READY HOST_POWERED_OFF
173 Wait Until Keyword Succeeds
174 ... 10 min 10 sec Verify BMC State ${states}
175
Chris Austenb29d2e82016-06-07 12:25:35 -0500176 ${resp} = openbmc get request ${pre_reboot_event}
177 should be equal as strings ${resp.status_code} ${HTTP_OK}
178 ${post_reboot_event1}= create a test log
Chris Austenb29d2e82016-06-07 12:25:35 -0500179
180 ${del_prereboot_uri} = catenate SEPARATOR= ${pre_reboot_event} /action/delete
181 ${resp} = openbmc post request ${del_prereboot_uri} data=${NIL}
182 should be equal as strings ${resp.status_code} ${HTTP_OK}
183 ${del_postreboot_uri} = catenate SEPARATOR= ${post_reboot_event1} /action/delete
184 ${resp} = openbmc post request ${del_postreboot_uri} data=${NIL}
185 should be equal as strings ${resp.status_code} ${HTTP_OK}
186
187clearing logs results in no logs
188 [Documentation] This testcase is for clearning the events when no logs present
Chris Austen859be602016-07-07 16:46:31 -0500189 [Tags] CI
Chris Austenb29d2e82016-06-07 12:25:35 -0500190 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
191 should be equal as strings ${resp.status_code} ${HTTP_OK}
192 ${resp} = openbmc get request /org/openbmc/records/events/
193 ${json} = to json ${resp.content}
194 Should Be Empty ${json['data']}
195 ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL}
196 should be equal as strings ${resp.status_code} ${HTTP_OK}
197
198
199*** Keywords ***
200
201create a test log
202 [arguments]
203 ${data} = create dictionary data=@{EMPTY}
204 ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data}
205 should be equal as strings ${resp.status_code} ${HTTP_OK}
206 ${json} = to json ${resp.content}
207 ${LOGID} = convert to integer ${json['data']}
208 ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID}
209 [return] ${uri}