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 | |
| 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 | |
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 | |
| 38 | *** Test Cases *** |
| 39 | |
| 40 | Create error log on single FRU |
| 41 | [Documentation] ***GOOD PATH*** |
| 42 | ... Create an error log on single FRU and verify |
| 43 | ... its association.\n |
| 44 | |
| 45 | Clear all logs |
| 46 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 47 | ${output}= Execute Command ${CREATE_ERROR_SINGLE_FRU} |
| 48 | |
| 49 | ${log_list} = Get EventList |
| 50 | ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru |
| 51 | |
| 52 | ${association_content} = Read Attribute ${association_uri} endpoints |
| 53 | Should Contain ${association_content} ${DIMM1_URI} |
| 54 | |
| 55 | ${dimm1_event} = Read Attribute ${DIMM1_URI}/event endpoints |
| 56 | Should Contain ${dimm1_event} ${log_list[0]} |
| 57 | |
| 58 | |
| 59 | Create error log on two FRU |
| 60 | [Documentation] ***GOOD PATH*** |
| 61 | ... Create an error log on two FRUs and verify |
| 62 | ... its association.\n |
| 63 | |
| 64 | ${log_uri} = Create a test log |
| 65 | ${association_uri} = catenate SEPARATOR= ${log_uri} /fru |
| 66 | |
| 67 | ${association_content} = Read Attribute ${association_uri} endpoints |
| 68 | Should Contain ${association_content} ${DIMM3_URI} |
| 69 | Should Contain ${association_content} ${DIMM2_URI} |
| 70 | |
| 71 | ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 72 | Should Contain ${dimm3_event} ${log_uri} |
| 73 | |
| 74 | ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 75 | Should Contain ${dimm2_event} ${log_uri} |
| 76 | |
| 77 | |
| 78 | Create multiple error logs |
| 79 | [Documentation] ***GOOD PATH*** |
| 80 | ... Create multiple error logs and verify |
| 81 | ... their association.\n |
| 82 | |
| 83 | : FOR ${INDEX} IN RANGE 1 4 |
| 84 | \ Log ${INDEX} |
| 85 | \ ${log_uri} = Create a test log |
| 86 | \ ${association_uri} = catenate SEPARATOR= ${log_uri} /fru |
| 87 | |
| 88 | \ ${association_content} = Read Attribute ${association_uri} endpoints |
| 89 | \ Should Contain ${association_content} ${DIMM3_URI} |
| 90 | \ Should Contain ${association_content} ${DIMM2_URI} |
| 91 | |
| 92 | \ ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 93 | \ Should Contain ${dimm3_event} ${log_uri} |
| 94 | |
| 95 | \ ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 96 | \ Should Contain ${dimm2_event} ${log_uri} |
| 97 | |
| 98 | |
| 99 | Delete error log |
| 100 | [Documentation] ***BAD PATH*** |
| 101 | ... Delete an error log and verify that its |
| 102 | ... association is also removed.\n |
| 103 | |
| 104 | ${log_uri1} = Create a test log |
| 105 | ${association_uri1} = catenate SEPARATOR= ${log_uri1} /fru |
| 106 | |
| 107 | ${log_uri2} = Create a test log |
| 108 | |
| 109 | ${del_uri} = catenate SEPARATOR= ${log_uri1} /action/delete |
| 110 | ${resp} = openbmc post request ${del_uri} data=${NIL} |
| 111 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 112 | |
| 113 | ${resp} = openbmc get request ${association_uri1} |
| 114 | ${jsondata} = to json ${resp.content} |
| 115 | Should Contain ${jsondata['message']} 404 Not Found |
| 116 | |
| 117 | ${dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 118 | Should Not Contain ${dimm3_event} ${log_uri1} |
| 119 | |
| 120 | ${dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 121 | Should Not Contain ${dimm2_event} ${log_uri1} |
| 122 | |
| 123 | |
| 124 | Association with invalid FRU |
| 125 | [Documentation] ***BAD PATH*** |
George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 126 | ... Create an error log on invalid FRU and verify |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 127 | ... that its does not have any association.\n |
| 128 | |
| 129 | Clear all logs |
| 130 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 131 | ${output}= Execute Command ${CREATE_ERROR_INVALID_FRU} |
| 132 | ${log_list} = Get EventList |
| 133 | ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru |
| 134 | |
| 135 | ${resp} = openbmc get request ${association_uri} |
| 136 | ${jsondata} = to json ${resp.content} |
| 137 | Should Contain ${jsondata['message']} 404 Not Found |
| 138 | |
| 139 | |
| 140 | Assocition with no FRU error event |
| 141 | [Documentation] ***BAD PATH*** |
| 142 | ... Create an error log on no FRU and verify |
| 143 | ... that its does not have any association.\n |
| 144 | |
| 145 | Clear all logs |
| 146 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 147 | ${output}= Execute Command ${CREATE_ERROR_NO_FRU} |
| 148 | ${log_list} = Get EventList |
| 149 | ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru |
| 150 | |
| 151 | ${resp} = openbmc get request ${association_uri} |
| 152 | ${jsondata} = to json ${resp.content} |
| 153 | Should Contain ${jsondata['message']} 404 Not Found |
| 154 | |
| 155 | |
| 156 | Association with virtual sensor |
| 157 | [Documentation] ***GOOD PATH*** |
| 158 | ... Create an error log on virtual sensor and |
| 159 | ... verify its association.\n |
| 160 | |
| 161 | Clear all logs |
| 162 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 163 | ${output}= Execute Command ${CREATE_ERROR_VIRTUAL_SENSOR} |
| 164 | ${log_list} = Get EventList |
| 165 | ${association_uri} = catenate SEPARATOR= ${log_list[0]} /fru |
| 166 | |
| 167 | ${association_content} = Read Attribute ${association_uri} endpoints |
| 168 | Should Contain ${association_content} /org/openbmc/inventory/system/systemevent |
| 169 | |
| 170 | Association unchanged after reboot |
| 171 | [Documentation] ***GOOD PATH*** |
| 172 | ... This test case is to verify that error log association |
| 173 | ... does not change after open bmc reboot.\n |
causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 174 | [Tags] bmcreboot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 175 | |
| 176 | ${pre_reboot_log_uri} = Create a test log |
| 177 | ${association_uri} = catenate SEPARATOR= ${pre_reboot_log_uri} /fru |
| 178 | ${pre_reboot_association_content} = Read Attribute ${association_uri} endpoints |
| 179 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 180 | ${output}= Execute Command /sbin/reboot |
| 181 | Sleep ${SYSTEM_SHUTDOWN_TIME} |
| 182 | Wait For Host To Ping ${OPENBMC_HOST} |
| 183 | Sleep ${WAIT_FOR_SERVICES_UP} |
| 184 | |
| 185 | ${post_reboot_association_content} = Read Attribute ${association_uri} endpoints |
| 186 | Should Be Equal ${pre_reboot_association_content} ${pre_reboot_association_content} |
| 187 | |
| 188 | ${post_reboot_dimm3_event} = Read Attribute ${DIMM3_URI}/event endpoints |
| 189 | Should Contain ${post_reboot_dimm3_event} ${pre_reboot_log_uri} |
| 190 | ${post_reboot_dimm2_event} = Read Attribute ${DIMM2_URI}/event endpoints |
| 191 | Should Contain ${post_reboot_dimm2_event} ${pre_reboot_log_uri} |
| 192 | |
| 193 | *** Keywords *** |
| 194 | |
| 195 | Get EventList |
| 196 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 197 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 198 | ${jsondata} = to json ${resp.content} |
| 199 | [return] ${jsondata['data']} |
| 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} |
| 210 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 211 | Clear all logs |
| 212 | ${resp} = openbmc post request /org/openbmc/records/events/action/clear data=${NIL} |
| 213 | should be equal as strings ${resp.status_code} ${HTTP_OK} |
| 214 | ${resp} = openbmc get request /org/openbmc/records/events/ |
| 215 | ${json} = to json ${resp.content} |
| 216 | Should Be Empty ${json['data']} |