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

[sfputilbase]: enhance the sfputilbase for transceiver monitoring #9

Merged
merged 8 commits into from
Jul 30, 2018
Merged

[sfputilbase]: enhance the sfputilbase for transceiver monitoring #9

merged 8 commits into from
Jul 30, 2018

Conversation

keboliu
Copy link
Collaborator

@keboliu keboliu commented Jul 3, 2018

[sfputilbase]: enhance the sfputilbase for transceiver monitoring

[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

keboliu added 2 commits July 3, 2018 09:17
[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
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments.

@@ -364,6 +364,41 @@ class sff8436InterfaceId(sffbase):
'type' : 'bitmap',
'decode': {}}}

sfp_type = {
'type':
{'offset':0,
Copy link
Contributor

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.

'type':
{'offset':0,
'size':1,
'type' : 'enum',
Copy link
Contributor

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.

{'offset':0,
'size':2,
'type': 'func',
'decode': { 'func':calc_voltage}}
Copy link
Contributor

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.

title = []
# XXX: move the porttab
# parsing stuff to a separate module, or reuse
# if something already exists
Copy link
Contributor

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.

if re.search("^#", line) is not None:
# The current format is: # name lanes alias index speed
# Where the ordering of the columns can vary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this line?


#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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?


try:
sysfsfile_eeprom.close()
except:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except IOError: ?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove?

def get_transceiver_change_event(self, timeout=0):
"""
:param timeout
:returns: Boolean, True if call successful, False if not;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace tabs with spaces.

: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'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace tabs with spaces.

'TXPower':
{'offset':2,
'size':2,
'type':'func',
Copy link

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?

: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'}
"""
Copy link
Contributor

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.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "migarate" => "migrate"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@lguohan lguohan merged commit d98600e into sonic-net:master Jul 30, 2018
@keboliu keboliu deleted the sfputilbase_enhance branch August 22, 2018 10:29
oleksandrivantsiv pushed a commit to oleksandrivantsiv/sonic-platform-common that referenced this pull request Oct 25, 2024
Files now end with a single newline.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants