| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation          Test IPMI Inband SDR commands. | 
|  | 3 | ...                    Following IPMI command are verified, | 
|  | 4 | ...                    1. Get SDR, | 
|  | 5 | ...                    2. Get Device SDR Info, | 
|  | 6 | ...                    3. Reserve Device SDR Repository, | 
|  | 7 | ...                    4. Get Device SDR. | 
|  | 8 |  | 
|  | 9 | Resource               ../lib/ipmi_client.robot | 
|  | 10 | Resource               ../lib/openbmc_ffdc.robot | 
|  | 11 | Resource               ../lib/boot_utils.robot | 
|  | 12 | Library                ../lib/ipmi_utils.py | 
|  | 13 | Variables              ../data/ipmi_raw_cmd_table.py | 
|  | 14 |  | 
| George Keishing | e42cd02 | 2022-05-06 08:16:57 -0500 | [diff] [blame] | 15 | Suite setup            Suite Setup Execution | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 16 | Suite Teardown         Redfish.Logout | 
|  | 17 | Test Teardown          FFDC On Test Case Fail | 
|  | 18 |  | 
| George Keishing | 87dc442 | 2023-10-20 12:56:30 +0530 | [diff] [blame] | 19 | Force Tags             IPMI_Inband_SDR | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 20 |  | 
|  | 21 | *** Test Cases *** | 
|  | 22 |  | 
|  | 23 | Verify Get SDR For Maximum Record Via IPMI | 
|  | 24 | [Documentation]  Verify Get SDR for each and every record one by one via IPMI lanplus. | 
|  | 25 | [Tags]  Verify_Get_SDR_For_Maximum_Record_Via_IPMI | 
|  | 26 |  | 
|  | 27 | # Gets the Total Record Count from SDR Info and the last Record entry number. | 
|  | 28 | ${record_count}  ${last_record}=  Get Record Count And Last Record From SDR | 
|  | 29 |  | 
|  | 30 | # Validate each and every record till the last record. | 
|  | 31 | FOR  ${record}  IN RANGE  0  ${record_count} | 
|  | 32 | # Convert number to hexadecimal record ID. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 33 | ${recordhex}=  Convert To Hex  ${record}  length=4  lowercase=yes | 
|  | 34 | ${first_digit}    Set Variable    ${recordhex}[0:2] | 
|  | 35 | ${second_digit}    Set Variable    ${recordhex}[2:4] | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 36 |  | 
|  | 37 | # Get SDR command. | 
|  | 38 | ${resp}=  Run IPMI Standard Command | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 39 | ...  raw ${IPMI_RAW_CMD['Get SDR']['Get'][1]} 0x00 0x00 0x${second_digit} 0x${first_digit} 0x00 0xff | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 40 | ${get_SDR}=  Split String  ${resp} | 
|  | 41 |  | 
|  | 42 | # If the record ID reaches the last data available, the next record ID will be ff ff. | 
|  | 43 | # eg, If total record ID available is 115, record IDs : 0 - 114, | 
|  | 44 | # Then when record ID reaches last record ID (i.e 114 (decimal) - 72h), | 
|  | 45 | # Get SDR response bytes 0:2 will be - ff ff 72 00 .... | 
|  | 46 | # If not then (say 25 - 19h ), 1a 00 19 00 .... | 
|  | 47 |  | 
|  | 48 | IF  '${record}' != '${last_record}' | 
|  | 49 | # current record ID in response data. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 50 | Should Be Equal  ${get_SDR[2]}  ${second_digit} | 
|  | 51 | Should Be Equal  ${get_SDR[3]}  ${first_digit} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 52 |  | 
|  | 53 | # Next record ID in response data. | 
|  | 54 | ${record_next}=  Evaluate  ${record} + 1 | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 55 | ${record_next}=  Convert To Hex  ${record_next}  length=4  lowercase=yes | 
|  | 56 | ${record_next_msb}    Set Variable    ${record_next}[0:2] | 
|  | 57 | ${record_next_lsb}    Set Variable    ${record_next}[2:4] | 
|  | 58 | Should Be Equal  ${get_SDR[0]}  ${record_next_lsb} | 
|  | 59 | Should Be Equal  ${get_SDR[1]}  ${record_next_msb} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 60 | ELSE | 
|  | 61 | # Next record ID in response data. | 
|  | 62 | Should Be Equal  ${get_SDR[0]}  ff | 
|  | 63 | Should Be Equal  ${get_SDR[1]}  ff | 
|  | 64 |  | 
|  | 65 | # current record ID in response data. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 66 | Should Be Equal  ${get_SDR[2]}  ${second_digit} | 
|  | 67 | Should Be Equal  ${get_SDR[3]}  ${first_digit} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 68 | END | 
|  | 69 |  | 
|  | 70 | # Response Data Count - total records (max - FFh - 255 in decimal). | 
|  | 71 | ${response_data}=  Set Variable  ${get_SDR[2:]} | 
|  | 72 | ${length}=  Get Length  ${response_data} | 
|  | 73 | Should Be True  0<${length}<=255 | 
|  | 74 | END | 
|  | 75 |  | 
|  | 76 |  | 
|  | 77 | Verify Sensor And SDR Count In Get Device SDR Info Via Inband IPMI | 
|  | 78 | [Documentation]  Verify Sensor and SDR Count in Get Device SDR Info via inband IPMI. | 
|  | 79 | [Tags]  Verify_Sensor_And_SDR_Count_In_Get_Device_SDR_Info_Via_Inband_IPMI | 
|  | 80 |  | 
|  | 81 | # Get Sensor count and SDR elist all count from IPMI LAN interface. | 
|  | 82 | ${sensor_count_lan1}  ${SDR_count_lan1}=  Get Count for Sensor And SDR Elist All | 
|  | 83 |  | 
|  | 84 | # Get Sensor Count From Get Device SDR Info command. | 
|  | 85 | ${sensor_count1}=  Get Sensor Count From SDR Info | 
|  | 86 | # Compare Get Device SDR Sensor count with Sensor count from lanplus. | 
|  | 87 | Should Be Equal As Integers   ${sensor_count1}  ${sensor_count_lan1} | 
|  | 88 |  | 
|  | 89 | # Get SDR Count From Get Device SDR Info command. | 
|  | 90 | ${SDR_count1}=  Get SDR Count From SDR Info | 
|  | 91 | # Compare Get Device SDR Sdr count with SDR Elist All count from lanplus. | 
|  | 92 | Should Be Equal As Integers  ${SDR_count1}  ${SDR_count_lan1} | 
|  | 93 |  | 
|  | 94 | # Reboot Host using Chassis Power Cycle. | 
|  | 95 | IPMI Power Cycle | 
|  | 96 |  | 
|  | 97 | # Get Sensor count and SDR elist all count from IPMI lanplus interface. | 
|  | 98 | ${sensor_count_lan2}  ${SDR_count_lan2}=  Get Count for Sensor And SDR Elist All | 
|  | 99 |  | 
|  | 100 | # Get Sensor Count From Get Device SDR Info command. | 
|  | 101 | ${sensor_count2}=  Get Sensor Count From SDR Info | 
|  | 102 | # Compare Get Device SDR Sensor count with Sensor count from lanplus. | 
|  | 103 | Should Be Equal As Integers   ${sensor_count2}  ${sensor_count_lan2} | 
|  | 104 |  | 
|  | 105 | # Get SDR Count From Get Device SDR Info command. | 
|  | 106 | ${SDR_count2}=  Get SDR Count From SDR Info | 
|  | 107 | # Compare Get Device SDR Sdr count with SDR Elist All count from lanplus. | 
|  | 108 | Should Be Equal As Integers  ${SDR_count2}  ${SDR_count_lan2} | 
|  | 109 |  | 
|  | 110 |  | 
|  | 111 | Verify Timestamp In Get Device SDR Info Via Inband IPMI | 
|  | 112 | [Documentation]  Verify timestamp In Get Device SDR Info via inband IPMI. | 
|  | 113 | [Tags]  Verify_Timestamp_In_Get_Device_SDR_Info_Via_Inband_IPMI | 
|  | 114 |  | 
|  | 115 | # Reboot Host using Chassis Power Cycle. | 
|  | 116 | IPMI Power Cycle | 
|  | 117 |  | 
|  | 118 | # Get epoch Timestamp obtained from Get Device SDR Info command. | 
|  | 119 | ${SDR_timestamp}=  Get Device SDR Timestamp | 
|  | 120 |  | 
|  | 121 | # Get current date from BMC Native Date command and convert to epoch. | 
|  | 122 | ${bmc_date}=  Get Current Date from BMC | 
|  | 123 | ${epoch_bmc}=  Convert Date  ${bmc_date}  epoch  exclude_millis=yes  date_format=%m/%d/%Y %H:%M:%S | 
|  | 124 |  | 
|  | 125 | # Compare time difference between bmc time and Get Device SDR Info timestamp. | 
|  | 126 | # The maximum time difference should be less then 6 minute - 360 seconds. | 
|  | 127 | ${difference}=  Evaluate  int(${epoch_bmc}) - int(${SDR_timestamp}) | 
|  | 128 | Should Be True  ${difference}<=360 | 
|  | 129 |  | 
|  | 130 |  | 
|  | 131 | Verify Get Device SDR Info For Invalid Data Request | 
|  | 132 | [Documentation]  Verify Get Device SDR Info via inband IPMI with extra bytes. | 
|  | 133 | [Tags]  Verify_Get_Device_SDR_Info_For_Invalid_Data_Request | 
|  | 134 |  | 
|  | 135 | # Sensor Count Via Device SDR Info with extra bytes. | 
|  | 136 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][3]}* | 
|  | 137 | ...  Run Inband IPMI Standard Command | 
|  | 138 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} 0x00 | 
|  | 139 | # Proper error code should be returned. | 
|  | 140 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][2]} | 
|  | 141 |  | 
|  | 142 | # SDR Count Via Device SDR Info with extra bytes. | 
|  | 143 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][3]}* | 
|  | 144 | ...  Run Inband IPMI Standard Command | 
|  | 145 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} 0x00 | 
|  | 146 | # Proper error code should be returned. | 
|  | 147 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][2]} | 
|  | 148 |  | 
|  | 149 |  | 
|  | 150 | Verify Device SDR Info Via IPMI Lanplus | 
|  | 151 | [Documentation]  Verify whether Get Device SDR Info command is accessible via lanplus. | 
|  | 152 | [Tags]  Verify_Device_SDR_Info_Via_IPMI_Lanplus | 
|  | 153 |  | 
|  | 154 | # Sensor Count Via Device SDR Info via lanplus. | 
|  | 155 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][5]}* | 
|  | 156 | ...  Run IPMI Standard Command | 
|  | 157 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} | 
|  | 158 | # Proper error code should be returned. | 
|  | 159 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][4]} | 
|  | 160 |  | 
|  | 161 | # SDR Count Via Device SDR Info via lanplus. | 
|  | 162 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Get_Info'][5]}* | 
|  | 163 | ...  Run IPMI Standard Command | 
|  | 164 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} | 
|  | 165 | # Proper error code should be returned. | 
|  | 166 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][4]} | 
|  | 167 |  | 
|  | 168 |  | 
|  | 169 | Verify Reserve Device SDR Repository Via Inband IPMI | 
|  | 170 | [Documentation]  Verify Reserve Device SDR Repository via inband IPMI. | 
|  | 171 | [Tags]  Verify_Reserve_Device_SDR_Repository_Via_Inband_IPMI | 
|  | 172 |  | 
|  | 173 | # Reserve Device SDR Repository via inband IPMI. | 
|  | 174 | ${resp}=  Get Reserve Device SDR Repository | 
|  | 175 | ${reserve_id}=  Split String  ${resp} | 
|  | 176 |  | 
|  | 177 | # Identify the byte count. | 
|  | 178 | ${length}=  Get Length  ${reserve_id} | 
|  | 179 | Should Be Equal As Integers  ${length}  2 | 
|  | 180 |  | 
|  | 181 |  | 
|  | 182 | Verify Reserve Device SDR Repository For Invalid Data Request | 
|  | 183 | [Documentation]  Verify Reserve Device SDR Repository via inband IPMI with extra request bytes. | 
|  | 184 | [Tags]  Verify_Reserve_Device_SDR_Repository_For_Invalid_Data_Request | 
|  | 185 |  | 
|  | 186 | # Reserve Device SDR Repository with extra request bytes. | 
|  | 187 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][2]}* | 
|  | 188 | ...  Run Inband IPMI Standard Command | 
|  | 189 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} 0x00 | 
|  | 190 | # Proper error code should be returned. | 
|  | 191 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][1]} | 
|  | 192 |  | 
|  | 193 |  | 
|  | 194 | Verify Reserve Device SDR Repository Info Via IPMI Lanplus | 
|  | 195 | [Documentation]  Verify whether Reserve Device SDR Repository command is accessible via lanplus. | 
| George Keishing | e45d262 | 2022-05-05 07:27:30 -0500 | [diff] [blame] | 196 | [Tags]  Verify_Reserve_Device_SDR_Repository_Info_Via_IPMI_Lanplus | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 197 |  | 
|  | 198 | # Reserve Device SDR Repository via lanplus. | 
|  | 199 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][4]}* | 
|  | 200 | ...  Run IPMI Standard Command | 
|  | 201 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} | 
|  | 202 | # Proper error code should be returned. | 
|  | 203 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][3]} | 
|  | 204 |  | 
|  | 205 |  | 
|  | 206 | Verify Reserve Device SDR Repository For Partial Record | 
| George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 207 | [Documentation]  Verify whether reservation ID of Reserve Device SDR Repository is accessible | 
|  | 208 | ...              to fetch partial record from Get Device SDR. | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 209 | [Tags]  Verify_Reserve_Device_SDR_Repository_For_Partial_Record | 
|  | 210 |  | 
|  | 211 | # Get Reservation ID. | 
|  | 212 | ${resp}=  Get Reserve Device SDR Repository | 
|  | 213 | ${reserve_id}=  Split String  ${resp} | 
|  | 214 |  | 
|  | 215 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 216 | ${resp}=  Run Inband IPMI Standard Command | 
| nagarjunb22 | 0f1d87e | 2022-07-12 21:09:25 +0530 | [diff] [blame] | 217 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x01 0x0f | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 218 | ${resp}=  Split String  ${resp} | 
|  | 219 | # Record data starts from ${resp[2]}. | 
|  | 220 | ${resp}=  Set Variable  ${resp[2:]} | 
|  | 221 | ${length}=  Get Length  ${resp} | 
|  | 222 | Should Be Equal As Integers  ${length}  15 | 
|  | 223 |  | 
|  | 224 |  | 
|  | 225 | Verify Reserve Device SDR Repository For Partial Record After BMC Reboot | 
|  | 226 | [Documentation]  Verify whether Reservation ID of Reserve Device SDR Repository, | 
|  | 227 | ...  is accessible after bmc reboot to fetch partial record from Get Device SDR. | 
|  | 228 | [Tags]  Verify_Reserve_Device_SDR_Repository_For_Partial_Record_After_BMC_Reboot | 
|  | 229 |  | 
|  | 230 | # Generate Reservation ID. | 
|  | 231 | ${resp}=  Get Reserve Device SDR Repository | 
|  | 232 | ${reserve_id}=  Split String  ${resp} | 
|  | 233 |  | 
|  | 234 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 235 | ${resp1}=  Run Inband IPMI Standard Command | 
| nagarjunb22 | 0f1d87e | 2022-07-12 21:09:25 +0530 | [diff] [blame] | 236 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x01 0x0f | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 237 |  | 
|  | 238 | # Reboot bmc. | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 239 | IPMI MC Reset Cold (run) | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 240 |  | 
|  | 241 | # Check whether the response for Get device SDR command is obtained with the given Reservation ID. | 
|  | 242 | # Reserve IDs are volatile so once bmc is rebooted, new Reserve ID should be generated. | 
|  | 243 | ${resp2}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 244 | ...  Run Inband IPMI Standard Command | 
| nagarjunb22 | 0f1d87e | 2022-07-12 21:09:25 +0530 | [diff] [blame] | 245 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x01 0x0f | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 246 |  | 
|  | 247 |  | 
|  | 248 | Verify Reserve Device SDR Repository Invalid Reservation ID For Partial Record | 
|  | 249 | [Documentation]  Verify whether invalid reservation ID of Reserve Device SDR Repository, | 
|  | 250 | ...  is accessible to fetch partial record from Get Device SDR. | 
|  | 251 | [Tags]  Verify_Reserve_Device_SDR_Repository_Invalid_Reservation_ID_For_Partial_Record | 
|  | 252 |  | 
|  | 253 | # Generate Reservation ID 1. | 
|  | 254 | ${resp}=  Get Reserve Device SDR Repository | 
|  | 255 | ${reserve_id}=  Split String  ${resp} | 
|  | 256 |  | 
|  | 257 | # Generate Reservation ID 2. | 
|  | 258 | ${resp2}=  Get Reserve Device SDR Repository | 
|  | 259 |  | 
|  | 260 | # Check whether response for Gner device SDR command is obtained with Reservation ID 1. | 
|  | 261 | # Once Reservation ID is overwritten, old Reservation ID will be invalid. | 
|  | 262 | ${resp1}=   Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][5]}* | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 263 | ...  Run Inband IPMI Standard Command | 
| nagarjunb22 | 0f1d87e | 2022-07-12 21:09:25 +0530 | [diff] [blame] | 264 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x${reserve_id[0]} 0x${reserve_id[1]} 0x00 0x00 0x01 0x0f | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 265 |  | 
|  | 266 |  | 
|  | 267 | Verify Get Device SDR For Maximum Record Via IPMI | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 268 | [Documentation]  Verify Get Device SDR for each and every Record Via IPMI Inband. | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 269 | [Tags]  Verify_Get_Device_SDR_For_Maximum_Record_Via_IPMI | 
|  | 270 |  | 
|  | 271 | # Gets the Total Record Count from SDR Info and the last Record entry number. | 
|  | 272 | ${record_count}  ${last_record}=  Get Record Count And Last Record From SDR | 
|  | 273 |  | 
|  | 274 | # Validate each and every record till the last record. | 
|  | 275 | FOR  ${record}  IN RANGE  0  ${record_count} | 
|  | 276 | # Convert number to hexadecimal record ID. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 277 | ${recordhex}=  Convert To Hex  ${record}  length=4  lowercase=yes | 
|  | 278 | ${first_digit}    Set Variable    ${recordhex}[0:2] | 
|  | 279 | ${second_digit}    Set Variable    ${recordhex}[2:4] | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 280 |  | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 281 | # Get Device SDR command. | 
|  | 282 | ${resp}=  Run Inband IPMI Standard Command | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 283 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 0x${second_digit} 0x${first_digit} 0x00 0xff | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 284 | ${get_dev_SDR}=  Split String  ${resp} | 
|  | 285 |  | 
|  | 286 | # If the record ID reaches the last data available, the next record ID will be ff ff | 
|  | 287 | # eg, If total record ID available is 115, record IDs : 0 - 114, | 
|  | 288 | # Then when record ID reaches last record ID (i.e 114 (in decimal) - 72h), | 
|  | 289 | # Get SDR response bytes 0:2 will be - ff ff 72 00 .... | 
|  | 290 | # If not then (say 25 - 19h ), 1a 00 19 00 .... | 
|  | 291 |  | 
|  | 292 | IF  '${record}' != '${last_record}' | 
|  | 293 | # current record ID in response data. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 294 | Should Be Equal  ${get_dev_SDR[2]}  ${second_digit} | 
|  | 295 | Should Be Equal  ${get_dev_SDR[3]}  ${first_digit} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 296 |  | 
|  | 297 | # Next record ID in response data. | 
|  | 298 | ${record_next}=  Evaluate  ${record} + 1 | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 299 | ${record_next}=  Convert To Hex  ${record_next}  length=4  lowercase=yes | 
|  | 300 | ${record_next_msb}    Set Variable    ${record_next}[0:2] | 
|  | 301 | ${record_next_lsb}    Set Variable    ${record_next}[2:4] | 
|  | 302 | Should Be Equal  ${get_dev_SDR[0]}  ${record_next_lsb} | 
|  | 303 | Should Be Equal  ${get_dev_SDR[1]}  ${record_next_msb} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 304 |  | 
|  | 305 | ELSE | 
|  | 306 | # Next record ID in response data. | 
|  | 307 | Should Be Equal  ${get_dev_SDR[0]}  ff | 
|  | 308 | Should Be Equal  ${get_dev_SDR[1]}  ff | 
|  | 309 |  | 
|  | 310 | # current record ID in response data. | 
| ishwaryamathim | 1a5de24 | 2023-11-10 06:57:37 +0000 | [diff] [blame] | 311 | Should Be Equal  ${get_dev_SDR[2]}  ${second_digit} | 
|  | 312 | Should Be Equal  ${get_dev_SDR[3]}  ${first_digit} | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 313 |  | 
|  | 314 | END | 
|  | 315 | # Response data count - total record ID (max - FFh - 255 in decimal). | 
|  | 316 | ${response_data}=  Set Variable  ${get_dev_SDR[2:]} | 
|  | 317 | ${length}=  Get Length  ${response_data} | 
|  | 318 | Should Be True  0<${length}<=255 | 
|  | 319 | END | 
|  | 320 |  | 
|  | 321 |  | 
|  | 322 | Verify Get Device SDR For Invalid Data Request Via IPMI | 
|  | 323 | [Documentation]  Verify Get Device SDR via IPMI lanplus with extra bytes. | 
|  | 324 | [Tags]  Verify_Get_Device_SDR_For_Invalid_Data_Request_Via_IPMI | 
|  | 325 |  | 
|  | 326 | # Get SDR command with extra bytes. | 
|  | 327 | ${resp}=  Run Keyword and Expect Error  *${IPMI_RAW_CMD['Device_SDR']['Get'][3]}* | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 328 | ...  Run Inband IPMI Standard Command | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 329 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get'][0]} 0x00 0x00 ${IPMI_RAW_CMD['Device_SDR']['Get'][1]} 0x00 | 
|  | 330 | # Proper error code should be returned. | 
|  | 331 | Should Contain  ${resp}  ${IPMI_RAW_CMD['Device_SDR']['Get'][2]} | 
|  | 332 |  | 
|  | 333 |  | 
|  | 334 | *** Keywords *** | 
|  | 335 |  | 
|  | 336 | Get IPMI Sensor Count | 
|  | 337 | [Documentation]  Get sensors count using "SDR elist all" command. | 
|  | 338 | # Example of "SDR elist all" command output: | 
|  | 339 | # BootProgress     | 03h | ok  | 34.2 | | 
|  | 340 | # OperatingSystemS | 05h | ok  | 35.1 | | 
|  | 341 | # AttemptsLeft     | 07h | ok  | 34.1 | | 
|  | 342 | # occ0             | 08h | ok  | 210.1 | Device Disabled | 
|  | 343 | # occ1             | 09h | ok  | 210.2 | Device Disabled | 
|  | 344 | # p0_core0_temp    | 11h | ns  |  3.1 | Disabled | 
|  | 345 | # cpu0_core0       | 12h | ok  | 208.1 | Presence detected | 
|  | 346 | # p0_core1_temp    | 14h | ns  |  3.2 | Disabled | 
|  | 347 | # cpu0_core1       | 15h | ok  | 208.2 | Presence detected | 
|  | 348 | # p0_core2_temp    | 17h | ns  |  3.3 | Disabled | 
|  | 349 | # .. | 
|  | 350 | # .. | 
|  | 351 | # .. | 
|  | 352 | # .. | 
|  | 353 | # .. | 
|  | 354 | # .. | 
|  | 355 | # fan3             | 00h | ns  | 29.4 | Logical FRU @35h | 
|  | 356 | # bmc              | 00h | ns  |  6.1 | Logical FRU @3Ch | 
|  | 357 | # ethernet         | 00h | ns  |  1.1 | Logical FRU @46h | 
|  | 358 |  | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 359 | ${output}=  Run IPMI Standard Command  sdr elist all | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 360 | ${sensor_list}=  Split String  ${output}  \n | 
|  | 361 | ${sensor_count}=  Get Length  ${sensor_list} | 
|  | 362 | [Return]  ${sensor_count} | 
|  | 363 |  | 
|  | 364 |  | 
|  | 365 | Get Device SDR Info For Sensor Data | 
|  | 366 | [Documentation]  Get Device SDR Info via inband IPMI and return response data with Sensor count. | 
|  | 367 |  | 
|  | 368 | # Get Device SDR Info for Sensor data. | 
|  | 369 | ${sensor_data}=  Run Inband IPMI Standard Command | 
|  | 370 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][0]} | 
|  | 371 |  | 
|  | 372 | [Return]  ${sensor_data} | 
|  | 373 |  | 
|  | 374 |  | 
|  | 375 | Get Device SDR Info For SDR Data | 
|  | 376 | [Documentation]  Get Device SDR Info via inband IPMI and return response data with SDR count. | 
|  | 377 |  | 
|  | 378 | # Get Device SDR Info for SDR data. | 
|  | 379 | ${SDR_data}=  Run Inband IPMI Standard Command | 
|  | 380 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Get_Info'][1]} | 
|  | 381 |  | 
|  | 382 | [Return]  ${SDR_data} | 
|  | 383 |  | 
|  | 384 |  | 
|  | 385 | Get Sensor Count From SDR Info | 
|  | 386 | [Documentation]  Get Sensor Count from Get Device SDR Info data. | 
|  | 387 |  | 
|  | 388 | # Get Device SDR Info Via inband IPMI for Sensor count. | 
|  | 389 | ${sensor_data}=  Get Device SDR Info For Sensor Data | 
|  | 390 |  | 
|  | 391 | # Get Sensor count from Get Device SDR Info count - bytie 0. | 
|  | 392 | ${sensor_data}=  Split String  ${sensor_data} | 
|  | 393 | ${sensor_count}=  Set Variable  ${sensor_data[0]} | 
|  | 394 | ${sensor_count}=  Convert To Integer  ${sensor_count}  16 | 
|  | 395 |  | 
|  | 396 | [Return]  ${sensor_count} | 
|  | 397 |  | 
|  | 398 |  | 
|  | 399 | Get SDR Count From SDR Info | 
|  | 400 | [Documentation]  Get SDR Count from Get Device SDR Info data. | 
|  | 401 |  | 
|  | 402 | # Get Device SDR Info Via inband IPMI for SDR count. | 
|  | 403 | ${SDR_data}=  Get Device SDR Info For SDR Data | 
|  | 404 |  | 
|  | 405 | # Get SDR count from Get Device SDR Info count - byte 0. | 
|  | 406 | ${SDR_data}=  Split String  ${SDR_data} | 
|  | 407 | ${SDR_count}=  Set Variable  ${SDR_data[0]} | 
|  | 408 | ${SDR_count}=  Convert To Integer  ${SDR_count}  16 | 
|  | 409 |  | 
|  | 410 | [Return]  ${SDR_count} | 
|  | 411 |  | 
|  | 412 |  | 
|  | 413 | Get Device SDR Timestamp | 
|  | 414 | [Documentation]  Get Timestamp from Get Device SDR Info. | 
|  | 415 |  | 
|  | 416 | # Get Device SDR Info Via inband IPMI for Sendor count. | 
|  | 417 | ${sensor_data}=  Get Device SDR Info For Sensor Data | 
|  | 418 | # Get Device SDR Info Via inband IPMI for SDR count. | 
|  | 419 | ${SDR_data}=  Get Device SDR Info For SDR Data | 
|  | 420 |  | 
|  | 421 | # Split into list. | 
|  | 422 | ${sensor_data}=  Split String  ${sensor_data} | 
|  | 423 | ${SDR_data}=  Split String  ${SDR_data} | 
|  | 424 |  | 
|  | 425 | # Timestamp for the Get SDR count will be from Response byte 2 to N. | 
|  | 426 | # Compare the timestamps for Sensor data and SDR data. | 
|  | 427 | Should Be Equal  ${sensor_data[2:]}  ${SDR_data[2:]} | 
|  | 428 |  | 
|  | 429 | # Convert Bytestamp to Epoch timestamp. | 
|  | 430 | ${timestamp}=  Set Variable  ${SDR_data[2:]} | 
|  | 431 | Reverse List  ${timestamp} | 
|  | 432 | ${timestamp}=  Evaluate  "".join(${timestamp}) | 
|  | 433 | # Prefixes 0s for expected bytes. | 
|  | 434 | ${timestamp}=  Zfill Data  ${timestamp}  8 | 
|  | 435 | ${timestamp}=  Convert To Integer  ${timestamp}  16 | 
|  | 436 |  | 
|  | 437 | [Return]  ${timestamp} | 
|  | 438 |  | 
|  | 439 |  | 
|  | 440 | Get Count for Sensor And SDR Elist All | 
|  | 441 | [Documentation]  Get Sensor and SDR elist all count via IPMI lanplus. | 
|  | 442 |  | 
|  | 443 | # Get Sensor list via IPMI lanplus. | 
|  | 444 | ${sensor_count}=  Run IPMI Standard Command  sensor | wc -l | 
|  | 445 | # Get SDR elist all via IPMI lanplus. | 
|  | 446 | ${SDR_count}=  Get IPMI Sensor Count | 
|  | 447 |  | 
|  | 448 | [Return]  ${sensor_count}  ${SDR_count} | 
|  | 449 |  | 
|  | 450 |  | 
|  | 451 | Get Reserve Device SDR Repository | 
|  | 452 | [Documentation]  Get Reserve Device SDR Repository via Inband IPMI. | 
|  | 453 |  | 
|  | 454 | # Reserve Device SDR Repository command via inband. | 
|  | 455 | ${resp}=  Run Inband IPMI Standard Command | 
|  | 456 | ...  raw ${IPMI_RAW_CMD['Device_SDR']['Reserve_Repository'][0]} | 
|  | 457 |  | 
|  | 458 | [Return]  ${resp} | 
|  | 459 |  | 
|  | 460 |  | 
|  | 461 | Get IPMI SDR Status Info | 
|  | 462 | [Documentation]  Returns status for given IPMI SDR Info. | 
|  | 463 | [Arguments]  ${setting} | 
|  | 464 | # Description of argument(s): | 
|  | 465 | # setting  SDR Info which needs to be read(e.g. "SDR Version"). | 
|  | 466 | # SDR Version                         : 0x51 | 
|  | 467 | # Record Count                        : 58 | 
|  | 468 | # Free Space                          : 9312 bytes | 
|  | 469 | # Most recent Addition                : 03/10/2022 05:56:02 | 
|  | 470 | # Most recent Erase                   : 02/07/2106 06:28:15 | 
|  | 471 | # SDR overflow                        : yes | 
|  | 472 | # SDR Repository Update Support       : unspecified | 
|  | 473 | # Delete SDR supported                : no | 
|  | 474 | # Partial Add SDR supported           : no | 
|  | 475 | # Reserve SDR repository supported    : yes | 
|  | 476 | # SDR Repository Alloc info supported : yes | 
|  | 477 |  | 
|  | 478 | # Get SDR Info IPMI command. | 
| nagarjunb22 | 0c70140 | 2022-05-10 14:53:06 +0530 | [diff] [blame] | 479 | ${resp}=  Run IPMI Standard Command  sdr info | 
| chithrag | 782ad28 | 2022-03-12 10:12:40 +0000 | [diff] [blame] | 480 |  | 
|  | 481 | # Return lines for given IPMI SDR Info. | 
|  | 482 | ${setting_line}=  Get Lines Containing String  ${resp}  ${setting} | 
|  | 483 | ...  case-insensitive | 
|  | 484 | ${setting_status}=  Fetch From Right  ${setting_line}  :${SPACE} | 
|  | 485 |  | 
|  | 486 | [Return]  ${setting_status} | 
|  | 487 |  | 
|  | 488 |  | 
|  | 489 | Get Record Count And Last Record From SDR | 
|  | 490 | [Documentation]  Returns total record count from IPMI SDR Info and last SDR record. | 
|  | 491 |  | 
|  | 492 | # Returns Record count from IPMI SDR Info. | 
|  | 493 | ${record_count}=  Get IPMI SDR Status Info  Record Count | 
|  | 494 |  | 
|  | 495 | # Identifies Last record ID. | 
|  | 496 | # If Record Count = 58 (3Ah), record IDs range from 0 to 57. | 
|  | 497 | # Then Last record ID will be 57 (in decimal) - 39h. | 
|  | 498 | ${last_record}=  Evaluate  ${record_count} - 1 | 
|  | 499 |  | 
|  | 500 | [Return]  ${record_count}  ${last_record} | 
| George Keishing | e42cd02 | 2022-05-06 08:16:57 -0500 | [diff] [blame] | 501 |  | 
|  | 502 |  | 
|  | 503 | Suite Setup Execution | 
|  | 504 | [Documentation]  Do suite setup tasks. | 
| George Keishing | e42cd02 | 2022-05-06 08:16:57 -0500 | [diff] [blame] | 505 | Redfish.Login | 
|  | 506 | Should Not Be Empty  ${OS_HOST}  msg=Please provide required parameter OS_HOST | 
|  | 507 | Should Not Be Empty  ${OS_USERNAME}  msg=Please provide required parameter OS_USERNAME | 
| George Keishing | 42c84ea | 2023-09-07 20:31:45 +0530 | [diff] [blame] | 508 | Should Not Be Empty  ${OS_PASSWORD}  msg=Please provide required parameter OS_PASSWORD |