Skip to content

Commit

Permalink
[component] add auto_update_firmware() to support the auto update. (#106
Browse files Browse the repository at this point in the history
)

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
  • Loading branch information
sujinmkang committed Jan 26, 2021
1 parent 49076a9 commit 6ad0004
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions sonic_platform_base/component_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,35 @@ def update_firmware(self, image_path):
RuntimeError: update failed
"""
raise NotImplementedError

def auto_update_firmware(self, image_path, boot_type):
"""
Updates firmware of the component
This API performs firmware update automatically based on boot_type: it assumes firmware installation
and/or creating a loading task during the reboot, if needed, in a single call.
In case platform component requires some extra steps (apart from calling Low Level Utility)
to load the installed firmware (e.g, reboot, power cycle, etc.) - this will be done automatically during the reboot.
The loading task will be created by API.
Args:
image_path: A string, path to firmware image
boot_type: A string, reboot type following the upgrade
- none/fast/warm/cold
Returns:
Output: A return code
return_code: An integer number, status of component firmware auto-update
- return code of a positive number indicates successful auto-update
- status_installed = 1
- status_updated = 2
- status_scheduled = 3
- return_code of a negative number indicates failed auto-update
- status_err_boot_type = -1
- status_err_image = -2
- status_err_unknown = -3
Raises:
RuntimeError: auto-update failure cause
"""
raise NotImplementedError

0 comments on commit 6ad0004

Please sign in to comment.