| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 1 | *** Settings *** | 
 | 2 | Documentation       This suite tests IPMI Payload in OpenBMC. | 
 | 3 | ...                 This script verifies Get Device ID IPMI command. | 
 | 4 | ... | 
 | 5 | ...                 Response data validated for each and every byte, | 
 | 6 | ...                 with respect to expected response. | 
 | 7 | ... | 
 | 8 | ...                 Following data validated in response bytes : | 
 | 9 | ...                 Device ID, Device Revision, Firmware Revision 1 & 2, | 
 | 10 | ...                 IPMI Version, Manufacture ID, Product ID, | 
 | 11 | ...                 Auxiliary Firmware Revision Information | 
 | 12 | ... | 
 | 13 | ...                 Request Data for Get Device ID defined under, | 
 | 14 | ...                       - data/ipmi_raw_cmd_table.py | 
 | 15 |  | 
 | 16 |  | 
| ganesanb | d0c4b80 | 2023-04-28 18:29:38 +0000 | [diff] [blame] | 17 | Resource            ../lib/ipmi_client.robot | 
 | 18 | Resource            ../lib/openbmc_ffdc.robot | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 19 | Library             Collections | 
 | 20 | Library             ../lib/ipmi_utils.py | 
 | 21 | Library             ../lib/var_funcs.py | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 22 | Variables           ../data/ipmi_raw_cmd_table.py | 
 | 23 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 24 | Test Tags          IPMI_Device_ID | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 25 |  | 
 | 26 | *** Test Cases *** | 
 | 27 |  | 
 | 28 | Get Device ID Via IPMI | 
 | 29 |     [Documentation]  Verify Get Device ID using IPMI and check whether a response is received. | 
 | 30 |     [Tags]  Get_Device_ID_Via_IPMI | 
 | 31 |  | 
 | 32 |     # Verify Get Device ID. | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 33 |     ${resp}=  Run IPMI Command | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 34 |     ...  ${IPMI_RAW_CMD['Device ID']['Get'][0]} | 
 | 35 |     Should Not Contain  ${resp}  ${IPMI_RAW_CMD['Device ID']['Get'][1]} | 
 | 36 |  | 
 | 37 |  | 
 | 38 | Verify Get Device ID With Invalid Data Request | 
 | 39 |     [Documentation]  Verify Get Device ID with invalid data request via IPMI. | 
 | 40 |     [Tags]  Verify_Get_Device_ID_With_Invalid_Data_Request | 
 | 41 |  | 
 | 42 |     # Run IPMI Get Device ID command with invalid request data byte. | 
 | 43 |     ${resp}=  Run Keyword and Expect Error  *Request data length invalid* | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 44 |     ...  Run IPMI Command  ${IPMI_RAW_CMD['Device ID']['Get'][0]} 0x00 | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 45 |     # Verify error code in 'rsp='. | 
 | 46 |     Should Contain  ${resp}  ${IPMI_RAW_CMD['Device ID']['Get'][2]} | 
 | 47 |  | 
 | 48 |  | 
 | 49 | Verify Device ID Response Data Via IPMI | 
 | 50 |     [Documentation]  Verify Get Device ID response data bytes using IPMI. | 
 | 51 |     [Tags]  Verify_Device_ID_Response_Data_Via_IPMI | 
 | 52 |  | 
 | 53 |     # Get Device ID IPMI command. | 
