Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[component]: Introduce new firmware management API #82

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions sonic_platform_base/component_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,72 @@ def get_firmware_version(self):
"""
Retrieves the firmware version of the component

Note: the firmware version will be read from HW

Returns:
A string containing the firmware version of the component
"""
raise NotImplementedError

def get_available_firmware_version(self, image_path):
"""
Retrieves the available firmware version of the component
nazariig marked this conversation as resolved.
Show resolved Hide resolved

Note: the firmware version will be read from image

Args:
image_path: A string, path to firmware image

Returns:
A string containing the available firmware version of the component
"""
raise NotImplementedError

def get_firmware_update_notification(self, image_path):
"""
Retrieves a notification on what should be done in order to complete
the component firmware update

Args:
image_path: A string, path to firmware image

Returns:
A string containing the component firmware update notification if required.
By default 'None' value will be used, which indicates that no actions are required
"""
return None

def install_firmware(self, image_path):
"""
Installs firmware to the component

This API performs firmware installation only: this may/may not be the same as firmware update.
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 must be done manually by user

Note: in case immediate actions are required to complete the component firmware update
(e.g., reboot, power cycle, etc.) - will be done automatically by API and no return value provided

Args:
image_path: A string, path to firmware image

Returns:
A boolean, True if install was successful, False if not
"""
raise NotImplementedError

def update_firmware(self, image_path):
"""
Updates firmware of the component

This API performs firmware update: it assumes firmware installation and loading 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 by API

Args:
image_path: A string, path to firmware image

Raises:
RuntimeError: update failed
"""
raise NotImplementedError