18f254b53SSushma M M*** Settings ***
28f254b53SSushma M MDocumentation  Test IPMI FRU data.
38f254b53SSushma M M
4e4a7549cSGeorge KeishingResource               ../lib/ipmi_client.robot
58f254b53SSushma M MResource               ../lib/openbmc_ffdc.robot
68f254b53SSushma M MLibrary                ../lib/ipmi_utils.py
78f254b53SSushma M M
88f254b53SSushma M M
98f254b53SSushma M MSuite Setup            Suite Setup Execution
108f254b53SSushma M MSuite Teardown         Suite Teardown Execution
118f254b53SSushma M MTest Teardown          Test Teardown Execution
128f254b53SSushma M M
13*6fb70d98SMatt FischerTest Tags             IPMI_FRU
148f254b53SSushma M M
158f254b53SSushma M M*** Variables ***
1687dc442cSGeorge Keishing
177c51c156Ssrichn28&{ipmi_redfish_fru_field_map}  product_serial=SerialNumber  product_part_number=PartNumber
188f254b53SSushma M M
198f254b53SSushma M M*** Test Cases ***
208f254b53SSushma M M
218f254b53SSushma M MTest FRU Info Of Power Supplies
228f254b53SSushma M M    [Documentation]  Verify FRU info of power supply via IPMI and Redfish.
238f254b53SSushma M M    [Tags]  Test_FRU_Info_Of_Power_Supplies
248f254b53SSushma M M
258f254b53SSushma M M    # IPMI FRU info.
2679940a5dSTony Lee    ${ipmi_fru_component_info}=  Get Component FRU Info  ${COMPONENT_NAME_OF_POWER_SUPPLY}
278f254b53SSushma M M    ...  ${fru_objs}
288f254b53SSushma M M
298f254b53SSushma M M    # Redfish FRU info.
30a91601b1SGeorge Keishing    ${redfish_power_details}=  Redfish.Get Members List
31a91601b1SGeorge Keishing    ...  /redfish/v1/Chassis/${CHASSIS_ID}/PowerSubsystem/PowerSupplies
327c51c156Ssrichn28    ${redfish_power_dict}=  Create List
337c51c156Ssrichn28    FOR  ${power_supply}  IN  @{redfish_power_details}
347c51c156Ssrichn28        ${redfish_power_supply_reading}=  Redfish.Get Properties  ${power_supply}
357c51c156Ssrichn28        Append To List  ${redfish_power_dict}  ${redfish_power_supply_reading}
367c51c156Ssrichn28    END
377c51c156Ssrichn28    Verify IPMI and Redfish subcomponents  ${redfish_power_dict}
388f254b53SSushma M M    ...  ${ipmi_fru_component_info}
398f254b53SSushma M M
408f254b53SSushma M M*** Keywords ***
418f254b53SSushma M M
428f254b53SSushma M MVerify IPMI and Redfish subcomponents
438f254b53SSushma M M    [Documentation]  Get IPMI And Redfish subcomponents of FRU and verify.
448f254b53SSushma M M    [Arguments]  ${redfish_fru_info}  ${ipmi_fru_info}
458f254b53SSushma M M
468f254b53SSushma M M    # Description of argument(s):
478f254b53SSushma M M    # ${ipmi_fru_info}       IPMI FRU component values.
488f254b53SSushma M M    # ${redfish_fru_info}    Redfish FRU component values.
498f254b53SSushma M M
508f254b53SSushma M M    ${sub_component_count}=  Get Length  ${redfish_fru_info}
518f254b53SSushma M M
528f254b53SSushma M M    # Fetch each subcomponent value of IPMI and Redfish and compare.
538f254b53SSushma M M    FOR  ${sub_component_index}  IN RANGE  0  ${sub_component_count}
548f254b53SSushma M M      ${ipmi_fru_sub_component}=
558f254b53SSushma M M      ...  Get From List  ${ipmi_fru_info}  ${sub_component_index}
568f254b53SSushma M M      ${redfish_fru_sub_component}=
578f254b53SSushma M M      ...  Get From List  ${redfish_fru_info}  ${sub_component_index}
588f254b53SSushma M M      Compare IPMI And Redfish FRU Component  ${ipmi_fru_sub_component}
598f254b53SSushma M M      ...  ${redfish_fru_sub_component}
608f254b53SSushma M M    END
618f254b53SSushma M M
628f254b53SSushma M M
638f254b53SSushma M MCompare IPMI And Redfish FRU Component
648f254b53SSushma M M    [Documentation]  Compare IPMI And Redfish FRU Component data objects.
658f254b53SSushma M M    [Arguments]  ${ipmi_fru_component_obj}  ${redfish_fru_component_obj}
668f254b53SSushma M M
678f254b53SSushma M M    # Description of argument(s):
688f254b53SSushma M M    # ${ipmi_fru_component_obj}  IPMI FRU component data in dictionary.
698f254b53SSushma M M    # Example:
708f254b53SSushma M M    # FRU Device Description : powersupply0 (ID 75)
718f254b53SSushma M M    # Board Mfg Date        : Sun Dec 31 18:00:00 1995
728f254b53SSushma M M    # Board Product         : powersupply0
738f254b53SSushma M M    # Board Serial          : 71G303
748f254b53SSushma M M    # Board Part Number     : 01KL471
758f254b53SSushma M M    # ${redfish_fru_component_obj}  Redfish FRU component data in dictionary.
768f254b53SSushma M M    # Example:
778f254b53SSushma M M    # "Name": "powersupply0",
788f254b53SSushma M M    # "PartNumber": "01KL471",
798f254b53SSushma M M    # "PowerInputWatts": 114.0,
808f254b53SSushma M M    # "SerialNumber": "71G303",
818f254b53SSushma M M
828f254b53SSushma M M    # Get key_map from ipmi_redfish_fru_field_map.
838f254b53SSushma M M    ${key_map}=  Get Dictionary Items   ${ipmi_redfish_fru_field_map}
848f254b53SSushma M M
858f254b53SSushma M M    FOR    ${key}    ${value}    IN    @{key_map}
86bd0fcfc6SSushma M M      Exit For Loop IF    "${value}" == "${EMPTY}"
8766023b83SNandish-Matti      FOR  ${ipmi_fru_component}  IN  ${ipmi_fru_component_obj}
8866023b83SNandish-Matti        FOR  ${redfish_fru_component}  IN  ${redfish_fru_component_obj}
8966023b83SNandish-Matti          Run Keyword If  '${ipmi_fru_component['product_name']}' == '${redfish_fru_component['Name']}'
9066023b83SNandish-Matti          ...  Should Contain  ${redfish_fru_component_obj['${value}']}
918f254b53SSushma M M          ...  ${ipmi_fru_component_obj['${key}']}
928f254b53SSushma M M          ...  msg=Comparison failed.
938f254b53SSushma M M        END
9466023b83SNandish-Matti      END
9566023b83SNandish-Matti    END
968f254b53SSushma M M
978f254b53SSushma M M
988f254b53SSushma M MSuite Setup Execution
998f254b53SSushma M M    [Documentation]  Do test setup initialization.
1008f254b53SSushma M M
1017c51c156Ssrichn28    ${status}  ${fru_objs}=  Run Keyword And Ignore Error  Get Fru Info
1027c51c156Ssrichn28    Log To Console  FRU: ${fru_objs}
1038f254b53SSushma M M    Set Suite Variable  ${fru_objs}
1048f254b53SSushma M M    Redfish.Login
1058f254b53SSushma M M
1068f254b53SSushma M M
1078f254b53SSushma M MSuite Teardown Execution
1088f254b53SSushma M M    [Documentation]  Do the post suite teardown.
1098f254b53SSushma M M
1108f254b53SSushma M M    Redfish.Logout
1118f254b53SSushma M M
1128f254b53SSushma M M
1138f254b53SSushma M MTest Teardown Execution
1148f254b53SSushma M M    [Documentation]  Do the post test teardown.
1158f254b53SSushma M M
1168f254b53SSushma M M    FFDC On Test Case Fail
117