From 8a22443568aa7a7b5aed54b1924287c6101c4ded Mon Sep 17 00:00:00 2001 From: Vasundhara Volam Date: Thu, 7 Nov 2024 05:30:11 +0000 Subject: [PATCH] Update the PR according to the discussion happened --- sonic_platform_base/module_base.py | 15 ++++++++++++++- tests/module_base_test.py | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sonic_platform_base/module_base.py b/sonic_platform_base/module_base.py index 827e4b315..1bcd80df5 100644 --- a/sonic_platform_base/module_base.py +++ b/sonic_platform_base/module_base.py @@ -52,6 +52,8 @@ class ModuleBase(device_base.DeviceBase): MODULE_REBOOT_FPGA_COMPLEX = "FPGA" # Module reboot type to reboot DPU MODULE_REBOOT_DPU = "DPU" + # Module reboot type to reboot SMART SWITCH + MODULE_REBOOT_SMARTSWITCH = "SMARTSWITCH" def __init__(self): # List of ComponentBase-derived objects representing all components @@ -168,10 +170,12 @@ def reboot(self, reboot_type): Args: reboot_type: A string, the type of reboot requested from one of the predefined reboot types: MODULE_REBOOT_DEFAULT, MODULE_REBOOT_CPU_COMPLEX, - MODULE_REBOOT_FPGA_COMPLEX or MODULE_REBOOT_DPU + MODULE_REBOOT_FPGA_COMPLEX, MODULE_REBOOT_DPU or MODULE_REBOOT_SMARTSWITCH MODULE_REBOOT_DPU is only applicable for smartswitch chassis. + MODULE_REBOOT_SMARTSWITCH is only applicable for smartswitch chassis. + Returns: bool: True if the request has been issued successfully, False if not """ @@ -280,6 +284,15 @@ def pci_detach(self): """ raise NotImplementedError + def pci_reattach(self): + """ + Rescans and reconnects the PCI device. + + Returns: True once the PCI is successfully reconnected. + Returns False, if PCI rescan fails or specified device is not found. + """ + raise NotImplementedError + ############################################## # Component methods ############################################## diff --git a/tests/module_base_test.py b/tests/module_base_test.py index b4306e89a..50e5d36e9 100644 --- a/tests/module_base_test.py +++ b/tests/module_base_test.py @@ -10,6 +10,7 @@ def test_module_base(self): [module.get_state_info], [module.get_bus_info], [module.pci_detach], + [module.pci_reattach], ] for method in not_implemented_methods: