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
138f254b53SSushma M M
148f254b53SSushma M M*** Variables ***
15*7c51c156Ssrichn28&{ipmi_redfish_fru_field_map}  product_serial=SerialNumber  product_part_number=PartNumber
168f254b53SSushma M M
178f254b53SSushma M M*** Test Cases ***
188f254b53SSushma M M
198f254b53SSushma M MTest FRU Info Of Power Supplies
208f254b53SSushma M M    [Documentation]  Verify FRU info of power supply via IPMI and Redfish.
218f254b53SSushma M M    [Tags]  Test_FRU_Info_Of_Power_Supplies
228f254b53SSushma M M
238f254b53SSushma M M    # IPMI FRU info.
2479940a5dSTony Lee    ${ipmi_fru_component_info}=  Get Component FRU Info  ${COMPONENT_NAME_OF_POWER_SUPPLY}
258f254b53SSushma M M    ...  ${fru_objs}
268f254b53SSushma M M
278f254b53SSushma M M    # Redfish FRU info.
28*7c51c156Ssrichn28    ${redfish_power_details}=  Redfish.Get Members List  /redfish/v1/Chassis/${CHASSIS_ID}/PowerSubsystem/PowerSupplies
29*7c51c156Ssrichn28    ${redfish_power_dict}=  Create List
30*7c51c156Ssrichn28    FOR  ${power_supply}  IN  @{redfish_power_details}
31*7c51c156Ssrichn28        ${redfish_power_supply_reading}=  Redfish.Get Properties  ${power_supply}
32*7c51c156Ssrichn28        Append To List  ${redfish_power_dict}  ${redfish_power_supply_reading}
33*7c51c156Ssrichn28    END
34*7c51c156Ssrichn28    Verify IPMI and Redfish subcomponents  ${redfish_power_dict}
358f254b53SSushma M M    ...  ${ipmi_fru_component_info}
368f254b53SSushma M M
378f254b53SSushma M M*** Keywords ***
388f254b53SSushma M M
398f254b53SSushma M MVerify IPMI and Redfish subcomponents
408f254b53SSushma M M    [Documentation]  Get IPMI And Redfish subcomponents of FRU and verify.
418f254b53SSushma M M    [Arguments]  ${redfish_fru_info}  ${ipmi_fru_info}
428f254b53SSushma M M
438f254b53SSushma M M    # Description of argument(s):
448f254b53SSushma M M    # ${ipmi_fru_info}       IPMI FRU component values.
458f254b53SSushma M M    # ${redfish_fru_info}    Redfish FRU component values.
468f254b53SSushma M M
478f254b53SSushma M M    ${sub_component_count}=  Get Length  ${redfish_fru_info}
488f254b53SSushma M M
498f254b53SSushma M M    # Fetch each subcomponent value of IPMI and Redfish and compare.
508f254b53SSushma M M    FOR  ${sub_component_index}  IN RANGE  0  ${sub_component_count}
518f254b53SSushma M M      ${ipmi_fru_sub_component}=
528f254b53SSushma M M      ...  Get From List  ${ipmi_fru_info}  ${sub_component_index}
538f254b53SSushma M M      ${redfish_fru_sub_component}=
548f254b53SSushma M M      ...  Get From List  ${redfish_fru_info}  ${sub_component_index}
558f254b53SSushma M M      Compare IPMI And Redfish FRU Component  ${ipmi_fru_sub_component}
568f254b53SSushma M M      ...  ${redfish_fru_sub_component}
578f254b53SSushma M M    END
588f254b53SSushma M M
598f254b53SSushma M M
608f254b53SSushma M MCompare IPMI And Redfish FRU Component
618f254b53SSushma M M    [Documentation]  Compare IPMI And Redfish FRU Component data objects.
628f254b53SSushma M M    [Arguments]  ${ipmi_fru_component_obj}  ${redfish_fru_component_obj}
638f254b53SSushma M M
648f254b53SSushma M M    # Description of argument(s):
658f254b53SSushma M M    # ${ipmi_fru_component_obj}  IPMI FRU component data in dictionary.
668f254b53SSushma M M    # Example:
678f254b53SSushma M M    # FRU Device Description : powersupply0 (ID 75)
688f254b53SSushma M M    # Board Mfg Date        : Sun Dec 31 18:00:00 1995
698f254b53SSushma M M    # Board Product         : powersupply0
708f254b53SSushma M M    # Board Serial          : 71G303
718f254b53SSushma M M    # Board Part Number     : 01KL471
728f254b53SSushma M M    # ${redfish_fru_component_obj}  Redfish FRU component data in dictionary.
738f254b53SSushma M M    # Example:
748f254b53SSushma M M    # "Name": "powersupply0",
758f254b53SSushma M M    # "PartNumber": "01KL471",
768f254b53SSushma M M    # "PowerInputWatts": 114.0,
778f254b53SSushma M M    # "SerialNumber": "71G303",
788f254b53SSushma M M
798f254b53SSushma M M    # Get key_map from ipmi_redfish_fru_field_map.
808f254b53SSushma M M    ${key_map}=  Get Dictionary Items   ${ipmi_redfish_fru_field_map}
818f254b53SSushma M M
828f254b53SSushma M M    FOR    ${key}    ${value}    IN    @{key_map}
83bd0fcfc6SSushma M M      Exit For Loop IF    "${value}" == "${EMPTY}"
848f254b53SSushma M M      Should Contain  ${redfish_fru_component_obj['${value}']}
858f254b53SSushma M M      ...  ${ipmi_fru_component_obj['${key}']}
868f254b53SSushma M M      ...  msg=Comparison failed.
878f254b53SSushma M M    END
888f254b53SSushma M M
898f254b53SSushma M M
908f254b53SSushma M MSuite Setup Execution
918f254b53SSushma M M    [Documentation]  Do test setup initialization.
928f254b53SSushma M M
93*7c51c156Ssrichn28    ${status}  ${fru_objs}=  Run Keyword And Ignore Error  Get Fru Info
94*7c51c156Ssrichn28    Log To Console  FRU: ${fru_objs}
958f254b53SSushma M M    Set Suite Variable  ${fru_objs}
968f254b53SSushma M M    Redfish.Login
978f254b53SSushma M M
988f254b53SSushma M M
998f254b53SSushma M MSuite Teardown Execution
1008f254b53SSushma M M    [Documentation]  Do the post suite teardown.
1018f254b53SSushma M M
1028f254b53SSushma M M    Redfish.Logout
1038f254b53SSushma M M
1048f254b53SSushma M M
1058f254b53SSushma M MTest Teardown Execution
1068f254b53SSushma M M    [Documentation]  Do the post test teardown.
1078f254b53SSushma M M
1088f254b53SSushma M M    FFDC On Test Case Fail
109