blob: d8539fef6306384dc6d054cde37ae6c379cac038 [file] [log] [blame]
Marissa Garza64609112019-07-03 11:48:58 -05001*** Settings ***
2Documentation Getting the systems power sensor readings for voltages.
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
17Get Power Sensor Voltage Records
18 [Documentation] Get the power voltage records.
19 [Tags] Get_Power_Sensor_Voltage_Records
20 [Template] Get Voltage Records and Verify
21
22 # record_type reading_type
23 Voltages ReadingVolts
24
25
26*** Keywords ***
27
28Get Voltage Records and Verify
29 [Documentation] Get the power records for voltages.
30 [Arguments] ${record_type} ${reading_type}
31
32 # Description of Arguments(s):
33 # record_type The sensor record type (e.g. "Voltages")
34 # reading_type The power voltage readings (e.g. "ReadingVolts")
35
36 # A valid record will have "State" key "Enabled" and "Health" key "OK"
37 ${records}= Redfish.Get Attribute
38 ... ${REDFISH_CHASSIS_POWER_URI} ${record_type}
39
40 ${num_records}= Get Length ${records}
41 Rprint Vars num_records records fmt=terse
42
43 ${invalid_records}= Filter Struct ${records}
44 ... [('Health', '^OK$'), ('State', '^Enabled$'), ('${reading_type}', '')] regex=1 invert=1
45 ${num_invalid_records}= Get Length ${invalid_records}
46
47 Run Keyword If ${num_invalid_records} > ${0}
48 ... Rprint Vars num_invalid_records invalid_records fmt=terse
Michael Walshe7edb222019-08-19 17:39:38 -050049 Valid Value num_invalid_records valid_values=[0]
Marissa Garza64609112019-07-03 11:48:58 -050050
Marissa Garza743d5972020-01-24 14:17:52 -060051 ${cmd} Catenate [x for x in ${records}
52 ... if not x['LowerThresholdNonCritical'] <= x['ReadingVolts'] <= x['UpperThresholdNonCritical']]
53 ${invalid_records}= Evaluate ${cmd}
Marissa Garza64609112019-07-03 11:48:58 -050054
55 ${num_invalid_records}= Get Length ${invalid_records}
56 Run Keyword If ${num_invalid_records} > ${0}
57 ... Rprint Vars num_invalid_records invalid_records fmt=terse
Michael Walshe7edb222019-08-19 17:39:38 -050058 Valid Value num_invalid_records valid_values=[0]
Marissa Garza64609112019-07-03 11:48:58 -050059
60
61Suite Teardown Execution
62 [Documentation] Do the post suite teardown.
63
64 Redfish.Logout
65
66
67Suite Setup Execution
68 [Documentation] Do test case setup tasks.
69
70 Printn
Marissa Garza0517c5d2019-08-15 13:46:09 -050071 Redfish Power On stack_mode=skip
Marissa Garza64609112019-07-03 11:48:58 -050072 Redfish.Login
73
74
75Test Teardown Execution
76 [Documentation] Do the post test teardown.
77
78 FFDC On Test Case Fail