-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adjusting Seastone's sfputil plugin to cope with new SfpUtil API. #1022
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
61 changes: 48 additions & 13 deletions
61
device/celestica/x86_64-cel_seastone-r0/plugins/sfputil.py
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 |
---|---|---|
@@ -1,25 +1,60 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Platform-specific SFP transceiver interface for SONiC | ||
# | ||
|
||
try: | ||
from sonic_sfp.sfputilbase import sfputilbase | ||
except ImportError, e: | ||
raise ImportError (str(e) + "- required module not found") | ||
import time | ||
from sonic_sfp.sfputilbase import SfpUtilBase | ||
except ImportError as e: | ||
raise ImportError("%s - required module not found" % str(e)) | ||
|
||
|
||
class sfputil(sfputilbase): | ||
"""Platform specific sfputil class""" | ||
class SfpUtil(SfpUtilBase): | ||
"""Platform-specific SfpUtil class""" | ||
|
||
port_start = 0 | ||
port_end = 31 | ||
ports_in_block = 32 | ||
PORT_START = 0 | ||
PORT_END = 31 | ||
PORTS_IN_BLOCK = 32 | ||
|
||
port_to_eeprom_mapping = {} | ||
# EEPROM_OFFSET = 20 | ||
|
||
_qsfp_ports = range(0, ports_in_block + 1) | ||
_port_to_eeprom_mapping = {} | ||
qsfp_ports = range(0, PORTS_IN_BLOCK + 1) | ||
|
||
def __init__(self, port_num): | ||
@property | ||
def port_start(self): | ||
return self.PORT_START | ||
|
||
@property | ||
def port_end(self): | ||
return self.PORT_END | ||
|
||
@property | ||
def qsfp_ports(self): | ||
return range(0, self.PORTS_IN_BLOCK + 1) | ||
|
||
@property | ||
def port_to_eeprom_mapping(self): | ||
return self._port_to_eeprom_mapping | ||
|
||
def __init__(self): | ||
# Override port_to_eeprom_mapping for class initialization | ||
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom' | ||
for x in range(self.port_start, self.port_end + 1): | ||
|
||
for x in range(self.PORT_START, self.PORT_END + 1): | ||
self.port_to_eeprom_mapping[x] = eeprom_path.format( x + 26 ) | ||
sfputilbase.__init__(self, port_num) | ||
SfpUtilBase.__init__(self) | ||
|
||
def get_presence(self, port_num): | ||
raise NotImplementedError | ||
|
||
def get_low_power_mode(self, port_num): | ||
raise NotImplementedError | ||
|
||
def set_low_power_mode(self, port_num, lpmode): | ||
raise NotImplementedError | ||
|
||
def reset(self, port_num): | ||
raise NotImplementedError | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, forgot to remove it, will send another patch right away.