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 |
| 23 | PowerSupplies ${REDFISH_CHASSIS_PSUPPLY0_URI} PowerInputWatts |
| 24 | PowerSupplies ${REDFISH_CHASSIS_PSUPPLY1_URI} PowerInputWatts |
| 25 | |
| 26 | |
| 27 | Verify 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 | |
| 39 | Verify 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 | |
| 51 | Verify 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 | |
| 74 | Verify 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 | |
| 99 | Suite Teardown Execution |
| 100 | [Documentation] Do the post suite teardown. |
| 101 | |
| 102 | Redfish.Logout |
| 103 | |
| 104 | |
| 105 | Suite Setup Execution |
| 106 | [Documentation] Do test case setup tasks. |
| 107 | |
| 108 | Printn |
| 109 | Redfish Power On |
| 110 | Redfish.Login |
| 111 | |
| 112 | |
| 113 | Test Teardown Execution |
| 114 | [Documentation] Do the post test teardown. |
| 115 | |
| 116 | FFDC On Test Case Fail |