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 |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 31 | [Tags] CI |
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 |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 40 | [Tags] CI |
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 |
| 86 | [Documentation] This testcase is for excersicing caching impleted, |
| 87 | ... Steps: |
| 88 | ... write three logs |
| 89 | ... delete middle log |
| 90 | ... middle log should not exist |
| 91 | ... time stamp should not match between logs(1st and 3rd) |
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} |
| 99 | ${time_event1}= Read Attribute ${event1} time |
| 100 | ${time_event3}= Read Attribute ${event3} time |
| 101 | should not be equal ${time_event1} ${time_event3} |
| 102 | |
| 103 | restarting event process retains logs |
| 104 | [Documentation] This is to test events are in place even after the |
| 105 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 106 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 107 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 108 | ${json} = to json ${resp.content} |
| 109 | ${logs_pre_restart}= set variable ${json['data']} |
| 110 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 111 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 112 | Sleep ${10} |
| 113 | |
| 114 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 115 | ${json} = to json ${resp.content} |
| 116 | ${logs_post_restart}= set variable ${json['data']} |
| 117 | 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 |
| 118 | |
| 119 | deleting log after obmc-phosphor-event.service restart |
| 120 | [Documentation] This is to test event can be deleted created prior to |
| 121 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 122 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 123 | ${uri}= create a test log |
| 124 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 125 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 126 | Sleep ${10} |
| 127 | |
| 128 | ${deluri} = catenate SEPARATOR= ${uri} /action/delete |
| 129 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 130 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 131 | |
George Keishing | 410b629 | 2016-07-05 10:40:16 -0500 | [diff] [blame] | 132 | making new log after obmc-phosphor-event.service restart |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 133 | [Documentation] This is for testing event creation after the |
| 134 | ... event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 135 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 136 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 137 | Sleep ${10} |
| 138 | |
| 139 | create a test log |
| 140 | |
| 141 | deleting new log after obmc-phosphor-event.service restart |
| 142 | [Documentation] This testcase is for testing deleted newly created event |
| 143 | ... after event service is restarted. |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 144 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 145 | ${uptime}= Execute Command systemctl restart obmc-phosphor-event.service |
| 146 | Sleep ${10} |
| 147 | |
| 148 | ${uri}= create a test log |
| 149 | ${deluri} = catenate SEPARATOR= ${uri} /action/delete |
| 150 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 151 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 152 | |
| 153 | Test events after openbmc reboot |
| 154 | [Documentation] This is to test event can be deleted created prior to |
| 155 | ... openbmc reboot |
| 156 | ... Steps: |
| 157 | ... Create event, |
| 158 | ... Reboot openbmc, |
| 159 | ... Events should exist post reboot, |
| 160 | ... Create two more events, |
| 161 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 162 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 163 | ${pre_reboot_event}= create a test log |
| 164 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 165 | ${output}= Execute Command /sbin/reboot |
| 166 | Sleep ${SYSTEM_SHUTDOWN_TIME} |
| 167 | Wait For Host To Ping ${OPENBMC_HOST} |
| 168 | Sleep ${WAIT_FOR_SERVICES_UP} |
| 169 | |
| 170 | ${resp} = openbmc get request ${pre_reboot_event} |
| 171 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 172 | ${post_reboot_event1}= create a test log |
| 173 | ${post_reboot_event2}= create a test log |
| 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} |