blob: b3b05c13d3413e849cb4a6913a9fa8adb0e05d62 [file] [log] [blame]
George Keishing5e870cd2016-08-24 10:05:47 -05001*** Settings ***
2Documentation 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 Keishingefc3ff22017-12-12 11:49:25 -060011... - Set Host Power host setting Policy to ALWAYS_POWER_OFF
George Keishing8db0e1b2016-10-20 13:46:54 -050012... On reboot this policy would ensure the BMC comes
13... online and stays at HOST_POWERED_OFF state.
George Keishingdc5aa58e92016-09-27 01:35:11 -050014... - Issue poweroff
George Keishing0bd59f12016-12-14 10:39:21 -060015... - Prune archived journal logs
George Keishingdc5aa58e92016-09-27 01:35:11 -050016... - Prepare for Update
George Keishingdc5aa58e92016-09-27 01:35:11 -050017... - Wait for BMC to come online clean
George Keishing1b150202016-09-29 08:51:58 -050018... - Wait for BMC_READY state
George Keishing5e870cd2016-08-24 10:05:47 -050019... - 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 Maheshwari724e5912017-04-20 06:04:37 -050025... - Identify REST url post update
George Keishing5e870cd2016-08-24 10:05:47 -050026
Michael Walsh5ce98052017-04-12 16:40:31 -050027Library ../../lib/gen_robot_keyword.py
28Library String
Sweta Potthuri3a8ae262017-03-10 00:02:09 -060029
Michael Walsh5ce98052017-04-12 16:40:31 -050030Resource code_update_utils.robot
Michael Walsh5ce98052017-04-12 16:40:31 -050031Resource ../../lib/state_manager.robot
32Resource ../../lib/utils.robot
Rahul Maheshwari724e5912017-04-20 06:04:37 -050033Resource ../../lib/list_utils.robot
Michael Walsh5ce98052017-04-12 16:40:31 -050034Resource ../../lib/openbmc_ffdc.robot
35Resource ../../extended/obmc_boot_test_resource.robot
36
37Test Teardown Run Key FFDC On Test Case Fail
George Keishing5e870cd2016-08-24 10:05:47 -050038
39*** Variables ***
40
Michael Walsh5ce98052017-04-12 16:40:31 -050041${QUIET} ${1}
42# Boot failures are not acceptable so we set the threshold to 0.
43${boot_fail_threshold} ${0}
44
45${FILE_PATH} ${EMPTY}
46${FORCE_UPDATE} ${0}
Rahul Maheshwari724e5912017-04-20 06:04:37 -050047${REST_URL_FILE_PATH} ${EMPTY}
George Keishing80dd5af2017-02-08 07:01:25 -060048
49# There are two reboots issued by code update.
Michael Walsh5ce98052017-04-12 16:40:31 -050050${MAX_BOOT_COUNT} ${2}
George Keishing5e870cd2016-08-24 10:05:47 -050051
Gunnar Mills7c8923f2016-12-12 21:19:52 -060052*** Test Cases ***
George Keishing5e870cd2016-08-24 10:05:47 -050053
Sivas SRRaca55712016-12-21 04:32:35 -060054Initiate Code Update BMC
Michael Walsh5ce98052017-04-12 16:40:31 -050055 [Documentation] Initiate a code update on the BMC.
Sivas SRRaca55712016-12-21 04:32:35 -060056 [Tags] Initiate_Code_Update_BMC
George Keishing5e870cd2016-08-24 10:05:47 -050057
George Keishing830211e2017-07-19 08:44:07 -050058 ${status}= Run Keyword If '${LAST_KNOWN_GOOD_VERSION}' != '${EMPTY}'
59 ... Run Keyword And Return Status
60 ... Validate BMC Version ${LAST_KNOWN_GOOD_VERSION}
George Keishingfb10f492017-03-07 21:34:18 -060061
George Keishing830211e2017-07-19 08:44:07 -050062 Run Keyword if '${status}' == '${True}'
63 ... Pass Execution The BMC already has the requested build loaded so no further action will be taken.
George Keishing50787fc2016-09-21 03:44:26 -050064
George Keishing5e785822017-04-04 10:15:50 -050065 # Enable user to bypass prerequisite operations.
66 # Use cases for if BMC is not in working state.
67 Run Keyword If ${FORCE_UPDATE} == ${0}
68 ... Prepare BMC For Update
George Keishing2582bee2016-11-17 21:41:49 -060069
Michael Walsh5ce98052017-04-12 16:40:31 -050070 Run Key U Preserve BMC Network Setting
71 Run Key SCP Tar Image File To BMC \ ${FILE_PATH}
72 Run Key Activate BMC Flash Image
73 Run Key U OBMC Boot Test \ OBMC Reboot (off)
74 Run Key U Check Boot Count And Time
George Keishing80dd5af2017-02-08 07:01:25 -060075 Run Keyword If ${BOOT_COUNT} == ${1}
Michael Walsh5ce98052017-04-12 16:40:31 -050076 ... Log Boot time not updated by kernel. level=WARN
Sivas SRRea85d1f2016-11-13 22:44:28 -060077
George Keishing80dd5af2017-02-08 07:01:25 -060078*** Keywords ***
79
George Keishing5e785822017-04-04 10:15:50 -050080Prepare BMC For Update
81 [Documentation] Prerequisite operation before code update.
82 Check Boot Count And Time
83 Prune Journal Log
84 Power Off Request
George Keishingefc3ff22017-12-12 11:49:25 -060085 Set BMC Power Policy ALWAYS_POWER_OFF
George Keishingd85b28f2017-08-17 00:31:54 -050086
George Keishing5e785822017-04-04 10:15:50 -050087 Prepare For Update
88 Check If BMC is Up 20 min 10 sec
89 Check Boot Count And Time
90
91 # Temporary fix for lab migration for driver which is booted with
92 # BMC state "/xyz/openbmc_project/state/BMC0/".
93 ${status}= Run Keyword And Return Status Temp BMC URI Check
94 Run Keyword If '${status}' == '${False}'
95 ... Wait For BMC Ready
96 ... ELSE Wait For Temp BMC Ready
97
George Keishing80dd5af2017-02-08 07:01:25 -060098Check Boot Count And Time
99 [Documentation] Check for unexpected reboots.
100 Set BMC Reset Reference Time
101 Log To Console \n Boot Count: ${BOOT_COUNT}
102 Log To Console \n Boot Time: ${BOOT_TIME}
103 Run Keyword If ${BOOT_COUNT} > ${MAX_BOOT_COUNT}
104 ... Log Phantom Reboot!!! Unexpected reboot detected level=WARN
105
George Keishing3cb1ade2017-03-23 09:03:06 -0500106Temp BMC URI Check
107 [Documentation] Check for transient "BMC0" interface.
108 ${resp}= Openbmc Get Request /xyz/openbmc_project/state/BMC0/
109 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
110
George Keishing3cb1ade2017-03-23 09:03:06 -0500111Wait For Temp BMC Ready
112 [Documentation] Check for BMC "Ready" until timedout.
113 Wait Until Keyword Succeeds
114 ... 10 min 10 sec Check Temp BMC State