George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Trigger code update to a target BMC. |
| 3 | ... Execution Method : |
| 4 | ... python -m robot -v OPENBMC_HOST:<hostname> |
| 5 | ... -v FILE_PATH:<path/*all.tar> update_bmc.robot |
| 6 | ... |
| 7 | ... Code update method BMC using REST |
| 8 | ... Update work flow sequence: |
| 9 | ... - User input BMC File existence check |
| 10 | ... - Ping Test and REST authentication |
George Keishing | 8db0e1b | 2016-10-20 13:46:54 -0500 | [diff] [blame] | 11 | ... - Set Host Power host setting Policy to RESTORE_LAST_STATE |
| 12 | ... On reboot this policy would ensure the BMC comes |
| 13 | ... online and stays at HOST_POWERED_OFF state. |
George Keishing | dc5aa58e9 | 2016-09-27 01:35:11 -0500 | [diff] [blame] | 14 | ... - Issue poweroff |
George Keishing | 0bd59f1 | 2016-12-14 10:39:21 -0600 | [diff] [blame] | 15 | ... - Prune archived journal logs |
George Keishing | dc5aa58e9 | 2016-09-27 01:35:11 -0500 | [diff] [blame] | 16 | ... - Prepare for Update |
George Keishing | dc5aa58e9 | 2016-09-27 01:35:11 -0500 | [diff] [blame] | 17 | ... - Wait for BMC to come online clean |
George Keishing | 1b15020 | 2016-09-29 08:51:58 -0500 | [diff] [blame] | 18 | ... - Wait for BMC_READY state |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 19 | ... - Apply preserve BMC Network setting |
| 20 | ... - SCP image to BMC |
| 21 | ... - Activate the flash image |
| 22 | ... - Warm Reset BMC to activate code |
| 23 | ... - Wait for BMC to come online time out 30 minutes |
| 24 | ... - Version check post update |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 25 | ... - Identify REST url post update |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 26 | |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 27 | Library ../../lib/gen_robot_keyword.py |
| 28 | Library String |
Sweta Potthuri | 3a8ae26 | 2017-03-10 00:02:09 -0600 | [diff] [blame] | 29 | |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 30 | Resource code_update_utils.robot |
| 31 | Resource ../../lib/boot/boot_resource_master.robot |
| 32 | Resource ../../lib/state_manager.robot |
| 33 | Resource ../../lib/utils.robot |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 34 | Resource ../../lib/list_utils.robot |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 35 | Resource ../../lib/openbmc_ffdc.robot |
| 36 | Resource ../../extended/obmc_boot_test_resource.robot |
| 37 | |
| 38 | Test Teardown Run Key FFDC On Test Case Fail |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 39 | |
| 40 | *** Variables *** |
| 41 | |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 42 | ${QUIET} ${1} |
| 43 | # Boot failures are not acceptable so we set the threshold to 0. |
| 44 | ${boot_fail_threshold} ${0} |
| 45 | |
| 46 | ${FILE_PATH} ${EMPTY} |
| 47 | ${FORCE_UPDATE} ${0} |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 48 | ${REST_URL_FILE_PATH} ${EMPTY} |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 49 | |
| 50 | # There are two reboots issued by code update. |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 51 | ${MAX_BOOT_COUNT} ${2} |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 52 | |
Gunnar Mills | 7c8923f | 2016-12-12 21:19:52 -0600 | [diff] [blame] | 53 | *** Test Cases *** |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 54 | |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 55 | Test Basic BMC Performance Before Code Update |
| 56 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 57 | [Tags] Test_Basic_BMC_Performance_Before_Code_Update |
| 58 | Open Connection And Log In |
| 59 | Check BMC CPU Performance |
| 60 | Check BMC Mem Performance |
| 61 | Check BMC File System Performance |
| 62 | |
Sivas SRR | 01262bd | 2017-03-19 10:00:23 -0500 | [diff] [blame] | 63 | Check Core Dump Exist Before Code Update |
| 64 | [Documentation] Check core dump existence on BMC before code update. |
| 65 | [Tags] Check_Core_Dump_Exist_Before_Code_Update |
| 66 | Check For Core Dumps |
| 67 | |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 68 | Check URLs Before Code Update |
| 69 | [Documentation] Check available URLs before code update. |
| 70 | [Tags] Check_URLs_Before_Code_Update |
| 71 | ${url_list}= Get URL List ${OPENBMC_BASE_URI} |
| 72 | Set Global Variable ${URL_BEFORE_CU} ${url_list} |
| 73 | |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 74 | Initiate Code Update BMC |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 75 | [Documentation] Initiate a code update on the BMC. |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 76 | [Tags] Initiate_Code_Update_BMC |
George Keishing | 5e870cd | 2016-08-24 10:05:47 -0500 | [diff] [blame] | 77 | |
George Keishing | fb10f49 | 2017-03-07 21:34:18 -0600 | [diff] [blame] | 78 | # TODO: Disabling version check until new logic are in place. |
| 79 | # ${status}= Run Keyword and Return Status |
| 80 | # ... Validate BMC Version before |
| 81 | |
| 82 | # Run Keyword if '${status}' == '${False}' |
| 83 | # ... Pass Execution Same Driver version installed |
George Keishing | 50787fc | 2016-09-21 03:44:26 -0500 | [diff] [blame] | 84 | |
George Keishing | 5e78582 | 2017-04-04 10:15:50 -0500 | [diff] [blame] | 85 | # Enable user to bypass prerequisite operations. |
| 86 | # Use cases for if BMC is not in working state. |
| 87 | Run Keyword If ${FORCE_UPDATE} == ${0} |
| 88 | ... Prepare BMC For Update |
George Keishing | 2582bee | 2016-11-17 21:41:49 -0600 | [diff] [blame] | 89 | |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 90 | Run Key U Preserve BMC Network Setting |
| 91 | Run Key SCP Tar Image File To BMC \ ${FILE_PATH} |
| 92 | Run Key Activate BMC Flash Image |
| 93 | Run Key U OBMC Boot Test \ OBMC Reboot (off) |
| 94 | Run Key U Check Boot Count And Time |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 95 | Run Keyword If ${BOOT_COUNT} == ${1} |
Michael Walsh | 5ce9805 | 2017-04-12 16:40:31 -0500 | [diff] [blame] | 96 | ... Log Boot time not updated by kernel. level=WARN |
Sivas SRR | ea85d1f | 2016-11-13 22:44:28 -0600 | [diff] [blame] | 97 | |
George Keishing | a126e21 | 2017-03-24 08:07:17 -0500 | [diff] [blame] | 98 | Install BMC Debug Tarball |
| 99 | [Documentation] Install the downloaded debug tarball on BMC. |
| 100 | [Tags] Install_BMC_Debug_Tarball |
| 101 | Run Keyword If '${DEBUG_TARBALL_PATH}' != '${EMPTY}' |
| 102 | ... Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH} |
| 103 | |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 104 | Compare URLs Before And After Code Update |
| 105 | [Documentation] Compare URLs before and after code update. |
| 106 | [Tags] Compare_URLs_Before_And_After_Code_Update |
| 107 | |
| 108 | ${url_after_cu}= Get URL List ${OPENBMC_BASE_URI} |
| 109 | Compare URL List After Code Update ${URL_BEFORE_CU} ${url_after_cu} |
George Keishing | a126e21 | 2017-03-24 08:07:17 -0500 | [diff] [blame] | 110 | |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 111 | Test Basic BMC Performance At Ready State |
| 112 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 113 | [Tags] Test_Basic_BMC_Performance_At_Ready_State |
George Keishing | 128643a | 2016-12-15 11:36:46 -0600 | [diff] [blame] | 114 | Open Connection And Log In |
Sivas SRR | ea85d1f | 2016-11-13 22:44:28 -0600 | [diff] [blame] | 115 | Check BMC CPU Performance |
| 116 | Check BMC Mem Performance |
Sivas SRR | aca5571 | 2016-12-21 04:32:35 -0600 | [diff] [blame] | 117 | Check BMC File System Performance |
| 118 | |
Sivas SRR | 01262bd | 2017-03-19 10:00:23 -0500 | [diff] [blame] | 119 | Check Core Dump Exist After Code Update |
| 120 | [Documentation] Check core dump existence on BMC after code update. |
| 121 | [Tags] Check_Core_Dump_Exist_After_Code_Update |
| 122 | Check For Core Dumps |
| 123 | |
| 124 | Enable Core Dump File Size To Be Unlimited |
| 125 | [Documentation] Set core dump file size to unlimited. |
| 126 | [Tags] Enable_Core_Dump_File_size_To_Be_unlimited |
| 127 | Set Core Dump File Size Unlimited |
| 128 | |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 129 | *** Keywords *** |
| 130 | |
George Keishing | 5e78582 | 2017-04-04 10:15:50 -0500 | [diff] [blame] | 131 | Prepare BMC For Update |
| 132 | [Documentation] Prerequisite operation before code update. |
| 133 | Check Boot Count And Time |
| 134 | Prune Journal Log |
| 135 | Power Off Request |
| 136 | Set Policy Setting RESTORE_LAST_STATE |
| 137 | Prepare For Update |
| 138 | Check If BMC is Up 20 min 10 sec |
| 139 | Check Boot Count And Time |
| 140 | |
| 141 | # Temporary fix for lab migration for driver which is booted with |
| 142 | # BMC state "/xyz/openbmc_project/state/BMC0/". |
| 143 | ${status}= Run Keyword And Return Status Temp BMC URI Check |
| 144 | Run Keyword If '${status}' == '${False}' |
| 145 | ... Wait For BMC Ready |
| 146 | ... ELSE Wait For Temp BMC Ready |
| 147 | |
| 148 | # TODO: openbmc/openbmc#815 |
| 149 | Sleep 1 min |
| 150 | |
| 151 | |
George Keishing | 80dd5af | 2017-02-08 07:01:25 -0600 | [diff] [blame] | 152 | Check Boot Count And Time |
| 153 | [Documentation] Check for unexpected reboots. |
| 154 | Set BMC Reset Reference Time |
| 155 | Log To Console \n Boot Count: ${BOOT_COUNT} |
| 156 | Log To Console \n Boot Time: ${BOOT_TIME} |
| 157 | Run Keyword If ${BOOT_COUNT} > ${MAX_BOOT_COUNT} |
| 158 | ... Log Phantom Reboot!!! Unexpected reboot detected level=WARN |
| 159 | |
George Keishing | 3cb1ade | 2017-03-23 09:03:06 -0500 | [diff] [blame] | 160 | Temp BMC URI Check |
| 161 | [Documentation] Check for transient "BMC0" interface. |
| 162 | ${resp}= Openbmc Get Request /xyz/openbmc_project/state/BMC0/ |
| 163 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 164 | |
| 165 | Check Temp BMC State |
| 166 | [Documentation] BMC state should be "Ready". |
| 167 | # quiet - Suppress REST output logging to console. |
| 168 | ${state}= |
| 169 | ... Read Attribute /xyz/openbmc_project/state/BMC0/ CurrentBMCState |
| 170 | Should Be Equal Ready ${state.rsplit('.', 1)[1]} |
| 171 | |
| 172 | Wait For Temp BMC Ready |
| 173 | [Documentation] Check for BMC "Ready" until timedout. |
| 174 | Wait Until Keyword Succeeds |
| 175 | ... 10 min 10 sec Check Temp BMC State |
| 176 | |
Rahul Maheshwari | 724e591 | 2017-04-20 06:04:37 -0500 | [diff] [blame] | 177 | Compare URL List After Code Update |
| 178 | [Documentation] Compare URL list before and after code update. |
| 179 | [Arguments] ${url_before_cu} ${url_after_cu} |
| 180 | # Description of arguments: |
| 181 | # url_before_cu List of URLs available before code update. |
| 182 | # url_after_cu List of URLs available after code update. |
| 183 | |
| 184 | ${url_removed_list}= Subtract Lists ${url_before_cu} ${url_after_cu} |
| 185 | ${url_added_list}= Subtract Lists ${url_after_cu} ${url_before_cu} |
| 186 | Log ${url_removed_list} |
| 187 | Log ${url_added_list} |
| 188 | |
| 189 | Return From Keyword If '${REST_URL_FILE_PATH}' == '${EMPTY}' |
| 190 | |
| 191 | Return From Keyword If |
| 192 | ... ${url_removed_list} == [] and ${url_added_list} == [] |
| 193 | |
| 194 | Create File ${REST_URL_FILE_PATH} URL Removed${\n} |
| 195 | Append To File ${REST_URL_FILE_PATH} [${url_removed_list}] |
| 196 | Append To File ${REST_URL_FILE_PATH} ${\n}URL Added${\n} |
| 197 | Append To File ${REST_URL_FILE_PATH} [${url_added_list}] |