19f74d3afSCharles Paul Hofer*** Settings *** 29f74d3afSCharles Paul HoferDocumentation Update the BMC code on a target BMC. 39f74d3afSCharles Paul Hofer... Execution Method: 49f74d3afSCharles Paul Hofer... python -m robot -v OPENBMC_HOST:<hostname> 59f74d3afSCharles Paul Hofer... -v IMAGE_FILE_PATH:<path/*.tar> bmc_code_update.robot 69f74d3afSCharles Paul Hofer 79f74d3afSCharles Paul HoferLibrary ../../lib/code_update_utils.py 8e78a4431SMichael WalshLibrary ../../lib/gen_robot_keyword.py 99f74d3afSCharles Paul HoferVariables ../../data/variables.py 1077c6919bSSivas SRRResource ../../lib/utils.robot 119f74d3afSCharles Paul HoferResource ../../lib/boot_utils.robot 129f74d3afSCharles Paul HoferResource code_update_utils.robot 139f74d3afSCharles Paul HoferResource ../../lib/code_update_utils.robot 141eb85f57SGeorge KeishingResource ../../lib/openbmc_ffdc.robot 151eb85f57SGeorge KeishingResource ../../lib/dump_utils.robot 161659f59eSGeorge KeishingResource ../../lib/ipmi_client.robot 178b70ddd5SRahul MaheshwariResource ../../lib/certificate_utils.robot 189f74d3afSCharles Paul Hofer 19d66c5dceSCharles Paul HoferSuite Setup Suite Setup Execution 20d66c5dceSCharles Paul Hofer 21d66c5dceSCharles Paul HoferTest Teardown Test Teardown Execution 229f74d3afSCharles Paul Hofer 2309712a1eSGeorge KeishingForce Tags BMC_Code_Update 2409712a1eSGeorge Keishing 259f74d3afSCharles Paul Hofer*** Variables *** 269f74d3afSCharles Paul Hofer 279f74d3afSCharles Paul Hofer${QUIET} ${1} 289f74d3afSCharles Paul Hofer${IMAGE_FILE_PATH} ${EMPTY} 29c1fa2bc9SCharles Paul Hofer${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} 30b7842a59SCharles Paul Hofer${SKIP_UPDATE_IF_ACTIVE} false 31d66c5dceSCharles Paul Hofer${dump_id} ${EMPTY} 32d66c5dceSCharles Paul Hofer${running_persistence_test} ${FALSE} 33d66c5dceSCharles Paul Hofer${test_errlog_text} AutoTestSimple 349f74d3afSCharles Paul Hofer 359f74d3afSCharles Paul Hofer*** Test Cases *** 369f74d3afSCharles Paul Hofer 3777c6919bSSivas SRRTest Basic BMC Performance Before BMC Code Update 3877c6919bSSivas SRR [Documentation] Check performance of memory, CPU & file system of BMC. 3977c6919bSSivas SRR [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update 4077c6919bSSivas SRR 4177c6919bSSivas SRR Open Connection And Log In 4277c6919bSSivas SRR Check BMC Performance 4377c6919bSSivas SRR 44d66c5dceSCharles Paul HoferPrepare Persistent Data 45d66c5dceSCharles Paul Hofer [Documentation] Set data that should persist across the code update. 46d66c5dceSCharles Paul Hofer [Tags] Prepare_Persistent_Data 47d66c5dceSCharles Paul Hofer 48d66c5dceSCharles Paul Hofer # Install the debug tarball. 49d66c5dceSCharles Paul Hofer BMC Execute Command rm -rf /tmp/tarball 50d66c5dceSCharles Paul Hofer Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH} 51d66c5dceSCharles Paul Hofer 52d66c5dceSCharles Paul Hofer # Create a dummy error log and dump. 53d66c5dceSCharles Paul Hofer BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text} 54d66c5dceSCharles Paul Hofer ${dump_id}= Create User Initiated Dump 55d66c5dceSCharles Paul Hofer Check Dump Existence ${dump_id} 56d66c5dceSCharles Paul Hofer Set Suite Variable ${dump_id} 57d66c5dceSCharles Paul Hofer 58d66c5dceSCharles Paul Hofer # Set persistent settings. 59d66c5dceSCharles Paul Hofer ${autoreboot_dict}= Create Dictionary data=${0} 60d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot 61d66c5dceSCharles Paul Hofer ... data=${autoreboot_dict} 62d66c5dceSCharles Paul Hofer ${onetime_dict}= Create Dictionary data=${0} 63d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled 64d66c5dceSCharles Paul Hofer ... data=${onetime_dict} 65d66c5dceSCharles Paul Hofer 66d66c5dceSCharles Paul Hofer # Let the remaining test cases know we are doing a persistence test so we 67d66c5dceSCharles Paul Hofer # do not delete logs. 68d66c5dceSCharles Paul Hofer Set Suite Variable ${running_persistence_test} ${TRUE} 69d66c5dceSCharles Paul Hofer 70d66c5dceSCharles Paul Hofer 719f74d3afSCharles Paul HoferREST BMC Code Update 729f74d3afSCharles Paul Hofer [Documentation] Do a BMC code update by uploading image on BMC via REST. 739f74d3afSCharles Paul Hofer [Tags] REST_BMC_Code_Update 74d66c5dceSCharles Paul Hofer [Teardown] REST BMC Code Update Teardown 759f74d3afSCharles Paul Hofer 768c7ada42SSweta Potthuri Run Keyword And Ignore Error List Installed Images BMC 778c7ada42SSweta Potthuri 7821845469SCharles Paul Hofer Upload And Activate Image ${IMAGE_FILE_PATH} 7921845469SCharles Paul Hofer ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 809f74d3afSCharles Paul Hofer OBMC Reboot (off) 81e43fb2f7SCharles Paul Hofer Verify Running BMC Image ${IMAGE_FILE_PATH} 829f74d3afSCharles Paul Hofer 839f74d3afSCharles Paul Hofer 84d66c5dceSCharles Paul HoferVerify Error Log Persistency 85d66c5dceSCharles Paul Hofer [Documentation] Check that the error log is still present after a 86d66c5dceSCharles Paul Hofer ... code update. 87d66c5dceSCharles Paul Hofer [Tags] Verify_Error_Log_Persistency 88d66c5dceSCharles Paul Hofer 89d66c5dceSCharles Paul Hofer ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list 90d66c5dceSCharles Paul Hofer Log To Console ${error_log_paths} 91d66c5dceSCharles Paul Hofer ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message 92d66c5dceSCharles Paul Hofer Should Be Equal ${test_error_message} 93d66c5dceSCharles Paul Hofer ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text} 94d66c5dceSCharles Paul Hofer Delete Error Log Entry @{error_log_paths}[-1] 95d66c5dceSCharles Paul Hofer 96d66c5dceSCharles Paul Hofer 97d66c5dceSCharles Paul HoferVerify BMC Dump Persistency 98d66c5dceSCharles Paul Hofer [Documentation] Check that the BMC dump present after a code update. 99d66c5dceSCharles Paul Hofer [Tags] Verify_BMC_Dump_Persistency 100d66c5dceSCharles Paul Hofer [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE} 101d66c5dceSCharles Paul Hofer 102d66c5dceSCharles Paul Hofer Check Dump Existence ${dump_id} 103d66c5dceSCharles Paul Hofer Delete BMC Dump ${dump_id} 104d66c5dceSCharles Paul Hofer 105d66c5dceSCharles Paul Hofer 106d66c5dceSCharles Paul HoferVerify Settings Persistency 107d66c5dceSCharles Paul Hofer [Documentation] Verify that the settings from 'Prepare Persistent Data' 108d66c5dceSCharles Paul Hofer ... are still set correctly after the code update. 109d66c5dceSCharles Paul Hofer [Tags] Verify_Settings_Persistency 110d66c5dceSCharles Paul Hofer 111d66c5dceSCharles Paul Hofer ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot 112d66c5dceSCharles Paul Hofer ... AutoReboot 113d66c5dceSCharles Paul Hofer Should Be Equal ${autoreboot_enabled} ${0} 114d66c5dceSCharles Paul Hofer ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time 115d66c5dceSCharles Paul Hofer ... Enabled 116d66c5dceSCharles Paul Hofer Should Be Equal ${onetime_enabled} ${0} 117d66c5dceSCharles Paul Hofer 118d66c5dceSCharles Paul Hofer # Set values back to their defaults 119d66c5dceSCharles Paul Hofer ${autoreboot_dict}= Create Dictionary data=${1} 120d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot 121d66c5dceSCharles Paul Hofer ... data=${autoreboot_dict} 122d66c5dceSCharles Paul Hofer ${onetime_dict}= Create Dictionary data=${1} 123d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled 124d66c5dceSCharles Paul Hofer ... data=${onetime_dict} 125d66c5dceSCharles Paul Hofer 126d66c5dceSCharles Paul Hofer 127c1fa2bc9SCharles Paul HoferUpload And Activate Multiple BMC Images 128c1fa2bc9SCharles Paul Hofer [Documentation] Upload another BMC image and verify that its state is 129c1fa2bc9SCharles Paul Hofer ... different from all others. 130c1fa2bc9SCharles Paul Hofer [Tags] Upload_And_Activate_Multiple_BMC_Images 131c1fa2bc9SCharles Paul Hofer [Template] Activate Image And Verify No Duplicate Priorities 132c1fa2bc9SCharles Paul Hofer [Setup] Upload And Activate Multiple BMC Images Setup 133c1fa2bc9SCharles Paul Hofer 134c1fa2bc9SCharles Paul Hofer # Image File Path Image Purpose 135c1fa2bc9SCharles Paul Hofer ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC} 136c1fa2bc9SCharles Paul Hofer 137c1fa2bc9SCharles Paul Hofer 13842f17468SCharles Paul HoferBMC Set Priority To Invalid Values 13942f17468SCharles Paul Hofer [Documentation] Attempt to set the priority of an image to an invalid 14042f17468SCharles Paul Hofer ... value and expect an error. 14142f17468SCharles Paul Hofer [Tags] BMC_Set_Priority_To_Invalid_Values 14242f17468SCharles Paul Hofer [Template] Set Priority To Invalid Value And Expect Error 14342f17468SCharles Paul Hofer 14442f17468SCharles Paul Hofer # Version Type Priority 14542f17468SCharles Paul Hofer ${VERSION_PURPOSE_BMC} ${-1} 14642f17468SCharles Paul Hofer ${VERSION_PURPOSE_BMC} ${256} 14742f17468SCharles Paul Hofer 14842f17468SCharles Paul Hofer 1499f74d3afSCharles Paul HoferDelete BMC Image 1509f74d3afSCharles Paul Hofer [Documentation] Delete a BMC image from the BMC flash chip. 1519f74d3afSCharles Paul Hofer [Tags] Delete_BMC_Image 1529f74d3afSCharles Paul Hofer 1539f74d3afSCharles Paul Hofer ${software_object}= Get Non Running BMC Software Object 1549f74d3afSCharles Paul Hofer Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} 155c1fa2bc9SCharles Paul Hofer 156c1fa2bc9SCharles Paul Hofer 15797ecb270SGeorge KeishingBMC Image Priority Attribute Test 15897ecb270SGeorge Keishing [Documentation] Set "Priority" attribute. 15997ecb270SGeorge Keishing [Tags] BMC_Image_Priority_Attribute_Test 16097ecb270SGeorge Keishing [Template] Temporarily Set BMC Attribute 16197ecb270SGeorge Keishing 16297ecb270SGeorge Keishing # Property Value 16397ecb270SGeorge Keishing Priority ${0} 16497ecb270SGeorge Keishing Priority ${1} 16597ecb270SGeorge Keishing Priority ${127} 16697ecb270SGeorge Keishing Priority ${255} 16797ecb270SGeorge Keishing 16897ecb270SGeorge Keishing 169e8dc5253SCharles Paul HoferDelete All Non Running BMC Images 170e8dc5253SCharles Paul Hofer [Documentation] Delete all non running BMC images. 171e8dc5253SCharles Paul Hofer [Tags] Delete_All_Non_Running_BMC_Images 172e8dc5253SCharles Paul Hofer 173e8dc5253SCharles Paul Hofer ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH} 1740889d43bSGeorge Keishing ... skip_if_active=true 175e8dc5253SCharles Paul Hofer Delete All Non Running BMC Images 176e8dc5253SCharles Paul Hofer 177e8dc5253SCharles Paul Hofer ${software_ids}= Get Software Objects Id 178e8dc5253SCharles Paul Hofer ... version_type=${VERSION_PURPOSE_BMC} 179e8dc5253SCharles Paul Hofer Should Not Contain ${software_ids} ${version_id} 180e8dc5253SCharles Paul Hofer 1811659f59eSGeorge Keishing 1821659f59eSGeorge KeishingVerify IPMI Disable Policy Post BMC Code Update 1831659f59eSGeorge Keishing [Documentation] Disable IPMI, update BMC and verify post-update. 1841659f59eSGeorge Keishing [Tags] Verify_IPMI_Disable_Policy_Post_BMC_Code_Update 1851659f59eSGeorge Keishing 1861659f59eSGeorge Keishing REST Power On 1871659f59eSGeorge Keishing 1881659f59eSGeorge Keishing Run Inband IPMI Standard Command lan set 1 access off 1891659f59eSGeorge Keishing Run Keyword and Expect Error *Unable to establish IPMI* 1901659f59eSGeorge Keishing ... Run External IPMI Standard Command lan print 1911659f59eSGeorge Keishing 1921659f59eSGeorge Keishing Upload And Activate Image ${IMAGE_FILE_PATH} 1931659f59eSGeorge Keishing ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 1941659f59eSGeorge Keishing OBMC Reboot (off) 1951659f59eSGeorge Keishing Verify Running BMC Image ${IMAGE_FILE_PATH} 1961659f59eSGeorge Keishing 1971659f59eSGeorge Keishing Run Keyword and Expect Error *Unable to establish IPMI* 1981659f59eSGeorge Keishing ... Run External IPMI Standard Command lan print 1991659f59eSGeorge Keishing 2001659f59eSGeorge Keishing 2018b70ddd5SRahul MaheshwariTest Certificate Persistency After BMC Code Update 2028b70ddd5SRahul Maheshwari [Documentation] Test certificate persistency after BMC update. 2038b70ddd5SRahul Maheshwari [Tags] Test_Certificate_Persistency_After_BMC_Code_Update 2048b70ddd5SRahul Maheshwari 205*fa146c43SRahul Maheshwari # Create certificate sub-directory in current working directory. 206*fa146c43SRahul Maheshwari Create Directory certificate_dir 207*fa146c43SRahul Maheshwari OperatingSystem.Directory Should Exist ${EXECDIR}${/}certificate_dir 208*fa146c43SRahul Maheshwari 2098b70ddd5SRahul Maheshwari ${cert_file_path}= Generate Certificate File Via Openssl 2108b70ddd5SRahul Maheshwari ... Valid Certificate Valid Privatekey 2118b70ddd5SRahul Maheshwari ${file_data}= OperatingSystem.Get Binary File ${cert_file_path} 2128b70ddd5SRahul Maheshwari ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} 2138b70ddd5SRahul Maheshwari 2148b70ddd5SRahul Maheshwari Install Certificate File On BMC ${CLIENT_CERTIFICATE_URI} 2158b70ddd5SRahul Maheshwari ... data=${file_data} 2168b70ddd5SRahul Maheshwari 2178b70ddd5SRahul Maheshwari ${bmc_cert_content}= Get Certificate File Content From BMC Client 2188b70ddd5SRahul Maheshwari Should Contain ${cert_file_content} ${bmc_cert_content} 2198b70ddd5SRahul Maheshwari 2208b70ddd5SRahul Maheshwari Upload And Activate Image ${IMAGE_FILE_PATH} 2218b70ddd5SRahul Maheshwari ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 2228b70ddd5SRahul Maheshwari OBMC Reboot (off) 2238b70ddd5SRahul Maheshwari Verify Running BMC Image ${IMAGE_FILE_PATH} 2248b70ddd5SRahul Maheshwari 2258b70ddd5SRahul Maheshwari ${bmc_cert_content}= Get Certificate File Content From BMC Client 2268b70ddd5SRahul Maheshwari Should Contain ${cert_file_content} ${bmc_cert_content} 2278b70ddd5SRahul Maheshwari 2288b70ddd5SRahul Maheshwari 22977c6919bSSivas SRRTest Basic BMC Performance After Code Update 23077c6919bSSivas SRR [Documentation] Check performance of memory, CPU & file system of BMC. 23177c6919bSSivas SRR [Tags] Test_Basic_BMC_Performance_After_Code_Update 23277c6919bSSivas SRR 23377c6919bSSivas SRR Open Connection And Log In 23477c6919bSSivas SRR Check BMC Performance 23577c6919bSSivas SRR 236e8dc5253SCharles Paul Hofer 237c1fa2bc9SCharles Paul Hofer*** Keywords *** 238c1fa2bc9SCharles Paul Hofer 23997ecb270SGeorge KeishingTemporarily Set BMC Attribute 24097ecb270SGeorge Keishing [Documentation] Update the BMC attribute value. 24197ecb270SGeorge Keishing [Arguments] ${attribute_name} ${attribute_value} 24297ecb270SGeorge Keishing 24397ecb270SGeorge Keishing # Description of argument(s): 24497ecb270SGeorge Keishing # attribute_name BMC software attribute name (e.g. "Priority"). 24597ecb270SGeorge Keishing # attribute_value Value to be written. 24697ecb270SGeorge Keishing 24797ecb270SGeorge Keishing ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC} 24897ecb270SGeorge Keishing ${init_bmc_properties}= Get Host Software Property ${image_ids[0]} 24997ecb270SGeorge Keishing ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]} 25097ecb270SGeorge Keishing 25197ecb270SGeorge Keishing Set Host Software Property ${image_ids[0]} ${attribute_name} 25297ecb270SGeorge Keishing ... ${attribute_value} 25397ecb270SGeorge Keishing 25497ecb270SGeorge Keishing ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]} 25597ecb270SGeorge Keishing Should Be Equal As Integers ${cur_bmc_properties["Priority"]} 25697ecb270SGeorge Keishing ... ${attribute_value} 25797ecb270SGeorge Keishing 25897ecb270SGeorge Keishing # Revert to to initial value. 25997ecb270SGeorge Keishing Set Host Software Property 26097ecb270SGeorge Keishing ... ${image_ids[0]} ${attribute_name} ${initial_priority} 26197ecb270SGeorge Keishing 26297ecb270SGeorge Keishing 263c1fa2bc9SCharles Paul HoferUpload And Activate Multiple BMC Images Setup 264c1fa2bc9SCharles Paul Hofer [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. 265c1fa2bc9SCharles Paul Hofer 266c1fa2bc9SCharles Paul Hofer Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} 2671eb85f57SGeorge Keishing 268d66c5dceSCharles Paul Hofer 269d66c5dceSCharles Paul HoferREST BMC Code Update Teardown 270d66c5dceSCharles Paul Hofer [Documentation] Do code update test teardown. 271d66c5dceSCharles Paul Hofer 272d66c5dceSCharles Paul Hofer FFDC On Test Case Fail 273d66c5dceSCharles Paul Hofer Run Keyword If Test Failed Fatal Error msg=Code update failed. 274d66c5dceSCharles Paul Hofer 275d66c5dceSCharles Paul Hofer 276d66c5dceSCharles Paul HoferSuite Setup Execution 2771eb85f57SGeorge Keishing [Documentation] Do code update test case setup. 2781eb85f57SGeorge Keishing # - Clean up all existing BMC dumps. 2791eb85f57SGeorge Keishing 280e78a4431SMichael Walsh Run Key Delete All Dumps ignore=1 281b926408eSCharles Paul Hofer Run Keyword And Ignore Error Smart Power Off 2820071549eSGeorge Keishing 283d66c5dceSCharles Paul HoferTest Teardown Execution 2840071549eSGeorge Keishing [Documentation] Do code update test case teardown. 2850071549eSGeorge Keishing # 1. Collect FFDC if test case failed. 2860071549eSGeorge Keishing # 2. Collect FFDC if test PASS but error log exists. 2870071549eSGeorge Keishing 288d66c5dceSCharles Paul Hofer # Don't delete our logs if we want to persist them for tests. 289d66c5dceSCharles Paul Hofer Return From Keyword If ${running_persistence_test} 290d66c5dceSCharles Paul Hofer 2910071549eSGeorge Keishing FFDC On Test Case Fail 2920071549eSGeorge Keishing Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC 29377c6919bSSivas SRR Close All Connections 294