blob: 47e542988a3788e27d74258839a3d35a8730d132 [file] [log] [blame]
George Keishing6ecc04b2021-06-04 04:15:06 -05001*** Settings ***
2Documentation Update firmware on a target MCU via Redifsh.
3
4# Test Parameters:
5# IMAGE_MCU_FILE_PATH The path to the MCU 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
Stanley Chubc284352021-06-08 10:48:48 +080012Resource ../../lib/resource.robot
13Resource ../../lib/bmc_redfish_resource.robot
14Resource ../../lib/boot_utils.robot
15Resource ../../lib/openbmc_ffdc.robot
16Resource ../../lib/common_utils.robot
17Resource ../../lib/code_update_utils.robot
18Resource ../../lib/dump_utils.robot
19Resource ../../lib/logging_utils.robot
20Resource ../../lib/redfish_code_update_utils.robot
21Resource ../../lib/utils.robot
22Library ../../lib/gen_robot_valid.py
23Library ../../lib/tftp_update_utils.py
George Keishing6ecc04b2021-06-04 04:15:06 -050024
25Suite Setup Suite Setup Execution
26Suite Teardown Redfish.Logout
27Test Setup Printn
28Test Teardown FFDC On Test Case Fail
29
30Force Tags Mcu_Code_Update
31
32*** Test Cases ***
33
34Redfish Mcu Code Update With ApplyTime OnReset
35 [Documentation] Update the firmware image with ApplyTime of OnReset.
36 [Tags] Redfish_Mcu_Code_Update_With_ApplyTime_OnReset
37 [Template] Redfish Update Firmware
38
39 # policy
40 OnReset ${IMAGE_MCU_FILE_PATH_0}
41
42
43Redfish Mcu Code Update With ApplyTime Immediate
44 [Documentation] Update the firmware image with ApplyTime of Immediate.
45 [Tags] Redfish_Mcu_Code_Update_With_ApplyTime_Immediate
46 [Template] Redfish Update Firmware
47
48 # policy
49 Immediate ${IMAGE_MCU_FILE_PATH_1}
50
51
52*** Keywords ***
53
54Suite Setup Execution
55 [Documentation] Do the suite setup.
56
57 # Checking for file existence.
58 Valid File Path IMAGE_MCU_FILE_PATH_0
59 Valid File Path IMAGE_MCU_FILE_PATH_1
60
61 Redfish.Login
Tim Lee4aff2d02021-06-08 13:26:25 +080062 Redfish Delete All BMC Dumps
George Keishing6ecc04b2021-06-04 04:15:06 -050063 Redfish Purge Event Log
64
65
66Redfish Verify MCU Version
67 [Documentation] Verify that the version on the MCU is the same as the
68 ... version in the given image via Redfish.
69 [Arguments] ${image_file_path}
70
71 # Description of argument(s):
72 # image_file_path Path to the image tarball.
73
74 # Extract the version from the image tarball on our local system.
75 ${tar_version}= Get Version Tar ${image_file_path}
76
77 ${image_info}= Get Software Inventory State By Version ${tar_version}
78 ${image_id}= Get Image Id By Image Info ${image_info}
79
80 ${mcu_version}= Redfish.Get Attribute /redfish/v1/UpdateService/FirmwareInventory/${image_id} Version
81
82 Valid Value mcu_version valid_values=['${tar_version}']
83
84
85Redfish Update Firmware
86 [Documentation] Update the BMC firmware via redfish interface.
87 [Arguments] ${apply_time} ${image_file_path}
88
89 # Description of argument(s):
90 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
91
92 Redfish.Login
93
94 Set ApplyTime policy=${apply_time}
95
Sushil Singh5eb37da2023-05-18 01:50:32 -050096 # URI : /redfish/v1/UpdateService
97 # "HttpPushUri": "/redfish/v1/UpdateService/update",
98
99 ${redfish_update_uri}= Get Redfish Update Service URI
100 Redfish Upload Image ${redfish_update_uri} ${image_file_path}
George Keishing6ecc04b2021-06-04 04:15:06 -0500101 Sleep 30s
102
103 ${image_version}= Get Version Tar ${image_file_path}
104 ${image_info}= Get Software Inventory State By Version ${image_version}
105 ${image_id}= Get Image Id By Image Info ${image_info}
106
107 Redfish.Login
108 Redfish Verify MCU Version ${image_file_path}
109
110
111Get Image Id By Image Info
112 [Documentation] Get image ID from image_info.
113 [Arguments] ${image_info}
114
115 [Return] ${image_info["image_id"]}