blob: b79814f81c1a894fa366d9111e41ac160e2339a9 [file] [log] [blame]
Sushil Singh227dcaa2021-09-17 09:16:44 -05001*** Settings ***
2Documentation Update the BMC code 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/redfish_code_update_utils.robot
18Resource ../../lib/utils.robot
19Library ../../lib/gen_robot_valid.py
20Library ../../lib/var_funcs.py
21Library ../../lib/gen_robot_keyword.py
22Library ../../lib/code_update_utils.py
23
24Suite Setup Suite Setup Execution
25Suite Teardown Redfish.Logout
26Test Setup Printn
27Test Teardown FFDC On Test Case Fail
28
29# Force the test to timedout to prevent test hanging.
30Test Timeout 30 minutes
31
32*** Test Cases ***
33
34Redfish Host Code Update
35 [Documentation] Update the firmware image.
36 [Tags] Redfish_Host_Code_Update
37
38 ${image_version}= Get Version Tar ${IMAGE_FILE_PATH}
39 Rprint Vars image_version
40
41 ${sw_inv}= Get Functional Firmware Host image
42 ${nonfunctional_sw_inv}= Get Non Functional Firmware ${sw_inv} True
43
44 ${functional_version}= Set Variable ${nonfunctional_sw_inv['version']}
45 Rprint Vars functional_version
46
47 ${post_code_update_actions}= Get Post Boot Action
48 ${state}= Get Pre Reboot State
49 Rprint Vars state
50
51 # Check if the existing firmware is functional.
52 Pass Execution If '${functional_version}' == '${image_version}'
53 ... The existing ${image_version} firmware is already functional.
54
55 Print Timen Performing firmware update ${image_version}.
56
57 Redfish Update Firmware
58
59
60*** Keywords ***
61
62Suite Setup Execution
63 [Documentation] Do the suite setup.
64
65 Redfish.Login
66 # Delete BMC dump and Error logs.
67 Run Keyword And Ignore Error Redfish Delete All BMC Dumps
68 Run Keyword And Ignore Error Redfish Purge Event Log
69 # Checking for file existence.
70 Valid File Path IMAGE_FILE_PATH
71
72
73Redfish Update Firmware
74 [Documentation] Update the BMC firmware via redfish interface.
75
76 Redfish.Login
77 ${post_code_update_actions}= Get Post Boot Action
78 Rprint Vars post_code_update_actions
79 Run Keyword And Ignore Error Set ApplyTime policy=OnReset
80 Redfish Upload Image And Check Progress State
81 ${tar_version}= Get Version Tar ${IMAGE_FILE_PATH}
82 ${image_info}= Get Software Inventory State By Version ${tar_version}
83 Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']}
84 Redfish.Login
85 Redfish Verify Host Version ${IMAGE_FILE_PATH}
86