| ishwaryamathim | 372cd86 | 2023-11-14 18:12:23 +0000 | [diff] [blame] | 54 |     ${resp}=  Run IPMI Command | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 55 |     ...  ${IPMI_RAW_CMD['Device ID']['Get'][0]} | 
 | 56 |  | 
 | 57 |     # Split each and every byte and form list. | 
 | 58 |     ${resp}=  Split String  ${resp} | 
 | 59 |  | 
 | 60 |     # Checking Device ID. | 
 | 61 |     Run Keyword And Continue On Failure  Should Not Be Equal  ${resp[0]}  00 | 
 | 62 |     ...  msg=Device ID cannot be Unspecified | 
 | 63 |  | 
 | 64 |     # Verify Device Revision. | 
 | 65 |     ${device_rev}=  Set Variable  ${resp[1]} | 
 | 66 |     ${device_rev}=  Convert To Binary  ${device_rev}  base=16 | 
 | 67 |     ${device_rev}=  Zfill Data  ${device_rev}  8 | 
 | 68 |     # Comparing the reserved bits from Device Revision. | 
 | 69 |     Run Keyword And Continue On Failure  Should Be Equal As Strings  ${device_rev[1:4]}  000 | 
 | 70 |  | 
 | 71 |     # Get version details from /etc/os-release. | 
 | 72 |     ${os_release}=  Get BMC OS Release Details | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 73 |     ${version}=  Get Bmc Major Minor Version  ${os_release['version']} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 74 |  | 
 | 75 |     # Verify Firmware Revision 1. | 
 | 76 |     ${firmware_rev1}=  Set Variable  ${version[0]} | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 77 |     ${ipmi_rsp_firmware_rev1}=  Convert To Integer  ${resp[2]}  base=16 | 
 | 78 |     Run Keyword And Continue On Failure  Should Be Equal As Integers | 
 | 79 |     ...  ${ipmi_rsp_firmware_rev1}  ${firmware_rev1} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 80 |  | 
 | 81 |     # Verify Firmware Revision 2. | 
 | 82 |     ${firmware_rev2}=  Set Variable  ${version[1]} | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 83 |     ${ipmi_rsp_firmware_rev2}=  Convert To Integer  ${resp[3]}  base=16 | 
 | 84 |     Run Keyword And Continue On Failure  Should Be Equal As Integers | 
 | 85 |     ...  ${ipmi_rsp_firmware_rev2}  ${firmware_rev2} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 86 |  | 
 | 87 |     # Verify IPMI Version. | 
 | 88 |     Run Keyword And Continue On Failure  Should Be Equal  ${resp[4]}  02 | 
 | 89 |  | 
 | 90 |     # Verify Manufacture ID. | 
 | 91 |     ${manufacture_id}=  Set Variable  ${resp[6:9]} | 
 | 92 |     ${manufacture_id}=  Evaluate  "".join(${manufacture_id}) | 
 | 93 |     ${manufacture_data}=  Convert To Binary  ${manufacture_id}  base=16 | 
 | 94 |     # Manufacure ID has Most significant four bits - reserved (0000b) | 
 | 95 |     Run Keyword And Continue On Failure  Should Be Equal  ${manufacture_data[-5:-1]}  0000 | 
 | 96 |  | 
 | 97 |     # Verify Product ID. | 
 | 98 |     ${product_id}=  Set Variable  ${resp[9:11]} | 
 | 99 |     ${product_id}=  Evaluate   "".join(${product_id}) | 
 | 100 |     Run Keyword And Continue On Failure  Should Not Be Equal  ${product_id}  0000 | 
 | 101 |     ...  msg=Product ID cannot be Zero | 
 | 102 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 103 |     # Get Auxiliary Firmware Revision Information from IPMI response. | 
 | 104 |     ${auxiliary_rev_version}=  Set Variable  ${resp[11:]} | 
 | 105 |     Reverse List  ${auxiliary_rev_version} | 
 | 106 |     ${auxiliary_rev_version}=  Evaluate  "".join(${auxiliary_rev_version}) | 
 | 107 |     ${auxiliary_rev_version}=  Convert To Integer  ${auxiliary_rev_version}  16 | 
 | 108 |  | 
 | 109 |     # Compare both IPMI aux version and dev_id.json aux version. | 
 | 110 |     ${dev_id_data}=  Get Device Info From BMC | 
 | 111 |     ${aux_info}=  Get From Dictionary  ${dev_id_data}  aux | 
 | 112 |     Run Keyword And Continue On Failure  Should Be Equal  ${aux_info}  ${auxiliary_rev_version} | 
 | 113 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 114 |  | 
 | 115 | *** Keywords *** | 
 | 116 |  | 
 | 117 | Get BMC OS Release Details | 
 | 118 |     [Documentation]  To get the release details from bmc etc/os-release. | 
 | 119 |  | 
 | 120 |     # The BMC OS Release information will be, | 
 | 121 |     # for example, | 
 | 122 |     # ID=openbmc-phosphor | 
 | 123 |     # NAME="ADCD EFG BMC (OpenBMC     Project Reference Distro)" | 
 | 124 |     # VERSION="2.9.1-2719" | 
 | 125 |     # VERSION_ID=2.9.1-2719-xxxxxxxx | 
 | 126 |     # PRETTY_NAME="ABCD EFG BMC (OpenBMC     Project Reference Distro) 2.9.1-2719" | 
 | 127 |     # BUILD_ID="xxxxxxxxxx" | 
 | 128 |     # OPENBMC_TARGET_MACHINE="efg" | 
 | 129 |  | 
 | 130 |     ${os_release}=  Get BMC Release Info | 
 | 131 |     ${os_release}=  Convert To Dictionary  ${os_release} | 
 | 132 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 133 |     RETURN  ${os_release} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 134 |  | 
 | 135 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 136 | Get Device Info From BMC | 
 | 137 |     [Documentation]  To get the device information from BMC. | 
 | 138 |  | 
 | 139 |     # Get Device ID information from BMC. | 
 | 140 |     ${data}=  Bmc Execute Command   cat /usr/share/ipmi-providers/dev_id.json | 
 | 141 |     ${data}=  Convert To List  ${data} | 
 | 142 |  | 
 | 143 |     # Fetching dictionary from the response. | 
 | 144 |     ${info}=  Set Variable  ${data[0]} | 
 | 145 |     ${info}=  Evaluate  dict(${info}) | 
 | 146 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 147 |     RETURN  ${info} |