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 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 24 25 # Component Field 26 System Model 27 System SerialNumber 28 System LocationCode 29 30 31Verify 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 41Verify 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 51Verify VPD Field Write 52 [Documentation] Verify writing VPD field value via vpdtool. 53 [Tags] Verify_VPD_Field_Write 54 55 ${components}= Get Dictionary Keys ${VPD_DETAILS} 56 FOR ${component} IN @{components} 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} 61 END 62 63 64*** Keywords *** 65 66Verify 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 95Verify VPD Component Read Operation 96 [Documentation] Verify reading VPD details of given component via vpdtool. 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 116Verify VPD Field Read Operation 117 [Documentation] Verify reading all VPD fields for given component via vpdtool. 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 130Verify VPD Field Write Operation 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} 134 # Description of arguments: 135 # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 136 # field VPD component field (e.g. PN, SN) 137 138 ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 139 ${old_field_value}= Set Variable ${vpd_records['${component}']['${field}']} 140 141 ${write_value}= Set Variable If 142 ... '${field}' == 'DR' ${DR_WRITE_VALUE} 143 ... '${field}' == 'PN' ${PN_WRITE_VALUE} 144 ... '${field}' == 'SN' ${SN_WRITE_VALUE} 145 146 Vpdtool -w -O ${component} -R VINI -K ${field} --value ${write_value} 147 148 Verify VPD Field Value ${component} ${field} 149 150 151Restore 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} 160 161 162Verify 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('"')}'] 181 182 183Verify 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('"')} 214