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

[sonic-platform-base] Introduce APIs for modular chassis support #124

Merged
merged 10 commits into from
Nov 10, 2020
2 changes: 1 addition & 1 deletion sonic_platform_base/chassis_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def get_module_index(self, module_name):
Retrieves module index from the module name

Args:
name: A string, prefixed by SUPERVISOR, LINE-CARD or FABRIC-CARD
module_name: A string, prefixed by SUPERVISOR, LINE-CARD or FABRIC-CARD
Ex. SUPERVISOR0, LINE-CARD1, FABRIC-CARD5

Returns:
Expand Down
19 changes: 18 additions & 1 deletion sonic_platform_base/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ class ModuleBase(device_base.DeviceBase):
#Invalid slot for modular chassis
MODULE_INVALID_SLOT = -1

#Possible reboot types for modular chassis
#Module reboot type to reboot entire card
MODULE_REBOOT_DEFAULT = "Default"
#Module reboot type to reboot CPU complex
MODULE_REBOOT_CPU_COMPLEX = "CPU"
#Module reboot type to reboot FPGA complex
MODULE_REBOOT_FPGA_COMPLEX = "FPGA"

# List of ComponentBase-derived objects representing all components
# available on the module
_component_list = None
Expand Down Expand Up @@ -144,10 +152,15 @@ def get_status(self):
"""
raise NotImplementedError

def reboot(self):
def reboot(self, reboot_type):
"""
Request to reboot the module

Args:
reboot_type: A string, choose from one of pre-defined module
reboot-types. MODULE_REBOOT_DEFAULT, MODULE_REBOOT_CPU_COMPLEX,
MODULE_REBOOT_FPGA_COMPLEX
mprabhu-nokia marked this conversation as resolved.
Show resolved Hide resolved

Returns:
bool: True if the request has been issued successfully, False if not
"""
Expand All @@ -161,6 +174,10 @@ def set_admin_state(self, up):
The up state will take the module to MODULE_STATUS_PRESENT,
MODULE_STATUS_FAULT or MODULE_STAUS_ONLINE states.

mprabhu-nokia marked this conversation as resolved.
Show resolved Hide resolved
Args:
up: A boolean, True to set the admin-state to UP. False to set the
admin-state to DOWN.

Returns:
bool: True if the request has been issued successfully, False if not
"""
Expand Down