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 10*6fb70d98SMatt FischerTest Tags VPD_Tool 11ef00306eSRahul Maheshwari 12ef00306eSRahul Maheshwari*** Variables *** 13ef00306eSRahul Maheshwari 14ef00306eSRahul Maheshwari${CMD_GET_PROPERTY_INVENTORY} busctl get-property xyz.openbmc_project.Inventory.Manager 15ef00306eSRahul Maheshwari${DR_WRITE_VALUE} XYZ Component 16ef00306eSRahul Maheshwari${PN_WRITE_VALUE} XYZ1234 17ef00306eSRahul Maheshwari${SN_WRITE_VALUE} ABCD12345678 1862a3b7dbSdnirmala@{fields} PN SN LocationCode 1962a3b7dbSdnirmala@{vpd_fields} PN SN 20ef00306eSRahul Maheshwari 21ef00306eSRahul Maheshwari*** Test Cases *** 22ef00306eSRahul Maheshwari 23348356a3SdnirmalaVerify System VPD Data Via Vpdtool 24348356a3Sdnirmala [Documentation] Verify the system VPD details via vpdtool output. 25348356a3Sdnirmala [Tags] Verify_System_VPD_Data_Via_Vpdtool 26348356a3Sdnirmala [Template] Verify VPD Data Via Vpdtool 27ef00306eSRahul Maheshwari 28348356a3Sdnirmala # Component Field 29348356a3Sdnirmala System Model 30348356a3Sdnirmala System SerialNumber 31348356a3Sdnirmala System LocationCode 32ef00306eSRahul Maheshwari 33ef00306eSRahul Maheshwari 34ef00306eSRahul MaheshwariVerify VPD Component Read 3562a3b7dbSdnirmala [Documentation] Verify details of all VPD component via vpdtool. 36ef00306eSRahul Maheshwari [Tags] Verify_VPD_Component_Read 37ef00306eSRahul Maheshwari 3862a3b7dbSdnirmala ${vpd_records}= Vpdtool -i 3962a3b7dbSdnirmala ${components}= Get Dictionary Keys ${vpd_records} 40ef00306eSRahul Maheshwari FOR ${component} IN @{components} 41ef00306eSRahul Maheshwari Verify VPD Component Read Operation ${component} 42ef00306eSRahul Maheshwari END 43ef00306eSRahul Maheshwari 44ef00306eSRahul Maheshwari 45ef00306eSRahul MaheshwariVerify VPD Field Read 46ef00306eSRahul Maheshwari [Documentation] Verify reading VPD field value via vpdtool. 47ef00306eSRahul Maheshwari [Tags] Verify_VPD_Field_Read 48ef00306eSRahul Maheshwari 4962a3b7dbSdnirmala ${vpd_records}= Vpdtool -i 5062a3b7dbSdnirmala ${components}= Get Dictionary Keys ${vpd_records} 51ef00306eSRahul Maheshwari FOR ${component} IN @{components} 52e01ee587SGeorge Keishing # Drive component field values response in ascii format 53e01ee587SGeorge Keishing # due to that skipping here. 5462a3b7dbSdnirmala IF 'drive' in '${component}' 5562a3b7dbSdnirmala Continue FOR Loop 5662a3b7dbSdnirmala ELSE 57ef00306eSRahul Maheshwari Verify VPD Field Read Operation ${component} 58ef00306eSRahul Maheshwari END 5962a3b7dbSdnirmala END 60ef00306eSRahul Maheshwari 61ef00306eSRahul Maheshwari 62ef00306eSRahul MaheshwariVerify VPD Field Write 63e20f82cdSGeorge Keishing [Documentation] Verify writing VPD field value via vpdtool. 64ef00306eSRahul Maheshwari [Tags] Verify_VPD_Field_Write 65ef00306eSRahul Maheshwari 66ef00306eSRahul Maheshwari ${components}= Get Dictionary Keys ${VPD_DETAILS} 67ef00306eSRahul Maheshwari FOR ${component} IN @{components} 680ef1e157SRahul Maheshwari # VPD fields "DR", "CC" and "FN" will be added later. 690ef1e157SRahul Maheshwari @{vpd_fields}= Create List SN PN 700ef1e157SRahul Maheshwari ${field}= Evaluate random.choice($vpd_fields) random 710ef1e157SRahul Maheshwari Verify VPD Field Write Operation ${component} ${field} 72ef00306eSRahul Maheshwari END 73ef00306eSRahul Maheshwari 74ef00306eSRahul Maheshwari 75ef00306eSRahul Maheshwari*** Keywords *** 76ef00306eSRahul Maheshwari 77ef00306eSRahul MaheshwariVerify VPD Component Read Operation 7816b3c7bfSGeorge Keishing [Documentation] Verify reading VPD details of given component via vpdtool. 79ef00306eSRahul Maheshwari [Arguments] ${component} 80ef00306eSRahul Maheshwari # Description of arguments: 81ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 82ef00306eSRahul Maheshwari 83ef00306eSRahul Maheshwari ${vpd_records}= Vpdtool -o -O ${component} 84ef00306eSRahul Maheshwari 85ef00306eSRahul Maheshwari # Example output from 'Vpdtool -o -O /system/chassis/motherboard/vdd_vrm1': 86ef00306eSRahul Maheshwari # [/system/chassis/motherboard/vdd_vrm1]: 87ef00306eSRahul Maheshwari # [DR]: CPU POWER CARD 88ef00306eSRahul Maheshwari # [type]: xyz.openbmc_project.Inventory.Item.Vrm 89ef00306eSRahul Maheshwari # [CC]: E123 90ef00306eSRahul Maheshwari # [FN]: F123456 91ef00306eSRahul Maheshwari # [LocationCode]: ABCD.XY1.1234567-P0 92ef00306eSRahul Maheshwari # [SN]: YL2E32010000 93ef00306eSRahul Maheshwari # [PN]: PN12345 94ef00306eSRahul Maheshwari 9562a3b7dbSdnirmala ${vpdtool_res}= Set To Dictionary ${vpd_records}[${component}] 9662a3b7dbSdnirmala FOR ${vpd_field} IN @{fields} 9762a3b7dbSdnirmala ${match_key_exists}= Run Keyword And Return Status 9862a3b7dbSdnirmala ... Dictionary Should Contain Key ${vpdtool_res} ${vpd_field} 9962a3b7dbSdnirmala IF '${match_key_exists}' == 'True' 10062a3b7dbSdnirmala # drive components busctl field response in ascii due to that checking only locationcode. 10162a3b7dbSdnirmala IF 'drive' in '${component}' 10262a3b7dbSdnirmala ${vpd_field}= Set Variable LocationCode 10362a3b7dbSdnirmala END 10462a3b7dbSdnirmala # Skip check if VPD field is empty. 10562a3b7dbSdnirmala Run Keyword If '${vpd_records['${component}']['${vpd_field}']}' == '' 10662a3b7dbSdnirmala ... Continue For Loop 10762a3b7dbSdnirmala 10862a3b7dbSdnirmala # Get VPD field values via busctl. 10962a3b7dbSdnirmala ${busctl_field}= Set Variable If 11062a3b7dbSdnirmala ... '${vpd_field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode 11162a3b7dbSdnirmala ... '${vpd_field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 11262a3b7dbSdnirmala ... '${vpd_field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 11362a3b7dbSdnirmala ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} 11462a3b7dbSdnirmala ... /xyz/openbmc_project/inventory${component} ${busctl_field} 11562a3b7dbSdnirmala ${cmd_output}= BMC Execute Command ${cmd} 11662a3b7dbSdnirmala # Check whether the vpdtool response and busctl response matching. 11762a3b7dbSdnirmala Valid Value vpd_records['${component}']['${vpd_field}'] 11862a3b7dbSdnirmala ... ['${cmd_output[0].split('"')[1].strip('"')}'] 11962a3b7dbSdnirmala ELSE 12062a3b7dbSdnirmala Continue For Loop 12162a3b7dbSdnirmala END 12262a3b7dbSdnirmala END 123ef00306eSRahul Maheshwari 124ef00306eSRahul Maheshwari 125ef00306eSRahul MaheshwariVerify VPD Field Read Operation 12616b3c7bfSGeorge Keishing [Documentation] Verify reading all VPD fields for given component via vpdtool. 127ef00306eSRahul Maheshwari [Arguments] ${component} 128ef00306eSRahul Maheshwari # Description of arguments: 129ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 130ef00306eSRahul Maheshwari 13162a3b7dbSdnirmala ${vpd_records}= Vpdtool -o -O ${component} 13262a3b7dbSdnirmala ${vpdtool_res}= Set To Dictionary ${vpd_records}[${component}] 13362a3b7dbSdnirmala FOR ${field} IN @{vpd_fields} 13462a3b7dbSdnirmala ${match_key_exists}= Run Keyword And Return Status 13562a3b7dbSdnirmala ... Dictionary Should Contain Key ${vpdtool_res} ${field} 13662a3b7dbSdnirmala IF '${match_key_exists}' == 'True' 13762a3b7dbSdnirmala ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 13862a3b7dbSdnirmala # Skip check if field value is empty. 13962a3b7dbSdnirmala Run Keyword If '${vpd_records['${component}']['${field}']}' == '' 14062a3b7dbSdnirmala ... Continue For Loop 141ef00306eSRahul Maheshwari 14262a3b7dbSdnirmala ${busctl_field}= Set Variable If 14362a3b7dbSdnirmala ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 14462a3b7dbSdnirmala ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 14562a3b7dbSdnirmala ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} 14662a3b7dbSdnirmala ... /xyz/openbmc_project/inventory${component} ${busctl_field} 14762a3b7dbSdnirmala ${cmd_output}= BMC Execute Command ${cmd} 14862a3b7dbSdnirmala 14962a3b7dbSdnirmala # Check vpdtool response and busctl response for the component field. 15062a3b7dbSdnirmala Valid Value vpd_records['${component}']['${field}'] 15162a3b7dbSdnirmala ... ['${cmd_output[0].split('"')[1].strip('"')}'] 15262a3b7dbSdnirmala ELSE 15362a3b7dbSdnirmala Continue For Loop 15462a3b7dbSdnirmala END 155ef00306eSRahul Maheshwari END 156ef00306eSRahul Maheshwari 157ef00306eSRahul Maheshwari 158ef00306eSRahul MaheshwariVerify VPD Field Write Operation 1590ef1e157SRahul Maheshwari [Documentation] Verify writing VPD fields for given component via vpdtool. 1600ef1e157SRahul Maheshwari [Arguments] ${component} ${field} 1610ef1e157SRahul Maheshwari [Teardown] Restore VPD Value ${component} ${field} ${old_field_value} 162ef00306eSRahul Maheshwari # Description of arguments: 1630ef1e157SRahul Maheshwari # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 1640ef1e157SRahul Maheshwari # field VPD component field (e.g. PN, SN) 165ef00306eSRahul Maheshwari 1660ef1e157SRahul Maheshwari ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 1670ef1e157SRahul Maheshwari ${old_field_value}= Set Variable ${vpd_records['${component}']['${field}']} 168ef00306eSRahul Maheshwari 169ef00306eSRahul Maheshwari ${write_value}= Set Variable If 170ef00306eSRahul Maheshwari ... '${field}' == 'DR' ${DR_WRITE_VALUE} 171ef00306eSRahul Maheshwari ... '${field}' == 'PN' ${PN_WRITE_VALUE} 172ef00306eSRahul Maheshwari ... '${field}' == 'SN' ${SN_WRITE_VALUE} 1730ef1e157SRahul Maheshwari 174ef00306eSRahul Maheshwari Vpdtool -w -O ${component} -R VINI -K ${field} --value ${write_value} 1750ef1e157SRahul Maheshwari 1760ef1e157SRahul Maheshwari Verify VPD Field Value ${component} ${field} 1770ef1e157SRahul Maheshwari 1780ef1e157SRahul Maheshwari 1790ef1e157SRahul MaheshwariRestore VPD Value 1800ef1e157SRahul Maheshwari [Documentation] Restore VPD's field value of given component. 1810ef1e157SRahul Maheshwari [Arguments] ${component} ${field} ${value} 1820ef1e157SRahul Maheshwari # Description of arguments: 1830ef1e157SRahul Maheshwari # component VPD component (e.g. /system/chassis/motherboard/vdd_vrm1). 1840ef1e157SRahul Maheshwari # field VPD component field (e.g. PN, SN) 1850ef1e157SRahul Maheshwari # value VPD value to be restore. 1860ef1e157SRahul Maheshwari 1870ef1e157SRahul Maheshwari Vpdtool -w -O ${component} -R VINI -K ${field} --value ${value} 188ef00306eSRahul Maheshwari 189ef00306eSRahul Maheshwari 190ef00306eSRahul MaheshwariVerify VPD Field Value 191ef00306eSRahul Maheshwari [Documentation] Verify VPD field value via vpdtool. 192ef00306eSRahul Maheshwari [Arguments] ${component} ${field} 193ef00306eSRahul Maheshwari # Description of arguments: 194ef00306eSRahul Maheshwari # component VDP component (e.g. /system/chassis/motherboard/vdd_vrm1). 195ef00306eSRahul Maheshwari # field VPD field (e.g. DR, SN, PN) 196ef00306eSRahul Maheshwari 197ef00306eSRahul Maheshwari ${vpd_records}= Vpdtool -r -O ${component} -R VINI -K ${field} 198ef00306eSRahul Maheshwari 199ef00306eSRahul Maheshwari ${busctl_field}= Set Variable If 200ef00306eSRahul Maheshwari ... '${field}' == 'DR' xyz.openbmc_project.Inventory.Item PrettyName 201ef00306eSRahul Maheshwari ... '${field}' == 'PN' xyz.openbmc_project.Inventory.Decorator.Asset PartNumber 202ef00306eSRahul Maheshwari ... '${field}' == 'SN' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 203ef00306eSRahul Maheshwari 204ef00306eSRahul Maheshwari ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory${component} 205ef00306eSRahul Maheshwari ... ${busctl_field} 206ef00306eSRahul Maheshwari ${cmd_output}= BMC Execute Command ${cmd} 207ef00306eSRahul Maheshwari 208ef00306eSRahul Maheshwari Valid Value vpd_records['${component}']['${field}'] ['${cmd_output[0].split('"')[1].strip('"')}'] 209348356a3Sdnirmala 210348356a3Sdnirmala 211348356a3SdnirmalaVerify VPD Data Via Vpdtool 212348356a3Sdnirmala [Documentation] Get VPD details of given component via vpdtool and verify it 213348356a3Sdnirmala ... using busctl command. 214348356a3Sdnirmala [Arguments] ${component} ${field} 215348356a3Sdnirmala # Description of arguments: 216348356a3Sdnirmala # component VPD component (e.g. System,Chassis etc). 217348356a3Sdnirmala # field VPD field (e.g. Serialnumber,LocationCode etc). 218348356a3Sdnirmala 219348356a3Sdnirmala ${component_url}= Run Keyword If 220348356a3Sdnirmala ... '${component}' == 'System' Set Variable /system 221348356a3Sdnirmala 222348356a3Sdnirmala # Get VPD details of given component via vpd-tool. 223348356a3Sdnirmala ${vpd_records}= Vpdtool -o -O ${component_url} 224348356a3Sdnirmala 225348356a3Sdnirmala # Get VPD details of given component via busctl command. 226348356a3Sdnirmala ${busctl_field}= Set Variable If 227348356a3Sdnirmala ... '${field}' == 'LocationCode' com.ibm.ipzvpd.Location LocationCode 228348356a3Sdnirmala ... '${field}' == 'Model' xyz.openbmc_project.Inventory.Decorator.Asset Model 229348356a3Sdnirmala ... '${field}' == 'SerialNumber' xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber 230348356a3Sdnirmala 231348356a3Sdnirmala ${cmd}= Catenate ${CMD_GET_PROPERTY_INVENTORY} /xyz/openbmc_project/inventory/system 232348356a3Sdnirmala ... ${busctl_field} 233348356a3Sdnirmala ${cmd_output}= BMC Execute Command ${cmd} 234348356a3Sdnirmala # Example of cmd_output: 235348356a3Sdnirmala # [0]: s "ABCD.XY1.1234567-P0" 236348356a3Sdnirmala # [1]: 237348356a3Sdnirmala # [2]: 0 238348356a3Sdnirmala 239348356a3Sdnirmala # Cross check vpdtool output with busctl response. 240348356a3Sdnirmala Should Be Equal As Strings ${vpd_records["/system"]["${field}"]} 241348356a3Sdnirmala ... ${cmd_output[0].split('"')[1].strip('"')} 242