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