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

Generate media key in platform sepcific way and fix cable issues #481

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions sonic_platform_base/sfp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,22 @@ def get_xcvr_api(self):
if self._xcvr_api is None:
self.refresh_xcvr_api()
return self._xcvr_api

def get_platform_media_key(self, transceiver_dict, port_speed, lane_count):
"""
Retrieves the media key constructed in a platform specific way,
to be used for parsing the media settings

Args:
transceiver_dict :
SFP transceived EEPROM dictionary
port_speed:
Configured port speed
lane_count:
Number of lanes assigned for that port

Returns:
a dictionary with string values defined for keys,
{'vendor_key':'', 'media_key':'', 'lane_speed_key':'')
"""
raise NotImplementedError
1 change: 1 addition & 0 deletions sonic_platform_base/sonic_xcvr/api/public/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def get_transceiver_info(self):
if len > 0:
cable_len = len
cable_type = type
break

xcvr_info = {
"type": serial_id[consts.ID_FIELD],
Expand Down
1 change: 1 addition & 0 deletions sonic_platform_base/sonic_xcvr/api/public/sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def get_transceiver_info(self):
if len > 0:
cable_len = len
cable_type = type
break

xcvr_info = {
"type": serial_id[consts.ID_FIELD],
Expand Down
4 changes: 2 additions & 2 deletions sonic_platform_base/sonic_xcvr/xcvr_api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ def _get_vendor_name(self):
name_data = self.reader(VENDOR_NAME_OFFSET, VENDOR_NAME_LENGTH)
if name_data is None:
return None
vendor_name = name_data.decode()
vendor_name = name_data.decode("ascii", errors="ignore")
return vendor_name.strip()

def _get_vendor_part_num(self):
part_num = self.reader(VENDOR_PART_NUM_OFFSET, VENDOR_PART_NUM_LENGTH)
if part_num is None:
return None
vendor_pn = part_num.decode()
vendor_pn = part_num.decode("ascii", errors="ignore")
return vendor_pn.strip()

def create_xcvr_api(self):
Expand Down
Loading