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 eventlog association. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 3 | |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/utils.robot |
| 6 | Resource ../lib/connection_client.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 7 | Resource ../lib/openbmc_ffdc.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 |
| 10 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 11 | Suite Setup Suite Initialization Setup |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 12 | Suite Teardown Close All Connections |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 13 | |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 14 | Test Teardown Log FFDC |
| 15 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 16 | *** Variables *** |
| 17 | |
| 18 | ${SYSTEM_SHUTDOWN_TIME} 1min |
| 19 | |
| 20 | ${WAIT_FOR_SERVICES_UP} 3min |
| 21 | |
| 22 | ${CREATE_ERROR_SINGLE_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing failure" "/org/openbmc/inventory/system/chassis/motherboard/dimm1" 1 1 |
| 23 | |
| 24 | ${CREATE_ERROR_INVALID_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with invalid FRU" "abc" 1 1 |
| 25 | |
| 26 | ${CREATE_ERROR_NO_FRU} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with no fru" "" 1 1 |
| 27 | |
| 28 | ${CREATE_ERROR_VIRTUAL_SENSOR} busctl call org.openbmc.records.events /org/openbmc/records/events org.openbmc.recordlog acceptHostMessage sssay "Error" "Testing with a virtual sensor" "/org/openbmc/inventory/system/systemevent " 1 1 |
| 29 | |
| 30 | ${DIMM1_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm1 |
| 31 | |
| 32 | ${DIMM2_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm2 |
| 33 | |
| 34 | ${DIMM3_URI} /org/openbmc/inventory/system/chassis/motherboard/dimm3 |
| 35 | |
| 36 | &{NIL} data=@{EMPTY} |
| 37 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 38 | ${EVENT_RECORD} /org/openbmc/records/events |
| 39 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | *** Test Cases *** |
| 41 | |
| 42 | Create error log on single FRU |
| 43 | [Documentation] ***GOOD PATH*** |
| 44 | ... Create an error log on single FRU and verify |
| 45 | ... its association.\n |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 46 | [Tags] Create_error_log_on_single_FRU |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 47 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 48 | Run Keyword And Continue On Failure Clear all logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 49 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 50 | ${elog} ${stderr}= |
| 51 | ... Execute Command ${CREATE_ERROR_SINGLE_FRU} |
| 52 | ... return_stderr=True |
| 53 | Should Be Empty ${stderr} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 54 | |
| 55 | ${log_list} = Get EventList |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 56 | Should Contain '${log_list}' ${elog.strip('q ')} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 57 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 58 | ${association_uri} = |
| 59 | ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru |
| 60 | |
| 61 | ${association_content} = |
| 62 | ... Read Attribute ${association_uri} endpoints |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 63 | Should Contain ${association_content} ${DIMM1_URI} |
| 64 | |
| 65 | ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints |
| 66 | Should Contain ${dimm1_event} ${log_list[0]} |
| 67 | |
| 68 | |
| 69 | Create error log on two FRU |
| 70 | [Documentation] ***GOOD PATH*** |
| 71 | ... Create an error log on two FRUs and verify |
| 72 | ... its association.\n |
| 73 | |
| 74 | ${log_uri} = Create a test log |
| 75 | ${association_uri} = catenate SEPARATOR= ${log_uri} /fru |
| 76 | |
| 77 | ${association_content} = Read Attribute ${association_uri} endpoints |
| 78 | Should Contain ${association_content} ${DIMM3_URI} |
| 79 | Should Contain ${association_content} ${DIMM2_URI} |
| 80 | |
| 81 | ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 82 | Should Contain ${dimm3_event} ${log_uri} |
| 83 | |
| 84 | ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 85 | Should Contain ${dimm2_event} ${log_uri} |
| 86 | |
| 87 | |
| 88 | Create multiple error logs |
| 89 | [Documentation] ***GOOD PATH*** |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 90 | ... Create multiple error logs and verify |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 91 | ... their association.\n |
| 92 | |
| 93 | : FOR ${INDEX} IN RANGE 1 4 |
| 94 | \ Log ${INDEX} |
| 95 | \ ${log_uri} = Create a test log |
| 96 | \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru |
| 97 | |
| 98 | \ ${association_content} = Read Attribute ${association_uri} endpoints |
| 99 | \ Should Contain ${association_content} ${DIMM3_URI} |
| 100 | \ Should Contain ${association_content} ${DIMM2_URI} |
| 101 | |
| 102 | \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 103 | \ Should Contain ${dimm3_event} ${log_uri} |
| 104 | |
| 105 | \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 106 | \ Should Contain ${dimm2_event} ${log_uri} |
| 107 | |
| 108 | |
| 109 | Delete error log |
| 110 | [Documentation] ***BAD PATH*** |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 111 | ... Delete an error log and verify that its |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 112 | ... association is also removed.\n |
George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 113 | [Tags] Delete_error_log |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 114 | |
| 115 | ${log_uri1} = Create a test log |
| 116 | ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru |
| 117 | |
| 118 | ${log_uri2} = Create a test log |
| 119 | |
| 120 | ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete |
| 121 | ${resp} = openbmc post request ${del_uri} data=${NIL} |
| 122 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 123 | |
| 124 | ${resp} = openbmc get request ${association_uri1} |
| 125 | ${jsondata} = to json ${resp.content} |
| 126 | Should Contain ${jsondata['message']} 404 Not Found |
| 127 | |
| 128 | ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 129 | Should Not Contain ${dimm3_event} ${log_uri1} |
| 130 | |
| 131 | ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 132 | Should Not Contain ${dimm2_event} ${log_uri1} |
| 133 | |
| 134 | |
| 135 | Association with invalid FRU |
| 136 | [Documentation] ***BAD PATH*** |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 137 | ... Create an error log on invalid FRU and verify |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 138 | ... that its does not have any association.\n |
| 139 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 140 | Run Keyword And Continue On Failure Clear all logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 141 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 142 | ${elog} ${stderr}= |
| 143 | ... Execute Command ${CREATE_ERROR_INVALID_FRU} |
| 144 | ... return_stderr=True |
| 145 | Should Be Empty ${stderr} |
| 146 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 147 | ${log_list} = Get EventList |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 148 | Should Contain '${log_list}' ${elog.strip('q ')} |
| 149 | |
| 150 | ${association_uri} = |
| 151 | ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 152 | |
| 153 | ${resp} = openbmc get request ${association_uri} |
| 154 | ${jsondata} = to json ${resp.content} |
| 155 | Should Contain ${jsondata['message']} 404 Not Found |
| 156 | |
| 157 | |
| 158 | Assocition with no FRU error event |
| 159 | [Documentation] ***BAD PATH*** |
| 160 | ... Create an error log on no FRU and verify |
| 161 | ... that its does not have any association.\n |
| 162 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 163 | Run Keyword And Continue On Failure Clear all logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 164 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 165 | ${elog} ${stderr}= |
| 166 | ... Execute Command ${CREATE_ERROR_NO_FRU} |
| 167 | ... return_stderr=True |
| 168 | Should Be Empty ${stderr} |
| 169 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 170 | ${log_list} = Get EventList |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 171 | Should Contain '${log_list}' ${elog.strip('q ')} |
| 172 | |
| 173 | ${association_uri} = |
| 174 | ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 175 | |
| 176 | ${resp} = openbmc get request ${association_uri} |
| 177 | ${jsondata} = to json ${resp.content} |
| 178 | Should Contain ${jsondata['message']} 404 Not Found |
| 179 | |
| 180 | |
| 181 | Association with virtual sensor |
| 182 | [Documentation] ***GOOD PATH*** |
| 183 | ... Create an error log on virtual sensor and |
| 184 | ... verify its association.\n |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 185 | [Tags] Association_with_virtual_sensor |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 186 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 187 | Run Keyword And Continue On Failure Clear all logs |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 188 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 189 | ${elog} ${stderr}= |
| 190 | ... Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR} |
| 191 | ... return_stderr=True |
| 192 | Should Be Empty ${stderr} |
| 193 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 194 | ${log_list} = Get EventList |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 195 | Should Contain '${log_list}' ${elog.strip('q ')} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 196 | |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 197 | ${association_uri} = |
| 198 | ... catenate SEPARATOR= ${EVENT_RECORD}/${elog.strip('q ')} /fru |
| 199 | |
| 200 | ${association_content} = |
| 201 | ... Read Attribute ${association_uri} endpoints |
| 202 | Should Contain |
| 203 | ... ${association_content} /org/openbmc/inventory/system/systemevent |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 204 | |
| 205 | Association unchanged after reboot |
| 206 | [Documentation] ***GOOD PATH*** |
| 207 | ... This test case is to verify that error log association |
| 208 | ... does not change after open bmc reboot.\n |
George Keishing | 930dcc0 | 2016-10-13 06:31:21 -0500 | [diff] [blame] | 209 | [Tags] bmcreboot Association_Unchanged_After_Reboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 210 | |
| 211 | ${pre_reboot_log_uri} = Create a test log |
George Keishing | 930dcc0 | 2016-10-13 06:31:21 -0500 | [diff] [blame] | 212 | ${association_uri} = |
| 213 | ... catenate SEPARATOR= ${pre_reboot_log_uri} /fru |
| 214 | ${pre_reboot_association_content} = |
| 215 | ... Read Attribute ${association_uri} endpoints |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 216 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 217 | ${output}= Execute Command /sbin/reboot |
George Keishing | f4e4faf | 2016-09-26 00:40:06 -0500 | [diff] [blame] | 218 | Check If BMC is Up 5 min 10 sec |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 219 | |
George Keishing | 930dcc0 | 2016-10-13 06:31:21 -0500 | [diff] [blame] | 220 | ${post_reboot_association_content} = |
| 221 | ... Read Attribute ${association_uri} endpoints |
| 222 | Should Be Equal |
| 223 | ... ${post_reboot_association_content} ${pre_reboot_association_content} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 224 | |
George Keishing | 930dcc0 | 2016-10-13 06:31:21 -0500 | [diff] [blame] | 225 | ${post_reboot_dimm3_event} = |
| 226 | ... Read Attribute ${DIMM3_URI}/event endpoints |
| 227 | Should Contain |
| 228 | ... ${post_reboot_dimm3_event} ${pre_reboot_log_uri} |
| 229 | ${post_reboot_dimm2_event} = |
| 230 | ... Read Attribute ${DIMM2_URI}/event endpoints |
| 231 | Should Contain |
| 232 | ... ${post_reboot_dimm2_event} ${pre_reboot_log_uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 233 | |
| 234 | *** Keywords *** |
| 235 | |
| 236 | Get EventList |
| 237 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 238 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 239 | ${jsondata} = to json ${resp.content} |
| 240 | [return] ${jsondata['data']} |
| 241 | |
| 242 | Create a test log |
| 243 | [arguments] |
| 244 | ${data} = create dictionary data=@{EMPTY} |
| 245 | ${resp} = openbmc post request /org/openbmc/records/events/action/acceptTestMessage data=${data} |
| 246 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 247 | ${json} = to json ${resp.content} |
| 248 | ${LOGID} = convert to integer ${json['data']} |
| 249 | ${uri}= catenate SEPARATOR= /org/openbmc/records/events/ ${LOGID} |
| 250 | [return] ${uri} |
| 251 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 252 | Clear all logs |
| 253 | ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL} |
| 254 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 255 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 256 | ${json} = to json ${resp.content} |
| 257 | Should Be Empty ${json['data']} |
George Keishing | d434c51 | 2016-10-07 06:46:29 -0500 | [diff] [blame] | 258 | |
| 259 | Suite Initialization Setup |
| 260 | Open Connection And Log In |
| 261 | Run Keyword And Continue On Failure Clear all logs |