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 ***
157c51c156Ssrichn28&{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.
28a91601b1SGeorge Keishing    ${redfish_power_details}=  Redfish.Get Members List
29a91601b1SGeorge Keishing    ...  /redfish/v1/Chassis/${CHASSIS_ID}/PowerSubsystem/PowerSupplies
307c51c156Ssrichn28    ${redfish_power_dict}=  Create List
317c51c156Ssrichn28    FOR  ${power_supply}  IN  @{redfish_power_details}
327c51c156Ssrichn28        ${redfish_power_supply_reading}=  Redfish.Get Properties  ${power_supply}
337c51c156Ssrichn28        Append To List  ${redfish_power_dict}  ${redfish_power_supply_reading}
347c51c156Ssrichn28    END
357c51c156Ssrichn28    Verify IPMI and Redfish subcomponents  ${redfish_power_dict}
368f254b53SSushma M M    ...  ${ipmi_fru_component_info}
378f254b53SSushma M M
388f254b53SSushma M M*** Keywords ***
398f254b53SSushma M M
408f254b53SSushma M MVerify IPMI and Redfish subcomponents
418f254b53SSushma M M    [Documentation]  Get IPMI And Redfish subcomponents of FRU and verify.
428f254b53SSushma M M    [Arguments]  ${redfish_fru_info}  ${ipmi_fru_info}
438f254b53SSushma M M
448f254b53SSushma M M    # Description of argument(s):
458f254b53SSushma M M    # ${ipmi_fru_info}       IPMI FRU component values.
468f254b53SSushma M M    # ${redfish_fru_info}    Redfish FRU component values.
478f254b53SSushma M M
488f254b53SSushma M M    ${sub_component_count}=  Get Length  ${redfish_fru_info}
498f254b53SSushma M M
508f254b53SSushma M M    # Fetch each subcomponent value of IPMI and Redfish and compare.
518f254b53SSushma M M    FOR  ${sub_component_index}  IN RANGE  0  ${sub_component_count}
528f254b53SSushma M M      ${ipmi_fru_sub_component}=
538f254b53SSushma M M      ...  Get From List  ${ipmi_fru_info}  ${sub_component_index}
548f254b53SSushma M M      ${redfish_fru_sub_component}=
558f254b53SSushma M M      ...  Get From List  ${redfish_fru_info}  ${sub_component_index}
568f254b53SSushma M M      Compare IPMI And Redfish FRU Component  ${ipmi_fru_sub_component}
578f254b53SSushma M M      ...  ${redfish_fru_sub_component}
588f254b53SSushma M M    END
598f254b53SSushma M M
608f254b53SSushma M M
618f254b53SSushma M MCompare IPMI And Redfish FRU Component
628f254b53SSushma M M    [Documentation]  Compare IPMI And Redfish FRU Component data objects.
638f254b53SSushma M M    [Arguments]  ${ipmi_fru_component_obj}  ${redfish_fru_component_obj}
648f254b53SSushma M M
658f254b53SSushma M M    # Description of argument(s):
668f254b53SSushma M M    # ${ipmi_fru_component_obj}  IPMI FRU component data in dictionary.
678f254b53SSushma M M    # Example:
688f254b53SSushma M M    # FRU Device Description : powersupply0 (ID 75)
698f254b53SSushma M M    # Board Mfg Date        : Sun Dec 31 18:00:00 1995
708f254b53SSushma M M    # Board Product         : powersupply0
718f254b53SSushma M M    # Board Serial          : 71G303
728f254b53SSushma M M    # Board Part Number     : 01KL471
738f254b53SSushma M M    # ${redfish_fru_component_obj}  Redfish FRU component data in dictionary.
748f254b53SSushma M M    # Example:
758f254b53SSushma M M    # "Name": "powersupply0",
768f254b53SSushma M M    # "PartNumber": "01KL471",
778f254b53SSushma M M    # "PowerInputWatts": 114.0,
788f254b53SSushma M M    # "SerialNumber": "71G303",
798f254b53SSushma M M
808f254b53SSushma M M    # Get key_map from ipmi_redfish_fru_field_map.
818f254b53SSushma M M    ${key_map}=  Get Dictionary Items   ${ipmi_redfish_fru_field_map}
828f254b53SSushma M M
838f254b53SSushma M M    FOR    ${key}    ${value}    IN    @{key_map}
84bd0fcfc6SSushma M M      Exit For Loop IF    "${value}" == "${EMPTY}"
85*66023b83SNandish-Matti      FOR  ${ipmi_fru_component}  IN  ${ipmi_fru_component_obj}
86*66023b83SNandish-Matti        FOR  ${redfish_fru_component}  IN  ${redfish_fru_component_obj}
87*66023b83SNandish-Matti          Run Keyword If  '${ipmi_fru_component['product_name']}' == '${redfish_fru_component['Name']}'
88*66023b83SNandish-Matti          ...  Should Contain  ${redfish_fru_component_obj['${value}']}
898f254b53SSushma M M          ...  ${ipmi_fru_component_obj['${key}']}
908f254b53SSushma M M          ...  msg=Comparison failed.
918f254b53SSushma M M        END
92*66023b83SNandish-Matti      END
93*66023b83SNandish-Matti    END
948f254b53SSushma M M
958f254b53SSushma M M
968f254b53SSushma M MSuite Setup Execution
978f254b53SSushma M M    [Documentation]  Do test setup initialization.
988f254b53SSushma M M
997c51c156Ssrichn28    ${status}  ${fru_objs}=  Run Keyword And Ignore Error  Get Fru Info
1007c51c156Ssrichn28    Log To Console  FRU: ${fru_objs}
1018f254b53SSushma M M    Set Suite Variable  ${fru_objs}
1028f254b53SSushma M M    Redfish.Login
1038f254b53SSushma M M
1048f254b53SSushma M M
1058f254b53SSushma M MSuite Teardown Execution
1068f254b53SSushma M M    [Documentation]  Do the post suite teardown.
1078f254b53SSushma M M
1088f254b53SSushma M M    Redfish.Logout
1098f254b53SSushma M M
1108f254b53SSushma M M
1118f254b53SSushma M MTest Teardown Execution
1128f254b53SSushma M M    [Documentation]  Do the post test teardown.
1138f254b53SSushma M M
1148f254b53SSushma M M    FFDC On Test Case Fail
115