From 9c17629b5400e10b765ffaa4a5a94e66e37cde86 Mon Sep 17 00:00:00 2001 From: Liam Kearney Date: Wed, 11 Feb 2026 03:34:14 +0000 Subject: [PATCH] [module_base]: Add states and platform API for provisioning modules Signed-off-by: Liam Kearney --- sonic_platform_base/module_base.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/module_base.py b/sonic_platform_base/module_base.py index dcce79960..26c67c46e 100644 --- a/sonic_platform_base/module_base.py +++ b/sonic_platform_base/module_base.py @@ -50,6 +50,16 @@ class ModuleBase(device_base.DeviceBase): # Module state is Present when it is powered up, but entered a fault state. # Module is not able to go Online. MODULE_STATUS_FAULT = "Fault" + # Module state when module is detected, is able to run SONiC, but is not yet running SONiC. + # Modules in this state will be attempted to be converted to SONiC via calls to module.provision_module() + # This state does not make much sense if provision_module() is not implemented. + MODULE_STATUS_PROVISION_READY = "ProvisionReady" + # Module state if module is currently undergoing provisioning. + # Module is not expected to be contactable in this state. + MODULE_STATUS_PROVISION_PENDING = "ProvisionPending" + # Module state once module has been provisioned successfully, + # but the chassis requires a reboot to fully incorporate the module. + MODULE_STATUS_PROVISIONED = "Provisioned" # Module state is Online when fully operational MODULE_STATUS_ONLINE = "Online" @@ -221,7 +231,9 @@ def get_oper_status(self): Returns: A string, the operational status of the module from one of the predefined status values: MODULE_STATUS_EMPTY, MODULE_STATUS_OFFLINE, - MODULE_STATUS_FAULT, MODULE_STATUS_PRESENT or MODULE_STATUS_ONLINE + MODULE_STATUS_FAULT, MODULE_STATUS_PRESENT, MODULE_STATUS_PROVISION_READY, + MODULE_STATUS_PROVISION_PENDING, MODULE_STATUS_PROVISIONED, + or MODULE_STATUS_ONLINE """ raise NotImplementedError @@ -270,6 +282,17 @@ def get_maximum_consumed_power(self): """ raise NotImplementedError + def provision_module(self): + """ + Request to provision the module. + This method should be implemented if the module supports + MODULE_STATUS_PROVISION_READY state. + + Returns: + bool: True if the request has been issued successfully, False if not + """ + raise NotImplementedError + ############################################## # SmartSwitch methods ##############################################