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