1*** Settings *** 2Documentation 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 17Resource ../lib/ipmi_client.robot 18Resource ../lib/openbmc_ffdc.robot 19Library Collections 20Library ../lib/ipmi_utils.py 21Library ../lib/var_funcs.py 22Variables ../data/ipmi_raw_cmd_table.py 23 24 25*** Test Cases *** 26 27Get Device ID Via IPMI 28 [Documentation] Verify Get Device ID using IPMI and check whether a response is received. 29 [Tags] Get_Device_ID_Via_IPMI 30 31 # Verify Get Device ID. 32 ${resp}= Run External IPMI Raw Command 33 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]} 34 Should Not Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][1]} 35 36 37Verify Get Device ID With Invalid Data Request 38 [Documentation] Verify Get Device ID with invalid data request via IPMI. 39 [Tags] Verify_Get_Device_ID_With_Invalid_Data_Request 40 41 # Run IPMI Get Device ID command with invalid request data byte. 42 ${resp}= Run Keyword and Expect Error *Request data length invalid* 43 ... Run External IPMI Raw Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} 0x00 44 # Verify error code in 'rsp='. 45 Should Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][2]} 46 47 48Verify Device ID Response Data Via IPMI 49 [Documentation] Verify Get Device ID response data bytes using IPMI. 50 [Tags] Verify_Device_ID_Response_Data_Via_IPMI 51 52 # Get Device ID IPMI command. 53 ${resp}= Run External IPMI Raw Command 54 ... ${IPMI_RAW_CMD['Device ID']['Get'][0]} 55 56 # Split each and every byte and form list. 57 ${resp}= Split String ${resp} 58 59 # Checking Device ID. 60 Run Keyword And Continue On Failure Should Not Be Equal ${resp[0]} 00 61 ... msg=Device ID cannot be Unspecified 62 63 # Verify Device Revision. 64 ${device_rev}= Set Variable ${resp[1]} 65 ${device_rev}= Convert To Binary ${device_rev} base=16 66 ${device_rev}= Zfill Data ${device_rev} 8 67 # Comparing the reserved bits from Device Revision. 68 Run Keyword And Continue On Failure Should Be Equal As Strings ${device_rev[1:4]} 000 69 70 # Get version details from /etc/os-release. 71 ${os_release}= Get BMC OS Release Details 72 ${version}= Get Version Details From BMC OS Release ${os_release['version']} 73 74 # Verify Firmware Revision 1. 75 ${firmware_rev1}= Set Variable ${version[0]} 76 Run Keyword And Continue On Failure Should Be Equal ${resp[2]} 0${firmware_rev1} 77 78 # Verify Firmware Revision 2. 79 ${firmware_rev2}= Set Variable ${version[1]} 80 Run Keyword And Continue On Failure Should Be Equal ${resp[3]} 0${firmware_rev2} 81 82 # Verify IPMI Version. 83 Run Keyword And Continue On Failure Should Be Equal ${resp[4]} 02 84 85 # Verify Manufacture ID. 86 ${manufacture_id}= Set Variable ${resp[6:9]} 87 ${manufacture_id}= Evaluate "".join(${manufacture_id}) 88 ${manufacture_data}= Convert To Binary ${manufacture_id} base=16 89 # Manufacure ID has Most significant four bits - reserved (0000b) 90 Run Keyword And Continue On Failure Should Be Equal ${manufacture_data[-5:-1]} 0000 91 92 # Verify Product ID. 93 ${product_id}= Set Variable ${resp[9:11]} 94 ${product_id}= Evaluate "".join(${product_id}) 95 Run Keyword And Continue On Failure Should Not Be Equal ${product_id} 0000 96 ... msg=Product ID cannot be Zero 97 98 # Verify Auxiliary Firmware Revision Information. 99 # etc/os-release - from bmc. 100 ${auxiliary_info}= Get Auxiliary Firmware Revision Information 101 102 # Get Auxiliary Firmware Revision Information from IPMI response. 103 ${auxiliary_rev_version}= Set Variable ${resp[11:]} 104 Reverse List ${auxiliary_rev_version} 105 ${auxiliary_rev_version}= Evaluate "".join(${auxiliary_rev_version}) 106 ${auxiliary_rev_version}= Convert To Integer ${auxiliary_rev_version} 16 107 108 # Compare both IPMI aux version and dev_id.json aux version. 109 ${dev_id_data}= Get Device Info From BMC 110 ${aux_info}= Get From Dictionary ${dev_id_data} aux 111 Run Keyword And Continue On Failure Should Be Equal ${aux_info} ${auxiliary_rev_version} 112 113 # Compare both IPMI version and /etc/os-release version. 114 Run Keyword And Continue On Failure Should Be Equal ${auxiliary_info} ${auxiliary_rev_version} 115 116 117*** Keywords *** 118 119Get BMC OS Release Details 120 [Documentation] To get the release details from bmc etc/os-release. 121 122 # The BMC OS Release information will be, 123 # for example, 124 # ID=openbmc-phosphor 125 # NAME="ADCD EFG BMC (OpenBMC Project Reference Distro)" 126 # VERSION="2.9.1-2719" 127 # VERSION_ID=2.9.1-2719-xxxxxxxx 128 # PRETTY_NAME="ABCD EFG BMC (OpenBMC Project Reference Distro) 2.9.1-2719" 129 # BUILD_ID="xxxxxxxxxx" 130 # OPENBMC_TARGET_MACHINE="efg" 131 132 ${os_release}= Get BMC Release Info 133 ${os_release}= Convert To Dictionary ${os_release} 134 135 [Return] ${os_release} 136 137 138Get Version Details From BMC OS Release 139 [Documentation] To get the Version details from bmc etc/os-release, 140 ... and returns list consists of major, minor and auxiliary version. 141 [Arguments] ${version} 142 143 # As per BMC, VERSION="X.Y.Z-ZZZZ" 144 # ${version} - ["X", "Y" ,"Z-ZZZZ"] 145 # here, X - major version, Y - minor version, 146 # Z-ZZZZ - auxiliary version. 147 ${version}= Split String ${version} . 148 149 [Return] ${version} 150 151 152Get Auxiliary Firmware Revision Information 153 [Documentation] To Get the Auxiliary Firmware Revision Information from BMC etc/os-release. 154 155 # Get the Auxiliary Firmware Revision Information version from etc/os-release. 156 ${os_release}= Get BMC OS Release Details 157 158 # Fetch the version from dictionary response and identify Auxiliary version. 159 ${version}= Get Version Details From BMC OS Release ${os_release['version']} 160 ${aux_rev}= Set Variable ${version[2]} 161 162 # Remove extra special character. 163 ${aux_rev}= Replace String ${aux_rev} - ${EMPTY} 164 ${aux_rev}= Convert To Integer ${aux_rev} 165 166 [Return] ${aux_rev} 167 168 169Get Device Info From BMC 170 [Documentation] To get the device information from BMC. 171 172 # Get Device ID information from BMC. 173 ${data}= Bmc Execute Command cat /usr/share/ipmi-providers/dev_id.json 174 ${data}= Convert To List ${data} 175 176 # Fetching dictionary from the response. 177 ${info}= Set Variable ${data[0]} 178 ${info}= Evaluate dict(${info}) 179 180 [Return] ${info} 181