Skip to content

Commit 6ad0004

Browse files
authored
[component] add auto_update_firmware() to support the auto update. (#106)
To support the component firmware automatic update, add auto_update_firmware() to platform component api This is to support fwutil auto_update command to update the platform component firmware automatically. Fwutil HLD to support auto_update interfaces/commands. sonic-net/SONiC#648
1 parent 49076a9 commit 6ad0004

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

sonic_platform_base/component_base.py

+32
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,35 @@ def update_firmware(self, image_path):
103103
RuntimeError: update failed
104104
"""
105105
raise NotImplementedError
106+
107+
def auto_update_firmware(self, image_path, boot_type):
108+
"""
109+
Updates firmware of the component
110+
111+
This API performs firmware update automatically based on boot_type: it assumes firmware installation
112+
and/or creating a loading task during the reboot, if needed, in a single call.
113+
In case platform component requires some extra steps (apart from calling Low Level Utility)
114+
to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically during the reboot.
115+
The loading task will be created by API.
116+
117+
Args:
118+
image_path: A string, path to firmware image
119+
boot_type: A string, reboot type following the upgrade
120+
- none/fast/warm/cold
121+
122+
Returns:
123+
Output: A return code
124+
return_code: An integer number, status of component firmware auto-update
125+
- return code of a positive number indicates successful auto-update
126+
- status_installed = 1
127+
- status_updated = 2
128+
- status_scheduled = 3
129+
- return_code of a negative number indicates failed auto-update
130+
- status_err_boot_type = -1
131+
- status_err_image = -2
132+
- status_err_unknown = -3
133+
134+
Raises:
135+
RuntimeError: auto-update failure cause
136+
"""
137+
raise NotImplementedError

0 commit comments

Comments
 (0)