blob: 31cf57894bf601c4b1f12b99e87fbc55869565ff [file] [log] [blame]
Sushil Singhcdebdd52019-08-14 15:29:24 -05001*** Settings ***
2Documentation Update firmware on a target BMC via Redifsh.
3
4# Test Parameters:
5# IMAGE_FILE_PATH The path to the BMC image file.
6#
7# Firmware update states:
8# Enabled Image is installed and either functional or active.
9# Disabled Image installation failed or ready for activation.
10# Updating Image installation currently in progress.
11
12Resource ../../lib/resource.robot
13Resource ../../lib/bmc_redfish_resource.robot
14Resource ../../lib/openbmc_ffdc.robot
15Resource ../../lib/common_utils.robot
16Resource ../../lib/code_update_utils.robot
17Resource ../../lib/dump_utils.robot
18Resource ../../lib/logging_utils.robot
19Resource ../../lib/redfish_code_update_utils.robot
Sushil Singhb13fc362020-02-06 03:40:56 -060020Resource ../../lib/utils.robot
Anves Kumar rayankula7ed1ae82021-02-03 04:19:46 -060021Resource ../../lib/bmc_redfish_utils.robot
Sushil Singhcdebdd52019-08-14 15:29:24 -050022Library ../../lib/gen_robot_valid.py
23Library ../../lib/tftp_update_utils.py
Sushil Singhf7674a52019-11-19 00:36:15 -060024Library ../../lib/gen_robot_keyword.py
Sushil Singhcdebdd52019-08-14 15:29:24 -050025
26Suite Setup Suite Setup Execution
27Suite Teardown Redfish.Logout
28Test Setup Printn
29Test Teardown FFDC On Test Case Fail
30
31Force Tags BMC_Code_Update
32
Anves Kumar rayankula7ed1ae82021-02-03 04:19:46 -060033*** Variables ***
34
35@{ADMIN} admin_user TestPwd123
36&{USERS} Administrator=${ADMIN}
37
Sushil Singhcdebdd52019-08-14 15:29:24 -050038*** Test Cases ***
39
40Redfish Code Update With ApplyTime OnReset
George Keishing16b3c7b2021-01-28 09:23:37 -060041 [Documentation] Update the firmware image with ApplyTime of OnReset.
Sushil Singhcdebdd52019-08-14 15:29:24 -050042 [Tags] Redfish_Code_Update_With_ApplyTime_OnReset
43 [Template] Redfish Update Firmware
44
45 # policy
46 OnReset
47
48
49Redfish Code Update With ApplyTime Immediate
George Keishing16b3c7b2021-01-28 09:23:37 -060050 [Documentation] Update the firmware image with ApplyTime of Immediate.
Sushil Singhcdebdd52019-08-14 15:29:24 -050051 [Tags] Redfish_Code_Update_With_ApplyTime_Immediate
52 [Template] Redfish Update Firmware
53
54 # policy
55 Immediate
56
57
Sushil Singhffbfedf2019-10-17 15:58:25 -050058Redfish Code Update With Multiple Firmware
George Keishing16b3c7b2021-01-28 09:23:37 -060059 [Documentation] Update the firmware image with ApplyTime of Immediate.
Sushil Singhffbfedf2019-10-17 15:58:25 -050060 [Tags] Redfish_Code_Update_With_Multiple_Firmware
61 [Template] Redfish Multiple Upload Image And Check Progress State
62
63 # policy image_file_path alternate_image_file_path
64 Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
65
66
Anves Kumar rayankula7ed1ae82021-02-03 04:19:46 -060067Verify If The Modified Admin Credential Is Valid Post Image Switched To Backup
68 [Tags] Verify_If_The_Modified_Admin_Credentails_Is_Valid_Backup_Image
69 [Setup] Create Users With Different Roles users=${USERS} force=${True}
70 [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS}
71
72 ${post_code_update_actions}= Get Post Boot Action
73 ${state}= Get Pre Reboot State
74 Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123
75
76 Redfish.Login
77 # change to backup image and reset the BMC.
78 Switch Backup Firmware Image To Functional
79 Wait For Reboot start_boot_seconds=${state['epoch_seconds']}
80
81 # verify modified admin password on backup image.
82 Redfish.Login admin_user 0penBmc123
83 Redfish.Logout
84
85Verify If The Modified Admin Credential Is Valid Post Update
86 [Tags] Verify_If_The_Modified_Admin_Credentails_Is_Valid_Post_Update
87 [Setup] Create Users With Different Roles users=${USERS} force=${True}
88 [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS}
89
90 Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123
91
92 Redfish.Login
93 # Flash latest firmware using redfish.
94 Redfish Update Firmware OnReset
95
96 # verify modified admin credentails on latest image.
97 Redfish.Login admin_user 0penBmc123
98 Redfish.Logout
99
Sushil Singhcdebdd52019-08-14 15:29:24 -0500100*** Keywords ***
101
102Suite Setup Execution
103 [Documentation] Do the suite setup.
104
Sushil Singhcdebdd52019-08-14 15:29:24 -0500105 Valid File Path IMAGE_FILE_PATH
106 Redfish.Login
Sushil Singhcdebdd52019-08-14 15:29:24 -0500107 Delete All BMC Dump
108 Redfish Purge Event Log
109
110
111Redfish Update Firmware
112 [Documentation] Update the BMC firmware via redfish interface.
113 [Arguments] ${apply_time}
114
115 # Description of argument(s):
116 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
117
Sushil Singhb13fc362020-02-06 03:40:56 -0600118 ${post_code_update_actions}= Get Post Boot Action
Sushil Singhcdebdd52019-08-14 15:29:24 -0500119 ${state}= Get Pre Reboot State
120 Rprint Vars state
Sushil Singh6f86f172019-10-30 11:36:25 -0500121 Set ApplyTime policy=${apply_Time}
122 Redfish Upload Image And Check Progress State
Sushil Singhb13fc362020-02-06 03:40:56 -0600123 Run Key ${post_code_update_actions['BMC image']['${apply_time}']}
Sushil Singhf7674a52019-11-19 00:36:15 -0600124 Redfish.Login
Sushil Singhb13fc362020-02-06 03:40:56 -0600125 Redfish Verify BMC Version ${IMAGE_FILE_PATH}
Sushil Singh811ffae2019-10-23 05:16:22 -0500126 Verify Get ApplyTime ${apply_time}
Sushil Singhcdebdd52019-08-14 15:29:24 -0500127
Sushil Singhffbfedf2019-10-17 15:58:25 -0500128
129Redfish Multiple Upload Image And Check Progress State
130 [Documentation] Update multiple BMC firmware via redfish interface and check status.
131 [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH}
132
133 # Description of argument(s):
134 # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate").
135 # IMAGE_FILE_PATH The path to BMC image file.
136 # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file.
137
Sushil Singhb13fc362020-02-06 03:40:56 -0600138 ${post_code_update_actions}= Get Post Boot Action
Sushil Singhffbfedf2019-10-17 15:58:25 -0500139 Valid File Path ALTERNATE_IMAGE_FILE_PATH
140 ${state}= Get Pre Reboot State
141 Rprint Vars state
142
143 Set ApplyTime policy=${apply_time}
144 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH}
145
146 ${first_image_id}= Get Latest Image ID
147 Rprint Vars first_image_id
148 Sleep 5s
149 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH}
150
151 ${second_image_id}= Get Latest Image ID
152 Rprint Vars second_image_id
153
154 Check Image Update Progress State
155 ... match_state='Updating', 'Disabled' image_id=${second_image_id}
156
157 Check Image Update Progress State
158 ... match_state='Updating' image_id=${first_image_id}
159
160 Wait Until Keyword Succeeds 8 min 20 sec
161 ... Check Image Update Progress State
162 ... match_state='Enabled' image_id=${first_image_id}
Sushil Singhb13fc362020-02-06 03:40:56 -0600163 Run Key ${post_code_update_actions['BMC image']['${apply_time}']}
164 Redfish.Login
165 Redfish Verify BMC Version ${IMAGE_FILE_PATH}