-
Notifications
You must be signed in to change notification settings - Fork 182
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
[sfputilbase]: enhance the sfputilbase for transceiver monitoring #9
Conversation
keboliu
commented
Jul 3, 2018
[List of changes] * add ability to only read and parse specific bytes from eeprom * add two API to read the transceiver info and dom info which intrested by SNMP * add a new API definiton: get_transceiver_change_event * fix a bug: wrong 'VendorOUI' offset for sff8472 modified: sff8436.py modified: sff8472.py modified: sfputilbase.py Signed-off-by Liu Kebo kebol@mellanox.com
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.
As comments.
sonic_sfp/sff8436.py
Outdated
@@ -364,6 +364,41 @@ class sff8436InterfaceId(sffbase): | |||
'type' : 'bitmap', | |||
'decode': {}}} | |||
|
|||
sfp_type = { | |||
'type': | |||
{'offset':0, |
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.
Add space after :
for consistent PEP8 style ({'offset': 0,
).
There are many more occurrences. Please do this throughout the entire file.
sonic_sfp/sff8436.py
Outdated
'type': | ||
{'offset':0, | ||
'size':1, | ||
'type' : 'enum', |
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.
Delete space before :
for consistent PEP8 style ({''type': 'enum',
).
There are many more occurrences. Please do this throughout the entire file.
sonic_sfp/sff8436.py
Outdated
{'offset':0, | ||
'size':2, | ||
'type': 'func', | ||
'decode': { 'func':calc_voltage}} |
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.
Delete space after {
for consistent PEP8 style ('decode': {'func':calc_voltage}}
).
There are many more occurrences. Please do this throughout the entire file.
sonic_sfp/sfputilbase.py
Outdated
title = [] | ||
# XXX: move the porttab | ||
# parsing stuff to a separate module, or reuse | ||
# if something already exists |
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.
Please change this comment back, as the other comment is newer and more descriptive as to what needs to be done.
sonic_sfp/sfputilbase.py
Outdated
if re.search("^#", line) is not None: | ||
# The current format is: # name lanes alias index speed | ||
# Where the ordering of the columns can vary |
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.
Why remove this line?
sonic_sfp/sfputilbase.py
Outdated
|
||
#print("transceiver info succcessfully fetched") | ||
return transceiver_info_dict | ||
#return sfp_type_data, sfp_vendor_name_data, sfp_vendor_pn_data, sfp_vendor_rev_data, sfp_vendor_sn_data |
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.
Remove?
sonic_sfp/sfputilbase.py
Outdated
|
||
try: | ||
sysfsfile_eeprom.close() | ||
except: |
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.
except IOError:
?
sonic_sfp/sfputilbase.py
Outdated
transceiver_dom_info_dict['voltage'] = dom_voltage_data['data']['Vcc']['value'] | ||
|
||
return transceiver_dom_info_dict | ||
#return dom_temperature_data, dom_voltage_data, dom_channel_monitor_data |
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.
Remove?
sonic_sfp/sfputilbase.py
Outdated
def get_transceiver_change_event(self, timeout=0): | ||
""" | ||
:param timeout | ||
:returns: Boolean, True if call successful, False if not; |
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.
Replace tabs with spaces.
sonic_sfp/sfputilbase.py
Outdated
:param timeout | ||
:returns: Boolean, True if call successful, False if not; | ||
dict for pysical interface number and the SFP status, | ||
status='1' represent plug in, '0' represent plug out like {'0': '1', '31':'0'} |
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.
Replace tabs with spaces.
sonic_sfp/sff8472.py
Outdated
'TXPower': | ||
{'offset':2, | ||
'size':2, | ||
'type':'func', |
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.
Could we expose TXpower from the sfputilbase and add them into Database?
sonic_sfp/sfputilbase.py
Outdated
:returns: Boolean, True if call successful, False if not; | ||
dict for pysical interface number and the SFP status, | ||
status='1' represent plug in, '0' represent plug out like {'0': '1', '31':'0'} | ||
""" |
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.
Please add 4 more spaces to align.
sonic_sfp/sfputilbase.py
Outdated
return None | ||
|
||
# QSFP capability byte parse, through this byte can know whether it support tx_power or not. | ||
# TODO: in the future when decided to migarate to support SFF-8636 instead of SFF-8436, |
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.
Typo: "migarate" => "migrate"
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.
fixed.
Files now end with a single newline.