-
Notifications
You must be signed in to change notification settings - Fork 710
[sfp] Fix issue: Application Advertisement is not well formatted #2491
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
Changes from all commits
5cdba83
6a908e8
58ac8c6
52d6c81
04bd602
d6b4a8f
ea5452b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ | |
from swsscommon.swsscommon import SonicV2Connector | ||
from natsort import natsorted | ||
from sonic_py_common import device_info, logger, multi_asic | ||
from utilities_common.sfp_helper import covert_application_advertisement_to_output_string | ||
from utilities_common.sfp_helper import QSFP_DATA_MAP | ||
from tabulate import tabulate | ||
|
||
VERSION = '3.0' | ||
|
@@ -50,25 +52,6 @@ | |
SFF8472_A0_SIZE = 256 | ||
|
||
# TODO: We should share these maps and the formatting functions between sfputil and sfpshow | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
QSFP_DATA_MAP = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is still used by QSFP28/and QSFP+ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not remove it. I just move it to a common place. See sfp_helper.py. |
||
'model': 'Vendor PN', | ||
'vendor_oui': 'Vendor OUI', | ||
'vendor_date': 'Vendor Date Code(YYYY-MM-DD Lot)', | ||
'manufacturer': 'Vendor Name', | ||
'vendor_rev': 'Vendor Rev', | ||
'serial': 'Vendor SN', | ||
'type': 'Identifier', | ||
'ext_identifier': 'Extended Identifier', | ||
'ext_rateselect_compliance': 'Extended RateSelect Compliance', | ||
'cable_length': 'cable_length', | ||
'cable_type': 'Length', | ||
'nominal_bit_rate': 'Nominal Bit Rate(100Mbs)', | ||
'specification_compliance': 'Specification compliance', | ||
'encoding': 'Encoding', | ||
'connector': 'Connector', | ||
'application_advertisement': 'Application Advertisement' | ||
} | ||
|
||
QSFP_DD_DATA_MAP = { | ||
'model': 'Vendor PN', | ||
'vendor_oui': 'Vendor OUI', | ||
|
@@ -350,6 +333,8 @@ def convert_sfp_info_to_output_string(sfp_info_dict): | |
elif key == 'supported_max_laser_freq' or key == 'supported_min_laser_freq': | ||
if key in sfp_info_dict: # C-CMIS compliant / coherent modules | ||
output += '{}{}: {}GHz\n'.format(indent, QSFP_DD_DATA_MAP[key], sfp_info_dict[key]) | ||
elif key == 'application_advertisement': | ||
output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) | ||
else: | ||
try: | ||
output += '{}{}: {}\n'.format(indent, QSFP_DD_DATA_MAP[key], sfp_info_dict[key]) | ||
|
@@ -1358,8 +1343,8 @@ def download_firmware(port_name, filepath): | |
def run(port_name, mode): | ||
"""Run the firmware with default mode=1""" | ||
|
||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
sys.exit(EXIT_FAIL) | ||
|
||
if not is_sfp_present(port_name): | ||
|
@@ -1379,8 +1364,8 @@ def run(port_name, mode): | |
def commit(port_name): | ||
"""Commit the running firmware""" | ||
|
||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
sys.exit(EXIT_FAIL) | ||
|
||
if not is_sfp_present(port_name): | ||
|
@@ -1403,8 +1388,8 @@ def upgrade(port_name, filepath): | |
|
||
physical_port = logical_port_to_physical_port_index(port_name) | ||
|
||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
sys.exit(EXIT_FAIL) | ||
|
||
if not is_sfp_present(port_name): | ||
|
@@ -1441,8 +1426,8 @@ def upgrade(port_name, filepath): | |
def download(port_name, filepath): | ||
"""Download firmware on the transceiver""" | ||
|
||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
sys.exit(EXIT_FAIL) | ||
|
||
if not is_sfp_present(port_name): | ||
|
@@ -1469,8 +1454,8 @@ def unlock(port_name, password): | |
physical_port = logical_port_to_physical_port_index(port_name) | ||
sfp = platform_chassis.get_sfp(physical_port) | ||
|
||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
if is_port_type_rj45(port_name): | ||
click.echo("This functionality is not applicable for RJ45 port {}.".format(port_name)) | ||
sys.exit(EXIT_FAIL) | ||
|
||
if not is_sfp_present(port_name): | ||
|
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.
is this TODO is still valid? what is missing to close it?
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.
Yes, it is still valid. Now
show interface transceiver eeprom
andsfputil show eeprom
have very similar output. However, these two commands have their own implementation. I suppose they shall share the same implementation, but I did not do it in this PR because it would be a big change.