1*** Settings *** 2Documentation This suite tests System Vital Product Data (VPD) using vpdtool. 3 4Library ../../lib/vpd_utils.py 5Variables ../../data/vpd_variables.py 6Resource ../../lib/openbmc_ffdc.robot 7 8Test 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 20Verify System VPD 21 [Documentation] Verify system VPD details via vpdtool '-i' option. 22 [Tags] Verify_System_VPD 23 24 ${vpd_records}= Vpdtool -i 25 26 ${components}= Get Dictionary Keys ${vpd_records} 27 FOR ${component} IN @{components} 28 Verify VPD Data ${vpd_records} ${component} 29 END 30 31 32Verify VPD Component Read 33 [Documentation] Verify details of VPD component via vpdtool. 34 [Tags] Verify_VPD_Component_Read 35 36 ${components}= Get Dictionary Keys ${VPD_DETAILS} 37 FOR ${component} IN @{components} 38 Verify VPD Component Read Operation ${component} 39 END 40 41 42Verify VPD Field Read 43 [Documentation] Verify reading VPD field value via vpdtool. 44 [Tags] Verify_VPD_Field_Read 45 46 ${components}= Get Dictionary Keys ${VPD_DETAILS} 47 FOR ${component} IN @{components} 48 Verify VPD Field Read Operation ${component} 49 END 50 51 52Verify VPD Field Write 53 [Documentation] Verify writing VPD field value via vpdtool. 54 [Tags] Verify_VPD_Field_Write 55 56 ${components}= Get Dictionary Keys ${VPD_DETAILS} 57 FOR ${component} IN @{components} 58 # VPD fields "DR", "CC" and "FN" will be added later. 59 @{vpd_fields}= Create List SN PN 60 ${field}= Evaluate random.choice($vpd_fields) random 61 Verify VPD Field Write Operation ${component} ${field} 62 END 63 64 65*** Keywords *** 66 67Verify VPD Data 68 [Documentation] Verify VPD data of given component. 69 [Arguments] ${vpd_records} ${component} 70 # Description of arguments: 71 # vpd_records All VPD data Via vpdtool. 72 # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 73 74 # Verification of "CC" and "FN" will be added later. 75 @{vpd_fields}= Create List DR LocationCode SN PN 76 FOR ${field} IN @{vpd_fields} 77 ${busctl_field}= Set Variable If 78 ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName 79 ... '${field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode 80 ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 81 ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 82 83 ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} 84 ... ${busctl_field} 85 ${cmd_output}= BMC Execute Command ${cmd} 86 # Example of cmd_output: 87 # [0]: s "ABCD.XY1.1234567-P0" 88 # [1]: 89 # [2]: 0 90 91 Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] 92 END 93 Valid Value vpd_records['${component}']['type'] ['${VPD_DETAILS['${component}']['type']}'] 94 95 96Verify VPD Component Read Operation 97 [Documentation] Verify reading VPD details of given compoment via vpdtool. 98 [Arguments] ${component} 99 # Description of arguments: 100 # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 101 102 ${vpd_records}= Vpdtool -o -O ${component} 103 104 # Example output from 'Vpdtool -o -O /system/chassis/motherboard/vdd_vrm1': 105 # [/system/chassis/motherboard/vdd_vrm1]: 106 # [DR]: CPU POWER CARD 107 # [type]: xyz.openbmc_project.Inventory.Item.Vrm 108 # [CC]: E123 109 # [FN]: F123456 110 # [LocationCode]: ABCD.XY1.1234567-P0 111 # [SN]: YL2E32010000 112 # [PN]: PN12345 113 114 Verify VPD Data ${vpd_records} ${component} 115 116 117Verify VPD Field Read Operation 118 [Documentation] Verify reading all VPD fields for given compoment via vpdtool. 119 [Arguments] ${component} 120 # Description of arguments: 121 # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 122 123 # Verification of "CC" and "FN" will be added later. 124 @{vpd_fields}= Create List DR SN PN 125 126 FOR ${fields} IN @{vpd_fields} 127 Verify VPD Field Value ${component} ${fields} 128 END 129 130 131Verify VPD Field Write Operation 132 [Documentation] Verify writing VPD fields for given component via vpdtool. 133 [Arguments] ${component} ${field} 134 [Teardown] Restore VPD Value ${component} ${field} ${old_field_value} 135 # Description of arguments: 136 # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 137 # field VPD component field (e.g. PN, SN) 138 139 ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 140 ${old_field_value}= Set Variable ${vpd_records['${component}']['${field}']} 141 142 ${write_value}= Set Variable If 143 ... '${field}' == 'DR' ${DR_WRITE_VALUE} 144 ... '${field}' == 'PN' ${PN_WRITE_VALUE} 145 ... '${field}' == 'SN' ${SN_WRITE_VALUE} 146 147 Vpdtool -w -O ${component} -R VINI -K ${field} --value ${write_value} 148 149 Verify VPD Field Value ${component} ${field} 150 151 152Restore VPD Value 153 [Documentation] Restore VPD's field value of given component. 154 [Arguments] ${component} ${field} ${value} 155 # Description of arguments: 156 # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 157 # field VPD component field (e.g. PN, SN) 158 # value VPD value to be restore. 159 160 Vpdtool -w -O ${component} -R VINI -K ${field} --value ${value} 161 162 163Verify VPD Field Value 164 [Documentation] Verify VPD field value via vpdtool. 165 [Arguments] ${component} ${field} 166 # Description of arguments: 167 # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 168 # field VPD field (e.g. DR, SN, PN) 169 170 ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 171 172 ${busctl_field}= Set Variable If 173 ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName 174 ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 175 ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 176 177 ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} 178 ... ${busctl_field} 179 ${cmd_output}= BMC Execute Command ${cmd} 180 181 Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] 182