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 168b70ddd5SRahul MaheshwariResource ../../lib/certificate_utils.robot 179f74d3afSCharles Paul Hofer 18d66c5dceSCharles Paul HoferSuite Setup Suite Setup Execution 19d66c5dceSCharles Paul Hofer 20d66c5dceSCharles Paul HoferTest Teardown Test Teardown Execution 219f74d3afSCharles Paul Hofer 227e854715SGeorge Keishing# Force the test to timedout to prevent test hanging. 237e854715SGeorge KeishingTest Timeout 30 minutes 247e854715SGeorge Keishing 25*6fb70d98SMatt FischerTest Tags BMC_Code_Update 2609712a1eSGeorge Keishing 279f74d3afSCharles Paul Hofer*** Variables *** 289f74d3afSCharles Paul Hofer 299f74d3afSCharles Paul Hofer${QUIET} ${1} 309f74d3afSCharles Paul Hofer${IMAGE_FILE_PATH} ${EMPTY} 31c1fa2bc9SCharles Paul Hofer${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} 32b7842a59SCharles Paul Hofer${SKIP_UPDATE_IF_ACTIVE} false 33d66c5dceSCharles Paul Hofer${dump_id} ${EMPTY} 34d66c5dceSCharles Paul Hofer${running_persistence_test} ${FALSE} 35d66c5dceSCharles Paul Hofer${test_errlog_text} AutoTestSimple 369f74d3afSCharles Paul Hofer 379f74d3afSCharles Paul Hofer*** Test Cases *** 389f74d3afSCharles Paul Hofer 3977c6919bSSivas SRRTest Basic BMC Performance Before BMC Code Update 4077c6919bSSivas SRR [Documentation] Check performance of memory, CPU & file system of BMC. 4177c6919bSSivas SRR [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update 4277c6919bSSivas SRR 4377c6919bSSivas SRR Open Connection And Log In 4477c6919bSSivas SRR Check BMC Performance 4577c6919bSSivas SRR 46d66c5dceSCharles Paul HoferPrepare Persistent Data 47d66c5dceSCharles Paul Hofer [Documentation] Set data that should persist across the code update. 48d66c5dceSCharles Paul Hofer [Tags] Prepare_Persistent_Data 49d66c5dceSCharles Paul Hofer 50d66c5dceSCharles Paul Hofer # Install the debug tarball. 51d66c5dceSCharles Paul Hofer BMC Execute Command rm -rf /tmp/tarball 52d66c5dceSCharles Paul Hofer Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH} 53d66c5dceSCharles Paul Hofer 54d66c5dceSCharles Paul Hofer # Create a dummy error log and dump. 55d66c5dceSCharles Paul Hofer BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text} 56d66c5dceSCharles Paul Hofer ${dump_id}= Create User Initiated Dump 57d66c5dceSCharles Paul Hofer Check Dump Existence ${dump_id} 58d66c5dceSCharles Paul Hofer Set Suite Variable ${dump_id} 59d66c5dceSCharles Paul Hofer 60d66c5dceSCharles Paul Hofer # Set persistent settings. 61d66c5dceSCharles Paul Hofer ${autoreboot_dict}= Create Dictionary data=${0} 62d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot 63d66c5dceSCharles Paul Hofer ... data=${autoreboot_dict} 64d66c5dceSCharles Paul Hofer ${onetime_dict}= Create Dictionary data=${0} 65d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled 66d66c5dceSCharles Paul Hofer ... data=${onetime_dict} 67d66c5dceSCharles Paul Hofer 68d66c5dceSCharles Paul Hofer # Let the remaining test cases know we are doing a persistence test so we 69d66c5dceSCharles Paul Hofer # do not delete logs. 70d66c5dceSCharles Paul Hofer Set Suite Variable ${running_persistence_test} ${TRUE} 71d66c5dceSCharles Paul Hofer 72d66c5dceSCharles Paul Hofer 739f74d3afSCharles Paul HoferREST BMC Code Update 749f74d3afSCharles Paul Hofer [Documentation] Do a BMC code update by uploading image on BMC via REST. 759f74d3afSCharles Paul Hofer [Tags] REST_BMC_Code_Update 76d66c5dceSCharles Paul Hofer [Teardown] REST BMC Code Update Teardown 779f74d3afSCharles Paul Hofer 788c7ada42SSweta Potthuri Run Keyword And Ignore Error List Installed Images BMC 79fe96e64eSGeorge Keishing Run Keyword And Ignore Error Set ApplyTime policy=OnReset 808c7ada42SSweta Potthuri 818010d867SGeorge Keishing ${image_version}= Get Version Tar ${IMAGE_FILE_PATH} 82c81c6aebSMichael Walsh ${bmc_release_info}= Get BMC Release Info 83c81c6aebSMichael Walsh ${functional_version}= Set Variable ${bmc_release_info['version_id']} 84c81c6aebSMichael Walsh Rprint Vars image_version functional_version 858010d867SGeorge Keishing 868010d867SGeorge Keishing # Check if the existing firmware is functional. 87c81c6aebSMichael Walsh Pass Execution If '${functional_version}' == '${image_version}' 88c81c6aebSMichael Walsh ... The existing ${image_version} firmware is already functional. 898010d867SGeorge Keishing 9073cae6e4Ssusilsi7 Run Keyword And Ignore Error Delete Only BMC Image 9173cae6e4Ssusilsi7 9221845469SCharles Paul Hofer Upload And Activate Image ${IMAGE_FILE_PATH} 9321845469SCharles Paul Hofer ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 949f74d3afSCharles Paul Hofer OBMC Reboot (off) 95e43fb2f7SCharles Paul Hofer Verify Running BMC Image ${IMAGE_FILE_PATH} 96da339e6cSSivas SRR BMC Execute Command cd /etc ; cat host.conf hosts hostname print_out=1 979f74d3afSCharles Paul Hofer 989f74d3afSCharles Paul Hofer 99d66c5dceSCharles Paul HoferVerify Error Log Persistency 100d66c5dceSCharles Paul Hofer [Documentation] Check that the error log is still present after a 101d66c5dceSCharles Paul Hofer ... code update. 102d66c5dceSCharles Paul Hofer [Tags] Verify_Error_Log_Persistency 103d66c5dceSCharles Paul Hofer 104a8800da7SSteven Sombar ${error_log_paths}= Read Properties ${BMC_LOGGING_ENTRY}list 105d66c5dceSCharles Paul Hofer Log To Console ${error_log_paths} 106d66c5dceSCharles Paul Hofer ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message 107d66c5dceSCharles Paul Hofer Should Be Equal ${test_error_message} 108d66c5dceSCharles Paul Hofer ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text} 109d66c5dceSCharles Paul Hofer Delete Error Log Entry @{error_log_paths}[-1] 110d66c5dceSCharles Paul Hofer 111d66c5dceSCharles Paul Hofer 112d66c5dceSCharles Paul HoferVerify BMC Dump Persistency 113d66c5dceSCharles Paul Hofer [Documentation] Check that the BMC dump present after a code update. 114d66c5dceSCharles Paul Hofer [Tags] Verify_BMC_Dump_Persistency 115d66c5dceSCharles Paul Hofer [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE} 116d66c5dceSCharles Paul Hofer 117d66c5dceSCharles Paul Hofer Check Dump Existence ${dump_id} 118d66c5dceSCharles Paul Hofer Delete BMC Dump ${dump_id} 119d66c5dceSCharles Paul Hofer 120d66c5dceSCharles Paul Hofer 121d66c5dceSCharles Paul HoferVerify Settings Persistency 122d66c5dceSCharles Paul Hofer [Documentation] Verify that the settings from 'Prepare Persistent Data' 123d66c5dceSCharles Paul Hofer ... are still set correctly after the code update. 124d66c5dceSCharles Paul Hofer [Tags] Verify_Settings_Persistency 125d66c5dceSCharles Paul Hofer 126d66c5dceSCharles Paul Hofer ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot 127d66c5dceSCharles Paul Hofer ... AutoReboot 128d66c5dceSCharles Paul Hofer Should Be Equal ${autoreboot_enabled} ${0} 129d66c5dceSCharles Paul Hofer ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time 130d66c5dceSCharles Paul Hofer ... Enabled 131d66c5dceSCharles Paul Hofer Should Be Equal ${onetime_enabled} ${0} 132d66c5dceSCharles Paul Hofer 133d66c5dceSCharles Paul Hofer # Set values back to their defaults 134d66c5dceSCharles Paul Hofer ${autoreboot_dict}= Create Dictionary data=${1} 135d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot 136d66c5dceSCharles Paul Hofer ... data=${autoreboot_dict} 137d66c5dceSCharles Paul Hofer ${onetime_dict}= Create Dictionary data=${1} 138d66c5dceSCharles Paul Hofer Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled 139d66c5dceSCharles Paul Hofer ... data=${onetime_dict} 140d66c5dceSCharles Paul Hofer 141d66c5dceSCharles Paul Hofer 142c1fa2bc9SCharles Paul HoferUpload And Activate Multiple BMC Images 143c1fa2bc9SCharles Paul Hofer [Documentation] Upload another BMC image and verify that its state is 144c1fa2bc9SCharles Paul Hofer ... different from all others. 145c1fa2bc9SCharles Paul Hofer [Tags] Upload_And_Activate_Multiple_BMC_Images 146c1fa2bc9SCharles Paul Hofer [Template] Activate Image And Verify No Duplicate Priorities 147c1fa2bc9SCharles Paul Hofer [Setup] Upload And Activate Multiple BMC Images Setup 148c1fa2bc9SCharles Paul Hofer 149c1fa2bc9SCharles Paul Hofer # Image File Path Image Purpose 150c1fa2bc9SCharles Paul Hofer ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC} 151c1fa2bc9SCharles Paul Hofer 152c1fa2bc9SCharles Paul Hofer 15342f17468SCharles Paul HoferBMC Set Priority To Invalid Values 15442f17468SCharles Paul Hofer [Documentation] Attempt to set the priority of an image to an invalid 15542f17468SCharles Paul Hofer ... value and expect an error. 15642f17468SCharles Paul Hofer [Tags] BMC_Set_Priority_To_Invalid_Values 15742f17468SCharles Paul Hofer [Template] Set Priority To Invalid Value And Expect Error 15842f17468SCharles Paul Hofer 15942f17468SCharles Paul Hofer # Version Type Priority 16042f17468SCharles Paul Hofer ${VERSION_PURPOSE_BMC} ${-1} 16142f17468SCharles Paul Hofer ${VERSION_PURPOSE_BMC} ${256} 16242f17468SCharles Paul Hofer 16342f17468SCharles Paul Hofer 1649f74d3afSCharles Paul HoferDelete BMC Image 1659f74d3afSCharles Paul Hofer [Documentation] Delete a BMC image from the BMC flash chip. 1669f74d3afSCharles Paul Hofer [Tags] Delete_BMC_Image 1679f74d3afSCharles Paul Hofer 1689f74d3afSCharles Paul Hofer ${software_object}= Get Non Running BMC Software Object 1699f74d3afSCharles Paul Hofer Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} 170c1fa2bc9SCharles Paul Hofer 171c1fa2bc9SCharles Paul Hofer 17297ecb270SGeorge KeishingBMC Image Priority Attribute Test 17397ecb270SGeorge Keishing [Documentation] Set "Priority" attribute. 17497ecb270SGeorge Keishing [Tags] BMC_Image_Priority_Attribute_Test 17597ecb270SGeorge Keishing [Template] Temporarily Set BMC Attribute 17697ecb270SGeorge Keishing 17797ecb270SGeorge Keishing # Property Value 178872d69faSGeorge Keishing Priority ${False} 179872d69faSGeorge Keishing Priority ${True} 18097ecb270SGeorge Keishing Priority ${0} 18197ecb270SGeorge Keishing Priority ${1} 18297ecb270SGeorge Keishing Priority ${127} 18397ecb270SGeorge Keishing Priority ${255} 18497ecb270SGeorge Keishing 18597ecb270SGeorge Keishing 186e8dc5253SCharles Paul HoferDelete All Non Running BMC Images 187e8dc5253SCharles Paul Hofer [Documentation] Delete all non running BMC images. 188e8dc5253SCharles Paul Hofer [Tags] Delete_All_Non_Running_BMC_Images 189e8dc5253SCharles Paul Hofer 190e8dc5253SCharles Paul Hofer ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH} 1910889d43bSGeorge Keishing ... skip_if_active=true 192e8dc5253SCharles Paul Hofer Delete All Non Running BMC Images 193e8dc5253SCharles Paul Hofer 194e8dc5253SCharles Paul Hofer ${software_ids}= Get Software Objects Id 195e8dc5253SCharles Paul Hofer ... version_type=${VERSION_PURPOSE_BMC} 196e8dc5253SCharles Paul Hofer Should Not Contain ${software_ids} ${version_id} 197e8dc5253SCharles Paul Hofer 1981659f59eSGeorge Keishing 1998b70ddd5SRahul MaheshwariTest Certificate Persistency After BMC Code Update 2008b70ddd5SRahul Maheshwari [Documentation] Test certificate persistency after BMC update. 2018b70ddd5SRahul Maheshwari [Tags] Test_Certificate_Persistency_After_BMC_Code_Update 2028b70ddd5SRahul Maheshwari 203fa146c43SRahul Maheshwari # Create certificate sub-directory in current working directory. 204fa146c43SRahul Maheshwari Create Directory certificate_dir 205fa146c43SRahul Maheshwari OperatingSystem.Directory Should Exist ${EXECDIR}${/}certificate_dir 206fa146c43SRahul Maheshwari 2078b70ddd5SRahul Maheshwari ${cert_file_path}= Generate Certificate File Via Openssl 2088b70ddd5SRahul Maheshwari ... Valid Certificate Valid Privatekey 2098b70ddd5SRahul Maheshwari ${file_data}= OperatingSystem.Get Binary File ${cert_file_path} 2108b70ddd5SRahul Maheshwari ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} 2118b70ddd5SRahul Maheshwari 2126a849ad2SRahul Maheshwari Redfish.Login 2136a849ad2SRahul Maheshwari ${cert_id}= Install Certificate File On BMC ${REDFISH_CA_CERTIFICATE_URI} ok data=${file_data} 2146a849ad2SRahul Maheshwari Logging Installed certificate id: ${cert_id} 2158b70ddd5SRahul Maheshwari 2166a849ad2SRahul Maheshwari # Adding delay after certificate installation. 2176a849ad2SRahul Maheshwari Sleep 30s 2186a849ad2SRahul Maheshwari 2196a849ad2SRahul Maheshwari ${bmc_cert_content}= redfish_utils.Get Attribute 2204d430283Sganesanb ... /redfish/v1/Managers/${MANAGER_ID}/Truststore/Certificates/${cert_id} CertificateString 2218b70ddd5SRahul Maheshwari Should Contain ${cert_file_content} ${bmc_cert_content} 2228b70ddd5SRahul Maheshwari 2238b70ddd5SRahul Maheshwari Upload And Activate Image ${IMAGE_FILE_PATH} 2248b70ddd5SRahul Maheshwari ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 2258b70ddd5SRahul Maheshwari OBMC Reboot (off) 2268b70ddd5SRahul Maheshwari Verify Running BMC Image ${IMAGE_FILE_PATH} 2278b70ddd5SRahul Maheshwari 2286a849ad2SRahul Maheshwari Redfish.Login 2296a849ad2SRahul Maheshwari ${bmc_cert_content}= redfish_utils.Get Attribute 2306a849ad2SRahul Maheshwari ... ${REDFISH_CA_CERTIFICATE_URI}/${cert_id} CertificateString 2318b70ddd5SRahul Maheshwari Should Contain ${cert_file_content} ${bmc_cert_content} 2328b70ddd5SRahul Maheshwari 2336a849ad2SRahul Maheshwari Redfish.Logout 2346a849ad2SRahul Maheshwari 2358b70ddd5SRahul Maheshwari 23677c6919bSSivas SRRTest Basic BMC Performance After Code Update 23777c6919bSSivas SRR [Documentation] Check performance of memory, CPU & file system of BMC. 23877c6919bSSivas SRR [Tags] Test_Basic_BMC_Performance_After_Code_Update 23977c6919bSSivas SRR 24077c6919bSSivas SRR Open Connection And Log In 24177c6919bSSivas SRR Check BMC Performance 24277c6919bSSivas SRR 243e8dc5253SCharles Paul Hofer 244c1fa2bc9SCharles Paul Hofer*** Keywords *** 245c1fa2bc9SCharles Paul Hofer 24697ecb270SGeorge KeishingTemporarily Set BMC Attribute 24797ecb270SGeorge Keishing [Documentation] Update the BMC attribute value. 24897ecb270SGeorge Keishing [Arguments] ${attribute_name} ${attribute_value} 24997ecb270SGeorge Keishing 25097ecb270SGeorge Keishing # Description of argument(s): 25197ecb270SGeorge Keishing # attribute_name BMC software attribute name (e.g. "Priority"). 25297ecb270SGeorge Keishing # attribute_value Value to be written. 25397ecb270SGeorge Keishing 25497ecb270SGeorge Keishing ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC} 25597ecb270SGeorge Keishing ${init_bmc_properties}= Get Host Software Property ${image_ids[0]} 25697ecb270SGeorge Keishing ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]} 25797ecb270SGeorge Keishing 25897ecb270SGeorge Keishing Set Host Software Property ${image_ids[0]} ${attribute_name} 25997ecb270SGeorge Keishing ... ${attribute_value} 26097ecb270SGeorge Keishing 26197ecb270SGeorge Keishing ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]} 26297ecb270SGeorge Keishing Should Be Equal As Integers ${cur_bmc_properties["Priority"]} 26397ecb270SGeorge Keishing ... ${attribute_value} 26497ecb270SGeorge Keishing 26597ecb270SGeorge Keishing # Revert to to initial value. 26697ecb270SGeorge Keishing Set Host Software Property 26797ecb270SGeorge Keishing ... ${image_ids[0]} ${attribute_name} ${initial_priority} 26897ecb270SGeorge Keishing 26997ecb270SGeorge Keishing 270c1fa2bc9SCharles Paul HoferUpload And Activate Multiple BMC Images Setup 271c1fa2bc9SCharles Paul Hofer [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. 272c1fa2bc9SCharles Paul Hofer 273c1fa2bc9SCharles Paul Hofer Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} 2741eb85f57SGeorge Keishing 275d66c5dceSCharles Paul Hofer 27673cae6e4Ssusilsi7Delete Only BMC Image 27773cae6e4Ssusilsi7 [Documentation] Delete a BMC image from the BMC flash chip. 27873cae6e4Ssusilsi7 27973cae6e4Ssusilsi7 ${software_object}= Get Non Running BMC Software Object 28073cae6e4Ssusilsi7 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} 28173cae6e4Ssusilsi7 28273cae6e4Ssusilsi7 283d66c5dceSCharles Paul HoferREST BMC Code Update Teardown 284d66c5dceSCharles Paul Hofer [Documentation] Do code update test teardown. 285d66c5dceSCharles Paul Hofer 286d66c5dceSCharles Paul Hofer FFDC On Test Case Fail 287d66c5dceSCharles Paul Hofer Run Keyword If Test Failed Fatal Error msg=Code update failed. 288d66c5dceSCharles Paul Hofer 289d66c5dceSCharles Paul Hofer 290d66c5dceSCharles Paul HoferSuite Setup Execution 2911eb85f57SGeorge Keishing [Documentation] Do code update test case setup. 2921eb85f57SGeorge Keishing # - Clean up all existing BMC dumps. 2931eb85f57SGeorge Keishing 294e78a4431SMichael Walsh Run Key Delete All Dumps ignore=1 295b926408eSCharles Paul Hofer Run Keyword And Ignore Error Smart Power Off 2960071549eSGeorge Keishing 297d66c5dceSCharles Paul HoferTest Teardown Execution 2980071549eSGeorge Keishing [Documentation] Do code update test case teardown. 2990071549eSGeorge Keishing # 1. Collect FFDC if test case failed. 3000071549eSGeorge Keishing # 2. Collect FFDC if test PASS but error log exists. 3010071549eSGeorge Keishing 302d66c5dceSCharles Paul Hofer # Don't delete our logs if we want to persist them for tests. 303d66c5dceSCharles Paul Hofer Return From Keyword If ${running_persistence_test} 304d66c5dceSCharles Paul Hofer 3050071549eSGeorge Keishing FFDC On Test Case Fail 3060071549eSGeorge Keishing Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC 30777c6919bSSivas SRR Close All Connections 308