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 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 10 | Library Collections |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 12 | Suite Setup Open Connection And Log In |
| 13 | Suite Teardown Close All Connections |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 14 | Test Teardown Log FFDC |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
| 16 | *** Variables *** |
| 17 | &{NIL} data=@{EMPTY} |
| 18 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 19 | ${WAIT_FOR_SERVICES_UP} 3min |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | |
| 23 | valid path to logs |
| 24 | [Documentation] Test list all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 25 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 26 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 27 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 28 | |
| 29 | clear any logs |
| 30 | [Documentation] Test delete all events |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 31 | [Tags] CI clear_any_logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 32 | ${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 | |
| 38 | write a log |
| 39 | [Documentation] Test create event |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 40 | [Tags] CI write_a_log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 41 | create a test log |
| 42 | |
| 43 | Message attribute should match |
| 44 | [Documentation] Check message attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 45 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 46 | ${uri} = create a test log |
| 47 | ${content} = Read Attribute ${uri} message |
| 48 | Should Be Equal ${content} A Test event log just happened |
| 49 | |
| 50 | Severity attribute should match |
| 51 | [Documentation] Check severity attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 52 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 53 | ${uri} = create a test log |
| 54 | ${content}= Read Attribute ${uri} severity |
| 55 | Should Be Equal ${content} Info |
| 56 | |
| 57 | data_bytes attribute should match |
| 58 | [Documentation] Check data_bytes attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 59 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | @{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 | |
| 65 | delete the log |
| 66 | [Documentation] Test the delete event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 67 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 68 | ${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 | |
| 75 | 2nd delete should fail |
| 76 | [Documentation] Negative scnenario to delete already deleted event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 77 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 78 | ${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 | |
| 85 | Intermixed delete |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 86 | [Documentation] This testcase does the following sequence |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 87 | ... Steps: |
| 88 | ... write three logs |
| 89 | ... delete middle log |
| 90 | ... middle log should not exist |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 91 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 92 | ${event1}= create a test log |
| 93 | ${event2}= create a test log |
| 94 | ${event3}= create a test log |
| 95 | ${deluri} = catenate SEPARATOR= ${event2} /action/delete |
| 96 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 97 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 98 | ${resp}= openbmc get request ${event2} |
| 99 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 100 | |
| 101 | restarting event process retains logs |
| 102 | [Documentation] This is to test events are in place even after the |
| 103 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 104 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 105 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 106 | ${json} = to json ${resp.content} |
| 107 | ${logs_pre_restart}= set variable ${json['data']} |
| 108 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 109 | ${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 | |
| 117 | deleting 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 Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 120 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 121 | ${uri}= create a test log |
| 122 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 123 | ${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 Keishing | 410b629 | 2016-07-05 10:40:16 -0500 | [diff] [blame] | 130 | making new log after obmc-phosphor-event.service restart |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 131 | [Documentation] This is for testing event creation after the |
| 132 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 133 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 134 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 135 | Sleep ${10} |
| 136 | |
| 137 | create a test log |
| 138 | |
| 139 | deleting 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 Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 142 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 143 | ${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 | |
| 151 | Test 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, |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 157 | ... Wait for BMC to READY or Powered OFF state |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 158 | ... Events should exist post reboot, |
| 159 | ... Create two more events, |
| 160 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 161 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 162 | ${pre_reboot_event}= create a test log |
| 163 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 164 | ${output}= Execute Command /sbin/reboot |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 165 | Check If BMC is Up 5 min 10 sec |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 166 | |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 167 | @{states}= Create List BMC_READY HOST_POWERED_OFF |
| 168 | Wait Until Keyword Succeeds |
| 169 | ... 10 min 10 sec Verify BMC State ${states} |
| 170 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 171 | ${resp} = openbmc get request ${pre_reboot_event} |
| 172 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 173 | ${post_reboot_event1}= create a test log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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 | |
| 182 | clearing logs results in no logs |
| 183 | [Documentation] This testcase is for clearning the events when no logs present |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 184 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 185 | ${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 | |
| 196 | create 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} |