Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite tests System Vital Product Data (VPD) using vpdtool. |
| 3 | |
| 4 | Library ../../lib/vpd_utils.py |
| 5 | Variables ../../data/vpd_variables.py |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
| 8 | Test Teardown FFDC On Test Case Fail |
| 9 | |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
| 13 | ${CMD_GET_PROPERTY_INVENTORY} busctl get-property xyz.openbmc_project.Inventory.Manager |
| 14 | ${DR_WRITE_VALUE} XYZ Component |
| 15 | ${PN_WRITE_VALUE} XYZ1234 |
| 16 | ${SN_WRITE_VALUE} ABCD12345678 |
| 17 | |
| 18 | *** Test Cases *** |
| 19 | |
dnirmala | 348356a | 2023-03-06 04:52:56 -0600 | [diff] [blame] | 20 | Verify System VPD Data Via Vpdtool |
| 21 | [Documentation] Verify the system VPD details via vpdtool output. |
| 22 | [Tags] Verify_System_VPD_Data_Via_Vpdtool |
| 23 | [Template] Verify VPD Data Via Vpdtool |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 24 | |
dnirmala | 348356a | 2023-03-06 04:52:56 -0600 | [diff] [blame] | 25 | # Component Field |
| 26 | System Model |
| 27 | System SerialNumber |
| 28 | System LocationCode |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 29 | |
| 30 | |
| 31 | Verify VPD Component Read |
| 32 | [Documentation] Verify details of VPD component via vpdtool. |
| 33 | [Tags] Verify_VPD_Component_Read |
| 34 | |
| 35 | ${components}= Get Dictionary Keys ${VPD_DETAILS} |
| 36 | FOR ${component} IN @{components} |
| 37 | Verify VPD Component Read Operation ${component} |
| 38 | END |
| 39 | |
| 40 | |
| 41 | Verify VPD Field Read |
| 42 | [Documentation] Verify reading VPD field value via vpdtool. |
| 43 | [Tags] Verify_VPD_Field_Read |
| 44 | |
| 45 | ${components}= Get Dictionary Keys ${VPD_DETAILS} |
| 46 | FOR ${component} IN @{components} |
| 47 | Verify VPD Field Read Operation ${component} |
| 48 | END |
| 49 | |
| 50 | |
| 51 | Verify VPD Field Write |
George Keishing | e20f82c | 2020-05-13 10:51:02 -0500 | [diff] [blame] | 52 | [Documentation] Verify writing VPD field value via vpdtool. |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 53 | [Tags] Verify_VPD_Field_Write |
| 54 | |
| 55 | ${components}= Get Dictionary Keys ${VPD_DETAILS} |
| 56 | FOR ${component} IN @{components} |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 57 | # VPD fields "DR", "CC" and "FN" will be added later. |
| 58 | @{vpd_fields}= Create List SN PN |
| 59 | ${field}= Evaluate random.choice($vpd_fields) random |
| 60 | Verify VPD Field Write Operation ${component} ${field} |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 61 | END |
| 62 | |
| 63 | |
| 64 | *** Keywords *** |
| 65 | |
| 66 | Verify VPD Data |
| 67 | [Documentation] Verify VPD data of given component. |
| 68 | [Arguments] ${vpd_records} ${component} |
| 69 | # Description of arguments: |
| 70 | # vpd_records All VPD data Via vpdtool. |
| 71 | # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 72 | |
| 73 | # Verification of "CC" and "FN" will be added later. |
| 74 | @{vpd_fields}= Create List DR LocationCode SN PN |
| 75 | FOR ${field} IN @{vpd_fields} |
| 76 | ${busctl_field}= Set Variable If |
| 77 | ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName |
| 78 | ... '${field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode |
| 79 | ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber |
| 80 | ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber |
| 81 | |
| 82 | ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} |
| 83 | ... ${busctl_field} |
| 84 | ${cmd_output}= BMC Execute Command ${cmd} |
| 85 | # Example of cmd_output: |
| 86 | # [0]: s "ABCD.XY1.1234567-P0" |
| 87 | # [1]: |
| 88 | # [2]: 0 |
| 89 | |
| 90 | Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] |
| 91 | END |
| 92 | Valid Value vpd_records['${component}']['type'] ['${VPD_DETAILS['${component}']['type']}'] |
| 93 | |
| 94 | |
| 95 | Verify VPD Component Read Operation |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 96 | [Documentation] Verify reading VPD details of given component via vpdtool. |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 97 | [Arguments] ${component} |
| 98 | # Description of arguments: |
| 99 | # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 100 | |
| 101 | ${vpd_records}= Vpdtool -o -O ${component} |
| 102 | |
| 103 | # Example output from 'Vpdtool -o -O /system/chassis/motherboard/vdd_vrm1': |
| 104 | # [/system/chassis/motherboard/vdd_vrm1]: |
| 105 | # [DR]: CPU POWER CARD |
| 106 | # [type]: xyz.openbmc_project.Inventory.Item.Vrm |
| 107 | # [CC]: E123 |
| 108 | # [FN]: F123456 |
| 109 | # [LocationCode]: ABCD.XY1.1234567-P0 |
| 110 | # [SN]: YL2E32010000 |
| 111 | # [PN]: PN12345 |
| 112 | |
| 113 | Verify VPD Data ${vpd_records} ${component} |
| 114 | |
| 115 | |
| 116 | Verify VPD Field Read Operation |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 117 | [Documentation] Verify reading all VPD fields for given component via vpdtool. |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 118 | [Arguments] ${component} |
| 119 | # Description of arguments: |
| 120 | # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 121 | |
| 122 | # Verification of "CC" and "FN" will be added later. |
| 123 | @{vpd_fields}= Create List DR SN PN |
| 124 | |
| 125 | FOR ${fields} IN @{vpd_fields} |
| 126 | Verify VPD Field Value ${component} ${fields} |
| 127 | END |
| 128 | |
| 129 | |
| 130 | Verify VPD Field Write Operation |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 131 | [Documentation] Verify writing VPD fields for given component via vpdtool. |
| 132 | [Arguments] ${component} ${field} |
| 133 | [Teardown] Restore VPD Value ${component} ${field} ${old_field_value} |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 134 | # Description of arguments: |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 135 | # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 136 | # field VPD component field (e.g. PN, SN) |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 137 | |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 138 | ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} |
| 139 | ${old_field_value}= Set Variable ${vpd_records['${component}']['${field}']} |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 140 | |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 141 | ${write_value}= Set Variable If |
| 142 | ... '${field}' == 'DR' ${DR_WRITE_VALUE} |
| 143 | ... '${field}' == 'PN' ${PN_WRITE_VALUE} |
| 144 | ... '${field}' == 'SN' ${SN_WRITE_VALUE} |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 145 | |
Rahul Maheshwari | 0ef1e15 | 2020-11-02 23:10:55 -0600 | [diff] [blame] | 146 | Vpdtool -w -O ${component} -R VINI -K ${field} --value ${write_value} |
| 147 | |
| 148 | Verify VPD Field Value ${component} ${field} |
| 149 | |
| 150 | |
| 151 | Restore VPD Value |
| 152 | [Documentation] Restore VPD's field value of given component. |
| 153 | [Arguments] ${component} ${field} ${value} |
| 154 | # Description of arguments: |
| 155 | # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 156 | # field VPD component field (e.g. PN, SN) |
| 157 | # value VPD value to be restore. |
| 158 | |
| 159 | Vpdtool -w -O ${component} -R VINI -K ${field} --value ${value} |
Rahul Maheshwari | ef00306 | 2020-03-23 07:17:16 -0500 | [diff] [blame] | 160 | |
| 161 | |
| 162 | Verify VPD Field Value |
| 163 | [Documentation] Verify VPD field value via vpdtool. |
| 164 | [Arguments] ${component} ${field} |
| 165 | # Description of arguments: |
| 166 | # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). |
| 167 | # field VPD field (e.g. DR, SN, PN) |
| 168 | |
| 169 | ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} |
| 170 | |
| 171 | ${busctl_field}= Set Variable If |
| 172 | ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName |
| 173 | ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber |
| 174 | ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber |
| 175 | |
| 176 | ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} |
| 177 | ... ${busctl_field} |
| 178 | ${cmd_output}= BMC Execute Command ${cmd} |
| 179 | |
| 180 | Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] |
dnirmala | 348356a | 2023-03-06 04:52:56 -0600 | [diff] [blame] | 181 | |
| 182 | |
| 183 | Verify VPD Data Via Vpdtool |
| 184 | [Documentation] Get VPD details of given component via vpdtool and verify it |
| 185 | ... using busctl command. |
| 186 | [Arguments] ${component} ${field} |
| 187 | # Description of arguments: |
| 188 | # component VPD component (e.g. System,Chassis etc). |
| 189 | # field VPD field (e.g. Serialnumber,LocationCode etc). |
| 190 | |
| 191 | ${component_url}= Run Keyword If |
| 192 | ... '${component}' == 'System' Set Variable /system |
| 193 | |
| 194 | # Get VPD details of given component via vpd-tool. |
| 195 | ${vpd_records}= Vpdtool -o -O ${component_url} |
| 196 | |
| 197 | # Get VPD details of given component via busctl command. |
| 198 | ${busctl_field}= Set Variable If |
| 199 | ... '${field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode |
| 200 | ... '${field}' == 'Model' xyz.openbmc_project.Inventory.Decorator.Asset Model |
| 201 | ... '${field}' == 'SerialNumber' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber |
| 202 | |
| 203 | ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory/system |
| 204 | ... ${busctl_field} |
| 205 | ${cmd_output}= BMC Execute Command ${cmd} |
| 206 | # Example of cmd_output: |
| 207 | # [0]: s "ABCD.XY1.1234567-P0" |
| 208 | # [1]: |
| 209 | # [2]: 0 |
| 210 | |
| 211 | # Cross check vpdtool output with busctl response. |
| 212 | Should Be Equal As Strings ${vpd_records["/system"]["${field}"]} |
| 213 | ... ${cmd_output[0].split('"')[1].strip('"')} |