blob: 7357b06cb250e66f8ba9a282e6df40cfc70ad5b4 [file] [log] [blame]
Sushil Singhc08932e2019-09-10 15:23:10 -05001*** Settings ***
2Documentation Redfish BMC/Host signed and unsigned code update
3... over BMC functional signed image.
4
5# Test Parameters:
6# IMAGE_FILE_PATH The path to the BMC/Host image file.
7#
8# Firmware update states:
9# Enabled Image is installed and either functional or active.
10# Disabled Image installation failed or ready for activation.
11# Updating Image installation currently in progress.
12
13Resource ../../lib/resource.robot
14Resource ../../lib/bmc_redfish_resource.robot
15Resource ../../lib/openbmc_ffdc.robot
16Resource ../../lib/common_utils.robot
17Resource ../../lib/code_update_utils.robot
18Resource ../../lib/redfish_code_update_utils.robot
Sushil Singhc08932e2019-09-10 15:23:10 -050019Library ../../lib/gen_robot_valid.py
20Library ../../lib/var_funcs.py
Sushil Singhd7fb62f2022-05-13 05:57:13 -050021Library ../../lib/gen_robot_keyword.py
Sushil Singhc08932e2019-09-10 15:23:10 -050022
23Suite Setup Suite Setup Execution
24Suite Teardown Redfish.Logout
25Test Setup Printn
26Test Teardown FFDC On Test Case Fail
27
Sushil Singhd7fb62f2022-05-13 05:57:13 -050028
29*** Variables ***
30
31${ACTIVATION_WAIT_TIMEOUT} 8 min
32
Sushil Singhc08932e2019-09-10 15:23:10 -050033*** Test Cases ***
34
35Redfish Signed Code Update
36 [Documentation] BMC/Host signed code update over functional signed
37 ... image, when FieldMode is set to true value.
38 [Tags] Redfish_Signed_Code_Update
39 [Template] Redfish Signed Firmware Update
40
41 # image_file_path
42 ${IMAGE_FILE_PATH}
43
44
45Redfish Fail Unsigned Code Update
46 [Documentation] BMC/Host unsigned code update over functional signed
47 ... image, when Field Mode is set to true to value.
48 [Tags] Redfish_Fail_Unsigned_Code_Update
49 [Template] Redfish Unsigned Firmware Update
50
51 # image_file_path
52 ${IMAGE_FILE_PATH}
53
54
Sushil Singh2a520ee2019-09-16 14:19:17 -050055REST Failure When Field Mode Set To Disable
56 [Documentation] Verify error while disabling field mode from enabled mode.
57 [Tags] REST_Failure_When_Field_Mode_Set_To_Disable
58
59 ${args}= Create Dictionary data=${0}
60 ${resp}= OpenBMC Post Request ${SOFTWARE_VERSION_URI}attr/FieldModeEnabled data=${args}
61 Should Be Equal As Strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED}
62
63
Sushil Singhc08932e2019-09-10 15:23:10 -050064*** Keywords ***
65
66Suite Setup Execution
67 [Documentation] Do the suite setup.
68
69 Valid File Path IMAGE_FILE_PATH
Sushil Singh23349482019-09-18 07:35:01 -050070 Enable Field Mode And Verify Unmount
Sushil Singhc08932e2019-09-10 15:23:10 -050071 Redfish.Login
Tim Lee4aff2d02021-06-08 13:26:25 +080072 Redfish Delete All BMC Dumps
Sushil Singhc08932e2019-09-10 15:23:10 -050073 Redfish Purge Event Log
74
75
76Redfish Signed Firmware Update
77 [Documentation] Update the BMC/Host firmware via redfish interface.
78 [Arguments] ${image_file_path}
79
80 # Description of argument(s):
81 # IMAGE_FILE_PATH The path to the image file.
82
83 Field Mode Should Be Enabled
84 ${image_version}= Get Version Tar ${image_file_path}
Sushil Singhd7fb62f2022-05-13 05:57:13 -050085
86 ${post_code_update_actions}= Get Post Boot Action
Sushil Singhc08932e2019-09-10 15:23:10 -050087 ${state}= Get Pre Reboot State
88 Rprint Vars state
Sushil Singhd7fb62f2022-05-13 05:57:13 -050089
90 Run Keyword And Ignore Error Set ApplyTime policy=OnReset
91
92 # Python module: get_member_list(resource_path)
93 ${before_inv_list}= redfish_utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
94 Log To Console Current images on the BMC before upload: ${before_inv_list}
95
96 Redfish Upload Image /redfish/v1/UpdateService ${IMAGE_FILE_PATH}
97
98 # Python module: get_member_list(resource_path)
99 ${after_inv_list}= redfish_utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory
100 Log To Console Current images on the BMC after upload: ${after_inv_list}
101
102 ${image_id}= Evaluate set(${after_inv_list}) - set(${before_inv_list})
103 Should Not Be Empty ${image_id}
104 ${image_id}= Evaluate list(${image_id})[0].split('/')[-1]
105 Log To Console Firmware installation in progress with image id:: ${image_id}
106
107 Wait Until Keyword Succeeds ${ACTIVATION_WAIT_TIMEOUT} 10 sec
108 ... Check Image Update Progress State match_state='Enabled' image_id=${image_id}
109
110 # Python module: get_version_tar(tar_file_path)
111 ${tar_version}= code_update_utils.Get Version Tar ${IMAGE_FILE_PATH}
112 ${image_info}= Get Software Inventory State By Version ${tar_version}
113
114 Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']}
115 Redfish.Login
116 Redfish Verify BMC Version ${IMAGE_FILE_PATH}
Sushil Singhc08932e2019-09-10 15:23:10 -0500117
118
119Redfish Unsigned Firmware Update
120 [Documentation] Update the BMC/Host firmware via redfish interface.
121 [Arguments] ${image_file_path}
122
123 # Description of argument(s):
124 # IMAGE_FILE_PATH The path to the image file.
125
126 Field Mode Should Be Enabled
127 Set ApplyTime policy=Immediate
128 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${image_file_path}
129 ${image_id}= Get Latest Image ID
130 Rprint Vars image_id
131 Sleep 5s
132 Wait Until Keyword Succeeds 8 min 20 sec
133 ... Check Image Update Progress State
134 ... match_state='Disabled', 'Updating', 'Disabled' image_id=${image_id}
135 Delete Software Object
136 ... /xyz/openbmc_project/software/${image_id}
137