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