1ff43db9aSchithrag*** Settings *** 2ff43db9aSchithragDocumentation This suite tests IPMI Cold Reset in OpenBMC. 3ff43db9aSchithrag... 4ff43db9aSchithrag... The Cold reset command directs the Responder to perform 5ff43db9aSchithrag... a 'Cold Reset' action, which causes default setting of 6ff43db9aSchithrag... interrupt enables, event message generation,sensor scanning, 7ff43db9aSchithrag... threshold values, and other 'power up' default state to be restored. 8ff43db9aSchithrag... 9ff43db9aSchithrag... The script consist of 3 testcases: 10ff43db9aSchithrag... - Cold_Reset_Via_IPMI 11ff43db9aSchithrag... - Cold_Reset_With_Invalid_Data_Request_Via_IPMI 12ff43db9aSchithrag... - Verify_Cold_Reset_Impact_On_Sensor_Threshold_Via_IPMI 13ff43db9aSchithrag... 14ff43db9aSchithrag... The script verifies command execution for cold reset, 15ff43db9aSchithrag... invalid data request verification of cold reset and 16ff43db9aSchithrag... impact on sensor threshold value change with cold reset. 17ff43db9aSchithrag... 18ff43db9aSchithrag... The script changes sensor threshold value for Fan sensor, 19ff43db9aSchithrag... executes cold reset IPMI command, 20ff43db9aSchithrag... compares sensor threshold values of initial and reading after cold reset. 216b279b39Schithrag... 226b279b39Schithrag... Request data for cold reset present under data/ipmi_raw_cmd_table.py 23ff43db9aSchithrag 24ff43db9aSchithragResource ../lib/ipmi_client.robot 25ff43db9aSchithragResource ../lib/openbmc_ffdc.robot 26d0c4b800SganesanbLibrary Collections 27d0c4b800SganesanbLibrary ../lib/ipmi_utils.py 28ff43db9aSchithragVariables ../data/ipmi_raw_cmd_table.py 29ff43db9aSchithrag 306b279b39SchithragTest Teardown FFDC On Test Case Fail 31ff43db9aSchithrag 32*6fb70d98SMatt FischerTest Tags IPMI_Cold_Reset 33ff43db9aSchithrag 34ff43db9aSchithrag*** Variables *** 35ff43db9aSchithrag 36ff43db9aSchithrag${NETWORK_RESTART_TIME} 30s 37ff43db9aSchithrag@{thresholds_list} lcr lnc unc ucr 38ff43db9aSchithrag 39ff43db9aSchithrag 40ff43db9aSchithrag*** Test Cases *** 41ff43db9aSchithrag 42ff43db9aSchithragCold Reset Via IPMI 43ff43db9aSchithrag [Documentation] Verify Cold Reset via IPMI. 44ff43db9aSchithrag [Tags] Cold_Reset_Via_IPMI 45ff43db9aSchithrag 46ff43db9aSchithrag # Cold Reset Via IPMI raw command. 47372cd862Sishwaryamathim Run IPMI Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} 48ff43db9aSchithrag 49ff43db9aSchithrag # Get the BMC Status. 50ff43db9aSchithrag Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable 51ff43db9aSchithrag Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational 52ff43db9aSchithrag 53ff43db9aSchithrag # Verify if BMC restarted with Get Device ID command. 54ff43db9aSchithrag 55372cd862Sishwaryamathim ${resp}= Run IPMI Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} 56ff43db9aSchithrag Should Not Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][1]} 57ff43db9aSchithrag 58ff43db9aSchithrag 59ff43db9aSchithragCold Reset With Invalid Data Request Via IPMI 60ff43db9aSchithrag [Documentation] Verify Cold Reset with invalid data request via IPMI. 61ff43db9aSchithrag [Tags] Cold_Reset_With_Invalid_Data_Request_Via_IPMI 62ff43db9aSchithrag 63ff43db9aSchithrag # Verify cold reset with invalid length of the request data and expect error. 64ff43db9aSchithrag ${resp}= Run Keyword and Expect Error *Request data length invalid* 65372cd862Sishwaryamathim ... Run IPMI Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} 0x00 66ff43db9aSchithrag 67ff43db9aSchithrag 68ff43db9aSchithragVerify Cold Reset Impact On Sensor Threshold Via IPMI 69ff43db9aSchithrag [Documentation] Modify sensor threshold, perform cold reset, 70ff43db9aSchithrag ... and verify if sensor threshold reverts back to initial value. 71ff43db9aSchithrag [Tags] Verify_Cold_Reset_Impact_On_Sensor_Threshold_Via_IPMI 72ff43db9aSchithrag 73ff43db9aSchithrag # Get sensor list. 7429a24216Sganesanb ${sensor_list}= Get Sensor List 75ff43db9aSchithrag 76ff43db9aSchithrag # Get initial sensor threshold readings. 7729a24216Sganesanb ${sensor_name} ${sensor_threshold}= Get The Sensor Name And Threshold ${sensor_list} 78ff43db9aSchithrag 7929a24216Sganesanb ${threshold_key_list}= Get Dictionary Keys ${sensor_threshold} 8029a24216Sganesanb ${random_threshold_key}= Evaluate random.choice(${threshold_key_list}) random 81ff43db9aSchithrag 8229a24216Sganesanb ${old_threshold_value}= Get From Dictionary ${sensor_threshold} ${random_threshold_key} 83ff43db9aSchithrag 8429a24216Sganesanb # Modify Default Threshold Value For An Sensor To Set An New Threshold Value 8529a24216Sganesanb ${new_settable_threshold_value}= Modify Default Sensor Threshold Value ${old_threshold_value} 8629a24216Sganesanb 8729a24216Sganesanb # Set/Get sensor threshold for given sensor and compare with initial reading. 8829a24216Sganesanb ${new_threshold_value}= Set And Get Sensor Threshold For given Sensor ${sensor_name} ${random_threshold_key} 8929a24216Sganesanb ... ${new_settable_threshold_value} 9029a24216Sganesanb 9129a24216Sganesanb Should Not Be Equal ${new_threshold_value} ${old_threshold_value} 9229a24216Sganesanb 9329a24216Sganesanb # Cold Reset Via IPMI raw command. 94372cd862Sishwaryamathim Run IPMI Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} 9529a24216Sganesanb 9629a24216Sganesanb # Get the BMC Status. 97ff43db9aSchithrag Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable 9829a24216Sganesanb Wait Until Keyword Succeeds 10 min 10 sec Is BMC Operational 99ff43db9aSchithrag 100ff43db9aSchithrag # Get sensor data for the sensor identified. 101ff43db9aSchithrag ${data_after_coldreset}= Wait Until Keyword Succeeds 2 min 30 sec 10229a24216Sganesanb ... Run IPMI Standard Command sensor | grep -i "${sensor_name}" 103ff43db9aSchithrag 104ff43db9aSchithrag # Get sensor threshold readings after BMC restarts. 10529a24216Sganesanb ${threshold_value_after_reset}= Getting Sensor Threshold Value Based On Threshold Key ${random_threshold_key} ${sensor_name} 106ff43db9aSchithrag 107ff43db9aSchithrag # Compare with initial sensor threshold values. 10829a24216Sganesanb Should Be Equal ${threshold_value_after_reset} ${old_threshold_value} 109ff43db9aSchithrag 110ff43db9aSchithrag*** Keywords *** 111ff43db9aSchithrag 112ff43db9aSchithragGet Sensor List 113ff43db9aSchithrag [Documentation] To get the list of sensors via IPMI sensor list. 114ff43db9aSchithrag 115ff43db9aSchithrag # BMC may take time to populate all the sensors once BMC Cold reset completes. 116ff43db9aSchithrag ${data}= Wait Until Keyword Succeeds 2 min 30 sec 11729a24216Sganesanb ... Run IPMI Standard Command sensor 118ff43db9aSchithrag 119409df05dSGeorge Keishing RETURN ${data} 120ff43db9aSchithrag 1216b279b39SchithragGet The Sensor Name And Threshold 122ff43db9aSchithrag [Documentation] To get the sensor threshold for given sensor using IPMI. 12329a24216Sganesanb [Arguments] ${sensor_list} 124ff43db9aSchithrag 125ff43db9aSchithrag # Description of Argument(s): 12629a24216Sganesanb # ${sensor_list} All the sensors listed with ipmi sensor list command. 127ff43db9aSchithrag 12829a24216Sganesanb @{tmp_list}= Create List 129ff43db9aSchithrag 13029a24216Sganesanb @{sensor_list_lines}= Split To Lines ${sensor_list} 131ff43db9aSchithrag 13229a24216Sganesanb # Omit the discrete sensor and create an threshold sensor name list 13329a24216Sganesanb FOR ${sensor} IN @{sensor_list_lines} 13429a24216Sganesanb ${discrete_sensor_status}= Run Keyword And Return Status Should Contain ${sensor} discrete 13529a24216Sganesanb Continue For Loop If '${discrete_sensor_status}' == 'True' 13629a24216Sganesanb ${sensor_details}= Split String ${sensor} | 13729a24216Sganesanb ${get_sensor_name}= Get From List ${sensor_details} 0 13829a24216Sganesanb ${sensor_name}= Set Variable ${get_sensor_name.strip()} 13929a24216Sganesanb Append To List ${tmp_list} ${sensor_name} 140ff43db9aSchithrag END 141ff43db9aSchithrag 14229a24216Sganesanb ${sensor_count}= Get Length ${tmp_list} 143ff43db9aSchithrag 14429a24216Sganesanb FOR ${RANGE} IN RANGE 0 ${sensor_count} 14529a24216Sganesanb ${random_sensor} ${sensor_threshold}= Selecting Random Sensor Name And Threshold Value ${tmp_list} ${sensor_list} 14629a24216Sganesanb ${threshold_dict_count}= Get Length ${sensor_threshold} 14729a24216Sganesanb Exit For Loop If '${threshold_dict_count}' != '0' 14829a24216Sganesanb Remove Values From List ${tmp_list} ${random_sensor} 14929a24216Sganesanb END 150ff43db9aSchithrag 151409df05dSGeorge Keishing RETURN ${random_sensor} ${sensor_threshold} 15229a24216Sganesanb 15329a24216SganesanbSelecting Random Sensor Name And Threshold Value 15429a24216Sganesanb [Documentation] Select Random Sensor Name And Threshold Values. 15529a24216Sganesanb [Arguments] ${tmp_list} ${sensor_list} 15629a24216Sganesanb 15729a24216Sganesanb # Selecting random sensors from sensor list 15829a24216Sganesanb ${random_sensor_name}= Evaluate random.choice(${tmp_list}) random 15929a24216Sganesanb 16029a24216Sganesanb # Create Dictionary For Threshold Key With Threshold Values 16129a24216Sganesanb &{tmp_dict}= Create Dictionary 16229a24216Sganesanb ${sensor_threshold}= Get Lines Containing String ${sensor_list} ${random_sensor_name} 16329a24216Sganesanb @{ipmi_sensor}= Split String ${sensor_threshold} | 16429a24216Sganesanb ${get_ipmi_lower_non_recoverable_threshold}= Get From List ${ipmi_sensor} 4 16529a24216Sganesanb ${ipmi_lower_non_recoverable_threshold}= Set Variable ${get_ipmi_lower_non_recoverable_threshold.strip()} 16629a24216Sganesanb ${lower_non_recoverable_threshold_status}= Run Keyword And Return Status Should Not Contain 16729a24216Sganesanb ... ${ipmi_lower_non_recoverable_threshold} na 16829a24216Sganesanb Run Keyword If '${lower_non_recoverable_threshold_status}' == 'True' 16929a24216Sganesanb ... Set To Dictionary ${tmp_dict} lnr ${ipmi_lower_non_recoverable_threshold} 17029a24216Sganesanb 17129a24216Sganesanb ${get_ipmi_lower_critical_threshold}= Get From List ${ipmi_sensor} 5 17229a24216Sganesanb ${ipmi_lower_critical_threshold}= Set Variable ${get_ipmi_lower_critical_threshold.strip()} 17329a24216Sganesanb ${lower_critical_threshold_status}= Run Keyword And Return Status Should Not Contain 17429a24216Sganesanb ... ${ipmi_lower_critical_threshold} na 17529a24216Sganesanb Run Keyword If '${lower_critical_threshold_status}' == 'True' 17629a24216Sganesanb ... Set To Dictionary ${tmp_dict} lcr ${ipmi_lower_critical_threshold} 17729a24216Sganesanb 17829a24216Sganesanb ${get_ipmi_lower_non_critical_threshold}= Get From List ${ipmi_sensor} 6 17929a24216Sganesanb ${ipmi_lower_non_critical_threshold}= Set Variable ${get_ipmi_lower_non_critical_threshold.strip()} 18029a24216Sganesanb ${lower_non_critical_threshold_status}= Run Keyword And Return Status Should Not Contain 18129a24216Sganesanb ... ${ipmi_lower_non_critical_threshold} na 18229a24216Sganesanb Run Keyword If '${lower_non_critical_threshold_status}' == 'True' 18329a24216Sganesanb ... Set To Dictionary ${tmp_dict} lnc ${ipmi_lower_non_critical_threshold} 18429a24216Sganesanb 18529a24216Sganesanb ${get_ipmi_upper_non_critical_threshold}= Get From List ${ipmi_sensor} 7 18629a24216Sganesanb ${ipmi_upper_non_critical_threshold}= Set Variable ${get_ipmi_upper_non_critical_threshold.strip()} 18729a24216Sganesanb ${upper_non_critical_threshold_status}= Run Keyword And Return Status Should Not Contain 18829a24216Sganesanb ... ${ipmi_upper_non_critical_threshold} na 18929a24216Sganesanb Run Keyword If '${upper_non_critical_threshold_status}' == 'True' 19029a24216Sganesanb ... Set To Dictionary ${tmp_dict} unc ${ipmi_upper_non_critical_threshold} 19129a24216Sganesanb 19229a24216Sganesanb ${get_ipmi_upper_critical_threshold}= Get From List ${ipmi_sensor} 8 19329a24216Sganesanb ${ipmi_upper_critical_threshold}= Set Variable ${get_ipmi_upper_critical_threshold.strip()} 19429a24216Sganesanb ${upper_critical_threshold_status}= Run Keyword And Return Status Should Not Contain 19529a24216Sganesanb ... ${ipmi_upper_critical_threshold} na 19629a24216Sganesanb Run Keyword If '${upper_critical_threshold_status}' == 'True' 19729a24216Sganesanb ... Set To Dictionary ${tmp_dict} ucr ${ipmi_upper_critical_threshold} 19829a24216Sganesanb 19929a24216Sganesanb ${get_ipmi_upper_non_recoverable_threshold}= Get From List ${ipmi_sensor} 9 20029a24216Sganesanb ${ipmi_upper_non_recoverable_threshold}= Set Variable ${get_ipmi_upper_non_recoverable_threshold.strip()} 20129a24216Sganesanb ${upper_non_recoverable_threshold_status}= Run Keyword And Return Status Should Not Contain 20229a24216Sganesanb ... ${ipmi_upper_non_recoverable_threshold} na 20329a24216Sganesanb Run Keyword If '${upper_non_recoverable_threshold_status}' == 'True' 20429a24216Sganesanb ... Set To Dictionary ${tmp_dict} unr ${ipmi_upper_non_recoverable_threshold} 20529a24216Sganesanb 206409df05dSGeorge Keishing RETURN ${random_sensor_name} ${tmp_dict} 20729a24216Sganesanb 20829a24216SganesanbModify Default Sensor Threshold Value 20929a24216Sganesanb [Documentation] Modify Default Sensor Threshold Value with adding 100 to old threshold values. 21029a24216Sganesanb [Arguments] ${old_threshold} 21129a24216Sganesanb 21229a24216Sganesanb ${new_threshold}= Evaluate ${old_threshold} + 100 21329a24216Sganesanb 214409df05dSGeorge Keishing RETURN ${new_threshold} 21529a24216Sganesanb 21629a24216SganesanbSet And Get Sensor Threshold For given Sensor 21729a24216Sganesanb [Documentation] Set/Get Sensor Threshold for given sensor Via IPMI. 21829a24216Sganesanb [Arguments] ${sensor_name} ${random_threshold_key} ${new_settable_threshold_value} 21929a24216Sganesanb 22029a24216Sganesanb # Set New Threshold Value To The Randomly Selected Sensor. 22129a24216Sganesanb Run IPMI Standard Command sensor thresh "${sensor_name}" ${random_threshold_key} ${new_settable_threshold_value} 22229a24216Sganesanb 22329a24216Sganesanb Sleep 10s 22429a24216Sganesanb 22529a24216Sganesanb ${sensor_new_threshold_value}= Getting Sensor Threshold Value Based On Threshold Key ${random_threshold_key} ${sensor_name} 22629a24216Sganesanb 227409df05dSGeorge Keishing RETURN ${sensor_new_threshold_value} 22829a24216Sganesanb 22929a24216SganesanbGetting Sensor Threshold Value Based On Threshold Key 23029a24216Sganesanb [Documentation] Getting Particular Sensor Threshold Value Based On Sensor Name And Threshold Key. 23129a24216Sganesanb [Arguments] ${threshold_key} ${sensor_name} 23229a24216Sganesanb 23329a24216Sganesanb # After Setting Threshold Value, Get New Sensor Threshold Value. 23429a24216Sganesanb ${new_data}= Run IPMI Standard Command sensor | grep -i "${sensor_name}" 23529a24216Sganesanb ${new_sensor_details}= Split String ${new_data} | 23629a24216Sganesanb 23729a24216Sganesanb ${index_value}= Set Variable If 23829a24216Sganesanb ... '${threshold_key}' == 'lnr' ${4} 23929a24216Sganesanb ... '${threshold_key}' == 'lcr' ${5} 24029a24216Sganesanb ... '${threshold_key}' == 'lnc' ${6} 24129a24216Sganesanb ... '${threshold_key}' == 'unc' ${7} 24229a24216Sganesanb ... '${threshold_key}' == 'ucr' ${8} 24329a24216Sganesanb ... '${threshold_key}' == 'unr' ${9} 24429a24216Sganesanb 24529a24216Sganesanb ${get_sensor_new_threshold_value}= Get From List ${new_sensor_details} ${index_value} 24629a24216Sganesanb ${sensor_new_threshold_value}= Set Variable ${get_sensor_new_threshold_value.strip()} 24729a24216Sganesanb 248409df05dSGeorge Keishing RETURN ${sensor_new_threshold_value} 249