| 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 | 
| George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 44 | [Tags]  Create_error_log_on_single_FRU | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 45 |  | 
|  | 46 | Clear all logs | 
|  | 47 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 48 | ${output}=      Execute Command    ${CREATE_ERROR_SINGLE_FRU} | 
|  | 49 |  | 
|  | 50 | ${log_list} =     Get EventList | 
|  | 51 | ${association_uri} =    catenate    SEPARATOR=   ${log_list[0]}   /fru | 
|  | 52 |  | 
|  | 53 | ${association_content} =     Read Attribute    ${association_uri}    endpoints | 
|  | 54 | Should Contain     ${association_content}    ${DIMM1_URI} | 
|  | 55 |  | 
|  | 56 | ${dimm1_event} =     Read Attribute     ${DIMM1_URI}/event   endpoints | 
|  | 57 | Should Contain     ${dimm1_event}    ${log_list[0]} | 
|  | 58 |  | 
|  | 59 |  | 
|  | 60 | Create error log on two FRU | 
|  | 61 | [Documentation]     ***GOOD PATH*** | 
|  | 62 | ...                 Create an error log on two FRUs and verify | 
|  | 63 | ...                 its association.\n | 
|  | 64 |  | 
|  | 65 | ${log_uri} =      Create a test log | 
|  | 66 | ${association_uri} =    catenate    SEPARATOR=   ${log_uri}   /fru | 
|  | 67 |  | 
|  | 68 | ${association_content} =     Read Attribute    ${association_uri}    endpoints | 
|  | 69 | Should Contain     ${association_content}    ${DIMM3_URI} | 
|  | 70 | Should Contain     ${association_content}    ${DIMM2_URI} | 
|  | 71 |  | 
|  | 72 | ${dimm3_event} =     Read Attribute     ${DIMM3_URI}/event   endpoints | 
|  | 73 | Should Contain     ${dimm3_event}    ${log_uri} | 
|  | 74 |  | 
|  | 75 | ${dimm2_event} =     Read Attribute     ${DIMM2_URI}/event   endpoints | 
|  | 76 | Should Contain     ${dimm2_event}    ${log_uri} | 
|  | 77 |  | 
|  | 78 |  | 
|  | 79 | Create multiple error logs | 
|  | 80 | [Documentation]     ***GOOD PATH*** | 
|  | 81 | ...                 Create multiple error logs and verify | 
|  | 82 | ...                 their association.\n | 
|  | 83 |  | 
|  | 84 | : FOR    ${INDEX}    IN RANGE    1    4 | 
|  | 85 | \    Log    ${INDEX} | 
|  | 86 | \    ${log_uri} =      Create a test log | 
|  | 87 | \    ${association_uri} =    catenate    SEPARATOR=   ${log_uri}   /fru | 
|  | 88 |  | 
|  | 89 | \    ${association_content} =     Read Attribute    ${association_uri}    endpoints | 
|  | 90 | \    Should Contain     ${association_content}    ${DIMM3_URI} | 
|  | 91 | \    Should Contain     ${association_content}    ${DIMM2_URI} | 
|  | 92 |  | 
|  | 93 | \    ${dimm3_event} =     Read Attribute     ${DIMM3_URI}/event   endpoints | 
|  | 94 | \    Should Contain     ${dimm3_event}    ${log_uri} | 
|  | 95 |  | 
|  | 96 | \    ${dimm2_event} =     Read Attribute     ${DIMM2_URI}/event   endpoints | 
|  | 97 | \    Should Contain     ${dimm2_event}    ${log_uri} | 
|  | 98 |  | 
|  | 99 |  | 
|  | 100 | Delete error log | 
|  | 101 | [Documentation]     ***BAD PATH*** | 
|  | 102 | ...                 Delete an error log and verify that its | 
|  | 103 | ...                 association is also removed.\n | 
| George Keishing | 97651c7 | 2016-10-04 00:44:15 -0500 | [diff] [blame] | 104 | [Tags]  Delete_error_log | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 105 |  | 
|  | 106 | ${log_uri1} =      Create a test log | 
|  | 107 | ${association_uri1} =    catenate    SEPARATOR=   ${log_uri1}   /fru | 
|  | 108 |  | 
|  | 109 | ${log_uri2} =      Create a test log | 
|  | 110 |  | 
|  | 111 | ${del_uri} =  catenate    SEPARATOR=   ${log_uri1}   /action/delete | 
|  | 112 | ${resp} =    openbmc post request     ${del_uri}    data=${NIL} | 
|  | 113 | should be equal as strings      ${resp.status_code}     ${HTTP_OK} | 
|  | 114 |  | 
|  | 115 | ${resp} =     openbmc get request     ${association_uri1} | 
|  | 116 | ${jsondata} =    to json    ${resp.content} | 
|  | 117 | Should Contain     ${jsondata['message']}    404 Not Found | 
|  | 118 |  | 
|  | 119 | ${dimm3_event} =     Read Attribute      ${DIMM3_URI}/event   endpoints | 
|  | 120 | Should Not Contain     ${dimm3_event}    ${log_uri1} | 
|  | 121 |  | 
|  | 122 | ${dimm2_event} =     Read Attribute      ${DIMM2_URI}/event   endpoints | 
|  | 123 | Should Not Contain     ${dimm2_event}    ${log_uri1} | 
|  | 124 |  | 
|  | 125 |  | 
|  | 126 | Association with invalid FRU | 
|  | 127 | [Documentation]     ***BAD PATH*** | 
| George Keishing | 4d6c1da | 2016-07-15 05:51:22 -0500 | [diff] [blame] | 128 | ...                 Create an error log on invalid FRU and verify | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 129 | ...                 that its does not have any association.\n | 
|  | 130 |  | 
|  | 131 | Clear all logs | 
|  | 132 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 133 | ${output}=      Execute Command    ${CREATE_ERROR_INVALID_FRU} | 
|  | 134 | ${log_list} =     Get EventList | 
|  | 135 | ${association_uri} =    catenate    SEPARATOR=   ${log_list[0]}   /fru | 
|  | 136 |  | 
|  | 137 | ${resp} =     openbmc get request     ${association_uri} | 
|  | 138 | ${jsondata} =    to json    ${resp.content} | 
|  | 139 | Should Contain     ${jsondata['message']}    404 Not Found | 
|  | 140 |  | 
|  | 141 |  | 
|  | 142 | Assocition with no FRU error event | 
|  | 143 | [Documentation]     ***BAD PATH*** | 
|  | 144 | ...                 Create an error log on no FRU and verify | 
|  | 145 | ...                 that its does not have any association.\n | 
|  | 146 |  | 
|  | 147 | Clear all logs | 
|  | 148 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 149 | ${output}=      Execute Command    ${CREATE_ERROR_NO_FRU} | 
|  | 150 | ${log_list} =     Get EventList | 
|  | 151 | ${association_uri} =    catenate    SEPARATOR=   ${log_list[0]}   /fru | 
|  | 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 | Association with virtual sensor | 
|  | 159 | [Documentation]     ***GOOD PATH*** | 
|  | 160 | ...                 Create an error log on virtual sensor and | 
|  | 161 | ...                 verify its association.\n | 
|  | 162 |  | 
|  | 163 | Clear all logs | 
|  | 164 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 165 | ${output}=      Execute Command    ${CREATE_ERROR_VIRTUAL_SENSOR} | 
|  | 166 | ${log_list} =     Get EventList | 
|  | 167 | ${association_uri} =    catenate    SEPARATOR=   ${log_list[0]}   /fru | 
|  | 168 |  | 
|  | 169 | ${association_content} =     Read Attribute    ${association_uri}    endpoints | 
|  | 170 | Should Contain     ${association_content}    /org/openbmc/inventory/system/systemevent | 
|  | 171 |  | 
|  | 172 | Association unchanged after reboot | 
|  | 173 | [Documentation]     ***GOOD PATH*** | 
|  | 174 | ...                 This test case is to verify that error log association | 
|  | 175 | ...                 does not change after open bmc reboot.\n | 
| causten | 147f575 | 2016-08-11 16:24:45 -0500 | [diff] [blame] | 176 | [Tags]  bmcreboot | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 177 |  | 
|  | 178 | ${pre_reboot_log_uri} =      Create a test log | 
|  | 179 | ${association_uri} =    catenate    SEPARATOR=   ${pre_reboot_log_uri}   /fru | 
|  | 180 | ${pre_reboot_association_content} =     Read Attribute    ${association_uri}    endpoints | 
|  | 181 |  | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 182 | ${output}=      Execute Command    /sbin/reboot | 
| George Keishing | f4e4faf | 2016-09-26 00:40:06 -0500 | [diff] [blame] | 183 | Check If BMC is Up   5 min    10 sec | 
| Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 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']} |