1*** Settings *** 2Documentation Get the system power supply readings and power mode settings. 3 4Resource ../../lib/bmc_redfish_resource.robot 5Resource ../../lib/bmc_redfish_utils.robot 6Resource ../../lib/openbmc_ffdc.robot 7Library ../../lib/gen_robot_valid.py 8 9Suite Setup Suite Setup Execution 10Suite Teardown Suite Teardown Execution 11Test Setup Printn 12Test Teardown Test Teardown Execution 13 14*** Variables *** 15 16# Power Mode Settings 17@{VALID_POWER_MODES} Static PowerSaving MaximumPerformance 18 19 20*** Test Cases *** 21 22Verify Current Power Mode Setting 23 [Documentation] Verify the current power mode setting. 24 [Tags] Verify_Current_Power_Mode_Setting 25 26 # Example: 27 # /redfish/v1/Systems/system 28 # 29 # "PartNumber": "", 30 # "PowerMode": "MaximumPerformance", 31 # "PowerMode@Redfish.AllowableValues": [ 32 # "Static", 33 # "MaximumPerformance", 34 # "PowerSaving" 35 # ], 36 37 ${current_power_mode}= Redfish.Get Attribute ${SYSTEM_BASE_URI} PowerMode 38 Rprint Vars current_power_mode 39 40 Valid Value current_power_mode valid_values=${VALID_POWER_MODES} 41 42 43Verify Allowable Power Mode Settings 44 [Documentation] Verify the allowable power mode settings. 45 [Tags] Verify_Allowable_Power_Mode_Settings 46 47 ${allowed_power_modes}= Redfish.Get Attribute ${SYSTEM_BASE_URI} PowerMode@Redfish.AllowableValues 48 Rprint Vars allowed_power_modes 49 50 Valid List allowed_power_modes valid_values=${VALID_POWER_MODES} 51 52 53Verify Allowable Power Mode Settings Switch At Runtime 54 [Documentation] Check the allowable power modes are set successfully at runtime. 55 [Tags] Verify_Allowable_Power_Mode_Settings_Switch_At_Runtime 56 [Template] Set and Verify Power Mode Switches 57 58 # power_mode_type 59 Static 60 PowerSaving 61 MaximumPerformance 62 63 64Verify State Of PowerSubsystem PowerSupplies 65 [Documentation] Verify the state of the system's powersupplies is ok and enabled. 66 [Tags] Verify_State_Of_PowerSubsystem_PowerSupplies 67 68 ${total_num_supplies}= Get Total Number Of PowerSupplies 69 Rprint Vars total_num_supplies 70 71 ${resp}= Redfish.Get ${REDFISH_CHASSIS_URI}/${CHASSIS_ID}/PowerSubsystem/PowerSupplies 72 FOR ${entry} IN RANGE 0 ${total_num_supplies} 73 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]} 74 # Example: 75 # "Status": { 76 # "Health": "OK", 77 # "State": "Enabled" 78 # }, 79 Should Be Equal As Strings ${resp_resource.dict["Status"]["Health"]} OK 80 Should Be Equal As Strings ${resp_resource.dict["Status"]["State"]} Enabled 81 END 82 83 84Verify PowerSubsystem Efficiency Percent For All PowerSupplies 85 [Documentation] Verify the efficiency percent for all powersupplies. 86 [Tags] Verify_PowerSubsystem_Efficiency_Percent_For_All_PowerSupplies 87 88 ${total_num_supplies}= Get Total Number Of PowerSupplies 89 Rprint Vars total_num_supplies 90 91 # Example output: 92 # - Executing: get('/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply0') 93 # resp_resource: 94 # [0]: 95 # [EfficiencyPercent]: 90 96 # - Executing: get('/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply1') 97 # resp_resource: 98 # [0]: 99 # [EfficiencyPercent]: 90 100 101 ${resp}= Redfish.Get ${REDFISH_CHASSIS_URI}/${CHASSIS_ID}/PowerSubsystem/PowerSupplies 102 FOR ${entry} IN RANGE 0 ${total_num_supplies} 103 ${resp_resource}= Redfish.Get Attribute 104 ... ${resp.dict["Members"][${entry}]["@odata.id"]} EfficiencyRatings 105 Rprint Vars resp_resource 106 ${efficiency_percentages}= Nested Get EfficiencyPercent ${resp_resource} 107 Valid List efficiency_percentages [90] 108 END 109 110 111 112*** Keywords *** 113 114Get Total Number Of PowerSupplies 115 [Documentation] Return total number of powersupplies. 116 ${total_num_powersupplies}= Redfish.Get Attribute 117 ... ${REDFISH_CHASSIS_URI}/${CHASSIS_ID}/PowerSubsystem/PowerSupplies Members@odata.count 118 119 # Entries "Members@odata.count": 4, 120 # {'@odata.id': '/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply0'} 121 # {'@odata.id': '/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply1'} 122 # {'@odata.id': '/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply2'} 123 # {'@odata.id': '/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies/powersupply3'} 124 RETURN ${total_num_powersupplies} 125 126 127Set and Verify Power Mode Switches 128 [Documentation] Verify the power mode switches successfully at standby or runtime. 129 [Arguments] ${power_mode} 130 131 # Description of Arguments(s): 132 # power_mode Read the allowable power modes (e.g. "Static") 133 134 Redfish.Login 135 136 Redfish.patch ${SYSTEM_BASE_URI} 137 ... body={"PowerMode":"${power_mode}"} valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 138 ${current_power_mode}= Redfish.Get Attribute ${SYSTEM_BASE_URI} PowerMode 139 Should Be Equal As Strings ${power_mode} ${current_power_mode} 140 ... msg=The thermal mode does not match the current fan mode. 141 Rprint Vars current_power_mode 142 143 144Suite Teardown Execution 145 [Documentation] Do the post suite teardown. 146 147 Redfish.Logout 148 149 150Suite Setup Execution 151 [Documentation] Do test case setup tasks. 152 153 Printn 154 Redfish.Login 155 156 157Test Teardown Execution 158 [Documentation] Do the post test teardown. 159 160 FFDC On Test Case Fail 161