From f26b9323e53b5e2cfa506e8b2c7c9a665d093af7 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Mon, 3 Aug 2020 17:41:06 -0700 Subject: [PATCH 1/8] add boot_action option to fwutil update command --- sonic_platform_base/component_base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 37e767aa0..6a84286bc 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -88,7 +88,7 @@ def install_firmware(self, image_path): """ raise NotImplementedError - def update_firmware(self, image_path): + def update_firmware(self, image_path, boot_action): """ Updates firmware of the component @@ -98,6 +98,7 @@ def update_firmware(self, image_path): Args: image_path: A string, path to firmware image + boot_action: A string, boot action following the upgrade Raises: RuntimeError: update failed From c03fb4e0bf89bdb6ebc3fe31ce5a211de93cbee1 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Wed, 9 Sep 2020 17:27:12 -0700 Subject: [PATCH 2/8] add auto_update_firmware api to support --- sonic_platform_base/component_base.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 6a84286bc..f09c630e9 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -88,7 +88,7 @@ def install_firmware(self, image_path): """ raise NotImplementedError - def update_firmware(self, image_path, boot_action): + def update_firmware(self, image_path): """ Updates firmware of the component @@ -96,9 +96,28 @@ def update_firmware(self, image_path, boot_action): 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 + + def auto_update_firmware(self, image_path, boot_action, command): + """ + Updates firmware of the component + + This API performs firmware update automatically based on boot_action: it assumes firmware installation + and creating a loading task 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 and it will be performed by the reboot script. + Args: image_path: A string, path to firmware image boot_action: A string, boot action following the upgrade + command: A string, command to be performed Raises: RuntimeError: update failed From c8fce83d624b0bfddf916a2c4a9e7bf3d4bc4ec1 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Tue, 6 Oct 2020 00:16:14 -0700 Subject: [PATCH 3/8] remove command argument --- sonic_platform_base/component_base.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index f09c630e9..1e65d6ef1 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -104,22 +104,21 @@ def update_firmware(self, image_path): """ raise NotImplementedError - def auto_update_firmware(self, image_path, boot_action, command): + def auto_update_firmware(self, image_path, boot_action): """ Updates firmware of the component This API performs firmware update automatically based on boot_action: it assumes firmware installation - and creating a loading task in a single call. + and/or creating a loading task during a boot action, 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 and it will be performed by the reboot script. + The loading task will be created by API. Args: image_path: A string, path to firmware image boot_action: A string, boot action following the upgrade - command: A string, command to be performed Raises: - RuntimeError: update failed + RuntimeError: auto-update failure cause """ raise NotImplementedError From b6b0f41af5a08739d9568598c66c019a9a927896 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Thu, 29 Oct 2020 12:01:02 -0700 Subject: [PATCH 4/8] add more clarification on return of auto_update_firmware api --- sonic_platform_base/component_base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 1e65d6ef1..97d1ec744 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -108,7 +108,7 @@ def auto_update_firmware(self, image_path, boot_action): """ Updates firmware of the component - This API performs firmware update automatically based on boot_action: it assumes firmware installation + This API performs firmware update automatically based on boot_action: it assumes firmware installation and/or creating a loading task during a boot action, 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. @@ -118,6 +118,12 @@ def auto_update_firmware(self, image_path, boot_action): image_path: A string, path to firmware image boot_action: A string, boot action following the upgrade + Returns: + Output: A string, status and info + status: True or False, firmware auto-update status + info: The detail information of the firmware auto-update status. + "updated"/"installed"(which needs a reboot for the firmware to be active)/"scheduled" + Raises: RuntimeError: auto-update failure cause """ From 3a883471b83ae2c4f9f41b2c64641cf0e3eac8fc Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Thu, 19 Nov 2020 18:34:24 -0800 Subject: [PATCH 5/8] add more information on auto_update input and return values --- sonic_platform_base/component_base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 97d1ec744..2d3dd081f 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -117,12 +117,14 @@ def auto_update_firmware(self, image_path, boot_action): Args: image_path: A string, path to firmware image boot_action: A string, boot action following the upgrade + - none/fast/warm/cold Returns: Output: A string, status and info status: True or False, firmware auto-update status info: The detail information of the firmware auto-update status. - "updated"/"installed"(which needs a reboot for the firmware to be active)/"scheduled" + - "updated"/"installed"(which needs a reboot for the firmware to be active)/"scheduled" + - "ns_boot_type/image_error/exec_fail" Raises: RuntimeError: auto-update failure cause From 1d56deb33a4b2388b573119fd677434bf867d879 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Tue, 24 Nov 2020 00:09:12 -0800 Subject: [PATCH 6/8] review comments --- sonic_platform_base/component_base.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 2d3dd081f..ffd34bf16 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -120,11 +120,16 @@ def auto_update_firmware(self, image_path, boot_action): - none/fast/warm/cold Returns: - Output: A string, status and info - status: True or False, firmware auto-update status - info: The detail information of the firmware auto-update status. - - "updated"/"installed"(which needs a reboot for the firmware to be active)/"scheduled" - - "ns_boot_type/image_error/exec_fail" + 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_others = -3 Raises: RuntimeError: auto-update failure cause From 4c86ecc0356d8fb7556bc75593dd55808242abd5 Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Mon, 30 Nov 2020 10:04:57 -0800 Subject: [PATCH 7/8] review comments --- sonic_platform_base/component_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index ffd34bf16..46e15c5fc 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -104,19 +104,19 @@ def update_firmware(self, image_path): """ raise NotImplementedError - def auto_update_firmware(self, image_path, boot_action): + def auto_update_firmware(self, image_path, boot_type): """ Updates firmware of the component - This API performs firmware update automatically based on boot_action: it assumes firmware installation - and/or creating a loading task during a boot action, if needed, in a single call. + 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_action: A string, boot action following the upgrade + boot_type: A string, reboot type following the upgrade - none/fast/warm/cold Returns: From 87cd0eeedead1b1f4825f55f1ba15e92131b656c Mon Sep 17 00:00:00 2001 From: sujinmkang Date: Thu, 14 Jan 2021 11:41:42 -0800 Subject: [PATCH 8/8] address review comments --- sonic_platform_base/component_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic_platform_base/component_base.py b/sonic_platform_base/component_base.py index 46e15c5fc..ba9c975ca 100644 --- a/sonic_platform_base/component_base.py +++ b/sonic_platform_base/component_base.py @@ -129,7 +129,7 @@ def auto_update_firmware(self, image_path, boot_type): - return_code of a negative number indicates failed auto-update - status_err_boot_type = -1 - status_err_image = -2 - - status_err_others = -3 + - status_err_unknown = -3 Raises: RuntimeError: auto-update failure cause