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