blob: 835a288925c2e2173a3cc1a04f5758f09dee5b8d [file] [log] [blame]
Marissa Garza6e3f9ec2019-07-24 15:31:26 -05001*** Settings ***
2Documentation Get the systems' 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 Supplies Input Watts
18 [Documentation] Verify there are no invalid power supply input watt records.
19 [Tags] Verify_Power_Supplies_Input_Watts
20 [Template] Verify Watts Record
21
22 # record_type redfish_uri reading_type
23 PowerSupplies ${REDFISH_CHASSIS_PSUPPLY0_URI} PowerInputWatts
24 PowerSupplies ${REDFISH_CHASSIS_PSUPPLY1_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_PSUPPLY0_URI} ReadingVolts
34 Voltages ${REDFISH_CHASSIS_PSUPPLY1_URI} ReadingVolts
35
36
37*** Keywords ***
38
39Verify Watts Record
40 [Documentation] Verify the power watt records.
41 [Arguments] ${record_type} ${redfish_uri} ${reading_type}
42
43 # Description of Arguments(s):
44 # record_type The sensor record type (e.g. "PowerSupplies")
45 # redfish_uri The power supply URI (e.g. /redfish/v1/Chassis/powersupply0/Power)
46 # reading_type The power watt readings (e.g. "PowerInputWatts")
47
48 Verify Valid Records ${record_type} ${redfish_uri} ${reading_type}
49
50
51Verify Voltage Records
52 [Documentation] Verify the power voltage records.
53 [Arguments] ${record_type} ${redfish_uri} ${reading_type}
54
55 # Description of Arguments(s):
56 # record_type The sensor record type (e.g. "Voltages")
57 # redfish_uri The power supply URI (e.g. /redfish/v1/Chassis/powersupply0/Power)
58 # reading_type The power voltage readings (e.g. "ReadingVolts")
59
60 Verify Valid Records ${record_type} ${redfish_uri} ${reading_type}
61
62 ${records}= Redfish.Get Attribute
63 ... ${redfish_uri} ${record_type}
64
65 ${invalid_records}= Evaluate
66 ... [x for x in ${records} if not x['LowerThresholdNonCritical'] <= x['${reading_type}'] <= x['UpperThresholdNonCritical']]
67
68 ${num_invalid_records}= Get Length ${invalid_records}
69 Run Keyword If ${num_invalid_records} > ${0}
70 ... Rprint Vars num_invalid_records invalid_records
71 Rvalid Value num_invalid_records valid_values=[0]
72
73
74Verify Valid Records
75 [Documentation] Verify all the valid records.
76 [Arguments] ${record_type} ${redfish_uri} ${reading_type}
77
78 # Description of Arguments(s):
79 # record_type The sensor record type (e.g. "PowerSupplies")
80 # redfish_uri The power supply URI (e.g. /redfish/v1/Chassis/powersupply0/Power)
81 # reading_type The power watt readings (e.g. "PowerInputWatts")
82
83 # A valid record will have "State" key "Enabled" and "Health" key "OK".
84 ${records}= Redfish.Get Attribute
85 ... ${redfish_uri} ${record_type}
86
87 ${num_records}= Get Length ${records}
88 Rprint Vars num_records records
89
90 ${invalid_records}= Filter Struct ${records}
91 ... [('Health', '^OK$'), ('State', '^Enabled$'), ('${reading_type}', '')] regex=1 invert=1
92 ${num_invalid_records}= Get Length ${invalid_records}
93
94 Run Keyword If ${num_invalid_records} > ${0}
95 ... Rprint Vars num_invalid_records invalid_records
96 Rvalid Value num_invalid_records valid_values=[0]
97
98
99Suite Teardown Execution
100 [Documentation] Do the post suite teardown.
101
102 Redfish.Logout
103
104
105Suite Setup Execution
106 [Documentation] Do test case setup tasks.
107
108 Printn
109 Redfish Power On
110 Redfish.Login
111
112
113Test Teardown Execution
114 [Documentation] Do the post test teardown.
115
116 FFDC On Test Case Fail