Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add negative case for pci_detach() and pci_reattach() #504

Merged
merged 7 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions sonic_platform_base/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,28 +262,22 @@ def get_state_info(self):
"""
raise NotImplementedError

def get_bus_info(self, module_name):
def get_bus_info(self):
vvolam marked this conversation as resolved.
Show resolved Hide resolved
"""
Retrieves the bus information for the specified by "module_name" on a SmartSwitch.
Retrieves the bus information. Returns None for non-smartswitch chassis.
vvolam marked this conversation as resolved.
Show resolved Hide resolved

Returns:
Returns the PCI bus information in BDF format like "[DDDD:]BB:SS:F"
"""
raise NotImplementedError

def pci_detach(self, module_name):
def pci_detach(self):
vvolam marked this conversation as resolved.
Show resolved Hide resolved
"""
Detaches the DPU PCI device specified by "module_name" on a SmartSwitch.
Returns False for non-smartswitch chassis.

vvolam marked this conversation as resolved.
Show resolved Hide resolved
Returns: True once the PCI is successfully detached.
"""
raise NotImplementedError

def pci_reattach(self, module_name):
"""
Rescans and reconnects the DPU PCI device specified by "module_name" on a SmartSwitch.

Returns: True once the PCI is successfully reconnected.
Returns False if PCI detachment fails or specified 'module_name' is not found.
"""
raise NotImplementedError

Expand Down
5 changes: 2 additions & 3 deletions tests/module_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ def test_module_base(self):
[module.get_dpu_id],
[module.get_reboot_cause],
[module.get_state_info],
[module.get_bus_info, "module_name"],
[module.pci_detach, "module_name"],
[module.pci_reattach, "module_name"],
[module.get_bus_info],
[module.pci_detach],
]

for method in not_implemented_methods:
Expand Down
Loading