Skip to content

Commit

Permalink
Added type abbrev name to be used in media_settings.json for Dynamic …
Browse files Browse the repository at this point in the history
…transceiver tuning (#32)
  • Loading branch information
Sudharsan D.G authored and lguohan committed Jun 6, 2019
1 parent 35c0301 commit 7f95a2a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sonic_sfp/inf8628.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

try:
from .sff8024 import type_of_transceiver # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sff8024 import type_abbrv_name # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sffbase import sffbase # Dot module supports both Python 2 and Python 3 using explicit relative import methods
except ImportError as e:
raise ImportError ("%s - required module not found" % e)
Expand Down Expand Up @@ -77,6 +78,14 @@ def decode_module_state(self, eeprom_data, offset, size):
'decode': type_of_transceiver}
}

sfp_type_abbrv_name = {
'type_abbrv_name':
{'offset': 0,
'size': 1,
'type': 'enum',
'decode': type_abbrv_name}
}

vendor_name = {
'Vendor Name':
{'offset': 0,
Expand Down Expand Up @@ -121,6 +130,9 @@ def parse(self, eeprom_raw_data, start_pos):
def parse_sfp_type(self, type_raw_data, start_pos):
return sffbase.parse(self, self.sfp_type, type_raw_data, start_pos)

def parse_sfp_type_abbrv_name(self, type_raw_data, start_pos):
return sffbase.parse(self, self.sfp_type_abbrv_name, type_raw_data, start_pos)

def parse_vendor_name(self, name_raw_data, start_pos):
return sffbase.parse(self, self.vendor_name, name_raw_data, start_pos)

Expand Down
30 changes: 30 additions & 0 deletions sonic_sfp/sff8024.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,33 @@
'19': 'OSFP 8X Pluggable Transceiver',
'1a': 'SFP-DD Double Density 2X Pluggable Transceiver'
}

type_abbrv_name = {
'00': 'Unknown',
'01': 'GBIC',
'02': 'Soldered',
'03': 'SFP',
'04': 'XBI300',
'05': 'XENPAK',
'06': 'XFP',
'07': 'XFF',
'08': 'XFP-E',
'09': 'XPAK',
'0a': 'X2',
'0b': 'DWDM-SFP',
'0c': 'QSFP',
'0d': 'QSFP+',
'0e': 'CXP',
'0f': 'HD4X',
'10': 'HD8X',
'11': 'QSFP28',
'12': 'CXP2',
'13': 'CDFP-1/2',
'14': 'HD4X-Fanout',
'15': 'HD8X-Fanout',
'16': 'CDFP-3',
'17': 'MicroQSFP',
'18': 'QSFP-DD',
'19': 'OSFP-8X',
'1a': 'SFP-DD'
}
6 changes: 6 additions & 0 deletions sonic_sfp/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import types
from math import log10
from .sff8024 import type_of_transceiver # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sff8024 import type_abbrv_name # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sffbase import sffbase # Dot module supports both Python 2 and Python 3 using explicit relative import methods
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
Expand Down Expand Up @@ -352,6 +353,11 @@ class sff8436InterfaceId(sffbase):
'size':1,
'type' : 'enum',
'decode' : type_of_transceiver},
'type_abbrv_name':
{'offset':0,
'size':1,
'type' : 'enum',
'decode' : type_abbrv_name},
'Extended Identifier':
{'offset':1,
'size':1,
Expand Down
6 changes: 6 additions & 0 deletions sonic_sfp/sff8472.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import types
from math import log10
from .sff8024 import type_of_transceiver # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sff8024 import type_abbrv_name # Dot module supports both Python 2 and Python 3 using explicit relative import methods
from .sffbase import sffbase # Dot module supports both Python 2 and Python 3 using explicit relative import methods
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
Expand Down Expand Up @@ -419,6 +420,11 @@ class sff8472InterfaceId(sffbase):
'size':1,
'type' : 'enum',
'decode' : type_of_transceiver},
'type_abbrv_name':
{'offset':0,
'size':1,
'type' : 'enum',
'decode' : type_abbrv_name},
'Extended Identifier':
{'offset':1,
'size':1,
Expand Down
2 changes: 2 additions & 0 deletions sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ def get_transceiver_info_dict(self, port_num):
return None

transceiver_info_dict['type'] = sfp_type_data['data']['type']['value']
transceiver_info_dict['type_abbrv_name'] = sfp_type_data['data']['type_abbrv_name']['value']
transceiver_info_dict['manufacturename'] = sfp_vendor_name_data['data']['Vendor Name']['value']
transceiver_info_dict['modelname'] = sfp_vendor_pn_data['data']['Vendor PN']['value']
transceiver_info_dict['hardwarerev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value']
Expand Down Expand Up @@ -849,6 +850,7 @@ def get_transceiver_info_dict(self, port_num):
return None

transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value']
transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value']
transceiver_info_dict['manufacturename'] = sfp_vendor_name_data['data']['Vendor Name']['value']
transceiver_info_dict['modelname'] = sfp_vendor_pn_data['data']['Vendor PN']['value']
transceiver_info_dict['hardwarerev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value']
Expand Down

0 comments on commit 7f95a2a

Please sign in to comment.