| 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 |  | 
|  | 24 |  | 
|  | 25 | *** Test Cases *** | 
|  | 26 |  | 
|  | 27 | Get 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 |  | 
|  | 37 | Verify 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 |  | 
|  | 48 | Verify 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 | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 72 | ${version}=  Get Bmc Major Minor Version  ${os_release['version']} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 73 |  | 
|  | 74 | # Verify Firmware Revision 1. | 
|  | 75 | ${firmware_rev1}=  Set Variable  ${version[0]} | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 76 | ${ipmi_rsp_firmware_rev1}=  Convert To Integer  ${resp[2]}  base=16 | 
|  | 77 | Run Keyword And Continue On Failure  Should Be Equal As Integers | 
|  | 78 | ...  ${ipmi_rsp_firmware_rev1}  ${firmware_rev1} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 79 |  | 
|  | 80 | # Verify Firmware Revision 2. | 
|  | 81 | ${firmware_rev2}=  Set Variable  ${version[1]} | 
| ganesanb | bd187d2 | 2023-05-03 11:00:18 +0000 | [diff] [blame] | 82 | ${ipmi_rsp_firmware_rev2}=  Convert To Integer  ${resp[3]}  base=16 | 
|  | 83 | Run Keyword And Continue On Failure  Should Be Equal As Integers | 
|  | 84 | ...  ${ipmi_rsp_firmware_rev2}  ${firmware_rev2} | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 85 |  | 
|  | 86 | # Verify IPMI Version. | 
|  | 87 | Run Keyword And Continue On Failure  Should Be Equal  ${resp[4]}  02 | 
|  | 88 |  | 
|  | 89 | # Verify Manufacture ID. | 
|  | 90 | ${manufacture_id}=  Set Variable  ${resp[6:9]} | 
|  | 91 | ${manufacture_id}=  Evaluate  "".join(${manufacture_id}) | 
|  | 92 | ${manufacture_data}=  Convert To Binary  ${manufacture_id}  base=16 | 
|  | 93 | # Manufacure ID has Most significant four bits - reserved (0000b) | 
|  | 94 | Run Keyword And Continue On Failure  Should Be Equal  ${manufacture_data[-5:-1]}  0000 | 
|  | 95 |  | 
|  | 96 | # Verify Product ID. | 
|  | 97 | ${product_id}=  Set Variable  ${resp[9:11]} | 
|  | 98 | ${product_id}=  Evaluate   "".join(${product_id}) | 
|  | 99 | Run Keyword And Continue On Failure  Should Not Be Equal  ${product_id}  0000 | 
|  | 100 | ...  msg=Product ID cannot be Zero | 
|  | 101 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 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 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 113 |  | 
|  | 114 | *** Keywords *** | 
|  | 115 |  | 
|  | 116 | Get BMC OS Release Details | 
|  | 117 | [Documentation]  To get the release details from bmc etc/os-release. | 
|  | 118 |  | 
|  | 119 | # The BMC OS Release information will be, | 
|  | 120 | # for example, | 
|  | 121 | # ID=openbmc-phosphor | 
|  | 122 | # NAME="ADCD EFG BMC (OpenBMC     Project Reference Distro)" | 
|  | 123 | # VERSION="2.9.1-2719" | 
|  | 124 | # VERSION_ID=2.9.1-2719-xxxxxxxx | 
|  | 125 | # PRETTY_NAME="ABCD EFG BMC (OpenBMC     Project Reference Distro) 2.9.1-2719" | 
|  | 126 | # BUILD_ID="xxxxxxxxxx" | 
|  | 127 | # OPENBMC_TARGET_MACHINE="efg" | 
|  | 128 |  | 
|  | 129 | ${os_release}=  Get BMC Release Info | 
|  | 130 | ${os_release}=  Convert To Dictionary  ${os_release} | 
|  | 131 |  | 
|  | 132 | [Return]  ${os_release} | 
|  | 133 |  | 
|  | 134 |  | 
| chithrag | 8a17c49 | 2022-03-01 12:53:44 +0000 | [diff] [blame] | 135 | Get Device Info From BMC | 
|  | 136 | [Documentation]  To get the device information from BMC. | 
|  | 137 |  | 
|  | 138 | # Get Device ID information from BMC. | 
|  | 139 | ${data}=  Bmc Execute Command   cat /usr/share/ipmi-providers/dev_id.json | 
|  | 140 | ${data}=  Convert To List  ${data} | 
|  | 141 |  | 
|  | 142 | # Fetching dictionary from the response. | 
|  | 143 | ${info}=  Set Variable  ${data[0]} | 
|  | 144 | ${info}=  Evaluate  dict(${info}) | 
|  | 145 |  | 
|  | 146 | [Return]  ${info} |