blob: 6c507500b07f37aa311a20d25e5a063db33620d6 [file] [log] [blame]
Sushma M M8f254b52020-04-23 06:16:39 -05001*** Settings ***
2Documentation Test IPMI FRU data.
3
George Keishinge4a75492020-05-13 13:56:09 -05004Resource ../lib/ipmi_client.robot
Sushma M M8f254b52020-04-23 06:16:39 -05005Resource ../lib/openbmc_ffdc.robot
6Library ../lib/ipmi_utils.py
7
8
9Suite Setup Suite Setup Execution
10Suite Teardown Suite Teardown Execution
11Test Teardown Test Teardown Execution
12
13
14*** Variables ***
srichn287c51c152022-10-16 23:39:29 -050015&{ipmi_redfish_fru_field_map} product_serial=SerialNumber product_part_number=PartNumber
Sushma M M8f254b52020-04-23 06:16:39 -050016
17*** Test Cases ***
18
19Test 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 Lee79940a52021-10-12 17:04:13 +080024 ${ipmi_fru_component_info}= Get Component FRU Info ${COMPONENT_NAME_OF_POWER_SUPPLY}
Sushma M M8f254b52020-04-23 06:16:39 -050025 ... ${fru_objs}
26
27 # Redfish FRU info.
srichn287c51c152022-10-16 23:39:29 -050028 ${redfish_power_details}= Redfish.Get Members List /redfish/v1/Chassis/${CHASSIS_ID}/PowerSubsystem/PowerSupplies
29 ${redfish_power_dict}= Create List
30 FOR ${power_supply} IN @{redfish_power_details}
31 ${redfish_power_supply_reading}= Redfish.Get Properties ${power_supply}
32 Append To List ${redfish_power_dict} ${redfish_power_supply_reading}
33 END
34 Verify IPMI and Redfish subcomponents ${redfish_power_dict}
Sushma M M8f254b52020-04-23 06:16:39 -050035 ... ${ipmi_fru_component_info}
36
37*** Keywords ***
38
39Verify IPMI and Redfish subcomponents
40 [Documentation] Get IPMI And Redfish subcomponents of FRU and verify.
41 [Arguments] ${redfish_fru_info} ${ipmi_fru_info}
42
43 # Description of argument(s):
44 # ${ipmi_fru_info} IPMI FRU component values.
45 # ${redfish_fru_info} Redfish FRU component values.
46
47 ${sub_component_count}= Get Length ${redfish_fru_info}
48
49 # Fetch each subcomponent value of IPMI and Redfish and compare.
50 FOR ${sub_component_index} IN RANGE 0 ${sub_component_count}
51 ${ipmi_fru_sub_component}=
52 ... Get From List ${ipmi_fru_info} ${sub_component_index}
53 ${redfish_fru_sub_component}=
54 ... Get From List ${redfish_fru_info} ${sub_component_index}
55 Compare IPMI And Redfish FRU Component ${ipmi_fru_sub_component}
56 ... ${redfish_fru_sub_component}
57 END
58
59
60Compare IPMI And Redfish FRU Component
61 [Documentation] Compare IPMI And Redfish FRU Component data objects.
62 [Arguments] ${ipmi_fru_component_obj} ${redfish_fru_component_obj}
63
64 # Description of argument(s):
65 # ${ipmi_fru_component_obj} IPMI FRU component data in dictionary.
66 # Example:
67 # FRU Device Description : powersupply0 (ID 75)
68 # Board Mfg Date : Sun Dec 31 18:00:00 1995
69 # Board Product : powersupply0
70 # Board Serial : 71G303
71 # Board Part Number : 01KL471
72 # ${redfish_fru_component_obj} Redfish FRU component data in dictionary.
73 # Example:
74 # "Name": "powersupply0",
75 # "PartNumber": "01KL471",
76 # "PowerInputWatts": 114.0,
77 # "SerialNumber": "71G303",
78
79 # Get key_map from ipmi_redfish_fru_field_map.
80 ${key_map}= Get Dictionary Items ${ipmi_redfish_fru_field_map}
81
82 FOR ${key} ${value} IN @{key_map}
Sushma M Mbd0fcfc2020-06-09 02:16:48 -050083 Exit For Loop IF "${value}" == "${EMPTY}"
Sushma M M8f254b52020-04-23 06:16:39 -050084 Should Contain ${redfish_fru_component_obj['${value}']}
85 ... ${ipmi_fru_component_obj['${key}']}
86 ... msg=Comparison failed.
87 END
88
89
90Suite Setup Execution
91 [Documentation] Do test setup initialization.
92
srichn287c51c152022-10-16 23:39:29 -050093 ${status} ${fru_objs}= Run Keyword And Ignore Error Get Fru Info
94 Log To Console FRU: ${fru_objs}
Sushma M M8f254b52020-04-23 06:16:39 -050095 Set Suite Variable ${fru_objs}
96 Redfish.Login
97
98
99Suite Teardown Execution
100 [Documentation] Do the post suite teardown.
101
102 Redfish.Logout
103
104
105Test Teardown Execution
106 [Documentation] Do the post test teardown.
107
srichn287c51c152022-10-16 23:39:29 -0500108 FFDC On Test Case Fail