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 | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 9 | Resource ../lib/boot/boot_resource_master.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 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 13 | Suite Setup Open Connection And Log In |
| 14 | Suite Teardown Close All Connections |
Gunnar Mills | eac1af2 | 2016-11-14 15:30:09 -0600 | [diff] [blame] | 15 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 | |
| 17 | *** Variables *** |
| 18 | &{NIL} data=@{EMPTY} |
| 19 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 20 | ${WAIT_FOR_SERVICES_UP} 3min |
| 21 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 22 | ${EVENT_RECORD} ${RECORDS_URI}events/ |
| 23 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | *** Test Cases *** |
| 25 | |
| 26 | valid path to logs |
| 27 | [Documentation] Test list all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 28 | [Tags] CI |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 29 | ${resp}= openbmc get request ${EVENT_RECORD} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 30 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 31 | |
| 32 | clear any logs |
| 33 | [Documentation] Test delete all events |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 34 | [Tags] CI clear_any_logs |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 35 | ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 36 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 37 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 38 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | Should Be Empty ${json['data']} |
| 40 | |
| 41 | write a log |
| 42 | [Documentation] Test create event |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 43 | [Tags] CI write_a_log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 44 | create a test log |
| 45 | |
| 46 | Message attribute should match |
| 47 | [Documentation] Check message attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 48 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 49 | ${uri}= create a test log |
| 50 | ${content}= Read Attribute ${uri} message |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 51 | Should Be Equal ${content} A Test event log just happened |
| 52 | |
| 53 | Severity attribute should match |
| 54 | [Documentation] Check severity attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 55 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 56 | ${uri}= create a test log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 57 | ${content}= Read Attribute ${uri} severity |
| 58 | Should Be Equal ${content} Info |
| 59 | |
| 60 | data_bytes attribute should match |
| 61 | [Documentation] Check data_bytes attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 62 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 63 | @{data_list}= Create List ${48} ${0} ${19} ${127} ${136} ${255} |
| 64 | ${uri}= create a test log |
| 65 | ${content}= Read Attribute ${uri} debug_data |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 66 | Lists Should Be Equal ${content} ${data_list} |
| 67 | |
| 68 | delete the log |
| 69 | [Documentation] Test the delete event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 70 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 71 | ${uri}= create a test log |
| 72 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 73 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 74 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 75 | ${resp}= openbmc get request ${deluri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 76 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 77 | |
| 78 | 2nd delete should fail |
| 79 | [Documentation] Negative scnenario to delete already deleted event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 80 | [Tags] CI |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 81 | ${uri}= create a test log |
| 82 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 83 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 84 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 85 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 86 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 87 | |
| 88 | Intermixed delete |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 89 | [Documentation] This testcase does the following sequence |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 90 | ... Steps: |
| 91 | ... write three logs |
| 92 | ... delete middle log |
| 93 | ... middle log should not exist |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 94 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 95 | ${event1}= create a test log |
| 96 | ${event2}= create a test log |
| 97 | ${event3}= create a test log |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 98 | ${deluri}= catenate SEPARATOR= ${event2} /action/delete |
| 99 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 100 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 101 | ${resp}= openbmc get request ${event2} |
| 102 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 103 | |
| 104 | restarting event process retains logs |
| 105 | [Documentation] This is to test events are in place even after the |
| 106 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 107 | [Tags] CI |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 108 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 109 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 110 | ${logs_pre_restart}= set variable ${json['data']} |
| 111 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 112 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 113 | Sleep ${10} |
| 114 | |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 115 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 116 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 117 | ${logs_post_restart}= set variable ${json['data']} |
| 118 | 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 |
| 119 | |
| 120 | deleting log after obmc-phosphor-event.service restart |
| 121 | [Documentation] This is to test event can be deleted created prior to |
| 122 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 123 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 124 | ${uri}= create a test log |
| 125 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 126 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 127 | Sleep ${10} |
| 128 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 129 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 130 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 131 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 132 | |
George Keishing | 410b629 | 2016-07-05 10:40:16 -0500 | [diff] [blame] | 133 | making new log after obmc-phosphor-event.service restart |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 134 | [Documentation] This is for testing event creation after the |
| 135 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 136 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 137 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 138 | Sleep ${10} |
| 139 | |
| 140 | create a test log |
| 141 | |
| 142 | deleting new log after obmc-phosphor-event.service restart |
| 143 | [Documentation] This testcase is for testing deleted newly created event |
| 144 | ... after event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 145 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 146 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 147 | Sleep ${10} |
| 148 | |
| 149 | ${uri}= create a test log |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 150 | ${deluri}= catenate SEPARATOR= ${uri} /action/delete |
| 151 | ${resp}= openbmc post request ${deluri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 152 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 153 | |
| 154 | Test events after openbmc reboot |
| 155 | [Documentation] This is to test event can be deleted created prior to |
| 156 | ... openbmc reboot |
| 157 | ... Steps: |
| 158 | ... Create event, |
George Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 159 | ... Power off if ON else no-op |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 160 | ... Reboot openbmc, |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 161 | ... Wait for BMC to READY or Powered OFF state |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 162 | ... Events should exist post reboot, |
| 163 | ... Create two more events, |
| 164 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 165 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 166 | ${pre_reboot_event}= create a test log |
| 167 | |
George Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 168 | Initiate Power Off |
| 169 | Check Power Off States |
| 170 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 171 | ${output}= Execute Command /sbin/reboot |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 172 | Check If BMC is Up 5 min 10 sec |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 173 | |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 174 | @{states}= Create List BMC_READY HOST_POWERED_OFF |
| 175 | Wait Until Keyword Succeeds |
| 176 | ... 10 min 10 sec Verify BMC State ${states} |
| 177 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 178 | ${resp}= openbmc get request ${pre_reboot_event} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 179 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 180 | ${post_reboot_event1}= create a test log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 181 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 182 | ${del_prereboot_uri}= catenate SEPARATOR= ${pre_reboot_event} /action/delete |
| 183 | ${resp}= openbmc post request ${del_prereboot_uri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 184 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 185 | ${del_postreboot_uri}= catenate SEPARATOR= ${post_reboot_event1} /action/delete |
| 186 | ${resp}= openbmc post request ${del_postreboot_uri} data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 187 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 188 | |
| 189 | clearing logs results in no logs |
| 190 | [Documentation] This testcase is for clearning the events when no logs present |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 191 | [Tags] CI |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 192 | ${resp}= openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 193 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 194 | ${resp}= openbmc get request ${EVENT_RECORD} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 195 | ${json}= to json ${resp.content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 196 | Should Be Empty ${json['data']} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 197 | ${resp} = openbmc post request ${EVENT_RECORD}action/clear data=${NIL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 198 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 199 | |
| 200 | |
| 201 | *** Keywords *** |
| 202 | |
| 203 | create a test log |
| 204 | [arguments] |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 205 | ${data}= create dictionary data=@{EMPTY} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 206 | ${resp}= openbmc post request ${EVENT_RECORD}action/acceptTestMessage data=${data} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 207 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 208 | ${json}= to json ${resp.content} |
| 209 | ${LOGID}= convert to integer ${json['data']} |
George Keishing | ec80737 | 2016-12-05 03:54:51 -0600 | [diff] [blame] | 210 | ${uri}= catenate SEPARATOR= ${EVENT_RECORD} ${LOGID} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 211 | [return] ${uri} |