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 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 8 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 9 | Library Collections |
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 | Suite Setup Open Connection And Log In |
| 12 | Suite Teardown Close All Connections |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 13 | |
| 14 | *** Variables *** |
| 15 | &{NIL} data=@{EMPTY} |
| 16 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 17 | ${WAIT_FOR_SERVICES_UP} 3min |
| 18 | |
| 19 | *** Test Cases *** |
| 20 | |
| 21 | valid path to logs |
| 22 | [Documentation] Test list all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 23 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 25 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 26 | |
| 27 | clear any logs |
| 28 | [Documentation] Test delete all events |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 29 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 30 | ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL} |
| 31 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 32 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 33 | ${json} = to json ${resp.content} |
| 34 | Should Be Empty ${json['data']} |
| 35 | |
| 36 | write a log |
| 37 | [Documentation] Test create event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 38 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | create a test log |
| 40 | |
| 41 | Message attribute should match |
| 42 | [Documentation] Check message attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 43 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 44 | ${uri} = create a test log |
| 45 | ${content} = Read Attribute ${uri} message |
| 46 | Should Be Equal ${content} A Test event log just happened |
| 47 | |
| 48 | Severity attribute should match |
| 49 | [Documentation] Check severity attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 50 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 51 | ${uri} = create a test log |
| 52 | ${content}= Read Attribute ${uri} severity |
| 53 | Should Be Equal ${content} Info |
| 54 | |
| 55 | data_bytes attribute should match |
| 56 | [Documentation] Check data_bytes attribute for created event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 57 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 58 | @{data_list} = Create List ${48} ${0} ${19} ${127} ${136} ${255} |
| 59 | ${uri} = create a test log |
| 60 | ${content} = Read Attribute ${uri} debug_data |
| 61 | Lists Should Be Equal ${content} ${data_list} |
| 62 | |
| 63 | delete the log |
| 64 | [Documentation] Test the delete event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 65 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 66 | ${uri} = create a test log |
| 67 | ${deluri} = catenate SEPARATOR= ${uri} /action/delete |
| 68 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 69 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 70 | ${resp} = openbmc get request ${deluri} |
| 71 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 72 | |
| 73 | 2nd delete should fail |
| 74 | [Documentation] Negative scnenario to delete already deleted event |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 75 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 76 | ${uri} = create a test log |
| 77 | ${deluri} = catenate SEPARATOR= ${uri} /action/delete |
| 78 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 79 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 80 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 81 | should be equal as strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 82 | |
| 83 | Intermixed delete |
| 84 | [Documentation] This testcase is for excersicing caching impleted, |
| 85 | ... Steps: |
| 86 | ... write three logs |
| 87 | ... delete middle log |
| 88 | ... middle log should not exist |
| 89 | ... time stamp should not match between logs(1st and 3rd) |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 90 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 91 | ${event1}= create a test log |
| 92 | ${event2}= create a test log |
| 93 | ${event3}= create a test log |
| 94 | ${deluri} = catenate SEPARATOR= ${event2} /action/delete |
| 95 | ${resp} = openbmc post request ${deluri} data=${NIL} |
| 96 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 97 | ${time_event1}= Read Attribute ${event1} time |
| 98 | ${time_event3}= Read Attribute ${event3} time |
| 99 | should not be equal ${time_event1} ${time_event3} |
| 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, |
| 157 | ... Events should exist post reboot, |
| 158 | ... Create two more events, |
| 159 | ... Delete old and new event |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 160 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 161 | ${pre_reboot_event}= create a test log |
| 162 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 163 | ${output}= Execute Command /sbin/reboot |
| 164 | Sleep ${SYSTEM_SHUTDOWN_TIME} |
| 165 | Wait For Host To Ping ${OPENBMC_HOST} |
| 166 | Sleep ${WAIT_FOR_SERVICES_UP} |
| 167 | |
| 168 | ${resp} = openbmc get request ${pre_reboot_event} |
| 169 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 170 | ${post_reboot_event1}= create a test log |
| 171 | ${post_reboot_event2}= create a test log |
| 172 | |
| 173 | ${del_prereboot_uri} = catenate SEPARATOR= ${pre_reboot_event} /action/delete |
| 174 | ${resp} = openbmc post request ${del_prereboot_uri} data=${NIL} |
| 175 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 176 | ${del_postreboot_uri} = catenate SEPARATOR= ${post_reboot_event1} /action/delete |
| 177 | ${resp} = openbmc post request ${del_postreboot_uri} data=${NIL} |
| 178 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 179 | |
| 180 | clearing logs results in no logs |
| 181 | [Documentation] This testcase is for clearning the events when no logs present |
Chris Austen | 859be60 | 2016-07-07 16:46:31 -0500 | [diff] [blame] | 182 | [Tags] CI |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 183 | ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL} |
| 184 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 185 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 186 | ${json} = to json ${resp.content} |
| 187 | Should Be Empty ${json['data']} |
| 188 | ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL} |
| 189 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 190 | |
| 191 | |
| 192 | *** Keywords *** |
| 193 | |
| 194 | create a test log |
| 195 | [arguments] |
| 196 | ${data} = create dictionary data=@{EMPTY} |
| 197 | ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data} |
| 198 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 199 | ${json} = to json ${resp.content} |
| 200 | ${LOGID} = convert to integer ${json['data']} |
| 201 | ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID} |
| 202 | [return] ${uri} |