Skip to content

Commit

Permalink
Update the PR according to the discussion happened
Browse files Browse the repository at this point in the history
  • Loading branch information
vvolam committed Nov 7, 2024
1 parent 3b208c5 commit 8a22443
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sonic_platform_base/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
"""
Expand Down Expand Up @@ -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
##############################################
Expand Down
1 change: 1 addition & 0 deletions tests/module_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 8a22443

Please sign in to comment.