Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 2 | Documentation This suite is used for testing the error logging |
| 3 | ... capability from the host |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 4 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 5 | Resource ../lib/rest_client.robot |
| 6 | Resource ../lib/utils.robot |
| 7 | Resource ../lib/connection_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 8 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | 29ef22d | 2017-01-30 09:11:29 -0600 | [diff] [blame] | 9 | Resource ../lib/state_manager.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 10 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 11 | Library Collections |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 12 | |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 13 | Test Setup Open Connection And Log In |
| 14 | Test Teardown Post Test Case Execution |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
Sridevi Ramesh | 066a7b1 | 2017-01-19 10:01:28 -0600 | [diff] [blame] | 16 | Force Tags Event_Logging |
| 17 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 18 | *** Variables *** |
| 19 | &{NIL} data=@{EMPTY} |
| 20 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 21 | ${WAIT_FOR_SERVICES_UP} 3min |
| 22 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 23 | ${EVENT_RECORD} ${RECORDS_URI}events/ |
| 24 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 25 | *** Test Cases *** |
| 26 | |
| 27 | valid path to logs |
| 28 | [Documentation] Test list all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 29 | [Tags] CI |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 30 | ${resp}= openbmc get request ${EVENT_RECORD} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 32 | |
| 33 | clear any logs |
| 34 | [Documentation] Test delete all events |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 35 | [Tags] CI clear_any_logs |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 36 | ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 37 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 38 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 39 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | Should Be Empty ${json['data']} |
| 41 | |
| 42 | write a log |
| 43 | [Documentation] Test create event |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 44 | [Tags] CI write_a_log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 | create a test log |
| 46 | |
| 47 | Message attribute should match |
| 48 | [Documentation] Check message attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 49 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 50 | ${uri}= create a test log |
| 51 | ${content}= Read Attribute ${uri} message |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 52 | Should Be Equal ${content} A Test event log just happened |
| 53 | |
| 54 | Severity attribute should match |
| 55 | [Documentation] Check severity attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 56 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 57 | ${uri}= create a test log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 58 | ${content}= Read Attribute ${uri} severity |
| 59 | Should Be Equal ${content} Info |
| 60 | |
| 61 | data_bytes attribute should match |
| 62 | [Documentation] Check data_bytes attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 63 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 64 | @{data_list}= Create List ${48} ${0} ${19} ${127} ${136} ${255} |
| 65 | ${uri}= create a test log |
| 66 | ${content}= Read Attribute ${uri} debug_data |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 67 | Lists Should Be Equal ${content} ${data_list} |
| 68 | |
| 69 | delete the log |
| 70 | [Documentation] Test the delete event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 71 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 72 | ${uri}= create a test log |
| 73 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 74 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 75 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 76 | ${resp}= openbmc get request ${deluri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 77 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 78 | |
| 79 | 2nd delete should fail |
| 80 | [Documentation] Negative scnenario to delete already deleted event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 81 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 82 | ${uri}= create a test log |
| 83 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 84 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 85 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 86 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 87 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 88 | |
| 89 | Intermixed delete |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 90 | [Documentation] This testcase does the following sequence |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 91 | ... Steps: |
| 92 | ... write three logs |
| 93 | ... delete middle log |
| 94 | ... middle log should not exist |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 95 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 96 | ${event1}= create a test log |
| 97 | ${event2}= create a test log |
| 98 | ${event3}= create a test log |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 99 | ${deluri}= catenate SEPARATOR= ${event2} /action/delete |
| 100 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 101 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 102 | ${resp}= openbmc get request ${event2} |
| 103 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 104 | |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 105 | Test Event Logs Persistency |
| 106 | [Documentation] Create event logs, restart the event service |
| 107 | ... and verify if logs persist. |
| 108 | [Tags] CI Test_Event_Logs_Persistency |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 109 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 110 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 111 | ${logs_pre_restart}= set variable ${json['data']} |
| 112 | |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 113 | ${output} ${stderr} ${rc}= Execute Command |
| 114 | ... systemctl restart org.openbmc.records.events.service |
| 115 | ... return_stderr=True return_rc=True |
| 116 | Should Be Empty ${stderr} |
| 117 | Should Be Equal ${rc} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 118 | Sleep ${10} |
| 119 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 120 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 121 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 122 | ${logs_post_restart}= set variable ${json['data']} |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 123 | List Should Contain Sub List |
| 124 | ... ${logs_post_restart} ${logs_pre_restart} |
| 125 | ... msg=The event logs are mismatched. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 126 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 127 | |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 128 | Test Event Deletion Post Restarting Event Manager |
| 129 | [Documentation] Create event log, restart event service and |
| 130 | ... delete the event created earlier. |
| 131 | [Tags] CI Test_Event_Deletion Post_Restarting_Event_Manager |
| 132 | |
| 133 | ${uri}= create a test log |
| 134 | |
| 135 | ${output} ${stderr} ${rc}= Execute Command |
| 136 | ... systemctl restart org.openbmc.records.events.service |
| 137 | ... return_stderr=True return_rc=True |
| 138 | Should Be Empty ${stderr} |
| 139 | Should Be Equal ${rc} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 140 | Sleep ${10} |
| 141 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 142 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 143 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 144 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 145 | |
George Keishing | 410b629 | 2016-07-05 10:40:16 -0500 | [diff] [blame] | 146 | making new log after obmc-phosphor-event.service restart |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 147 | [Documentation] This is for testing event creation after the |
| 148 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 149 | [Tags] CI |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 150 | ${output} ${stderr} ${rc}= Execute Command |
| 151 | ... systemctl restart org.openbmc.records.events.service |
| 152 | ... return_stderr=True return_rc=True |
| 153 | Should Be Empty ${stderr} |
| 154 | Should Be Equal ${rc} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 155 | Sleep ${10} |
| 156 | |
| 157 | create a test log |
| 158 | |
| 159 | deleting new log after obmc-phosphor-event.service restart |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 160 | [Documentation] This testcase is for testing deleted newly created event |
| 161 | ... after event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 162 | [Tags] CI |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 163 | ${output} ${stderr} ${rc}= Execute Command |
| 164 | ... systemctl restart org.openbmc.records.events.service |
| 165 | ... return_stderr=True return_rc=True |
| 166 | Should Be Empty ${stderr} |
| 167 | Should Be Equal ${rc} ${0} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 168 | Sleep ${10} |
| 169 | |
| 170 | ${uri}= create a test log |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 171 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 172 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 173 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 174 | |
| 175 | Test events after openbmc reboot |
| 176 | [Documentation] This is to test event can be deleted created prior to |
| 177 | ... openbmc reboot |
| 178 | ... Steps: |
| 179 | ... Create event, |
George Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 180 | ... Power off if ON else no-op |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 181 | ... Reboot openbmc, |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 182 | ... Wait for BMC to READY or Powered OFF state |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 183 | ... Events should exist post reboot, |
| 184 | ... Create two more events, |
| 185 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 186 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 187 | ${pre_reboot_event}= create a test log |
| 188 | |
George Keishing | 29ef22d | 2017-01-30 09:11:29 -0600 | [diff] [blame] | 189 | Initiate Host PowerOff |
George Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 190 | |
Sridevi Ramesh | 742b3b5 | 2017-02-05 12:14:33 -0600 | [diff] [blame] | 191 | Initiate BMC Reboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 192 | |
George Keishing | 29ef22d | 2017-01-30 09:11:29 -0600 | [diff] [blame] | 193 | Wait Until Keyword Succeeds 10 min 10 sec Is BMC Ready |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 194 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 195 | ${resp}= openbmc get request ${pre_reboot_event} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 196 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 197 | ${post_reboot_event1}= create a test log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 198 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 199 | ${del_prereboot_uri}= catenate SEPARATOR= ${pre_reboot_event} /action/delete |
| 200 | ${resp}= openbmc post request ${del_prereboot_uri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 201 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 202 | ${del_postreboot_uri}= catenate SEPARATOR= ${post_reboot_event1} /action/delete |
| 203 | ${resp}= openbmc post request ${del_postreboot_uri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 204 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 205 | |
| 206 | clearing logs results in no logs |
| 207 | [Documentation] This testcase is for clearning the events when no logs present |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 208 | [Tags] CI |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 209 | ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 210 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 211 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 212 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 213 | Should Be Empty ${json['data']} |
George Keishing | bf5442c | 2016-12-06 01:57:44 -0600 | [diff] [blame] | 214 | ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 215 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 216 | |
| 217 | |
| 218 | *** Keywords *** |
| 219 | |
| 220 | create a test log |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 221 | [Arguments] |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 222 | ${data}= create dictionary data=@{EMPTY} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 223 | ${resp}= openbmc post request ${EVENT_RECORD}action/acceptTestMessage data=${data} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 224 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 225 | ${json}= to json ${resp.content} |
| 226 | ${LOGID}= convert to integer ${json['data']} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 227 | ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 228 | [Return] ${uri} |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 229 | |
| 230 | Post Test Case Execution |
| 231 | [Documentation] Do the post test teardown. |
| 232 | ... 1. Capture FFDC on test failure. |
| 233 | ... 2. Close all open SSH connections. |
| 234 | |
| 235 | FFDC On Test Case Fail |
| 236 | Close All Connections |