xref: /openbmc/openbmc-test-automation/redfish/systems/test_power_control_metrics.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           Power_Control_Metrics
15
16*** Test Cases ***
17
18Verify Power Control Consumed Watts
19    [Documentation]  Verify there are no invalid power control consumed watt records.
20    [Tags]  Verify_Power_Control_Consumed_Watts
21    [Template]  Verify Power Metric Records
22
23    # record_type   redfish_uri                   reading_type
24    PowerControl    ${REDFISH_CHASSIS_POWER_URI}  PowerConsumedWatts
25
26
27*** Keywords ***
28
29Verify Power Metric Records
30    [Documentation]  Verify the power metric records.
31    [Arguments]  ${record_type}  ${redfish_uri}  ${reading_type}
32
33    # Description of Arguments(s):
34    # record_type    The sensor record type (e.g. "PowerControl")
35    # redfish_uri    The power supply URI (e.g. /redfish/v1/Chassis/chassis/Power)
36    # reading_type   The power metric readings (e.g. "PowerConsumedWatts")
37
38    Verify Valid Records  ${record_type}  ${redfish_uri}  ${reading_type}
39
40    ${records}=  Redfish.Get Attribute  ${redfish_uri}  ${record_type}
41
42    ${invalid_records}=  Evaluate
43    ...  [x for x in ${records} if not x['${reading_type}'] <= x['PowerMetrics']['MaxConsumedWatts']]
44
45    Valid Length  invalid_records  max_length=0
46
47
48Suite Teardown Execution
49    [Documentation]  Do the post suite teardown.
50
51    Redfish.Logout
52
53
54Suite Setup Execution
55    [Documentation]  Do test case setup tasks.
56
57    Printn
58    Redfish Power On  stack_mode=skip
59    Redfish.Login
60
61
62Test Teardown Execution
63    [Documentation]  Do the post test teardown.
64
65    FFDC On Test Case Fail
66