Joy Onyerikwu | d806cc0 | 2019-10-01 07:46:18 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation BMC server health, collect sensors. |
| 3 | |
| 4 | # Test Parameters: |
| 5 | # OPENBMC_HOST The BMC host name or IP address. |
| 6 | |
| 7 | Resource ../../lib/bmc_redfish_resource.robot |
| 8 | Resource ../../lib/openbmc_ffdc.robot |
| 9 | Library Collections |
| 10 | Library ../syslib/utils_keywords.py |
| 11 | |
| 12 | Suite Setup Suite Setup Execution |
| 13 | Suite Teardown Suite Teardown Execution |
| 14 | Test Setup Printn |
| 15 | |
| 16 | *** Variables *** |
| 17 | ${QUIET} ${1} |
| 18 | ${sensors_values_rest} Rest sensors collection excluded |
| 19 | ${sensors_values_redfish} Redfish sensors collection excluded |
| 20 | ${sensors_flagged_rest} Rest sensors collection excluded |
| 21 | ${sensors_flagged_redfish} Redfish sensors collection excluded |
| 22 | |
| 23 | |
| 24 | *** Test Cases *** |
| 25 | |
| 26 | Rest Collect Sensors |
| 27 | [Documentation] Collect the sensors values using the OpenBMC Rest API. |
| 28 | [Tags] Rest_Collect_Sensors rest |
| 29 | [Teardown] FFDC On Test Case Fail clean_up=${FALSE} |
| 30 | |
| 31 | ${sensors}= OpenBMC Get Request ${SENSORS_URI}enumerate |
| 32 | ${sensors}= Evaluate $sensors.json()['data'] |
| 33 | ${sensors_collected_via_rest}= gen_robot_print.Sprint Vars sensors |
| 34 | Log To Console ${sensors_collected_via_rest} |
| 35 | ${fans}= Filter Struct ${sensors} [('Unit', '\.RPMS$')] regex=1 |
| 36 | ${no_fans}= Filter Struct ${sensors} [('WarningAlarmHigh', None),('WarningAlarmLow', None)] |
| 37 | ... invert=${True} |
| 38 | Log sensor values raw:${\n}${sensors}${\n}sensors no fans:${\n}${no_fans}${\n}fans:${\n}${fans} |
| 39 | ... level=DEBUG |
| 40 | |
| 41 | ${fans_flagged}= Filter Struct ${fans} |
| 42 | ... [('CriticalAlarmHigh', False),('CriticalAlarmLow', False)] invert=${True} |
| 43 | ${filter_str}= Catenate [('CriticalAlarmHigh', False),('CriticalAlarmLow', False), |
| 44 | ... ('WarningAlarmHigh', False),('WarningAlarmLow', False)] |
| 45 | ${other_sensors_flagged}= Filter Struct ${no_fans} ${filter_str} invert=${True} |
| 46 | ${sensors_flagged_rest}= gen_robot_print.Sprint Vars fans_flagged other_sensors_flagged |
| 47 | Set Suite Variable ${sensors_flagged_rest} |
| 48 | |
| 49 | |
| 50 | Redfish Collect Sensors |
| 51 | [Documentation] Collect the sensor values using Redfish. |
| 52 | [Tags] Redfish_Collect_Sensors redfish |
| 53 | [Setup] Redfish.Login |
| 54 | [Teardown] Redfish Test Teardown Execution |
| 55 | |
| 56 | ${redfish_chassis_power}= Redfish_Utils.Enumerate Request ${REDFISH_CHASSIS_POWER_URI} ${0} |
| 57 | ${redfish_chassis_thermal}= Redfish_Utils.Enumerate Request ${REDFISH_CHASSIS_THERMAL_URI} ${0} |
| 58 | ${redfish_chassis_sensors}= Redfish_Utils.Enumerate Request ${REDFISH_CHASSIS_SENSORS_URI} ${0} |
| 59 | ${sensors_values_redfish}= gen_robot_print.Sprint Vars |
| 60 | ... redfish_chassis_power redfish_chassis_thermal redfish_chassis_sensors |
| 61 | Set Suite Variable ${sensors_values_redfish} |
| 62 | Log To Console ${sensors_values_redfish} |
| 63 | |
| 64 | ${health_check_filter_dict}= Create Dictionary Health=OK |
| 65 | ${merged_dicts}= Evaluate {**$redfish_chassis_power, **$redfish_chassis_thermal} |
| 66 | Log ${merged_dicts} level=DEBUG |
| 67 | ${sensors_flagged_redfish}= Filter Struct ${merged_dicts} ${health_check_filter_dict} invert=${TRUE} |
| 68 | ${sensors_flagged_redfish}= gen_robot_print.Sprint Vars sensors_flagged_redfish |
| 69 | Set Suite Variable ${sensors_flagged_redfish} |
| 70 | |
| 71 | |
| 72 | *** Keywords *** |
| 73 | |
| 74 | Suite Setup Execution |
| 75 | [Documentation] Do suite setup tasks. |
| 76 | |
| 77 | Set Log Level DEBUG |
| 78 | REST Power On stack_mode=skip |
| 79 | |
| 80 | |
| 81 | Suite Teardown Execution |
| 82 | [Documentation] Do suite teardown tasks. Log sensor values collected. |
| 83 | |
| 84 | Log Many ${sensors_values_rest} ${sensors_values_redfish} |
| 85 | Log Sensors detected out of bounds via Rest:${\n}${sensors_flagged_rest} console=true |
| 86 | Log Sensors detected out of bounds via Redfish:${\n}${sensors_flagged_redfish} console=true |
| 87 | |
| 88 | |
| 89 | Redfish Test Teardown Execution |
| 90 | [Documentation] Do the post test teardown for redfish. |
| 91 | |
| 92 | Redfish.Logout |
| 93 | FFDC On Test Case Fail clean_up=${FALSE} |