xref: /openbmc/openbmc-test-automation/redfish/systems/test_powersupply_readings.robot (revision feb79d60e26d78a6e91521ee41b1af5b8ba71f4c)
1*** Settings ***
2Documentation       Get the system power supply voltage readings.
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
14Test Tags           Powersupply_Readings
15
16*** Test Cases ***
17
18Verify Power Supplies Input Watts
19    [Documentation]  Verify there are no invalid power supply input watt records.
20    [Tags]  Verify_Power_Supplies_Input_Watts
21    [Template]  Verify Watts Record
22
23    # record_type   redfish_uri                       reading_type
24    PowerSupplies   ${REDFISH_CHASSIS_POWER_URI}      PowerInputWatts
25
26
27Verify Power Supplies Input Output Voltages
28    [Documentation]  Verify there are no invalid power supply voltage records.
29    [Tags]  Verify_Power_Supplies_Input_Output_Voltages
30    [Template]  Verify Voltage Records
31
32    # record_type   redfish_uri                        reading_type
33    Voltages        ${REDFISH_CHASSIS_POWER_URI}       ReadingVolts
34
35
36Verify Power Supplies Efficiency Percentage
37    [Documentation]  Verify the efficiency percentage is set to correct value.
38    [Tags]  Verify_Power_Supplies_Efficiency_Percentage
39
40    # Example output:
41    # records:
42    #   [0]:
43    #     [@odata.id]:                /redfish/v1/Chassis/chassis/Power#/PowerSupplies/0
44    #     [EfficiencyPercent]:        90
45    #     [IndicatorLED]:             Off
46    #     [Manufacturer]:
47    #     [MemberId]:                 powersupply0
48    #     [Model]:                    2B1D
49    #     [Name]:                     powersupply0
50    #     [PartNumber]:               01KL779
51    #     [PowerInputWatts]:          106.0
52    #     [SerialNumber]:             75B1C2
53    #     [Status]:
54    #       [Health]:                 OK
55    #       [State]:                  Enabled
56
57    ${records}=  Verify Valid Records  PowerSupplies  ${REDFISH_CHASSIS_POWER_URI}  EfficiencyPercent
58    ${efficiency_percentages}=  Nested Get  EfficiencyPercent  ${records}
59    Valid List  efficiency_percentages  [90]
60
61
62*** Keywords ***
63
64Verify Watts Record
65    [Documentation]  Verify the power watt records.
66    [Arguments]  ${record_type}  ${redfish_uri}  ${reading_type}
67
68    # Description of Arguments(s):
69    # record_type    The sensor record type (e.g. "PowerSupplies")
70    # redfish_uri    The power supply URI (e.g. /redfish/v1/Chassis/chassis/Power)
71    # reading_type   The power watt readings (e.g. "PowerInputWatts")
72
73    Verify Valid Records  ${record_type}  ${redfish_uri}  ${reading_type}
74
75
76Verify Voltage Records
77    [Documentation]  Verify the power voltage records.
78    [Arguments]  ${record_type}  ${redfish_uri}  ${reading_type}
79
80    # Description of Arguments(s):
81    # record_type    The sensor record type (e.g. "Voltages")
82    # redfish_uri    The power supply URI (e.g. /redfish/v1/Chassis/chassis/Power)
83    # reading_type   The power voltage readings (e.g. "ReadingVolts")
84
85    Verify Valid Records  ${record_type}  ${redfish_uri}  ${reading_type}
86
87    ${records}=  Redfish.Get Attribute  ${redfish_uri}  ${record_type}
88
89    ${cmd}  Catenate  [x for x in ${records}
90    ...  if not x['LowerThresholdNonCritical'] <= x['${reading_type}'] <= x['UpperThresholdNonCritical']]
91    ${invalid_records}=  Evaluate  ${cmd}
92
93    Valid Length  invalid_records  max_length=0
94
95
96Suite Teardown Execution
97    [Documentation]  Do the post suite teardown.
98
99    Redfish.Logout
100
101
102Suite Setup Execution
103    [Documentation]  Do test case setup tasks.
104
105    Printn
106    Redfish Power On  stack_mode=skip
107    Redfish.Login
108
109
110Test Teardown Execution
111    [Documentation]  Do the post test teardown.
112
113    FFDC On Test Case Fail
114