forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new API to interact with the platform components (#60)
- Loading branch information
Showing
3 changed files
with
114 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# component_base.py | ||
# | ||
# Abstract base class for implementing a platform-specific class | ||
# to interact with a chassis/module component (e.g., BIOS, CPLD, FPGA, etc.) in SONiC | ||
# | ||
|
||
|
||
class ComponentBase(object): | ||
""" | ||
Abstract base class for implementing a platform-specific class | ||
to interact with a chassis/module component (e.g., BIOS, CPLD, FPGA, etc.) | ||
""" | ||
|
||
def get_name(self): | ||
""" | ||
Retrieves the name of the component | ||
Returns: | ||
A string containing the name of the component | ||
""" | ||
raise NotImplementedError | ||
|
||
def get_description(self): | ||
""" | ||
Retrieves the description of the component | ||
Returns: | ||
A string containing the description of the component | ||
""" | ||
raise NotImplementedError | ||
|
||
def get_firmware_version(self): | ||
""" | ||
Retrieves the firmware version of the component | ||
Returns: | ||
A string containing the firmware version of the component | ||
""" | ||
raise NotImplementedError | ||
|
||
def install_firmware(self, image_path): | ||
""" | ||
Installs firmware to the component | ||
Args: | ||
image_path: A string, path to firmware image | ||
Returns: | ||
A boolean, True if install was successful, False if not | ||
""" | ||
raise NotImplementedError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters