Marissa Garza | 6460911 | 2019-07-03 11:48:58 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Getting the systems power sensor readings for voltages. |
| 3 | |
| 4 | Resource ../../lib/bmc_redfish_resource.robot |
| 5 | Resource ../../lib/bmc_redfish_utils.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Library ../../lib/gen_robot_valid.py |
| 8 | |
| 9 | Suite Setup Suite Setup Execution |
| 10 | Suite Teardown Suite Teardown Execution |
| 11 | Test Setup Printn |
| 12 | Test Teardown Test Teardown Execution |
| 13 | |
| 14 | |
| 15 | *** Test Cases *** |
| 16 | |
| 17 | Get 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 | |
| 28 | Get 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 |
| 49 | Rvalid Value num_invalid_records valid_values=[0] |
| 50 | |
| 51 | ${invalid_records}= Evaluate |
| 52 | ... [x for x in ${records} if not x['LowerThresholdNonCritical'] <= x['ReadingVolts'] <= x['UpperThresholdNonCritical']] |
| 53 | |
| 54 | ${num_invalid_records}= Get Length ${invalid_records} |
| 55 | Run Keyword If ${num_invalid_records} > ${0} |
| 56 | ... Rprint Vars num_invalid_records invalid_records fmt=terse |
| 57 | Rvalid Value num_invalid_records valid_values=[0] |
| 58 | |
| 59 | |
| 60 | Suite Teardown Execution |
| 61 | [Documentation] Do the post suite teardown. |
| 62 | |
| 63 | Redfish.Logout |
| 64 | |
| 65 | |
| 66 | Suite Setup Execution |
| 67 | [Documentation] Do test case setup tasks. |
| 68 | |
| 69 | Printn |
| 70 | Redfish.Login |
| 71 | |
| 72 | |
| 73 | Test Teardown Execution |
| 74 | [Documentation] Do the post test teardown. |
| 75 | |
| 76 | FFDC On Test Case Fail |