| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation  Test IPMI FRU data. | 
|  | 3 |  | 
| George Keishing | e4a7549 | 2020-05-13 13:56:09 -0500 | [diff] [blame] | 4 | Resource               ../lib/ipmi_client.robot | 
| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 5 | Resource               ../lib/openbmc_ffdc.robot | 
|  | 6 | Library                ../lib/ipmi_utils.py | 
|  | 7 |  | 
|  | 8 |  | 
|  | 9 | Suite Setup            Suite Setup Execution | 
|  | 10 | Suite Teardown         Suite Teardown Execution | 
|  | 11 | Test Teardown          Test Teardown Execution | 
|  | 12 |  | 
|  | 13 |  | 
|  | 14 | *** Variables *** | 
|  | 15 | &{ipmi_redfish_fru_field_map}  board_serial=SerialNumber  board_part_number=PartNumber | 
| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 16 |  | 
|  | 17 | *** Test Cases *** | 
|  | 18 |  | 
|  | 19 | Test FRU Info Of Power Supplies | 
|  | 20 | [Documentation]  Verify FRU info of power supply via IPMI and Redfish. | 
|  | 21 | [Tags]  Test_FRU_Info_Of_Power_Supplies | 
|  | 22 |  | 
|  | 23 | # IPMI FRU info. | 
| Tony Lee | 79940a5 | 2021-10-12 17:04:13 +0800 | [diff] [blame] | 24 | ${ipmi_fru_component_info}=  Get Component FRU Info  ${COMPONENT_NAME_OF_POWER_SUPPLY} | 
| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 25 | ...  ${fru_objs} | 
|  | 26 |  | 
|  | 27 | # Redfish FRU info. | 
| Tony Lee | 79940a5 | 2021-10-12 17:04:13 +0800 | [diff] [blame] | 28 | ${redfish_power_details}=  Redfish.Get Properties  /redfish/v1/Chassis/${CHASSIS_ID}/Power | 
| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 29 | ${redfish_power_supply_reading}=  Set Variable  ${redfish_power_details['PowerSupplies']} | 
|  | 30 |  | 
|  | 31 | Verify IPMI and Redfish subcomponents  ${redfish_power_supply_reading} | 
|  | 32 | ...  ${ipmi_fru_component_info} | 
|  | 33 |  | 
|  | 34 | *** Keywords *** | 
|  | 35 |  | 
|  | 36 | Verify IPMI and Redfish subcomponents | 
|  | 37 | [Documentation]  Get IPMI And Redfish subcomponents of FRU and verify. | 
|  | 38 | [Arguments]  ${redfish_fru_info}  ${ipmi_fru_info} | 
|  | 39 |  | 
|  | 40 | # Description of argument(s): | 
|  | 41 | # ${ipmi_fru_info}       IPMI FRU component values. | 
|  | 42 | # ${redfish_fru_info}    Redfish FRU component values. | 
|  | 43 |  | 
|  | 44 | ${sub_component_count}=  Get Length  ${redfish_fru_info} | 
|  | 45 |  | 
|  | 46 | # Fetch each subcomponent value of IPMI and Redfish and compare. | 
|  | 47 | FOR  ${sub_component_index}  IN RANGE  0  ${sub_component_count} | 
|  | 48 | ${ipmi_fru_sub_component}= | 
|  | 49 | ...  Get From List  ${ipmi_fru_info}  ${sub_component_index} | 
|  | 50 | ${redfish_fru_sub_component}= | 
|  | 51 | ...  Get From List  ${redfish_fru_info}  ${sub_component_index} | 
|  | 52 | Compare IPMI And Redfish FRU Component  ${ipmi_fru_sub_component} | 
|  | 53 | ...  ${redfish_fru_sub_component} | 
|  | 54 | END | 
|  | 55 |  | 
|  | 56 |  | 
|  | 57 | Compare IPMI And Redfish FRU Component | 
|  | 58 | [Documentation]  Compare IPMI And Redfish FRU Component data objects. | 
|  | 59 | [Arguments]  ${ipmi_fru_component_obj}  ${redfish_fru_component_obj} | 
|  | 60 |  | 
|  | 61 | # Description of argument(s): | 
|  | 62 | # ${ipmi_fru_component_obj}  IPMI FRU component data in dictionary. | 
|  | 63 | # Example: | 
|  | 64 | # FRU Device Description : powersupply0 (ID 75) | 
|  | 65 | # Board Mfg Date        : Sun Dec 31 18:00:00 1995 | 
|  | 66 | # Board Product         : powersupply0 | 
|  | 67 | # Board Serial          : 71G303 | 
|  | 68 | # Board Part Number     : 01KL471 | 
|  | 69 | # ${redfish_fru_component_obj}  Redfish FRU component data in dictionary. | 
|  | 70 | # Example: | 
|  | 71 | # "Name": "powersupply0", | 
|  | 72 | # "PartNumber": "01KL471", | 
|  | 73 | # "PowerInputWatts": 114.0, | 
|  | 74 | # "SerialNumber": "71G303", | 
|  | 75 |  | 
|  | 76 | # Get key_map from ipmi_redfish_fru_field_map. | 
|  | 77 | ${key_map}=  Get Dictionary Items   ${ipmi_redfish_fru_field_map} | 
|  | 78 |  | 
|  | 79 | FOR    ${key}    ${value}    IN    @{key_map} | 
| Sushma M M | bd0fcfc | 2020-06-09 02:16:48 -0500 | [diff] [blame] | 80 | Exit For Loop IF    "${value}" == "${EMPTY}" | 
| Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 81 | Should Contain  ${redfish_fru_component_obj['${value}']} | 
|  | 82 | ...  ${ipmi_fru_component_obj['${key}']} | 
|  | 83 | ...  msg=Comparison failed. | 
|  | 84 | END | 
|  | 85 |  | 
|  | 86 |  | 
|  | 87 | Suite Setup Execution | 
|  | 88 | [Documentation]  Do test setup initialization. | 
|  | 89 |  | 
|  | 90 | ${fru_objs}=  Get Fru Info | 
|  | 91 | Set Suite Variable  ${fru_objs} | 
|  | 92 | Redfish.Login | 
|  | 93 |  | 
|  | 94 |  | 
|  | 95 | Suite Teardown Execution | 
|  | 96 | [Documentation]  Do the post suite teardown. | 
|  | 97 |  | 
|  | 98 | Redfish.Logout | 
|  | 99 |  | 
|  | 100 |  | 
|  | 101 | Test Teardown Execution | 
|  | 102 | [Documentation]  Do the post test teardown. | 
|  | 103 |  | 
| Sushma M M | bd0fcfc | 2020-06-09 02:16:48 -0500 | [diff] [blame] | 104 | FFDC On Test Case Fail |