blob: 4fb77db083ebf2c9cde38366e80dc9f8a8453079 [file] [log] [blame]
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05001*** Settings ***
2Documentation Update the BMC code on a target BMC.
3... Execution Method:
4... python -m robot -v OPENBMC_HOST:<hostname>
5... -v IMAGE_FILE_PATH:<path/*.tar> bmc_code_update.robot
6
7Library ../../lib/code_update_utils.py
8Variables ../../data/variables.py
9Resource ../../lib/boot_utils.robot
10Resource code_update_utils.robot
11Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050012Resource ../../lib/openbmc_ffdc.robot
13Resource ../../lib/dump_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050014
George Keishing00715492017-08-18 11:46:37 -050015Test Teardown Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050016
George Keishing09712a12017-10-16 12:52:42 -050017Force Tags BMC_Code_Update
18
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050019*** Variables ***
20
21${QUIET} ${1}
22${IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050023${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferb7842a52017-09-22 10:11:33 -050024${SKIP_UPDATE_IF_ACTIVE} false
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050025
26*** Test Cases ***
27
28REST BMC Code Update
29 [Documentation] Do a BMC code update by uploading image on BMC via REST.
30 [Tags] REST_BMC_Code_Update
George Keishing1eb85f52017-08-30 22:55:13 -050031 [Setup] Code Update Setup
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050032
Charles Paul Hofer21845462017-09-27 12:40:33 -050033 Upload And Activate Image ${IMAGE_FILE_PATH}
34 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050035 OBMC Reboot (off)
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050036 Verify Running BMC Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050037
38
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050039Upload And Activate Multiple BMC Images
40 [Documentation] Upload another BMC image and verify that its state is
41 ... different from all others.
42 [Tags] Upload_And_Activate_Multiple_BMC_Images
43 [Template] Activate Image And Verify No Duplicate Priorities
44 [Setup] Upload And Activate Multiple BMC Images Setup
45
46 # Image File Path Image Purpose
47 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
48
49
Charles Paul Hofer42f17462017-09-12 14:09:32 -050050BMC Set Priority To Invalid Values
51 [Documentation] Attempt to set the priority of an image to an invalid
52 ... value and expect an error.
53 [Tags] BMC_Set_Priority_To_Invalid_Values
54 [Template] Set Priority To Invalid Value And Expect Error
55
56 # Version Type Priority
57 ${VERSION_PURPOSE_BMC} ${-1}
58 ${VERSION_PURPOSE_BMC} ${256}
59
60
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050061Delete BMC Image
62 [Documentation] Delete a BMC image from the BMC flash chip.
63 [Tags] Delete_BMC_Image
64
65 ${software_object}= Get Non Running BMC Software Object
66 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050067
68
George Keishing97ecb272017-09-12 04:30:20 -050069BMC Image Priority Attribute Test
70 [Documentation] Set "Priority" attribute.
71 [Tags] BMC_Image_Priority_Attribute_Test
72 [Template] Temporarily Set BMC Attribute
73
74 # Property Value
75 Priority ${0}
76 Priority ${1}
77 Priority ${127}
78 Priority ${255}
79
80
Charles Paul Hofere8dc5252017-10-10 13:50:18 -050081Delete All Non Running BMC Images
82 [Documentation] Delete all non running BMC images.
83 [Tags] Delete_All_Non_Running_BMC_Images
84
85 ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH}
86 Delete All Non Running BMC Images
87
88 ${software_ids}= Get Software Objects Id
89 ... version_type=${VERSION_PURPOSE_BMC}
90 Should Not Contain ${software_ids} ${version_id}
91
92
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050093*** Keywords ***
94
George Keishing97ecb272017-09-12 04:30:20 -050095Temporarily Set BMC Attribute
96 [Documentation] Update the BMC attribute value.
97 [Arguments] ${attribute_name} ${attribute_value}
98
99 # Description of argument(s):
100 # attribute_name BMC software attribute name (e.g. "Priority").
101 # attribute_value Value to be written.
102
103 ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC}
104 ${init_bmc_properties}= Get Host Software Property ${image_ids[0]}
105 ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]}
106
107 Set Host Software Property ${image_ids[0]} ${attribute_name}
108 ... ${attribute_value}
109
110 ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]}
111 Should Be Equal As Integers ${cur_bmc_properties["Priority"]}
112 ... ${attribute_value}
113
114 # Revert to to initial value.
115 Set Host Software Property
116 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
117
118
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500119Upload And Activate Multiple BMC Images Setup
120 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
121
George Keishing1eb85f52017-08-30 22:55:13 -0500122 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
123
124Code Update Setup
125 [Documentation] Do code update test case setup.
126 # - Clean up all existing BMC dumps.
127
128 Delete All Dumps
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500129 Run Keyword And Ignore Error Smart Power Off
George Keishing00715492017-08-18 11:46:37 -0500130
131Code Update Test Teardown
132 [Documentation] Do code update test case teardown.
133 # 1. Collect FFDC if test case failed.
134 # 2. Collect FFDC if test PASS but error log exists.
135
136 FFDC On Test Case Fail
137 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC