From 2632a5912c246b1ddab97450a7b85aebaa2fb0a3 Mon Sep 17 00:00:00 2001 From: Nazarii Hnydyn Date: Mon, 13 Apr 2020 15:21:45 +0000 Subject: [PATCH] [component]: Introduce new firmware management API. Signed-off-by: Nazarii Hnydyn --- sonic_platform_base/component_base.py | 57 ++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 97444460ae2f..444750ee87f2 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -39,9 +39,37 @@ def get_firmware_version(self): """ raise NotImplementedError + def get_available_firmware_version(self, image_path): + """ + Retrieves the available firmware version of the component + + Args: + image_path: A string, path to firmware image + + Returns: + A string containing the available firmware version of the component + """ + raise NotImplementedError + + def get_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 + Installs firmware to the component. + It's user's responsibility to complete firmware update + in case some extra steps are required (e.g., reboot, power cycle, etc.) Args: image_path: A string, path to firmware image @@ -50,3 +78,30 @@ def install_firmware(self, image_path): A boolean, True if install was successful, False if not """ raise NotImplementedError + + def update_firmware(self, image_path): + """ + Updates firmware of the component. + It's API's responsibility to complete firmware update + in case some extra steps are required (e.g., reboot, power cycle, etc.) + + Args: + image_path: A string, path to firmware image + + Raises: + RuntimeError: update failed + """ + raise NotImplementedError + + def is_delayed_firmware_update_supported(self, image_path): + """ + Retrieves a value indicating whether immediate actions are required + to complete the component firmware update (e.g., reboot, power cycle, etc.) + + Args: + image_path: A string, path to firmware image + + Returns: + A boolean, True if delayed firmware update supported, False if not + """ + raise NotImplementedError