1ef00306eSRahul Maheshwari*** Settings *** 2ef00306eSRahul MaheshwariDocumentation This suite tests System Vital Product Data (VPD) using vpdtool. 3ef00306eSRahul Maheshwari 4ef00306eSRahul MaheshwariLibrary ../../lib/vpd_utils.py 5ef00306eSRahul MaheshwariVariables ../../data/vpd_variables.py 6ef00306eSRahul MaheshwariResource ../../lib/openbmc_ffdc.robot 7ef00306eSRahul Maheshwari 8ef00306eSRahul MaheshwariTest Teardown FFDC On Test Case Fail 9ef00306eSRahul Maheshwari 10ef00306eSRahul Maheshwari 11ef00306eSRahul Maheshwari*** Variables *** 12ef00306eSRahul Maheshwari 13ef00306eSRahul Maheshwari${CMD_GET_PROPERTY_INVENTORY} busctl get-property xyz.openbmc_project.Inventory.Manager 14ef00306eSRahul Maheshwari${DR_WRITE_VALUE} XYZ Component 15ef00306eSRahul Maheshwari${PN_WRITE_VALUE} XYZ1234 16ef00306eSRahul Maheshwari${SN_WRITE_VALUE} ABCD12345678 17ef00306eSRahul Maheshwari 18ef00306eSRahul Maheshwari*** Test Cases *** 19ef00306eSRahul Maheshwari 20ef00306eSRahul MaheshwariVerify System VPD 21ef00306eSRahul Maheshwari [Documentation] Verify system VPD details via vpdtool '-i' option. 22ef00306eSRahul Maheshwari [Tags] Verify_System_VPD 23ef00306eSRahul Maheshwari 24ef00306eSRahul Maheshwari ${vpd_records}= Vpdtool -i 25ef00306eSRahul Maheshwari 26ef00306eSRahul Maheshwari ${components}= Get Dictionary Keys ${vpd_records} 27ef00306eSRahul Maheshwari FOR ${component} IN @{components} 28ef00306eSRahul Maheshwari Verify VPD Data ${vpd_records} ${component} 29ef00306eSRahul Maheshwari END 30ef00306eSRahul Maheshwari 31ef00306eSRahul Maheshwari 32ef00306eSRahul MaheshwariVerify VPD Component Read 33ef00306eSRahul Maheshwari [Documentation] Verify details of VPD component via vpdtool. 34ef00306eSRahul Maheshwari [Tags] Verify_VPD_Component_Read 35ef00306eSRahul Maheshwari 36ef00306eSRahul Maheshwari ${components}= Get Dictionary Keys ${VPD_DETAILS} 37ef00306eSRahul Maheshwari FOR ${component} IN @{components} 38ef00306eSRahul Maheshwari Verify VPD Component Read Operation ${component} 39ef00306eSRahul Maheshwari END 40ef00306eSRahul Maheshwari 41ef00306eSRahul Maheshwari 42ef00306eSRahul MaheshwariVerify VPD Field Read 43ef00306eSRahul Maheshwari [Documentation] Verify reading VPD field value via vpdtool. 44ef00306eSRahul Maheshwari [Tags] Verify_VPD_Field_Read 45ef00306eSRahul Maheshwari 46ef00306eSRahul Maheshwari ${components}= Get Dictionary Keys ${VPD_DETAILS} 47ef00306eSRahul Maheshwari FOR ${component} IN @{components} 48ef00306eSRahul Maheshwari Verify VPD Field Read Operation ${component} 49ef00306eSRahul Maheshwari END 50ef00306eSRahul Maheshwari 51ef00306eSRahul Maheshwari 52ef00306eSRahul MaheshwariVerify VPD Field Write 53e20f82cdSGeorge Keishing [Documentation] Verify writing VPD field value via vpdtool. 54ef00306eSRahul Maheshwari [Tags] Verify_VPD_Field_Write 55ef00306eSRahul Maheshwari 56ef00306eSRahul Maheshwari ${components}= Get Dictionary Keys ${VPD_DETAILS} 57ef00306eSRahul Maheshwari FOR ${component} IN @{components} 580ef1e157SRahul Maheshwari # VPD fields "DR", "CC" and "FN" will be added later. 590ef1e157SRahul Maheshwari @{vpd_fields}= Create List SN PN 600ef1e157SRahul Maheshwari ${field}= Evaluate random.choice($vpd_fields) random 610ef1e157SRahul Maheshwari Verify VPD Field Write Operation ${component} ${field} 62ef00306eSRahul Maheshwari END 63ef00306eSRahul Maheshwari 64ef00306eSRahul Maheshwari 65ef00306eSRahul Maheshwari*** Keywords *** 66ef00306eSRahul Maheshwari 67ef00306eSRahul MaheshwariVerify VPD Data 68ef00306eSRahul Maheshwari [Documentation] Verify VPD data of given component. 69ef00306eSRahul Maheshwari [Arguments] ${vpd_records} ${component} 70ef00306eSRahul Maheshwari # Description of arguments: 71ef00306eSRahul Maheshwari # vpd_records All VPD data Via vpdtool. 72ef00306eSRahul Maheshwari # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 73ef00306eSRahul Maheshwari 74ef00306eSRahul Maheshwari # Verification of "CC" and "FN" will be added later. 75ef00306eSRahul Maheshwari @{vpd_fields}= Create List DR LocationCode SN PN 76ef00306eSRahul Maheshwari FOR ${field} IN @{vpd_fields} 77ef00306eSRahul Maheshwari ${busctl_field}= Set Variable If 78ef00306eSRahul Maheshwari ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName 79ef00306eSRahul Maheshwari ... '${field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode 80ef00306eSRahul Maheshwari ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 81ef00306eSRahul Maheshwari ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 82ef00306eSRahul Maheshwari 83ef00306eSRahul Maheshwari ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} 84ef00306eSRahul Maheshwari ... ${busctl_field} 85ef00306eSRahul Maheshwari ${cmd_output}= BMC Execute Command ${cmd} 86ef00306eSRahul Maheshwari # Example of cmd_output: 87ef00306eSRahul Maheshwari # [0]: s "ABCD.XY1.1234567-P0" 88ef00306eSRahul Maheshwari # [1]: 89ef00306eSRahul Maheshwari # [2]: 0 90ef00306eSRahul Maheshwari 91ef00306eSRahul Maheshwari Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] 92ef00306eSRahul Maheshwari END 93ef00306eSRahul Maheshwari Valid Value vpd_records['${component}']['type'] ['${VPD_DETAILS['${component}']['type']}'] 94ef00306eSRahul Maheshwari 95ef00306eSRahul Maheshwari 96ef00306eSRahul MaheshwariVerify VPD Component Read Operation 97*16b3c7bfSGeorge Keishing [Documentation] Verify reading VPD details of given component via vpdtool. 98ef00306eSRahul Maheshwari [Arguments] ${component} 99ef00306eSRahul Maheshwari # Description of arguments: 100ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 101ef00306eSRahul Maheshwari 102ef00306eSRahul Maheshwari ${vpd_records}= Vpdtool -o -O ${component} 103ef00306eSRahul Maheshwari 104ef00306eSRahul Maheshwari # Example output from 'Vpdtool -o -O /system/chassis/motherboard/vdd_vrm1': 105ef00306eSRahul Maheshwari # [/system/chassis/motherboard/vdd_vrm1]: 106ef00306eSRahul Maheshwari # [DR]: CPU POWER CARD 107ef00306eSRahul Maheshwari # [type]: xyz.openbmc_project.Inventory.Item.Vrm 108ef00306eSRahul Maheshwari # [CC]: E123 109ef00306eSRahul Maheshwari # [FN]: F123456 110ef00306eSRahul Maheshwari # [LocationCode]: ABCD.XY1.1234567-P0 111ef00306eSRahul Maheshwari # [SN]: YL2E32010000 112ef00306eSRahul Maheshwari # [PN]: PN12345 113ef00306eSRahul Maheshwari 114ef00306eSRahul Maheshwari Verify VPD Data ${vpd_records} ${component} 115ef00306eSRahul Maheshwari 116ef00306eSRahul Maheshwari 117ef00306eSRahul MaheshwariVerify VPD Field Read Operation 118*16b3c7bfSGeorge Keishing [Documentation] Verify reading all VPD fields for given component via vpdtool. 119ef00306eSRahul Maheshwari [Arguments] ${component} 120ef00306eSRahul Maheshwari # Description of arguments: 121ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 122ef00306eSRahul Maheshwari 123ef00306eSRahul Maheshwari # Verification of "CC" and "FN" will be added later. 124ef00306eSRahul Maheshwari @{vpd_fields}= Create List DR SN PN 125ef00306eSRahul Maheshwari 126ef00306eSRahul Maheshwari FOR ${fields} IN @{vpd_fields} 127ef00306eSRahul Maheshwari Verify VPD Field Value ${component} ${fields} 128ef00306eSRahul Maheshwari END 129ef00306eSRahul Maheshwari 130ef00306eSRahul Maheshwari 131ef00306eSRahul MaheshwariVerify VPD Field Write Operation 1320ef1e157SRahul Maheshwari [Documentation] Verify writing VPD fields for given component via vpdtool. 1330ef1e157SRahul Maheshwari [Arguments] ${component} ${field} 1340ef1e157SRahul Maheshwari [Teardown] Restore VPD Value ${component} ${field} ${old_field_value} 135ef00306eSRahul Maheshwari # Description of arguments: 1360ef1e157SRahul Maheshwari # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 1370ef1e157SRahul Maheshwari # field VPD component field (e.g. PN, SN) 138ef00306eSRahul Maheshwari 1390ef1e157SRahul Maheshwari ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 1400ef1e157SRahul Maheshwari ${old_field_value}= Set Variable ${vpd_records['${component}']['${field}']} 141ef00306eSRahul Maheshwari 142ef00306eSRahul Maheshwari ${write_value}= Set Variable If 143ef00306eSRahul Maheshwari ... '${field}' == 'DR' ${DR_WRITE_VALUE} 144ef00306eSRahul Maheshwari ... '${field}' == 'PN' ${PN_WRITE_VALUE} 145ef00306eSRahul Maheshwari ... '${field}' == 'SN' ${SN_WRITE_VALUE} 1460ef1e157SRahul Maheshwari 147ef00306eSRahul Maheshwari Vpdtool -w -O ${component} -R VINI -K ${field} --value ${write_value} 1480ef1e157SRahul Maheshwari 1490ef1e157SRahul Maheshwari Verify VPD Field Value ${component} ${field} 1500ef1e157SRahul Maheshwari 1510ef1e157SRahul Maheshwari 1520ef1e157SRahul MaheshwariRestore VPD Value 1530ef1e157SRahul Maheshwari [Documentation] Restore VPD's field value of given component. 1540ef1e157SRahul Maheshwari [Arguments] ${component} ${field} ${value} 1550ef1e157SRahul Maheshwari # Description of arguments: 1560ef1e157SRahul Maheshwari # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 1570ef1e157SRahul Maheshwari # field VPD component field (e.g. PN, SN) 1580ef1e157SRahul Maheshwari # value VPD value to be restore. 1590ef1e157SRahul Maheshwari 1600ef1e157SRahul Maheshwari Vpdtool -w -O ${component} -R VINI -K ${field} --value ${value} 161ef00306eSRahul Maheshwari 162ef00306eSRahul Maheshwari 163ef00306eSRahul MaheshwariVerify VPD Field Value 164ef00306eSRahul Maheshwari [Documentation] Verify VPD field value via vpdtool. 165ef00306eSRahul Maheshwari [Arguments] ${component} ${field} 166ef00306eSRahul Maheshwari # Description of arguments: 167ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 168ef00306eSRahul Maheshwari # field VPD field (e.g. DR, SN, PN) 169ef00306eSRahul Maheshwari 170ef00306eSRahul Maheshwari ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 171ef00306eSRahul Maheshwari 172ef00306eSRahul Maheshwari ${busctl_field}= Set Variable If 173ef00306eSRahul Maheshwari ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName 174ef00306eSRahul Maheshwari ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 175ef00306eSRahul Maheshwari ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 176ef00306eSRahul Maheshwari 177ef00306eSRahul Maheshwari ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} 178ef00306eSRahul Maheshwari ... ${busctl_field} 179ef00306eSRahul Maheshwari ${cmd_output}= BMC Execute Command ${cmd} 180ef00306eSRahul Maheshwari 181ef00306eSRahul Maheshwari Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] 182