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 *** |
srichn28 | 7c51c15 | 2022-10-16 23:39:29 -0500 | [diff] [blame] | 15 | &{ipmi_redfish_fru_field_map} product_serial=SerialNumber product_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. |
George Keishing | a91601b | 2023-03-21 09:35:49 +0530 | [diff] [blame] | 28 | ${redfish_power_details}= Redfish.Get Members List |
| 29 | ... /redfish/v1/Chassis/${CHASSIS_ID}/PowerSubsystem/PowerSupplies |
srichn28 | 7c51c15 | 2022-10-16 23:39:29 -0500 | [diff] [blame] | 30 | ${redfish_power_dict}= Create List |
| 31 | FOR ${power_supply} IN @{redfish_power_details} |
| 32 | ${redfish_power_supply_reading}= Redfish.Get Properties ${power_supply} |
| 33 | Append To List ${redfish_power_dict} ${redfish_power_supply_reading} |
| 34 | END |
| 35 | Verify IPMI and Redfish subcomponents ${redfish_power_dict} |
Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 36 | ... ${ipmi_fru_component_info} |
| 37 | |
| 38 | *** Keywords *** |
| 39 | |
| 40 | Verify IPMI and Redfish subcomponents |
| 41 | [Documentation] Get IPMI And Redfish subcomponents of FRU and verify. |
| 42 | [Arguments] ${redfish_fru_info} ${ipmi_fru_info} |
| 43 | |
| 44 | # Description of argument(s): |
| 45 | # ${ipmi_fru_info} IPMI FRU component values. |
| 46 | # ${redfish_fru_info} Redfish FRU component values. |
| 47 | |
| 48 | ${sub_component_count}= Get Length ${redfish_fru_info} |
| 49 | |
| 50 | # Fetch each subcomponent value of IPMI and Redfish and compare. |
| 51 | FOR ${sub_component_index} IN RANGE 0 ${sub_component_count} |
| 52 | ${ipmi_fru_sub_component}= |
| 53 | ... Get From List ${ipmi_fru_info} ${sub_component_index} |
| 54 | ${redfish_fru_sub_component}= |
| 55 | ... Get From List ${redfish_fru_info} ${sub_component_index} |
| 56 | Compare IPMI And Redfish FRU Component ${ipmi_fru_sub_component} |
| 57 | ... ${redfish_fru_sub_component} |
| 58 | END |
| 59 | |
| 60 | |
| 61 | Compare IPMI And Redfish FRU Component |
| 62 | [Documentation] Compare IPMI And Redfish FRU Component data objects. |
| 63 | [Arguments] ${ipmi_fru_component_obj} ${redfish_fru_component_obj} |
| 64 | |
| 65 | # Description of argument(s): |
| 66 | # ${ipmi_fru_component_obj} IPMI FRU component data in dictionary. |
| 67 | # Example: |
| 68 | # FRU Device Description : powersupply0 (ID 75) |
| 69 | # Board Mfg Date : Sun Dec 31 18:00:00 1995 |
| 70 | # Board Product : powersupply0 |
| 71 | # Board Serial : 71G303 |
| 72 | # Board Part Number : 01KL471 |
| 73 | # ${redfish_fru_component_obj} Redfish FRU component data in dictionary. |
| 74 | # Example: |
| 75 | # "Name": "powersupply0", |
| 76 | # "PartNumber": "01KL471", |
| 77 | # "PowerInputWatts": 114.0, |
| 78 | # "SerialNumber": "71G303", |
| 79 | |
| 80 | # Get key_map from ipmi_redfish_fru_field_map. |
| 81 | ${key_map}= Get Dictionary Items ${ipmi_redfish_fru_field_map} |
| 82 | |
| 83 | FOR ${key} ${value} IN @{key_map} |
Sushma M M | bd0fcfc | 2020-06-09 02:16:48 -0500 | [diff] [blame] | 84 | Exit For Loop IF "${value}" == "${EMPTY}" |
Nandish-Matti | 66023b8 | 2023-04-07 01:09:04 -0500 | [diff] [blame] | 85 | FOR ${ipmi_fru_component} IN ${ipmi_fru_component_obj} |
| 86 | FOR ${redfish_fru_component} IN ${redfish_fru_component_obj} |
| 87 | Run Keyword If '${ipmi_fru_component['product_name']}' == '${redfish_fru_component['Name']}' |
| 88 | ... Should Contain ${redfish_fru_component_obj['${value}']} |
| 89 | ... ${ipmi_fru_component_obj['${key}']} |
| 90 | ... msg=Comparison failed. |
| 91 | END |
| 92 | END |
Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 93 | END |
| 94 | |
| 95 | |
| 96 | Suite Setup Execution |
| 97 | [Documentation] Do test setup initialization. |
| 98 | |
srichn28 | 7c51c15 | 2022-10-16 23:39:29 -0500 | [diff] [blame] | 99 | ${status} ${fru_objs}= Run Keyword And Ignore Error Get Fru Info |
| 100 | Log To Console FRU: ${fru_objs} |
Sushma M M | 8f254b5 | 2020-04-23 06:16:39 -0500 | [diff] [blame] | 101 | Set Suite Variable ${fru_objs} |
| 102 | Redfish.Login |
| 103 | |
| 104 | |
| 105 | Suite Teardown Execution |
| 106 | [Documentation] Do the post suite teardown. |
| 107 | |
| 108 | Redfish.Logout |
| 109 | |
| 110 | |
| 111 | Test Teardown Execution |
| 112 | [Documentation] Do the post test teardown. |
| 113 | |
srichn28 | 7c51c15 | 2022-10-16 23:39:29 -0500 | [diff] [blame] | 114 | FFDC On Test Case Fail |