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