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 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | valid path to logs |
| 25 | [Documentation] Test list all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 26 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 27 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 28 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 29 | |
| 30 | clear any logs |
| 31 | [Documentation] Test delete all events |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 32 | [Tags] CI clear_any_logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 33 | ${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 | |
| 39 | write a log |
| 40 | [Documentation] Test create event |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 41 | [Tags] CI write_a_log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 42 | create a test log |
| 43 | |
| 44 | Message attribute should match |
| 45 | [Documentation] Check message attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 46 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 47 | ${uri} = create a test log |
| 48 | ${content} = Read Attribute ${uri} message |
| 49 | Should Be Equal ${content} A Test event log just happened |
| 50 | |
| 51 | Severity attribute should match |
| 52 | [Documentation] Check severity attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 53 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 54 | ${uri} = create a test log |
| 55 | ${content}= Read Attribute ${uri} severity |
| 56 | Should Be Equal ${content} Info |
| 57 | |
| 58 | data_bytes attribute should match |
| 59 | [Documentation] Check data_bytes attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 60 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 61 | @{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 | |
| 66 | delete the log |
| 67 | [Documentation] Test the delete event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 68 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 69 | ${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 | |
| 76 | 2nd delete should fail |
| 77 | [Documentation] Negative scnenario to delete already deleted event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 78 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 79 | ${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 | |
| 86 | Intermixed delete |
George Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 87 | [Documentation] This testcase does the following sequence |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 88 | ... Steps: |
| 89 | ... write three logs |
| 90 | ... delete middle log |
| 91 | ... middle log should not exist |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 92 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 93 | ${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 Keishing | 70490c3 | 2016-09-20 10:55:46 -0500 | [diff] [blame] | 99 | ${resp}= openbmc get request ${event2} |
| 100 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 101 | |
| 102 | restarting event process retains logs |
| 103 | [Documentation] This is to test events are in place even after the |
| 104 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 105 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 106 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 107 | ${json} = to json ${resp.content} |
| 108 | ${logs_pre_restart}= set variable ${json['data']} |
| 109 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 110 | ${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 | |
| 118 | deleting 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 Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 121 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 122 | ${uri}= create a test log |
| 123 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 124 | ${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 Keishing | 410b629 | 2016-07-05 10:40:16 -0500 | [diff] [blame] | 131 | making new log after obmc-phosphor-event.service restart |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 132 | [Documentation] This is for testing event creation after the |
| 133 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 134 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 135 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 136 | Sleep ${10} |
| 137 | |
| 138 | create a test log |
| 139 | |
| 140 | deleting 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 Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 143 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 144 | ${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 | |
| 152 | Test 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 Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 157 | ... Power off if ON else no-op |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 158 | ... Reboot openbmc, |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 159 | ... Wait for BMC to READY or Powered OFF state |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 160 | ... Events should exist post reboot, |
| 161 | ... Create two more events, |
| 162 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 163 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 164 | ${pre_reboot_event}= create a test log |
| 165 | |
George Keishing | f88767a | 2016-11-17 01:58:05 -0600 | [diff] [blame] | 166 | Initiate Power Off |
| 167 | Check Power Off States |
| 168 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 169 | ${output}= Execute Command /sbin/reboot |
George Keishing | c4d3dc0 | 2016-09-19 03:45:55 -0500 | [diff] [blame] | 170 | Check If BMC is Up 5 min 10 sec |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 171 | |
George Keishing | 17982fb | 2016-11-08 04:59:37 -0600 | [diff] [blame] | 172 | @{states}= Create List BMC_READY HOST_POWERED_OFF |
| 173 | Wait Until Keyword Succeeds |
| 174 | ... 10 min 10 sec Verify BMC State ${states} |
| 175 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 176 | ${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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 179 | |
| 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 | |
| 187 | clearing logs results in no logs |
| 188 | [Documentation] This testcase is for clearning the events when no logs present |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 189 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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 | ${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 | |
| 201 | create 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} |