From df6d58764950d6efeb61a3ebbda753b813490ba8 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Thu, 26 Jan 2023 01:06:16 +0000 Subject: [PATCH 1/7] Add transceiver info CLI support to show output from TRANSCEIVER_INFO for ZR Signed-off-by: Mihir Patel --- scripts/sfpshow | 46 +++++++++++++++++++++++++++++++--- show/interfaces/__init__.py | 22 ++++++++++++++++ utilities_common/sfp_helper.py | 37 +++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 4 deletions(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index 0787688903..c7b96955b3 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -17,7 +17,7 @@ from natsort import natsorted from sonic_py_common.interface import front_panel_prefix, backplane_prefix, inband_prefix, recirc_prefix from sonic_py_common import multi_asic from utilities_common.sfp_helper import covert_application_advertisement_to_output_string -from utilities_common.sfp_helper import QSFP_DATA_MAP +from utilities_common.sfp_helper import QSFP_DATA_MAP, CMIS_DATA_MAP from tabulate import tabulate # Mock the redis DB for unit test purposes @@ -245,8 +245,26 @@ class SFPShow(object): units) return output - # Convert sfp info in DB to cli output string - def convert_sfp_info_to_output_string(self, sfp_info_dict): + # Convert cmis sfp info in DB to cli output string + def convert_cmis_sfp_info_to_output_string(self, sfp_info_dict): + indent = ' ' * 8 + output = '' + + sorted_cmis_data_map_keys = sorted(CMIS_DATA_MAP, key=CMIS_DATA_MAP.get) + for key in sorted_cmis_data_map_keys: + if key == 'cable_type': + output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length']) + elif key == 'cable_length': + pass + elif key == 'application_advertisement': + output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) + else: + output += '{}{}: {}\n'.format(indent, CMIS_DATA_MAP[key], sfp_info_dict[key]) + + return output + + # Convert non cmis sfp info in DB to cli output string + def convert_non_cmis_sfp_info_to_output_string(self, sfp_info_dict): indent = ' ' * 8 output = '' @@ -385,7 +403,10 @@ class SFPShow(object): output = 'SFP EEPROM is not applicable for RJ45 port\n' else: output = 'SFP EEPROM detected\n' - sfp_info_output = self.convert_sfp_info_to_output_string(sfp_info_dict) + if 'cmis_rev' in sfp_info_dict: + sfp_info_output = self.convert_cmis_sfp_info_to_output_string(sfp_info_dict) + else: + sfp_info_output = self.convert_non_cmis_sfp_info_to_output_string(sfp_info_dict) output += sfp_info_output if dump_dom: @@ -476,6 +497,23 @@ def eeprom(port, dump_dom, namespace): sfp.get_eeprom() sfp.display_eeprom() +# 'eeprom' subcommand + +@cli.command() +@click.option('-p', '--port', metavar='', help="Display SFP EEPROM data for port only") +@click.option('-n', '--namespace', default=None, help="Display interfaces for specific namespace") +def info(port, namespace): + if port and multi_asic.is_multi_asic() and namespace is None: + try: + namespace = multi_asic.get_namespace_for_port(port) + except Exception: + display_invalid_intf_eeprom(port) + sys.exit(1) + + sfp = SFPShow(port, namespace) + sfp.get_eeprom() + sfp.display_eeprom() + # 'presence' subcommand diff --git a/show/interfaces/__init__.py b/show/interfaces/__init__.py index 3e82a68e66..c97cf4d7ed 100644 --- a/show/interfaces/__init__.py +++ b/show/interfaces/__init__.py @@ -446,6 +446,28 @@ def eeprom(interfacename, dump_dom, namespace, verbose): clicommon.run_command(cmd, display_cmd=verbose) +@transceiver.command() +@click.argument('interfacename', required=False) +@click.option('--namespace', '-n', 'namespace', default=None, show_default=True, + type=click.Choice(multi_asic_util.multi_asic_ns_choices()), help='Namespace name or all') +@click.option('--verbose', is_flag=True, help="Enable verbose output") +def info(interfacename, namespace, verbose): + """Show interface transceiver information""" + + ctx = click.get_current_context() + + cmd = "sfpshow info" + + if interfacename is not None: + interfacename = try_convert_interfacename_from_alias(ctx, interfacename) + + cmd += " -p {}".format(interfacename) + + if namespace is not None: + cmd += " -n {}".format(namespace) + + clicommon.run_command(cmd, display_cmd=verbose) + @transceiver.command() @click.argument('interfacename', required=False) @click.option('--verbose', is_flag=True, help="Enable verbose output") diff --git a/utilities_common/sfp_helper.py b/utilities_common/sfp_helper.py index 6ae9b85a1c..40aede59d1 100644 --- a/utilities_common/sfp_helper.py +++ b/utilities_common/sfp_helper.py @@ -19,6 +19,43 @@ 'application_advertisement': 'Application Advertisement' } +CMIS_DATA_MAP = { + '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', + 'host_lane_count': 'Host Lane Count', + 'media_lane_count': 'Media Lane Count', + 'active_apsel_hostlane1': 'Active application selected code assigned to host lane 1', + 'active_apsel_hostlane2': 'Active application selected code assigned to host lane 2', + 'active_apsel_hostlane3': 'Active application selected code assigned to host lane 3', + 'active_apsel_hostlane4': 'Active application selected code assigned to host lane 4', + 'active_apsel_hostlane5': 'Active application selected code assigned to host lane 5', + 'active_apsel_hostlane6': 'Active application selected code assigned to host lane 6', + 'active_apsel_hostlane7': 'Active application selected code assigned to host lane 7', + 'active_apsel_hostlane8': 'Active application selected code assigned to host lane 8', + 'media_interface_technology': 'Media Interface Technology', + 'hardware_rev': 'Module Hardware Rev', + 'cmis_rev': 'CMIS Rev', + 'active_firmware': 'Active Firmware', + 'inactive_firmware': 'Inactive Firmware', + 'supported_max_tx_power': 'Supported Max TX Power', + 'supported_min_tx_power': 'Supported Min TX Power', + 'supported_max_laser_freq': 'Supported Max Laser Frequency', + 'supported_min_laser_freq': 'Supported Min Laser Frequency' +} def covert_application_advertisement_to_output_string(indent, sfp_info_dict): key = 'application_advertisement' From 9e2e3e2fa014f51075ec11b64f194b11ad8d0dd0 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Thu, 26 Jan 2023 19:58:57 +0000 Subject: [PATCH 2/7] Added test case for info CLI --- tests/mock_tables/asic0/state_db.json | 37 +++++++++++++++++++ tests/mock_tables/state_db.json | 37 +++++++++++++++++++ tests/sfp_test.py | 52 +++++++++++++++++++++++++++ 3 files changed, 126 insertions(+) diff --git a/tests/mock_tables/asic0/state_db.json b/tests/mock_tables/asic0/state_db.json index 21b4fa0eab..2756404971 100644 --- a/tests/mock_tables/asic0/state_db.json +++ b/tests/mock_tables/asic0/state_db.json @@ -51,6 +51,43 @@ "vcclowalarm": "2.9700", "vcclowwarning": "3.1349" }, + "TRANSCEIVER_INFO|Ethernet48": { + "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", + "hardware_rev" : "1.1", + "serial" : "214455197", + "manufacturer" : "Acacia Comm Inc.", + "model" : "DP04QSDD-E20-001", + "connector" : "LC", + "encoding" : "N/A", + "ext_identifier" : "Power Class 8 (20.0W Max)", + "ext_rateselect_compliance" : "N/A", + "cable_type" : "Length Cable Assembly(m)", + "cable_length" : "0.0", + "nominal_bit_rate" : "0", + "specification_compliance" : "sm_media_interface", + "vendor_date" : "2021-11-19", + "vendor_oui" : "7c-b2-5c", + "application_advertisement" : "{1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, Single Wavelength, Unamplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 3: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85, 'media_lane_assignment_options': 1}}", + "host_lane_count" : "8", + "media_lane_count" : "1", + "active_apsel_hostlane1" : "1", + "active_apsel_hostlane2" : "1", + "active_apsel_hostlane3" : "1", + "active_apsel_hostlane4" : "1", + "active_apsel_hostlane5" : "1", + "active_apsel_hostlane6" : "1", + "active_apsel_hostlane7" : "1", + "active_apsel_hostlane8" : "1", + "media_interface_technology" : "1550 nm DFB", + "vendor_rev" : "A", + "cmis_rev" : "4.1", + "active_firmware" : "61.20", + "inactive_firmware" : "161.10", + "supported_max_tx_power" : "4.0", + "supported_min_tx_power" : "-22.9", + "supported_max_laser_freq" : "196100", + "supported_min_laser_freq" : "191300" + }, "CHASSIS_INFO|chassis 1": { "psu_num": "2" }, diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index 12552997b9..d01bc28cc3 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -227,6 +227,43 @@ "nominal_bit_rate": "Not supported for CMIS cables", "application_advertisement": "{1: {'host_electrical_interface_id': '400G CR8', 'module_media_interface_id': 'Copper cable', 'media_lane_count': 8, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 2}, 2: {'host_electrical_interface_id': '200GBASE-CR4 (Clause 136)'}}" }, + "TRANSCEIVER_INFO|Ethernet48": { + "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", + "hardware_rev" : "1.1", + "serial" : "214455197", + "manufacturer" : "Acacia Comm Inc.", + "model" : "DP04QSDD-E20-001", + "connector" : "LC", + "encoding" : "N/A", + "ext_identifier" : "Power Class 8 (20.0W Max)", + "ext_rateselect_compliance" : "N/A", + "cable_type" : "Length Cable Assembly(m)", + "cable_length" : "0.0", + "nominal_bit_rate" : "0", + "specification_compliance" : "sm_media_interface", + "vendor_date" : "2021-11-19", + "vendor_oui" : "7c-b2-5c", + "application_advertisement" : "{1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, Single Wavelength, Unamplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 3: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85, 'media_lane_assignment_options': 1}}", + "host_lane_count" : "8", + "media_lane_count" : "1", + "active_apsel_hostlane1" : "1", + "active_apsel_hostlane2" : "1", + "active_apsel_hostlane3" : "1", + "active_apsel_hostlane4" : "1", + "active_apsel_hostlane5" : "1", + "active_apsel_hostlane6" : "1", + "active_apsel_hostlane7" : "1", + "active_apsel_hostlane8" : "1", + "media_interface_technology" : "1550 nm DFB", + "vendor_rev" : "A", + "cmis_rev" : "4.1", + "active_firmware" : "61.20", + "inactive_firmware" : "161.10", + "supported_max_tx_power" : "4.0", + "supported_min_tx_power" : "-22.9", + "supported_max_laser_freq" : "196100", + "supported_min_laser_freq" : "191300" + }, "TRANSCEIVER_STATUS|Ethernet0": { "status": "67", "error": "Blocking Error|High temperature" diff --git a/tests/sfp_test.py b/tests/sfp_test.py index 6d5d9fa7af..43ab791d48 100644 --- a/tests/sfp_test.py +++ b/tests/sfp_test.py @@ -193,6 +193,46 @@ Vendor SN: INKAO2900002A """ +test_cmis_eeprom_output = """\ +Ethernet48: SFP EEPROM detected + Active Firmware: 61.20 + Active application selected code assigned to host lane 1: 1 + Active application selected code assigned to host lane 2: 1 + Active application selected code assigned to host lane 3: 1 + Active application selected code assigned to host lane 4: 1 + Active application selected code assigned to host lane 5: 1 + Active application selected code assigned to host lane 6: 1 + Active application selected code assigned to host lane 7: 1 + Active application selected code assigned to host lane 8: 1 + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1) + 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, Single Wavelength, Unamplified - Media Assign (0x1) + 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) + CMIS Rev: 4.1 + Connector: LC + Encoding: N/A + Extended Identifier: Power Class 8 (20.0W Max) + Extended RateSelect Compliance: N/A + Host Lane Count: 8 + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Inactive Firmware: 161.10 + Length Cable Assembly(m): 0.0 + Media Interface Technology: 1550 nm DFB + Media Lane Count: 1 + Module Hardware Rev: 1.1 + Nominal Bit Rate(100Mbs): 0 + Specification Compliance: sm_media_interface + Supported Max Laser Frequency: 196100 + Supported Max TX Power: 4.0 + Supported Min Laser Frequency: 191300 + Supported Min TX Power: -22.9 + Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 + Vendor Name: Acacia Comm Inc. + Vendor OUI: 7c-b2-5c + Vendor PN: DP04QSDD-E20-001 + Vendor Rev: A + Vendor SN: 214455197 +""" + test_sfp_eeprom_dom_all_output = """\ Ethernet0: SFP EEPROM detected Application Advertisement: N/A @@ -434,6 +474,12 @@ def test_qsfp_dd_eeprom_adv_app(self): print(result.output) assert result.output == test_qsfp_dd_eeprom_adv_app_output + def test_cmis_info(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet48"]) + assert result.exit_code == 0 + assert result.output == test_cmis_eeprom_output + def test_rj45_eeprom(self): runner = CliRunner() result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet36"]) @@ -508,6 +554,12 @@ def test_sfp_eeprom_with_ns(self): expected = "Ethernet200: SFP EEPROM Not detected" assert result_lines == expected + def test_cmis_sfp_info_with_ns(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet48 -n asic0"]) + assert result.exit_code == 0 + assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_cmis_eeprom_output + def test_sfp_eeprom_all(self): runner = CliRunner() result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"]) From 0c219ac86e6af58de92b4c03267f60179ec4c018 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Fri, 27 Jan 2023 20:32:53 +0000 Subject: [PATCH 3/7] Updated command reference --- doc/Command-Reference.md | 44 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index c6985b5970..537453fdee 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -926,7 +926,7 @@ This command displays information for all the interfaces for the transceiver req - Usage: ``` - show interfaces transceiver (eeprom [-d|--dom] | lpmode | presence | error-status [-hw|--fetch-from-hardware]) [] + show interfaces transceiver (eeprom [-d|--dom] | info | lpmode | presence | error-status [-hw|--fetch-from-hardware]) [] ``` - Example (Decode and display information stored on the EEPROM of SFP transceiver connected to Ethernet0): @@ -964,6 +964,48 @@ This command displays information for all the interfaces for the transceiver req Vcc : 0.0000Volts ``` +- Example (Decode and display information stored on the EEPROM of SFP transceiver connected to Ethernet16): + ``` + admin@sonic:~$ show interfaces transceiver info Ethernet16 + Ethernet16: SFP EEPROM detected + Active Firmware: 61.20 + Active application selected code assigned to host lane 1: 1 + Active application selected code assigned to host lane 2: 1 + Active application selected code assigned to host lane 3: 1 + Active application selected code assigned to host lane 4: 1 + Active application selected code assigned to host lane 5: 1 + Active application selected code assigned to host lane 6: 1 + Active application selected code assigned to host lane 7: 1 + Active application selected code assigned to host lane 8: 1 + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1) + 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, Single Wavelength, Unamplified - Media Assign (0x1) + 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) + CMIS Rev: 4.1 + Connector: LC + Encoding: N/A + Extended Identifier: Power Class 8 (20.0W Max) + Extended RateSelect Compliance: N/A + Host Lane Count: 8 + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Inactive Firmware: 61.20 + Length Cable Assembly(m): 0.0 + Media Interface Technology: 1550 nm DFB + Media Lane Count: 1 + Module Hardware Rev: 49.49 + Nominal Bit Rate(100Mbs): 0 + Specification Compliance: sm_media_interface + Supported Max Laser Frequency: 196100 + Supported Max TX Power: 4.0 + Supported Min Laser Frequency: 191300 + Supported Min TX Power: -22.9 + Vendor Date Code(YYYY-MM-DD Lot): 2020-21-02 17 + Vendor Name: Acacia Comm Inc. + Vendor OUI: 7c-b2-5c + Vendor PN: DP04QSDD-E20-00E + Vendor Rev: 01 + Vendor SN: 210753986 + ``` + - Example (Display status of low-power mode of SFP transceiver connected to Ethernet100): ``` admin@sonic:~$ show interfaces transceiver lpmode Ethernet100 From 686603e7eed299dc7eff8f2040f083b012152a52 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Wed, 1 Feb 2023 20:00:38 +0000 Subject: [PATCH 4/7] Resolved merged conflicts --- show/interfaces/__init__.py | 17 +++++------------ tests/mock_tables/state_db.json | 2 -- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/show/interfaces/__init__.py b/show/interfaces/__init__.py index 5686b2e3e6..a7a562446b 100644 --- a/show/interfaces/__init__.py +++ b/show/interfaces/__init__.py @@ -462,20 +462,12 @@ def pm(interfacename, namespace, verbose): interfacename = try_convert_interfacename_from_alias( ctx, interfacename) -@transceiver.command() -@click.argument('interfacename', required=False) -@click.option('--namespace', '-n', 'namespace', default=None, show_default=True, - type=click.Choice(multi_asic_util.multi_asic_ns_choices()), help='Namespace name or all') -@click.option('--verbose', is_flag=True, help="Enable verbose output") -def info(interfacename, namespace, verbose): - """Show interface transceiver information""" - - ctx = click.get_current_context() + cmd += " -p {}".format(interfacename) - cmd = "sfpshow info" + if namespace is not None: + cmd += " -n {}".format(namespace) - if interfacename is not None: - interfacename = try_convert_interfacename_from_alias(ctx, interfacename) + clicommon.run_command(cmd, display_cmd=verbose) @transceiver.command() @click.argument('interfacename', required=False) @@ -491,6 +483,7 @@ def info(interfacename, namespace, verbose): if interfacename is not None: interfacename = try_convert_interfacename_from_alias(ctx, interfacename) + cmd += " -p {}".format(interfacename) if namespace is not None: diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index ced6b84c10..1b560d655e 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -227,7 +227,6 @@ "nominal_bit_rate": "Not supported for CMIS cables", "application_advertisement": "{1: {'host_electrical_interface_id': '400G CR8', 'module_media_interface_id': 'Copper cable', 'media_lane_count': 8, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 2}, 2: {'host_electrical_interface_id': '200GBASE-CR4 (Clause 136)'}}" }, - "TRANSCEIVER_DOM_THRESHOLD|Ethernet44":{ "temphighalarm": "80.0", "templowalarm": "-5.0", @@ -374,7 +373,6 @@ "rx_sig_power_min": "-40", "rx_sig_power_max": "40" }, - "TRANSCEIVER_INFO|Ethernet48": { "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", "hardware_rev" : "1.1", From b6aa0e00af78977922af27a0b66ec74cd6411e51 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Thu, 2 Feb 2023 20:43:52 +0000 Subject: [PATCH 5/7] Made convert_sfp_info_to_output_string generic for CMIS and non CMIS and added test case to address PR comment --- scripts/sfpshow | 37 ++------ tests/mock_tables/asic1/state_db.json | 51 +++++++---- tests/mock_tables/state_db.json | 2 +- tests/sfp_test.py | 118 ++++++++++++++++++-------- utilities_common/sfp_helper.py | 20 +---- 5 files changed, 130 insertions(+), 98 deletions(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index cfc2c20bea..ce36835ebe 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -280,36 +280,20 @@ class SFPShow(object): units) return output - # Convert cmis sfp info in DB to cli output string - def convert_cmis_sfp_info_to_output_string(self, sfp_info_dict): + # Convert sfp info in DB to cli output string + def convert_sfp_info_to_output_string(self, sfp_info_dict): indent = ' ' * 8 output = '' + is_sfp_cmis = 'cmis_rev' in sfp_info_dict - sorted_cmis_data_map_keys = sorted(CMIS_DATA_MAP, key=CMIS_DATA_MAP.get) - for key in sorted_cmis_data_map_keys: + data_map = CMIS_DATA_MAP if is_sfp_cmis else QSFP_DATA_MAP + sorted_data_map_keys = sorted(data_map, key=data_map.get) + for key in sorted_data_map_keys: if key == 'cable_type': output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length']) elif key == 'cable_length': pass - elif key == 'application_advertisement': - output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) - else: - output += '{}{}: {}\n'.format(indent, CMIS_DATA_MAP[key], sfp_info_dict[key]) - - return output - - # Convert non cmis sfp info in DB to cli output string - def convert_non_cmis_sfp_info_to_output_string(self, sfp_info_dict): - indent = ' ' * 8 - output = '' - - sorted_qsfp_data_map_keys = sorted(QSFP_DATA_MAP, key=QSFP_DATA_MAP.get) - for key in sorted_qsfp_data_map_keys: - if key == 'cable_type': - output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length']) - elif key == 'cable_length': - pass - elif key == 'specification_compliance': + elif key == 'specification_compliance' and not(is_sfp_cmis): if sfp_info_dict['type'] == "QSFP-DD Double Density 8X Pluggable Transceiver": output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP[key], sfp_info_dict[key]) else: @@ -326,7 +310,7 @@ class SFPShow(object): elif key == 'application_advertisement': output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) else: - output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP[key], sfp_info_dict[key]) + output += '{}{}: {}\n'.format(indent, data_map[key], sfp_info_dict[key]) return output @@ -438,10 +422,7 @@ class SFPShow(object): output = 'SFP EEPROM is not applicable for RJ45 port\n' else: output = 'SFP EEPROM detected\n' - if 'cmis_rev' in sfp_info_dict: - sfp_info_output = self.convert_cmis_sfp_info_to_output_string(sfp_info_dict) - else: - sfp_info_output = self.convert_non_cmis_sfp_info_to_output_string(sfp_info_dict) + sfp_info_output = self.convert_sfp_info_to_output_string(sfp_info_dict) output += sfp_info_output if dump_dom: diff --git a/tests/mock_tables/asic1/state_db.json b/tests/mock_tables/asic1/state_db.json index dd775b9b50..bb132dbb3b 100644 --- a/tests/mock_tables/asic1/state_db.json +++ b/tests/mock_tables/asic1/state_db.json @@ -1,21 +1,40 @@ { "TRANSCEIVER_INFO|Ethernet64": { - "type": "QSFP28 or later", - "vendor_rev": "AC", - "serial": "MT1706FT02064", - "manufacturer": "Mellanox", - "model": "MFA1A00-C003", - "vendor_oui": "00-02-c9", - "vendor_date": "2017-01-13 ", - "connector": "No separable connector", - "encoding": "64B66B", - "ext_identifier": "Power Class 3(2.5W max), CDR present in Rx Tx", - "ext_rateselect_compliance": "QSFP+ Rate Select Version 1", - "cable_type": "Length Cable Assembly(m)", - "cable_length": "3", - "specification_compliance": "{'10/40G Ethernet Compliance Code': '40G Active Cable (XLPPI)'}", - "nominal_bit_rate": "255", - "application_advertisement": "N/A" + "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", + "hardware_rev" : "1.1", + "serial" : "214455197", + "manufacturer" : "Acacia Comm Inc.", + "model" : "DP04QSDD-E20-001", + "connector" : "LC", + "encoding" : "N/A", + "ext_identifier" : "Power Class 8 (20.0W Max)", + "ext_rateselect_compliance" : "N/A", + "cable_type" : "Length Cable Assembly(m)", + "cable_length" : "0.0", + "nominal_bit_rate" : "0", + "specification_compliance" : "sm_media_interface", + "vendor_date" : "2021-11-19", + "vendor_oui" : "7c-b2-5c", + "application_advertisement" : "{1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, Single Wavelength, Unamplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 3: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85, 'media_lane_assignment_options': 1}}", + "host_lane_count" : "8", + "media_lane_count" : "1", + "active_apsel_hostlane1" : "1", + "active_apsel_hostlane2" : "1", + "active_apsel_hostlane3" : "1", + "active_apsel_hostlane4" : "1", + "active_apsel_hostlane5" : "1", + "active_apsel_hostlane6" : "1", + "active_apsel_hostlane7" : "1", + "active_apsel_hostlane8" : "1", + "media_interface_technology" : "1550 nm DFB", + "vendor_rev" : "A", + "cmis_rev" : "4.1", + "active_firmware" : "61.20", + "inactive_firmware" : "161.10", + "supported_max_tx_power" : "4.0", + "supported_min_tx_power" : "-22.9", + "supported_max_laser_freq" : "196100", + "supported_min_laser_freq" : "191300" }, "TRANSCEIVER_DOM_SENSOR|Ethernet64": { "temperature": "30.9258", diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index 1b560d655e..97cf5f3b06 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -373,7 +373,7 @@ "rx_sig_power_min": "-40", "rx_sig_power_max": "40" }, - "TRANSCEIVER_INFO|Ethernet48": { + "TRANSCEIVER_INFO|Ethernet64": { "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", "hardware_rev" : "1.1", "serial" : "214455197", diff --git a/tests/sfp_test.py b/tests/sfp_test.py index 0cbcece4a5..1c30e005ad 100644 --- a/tests/sfp_test.py +++ b/tests/sfp_test.py @@ -216,7 +216,7 @@ """ test_cmis_eeprom_output = """\ -Ethernet48: SFP EEPROM detected +Ethernet64: SFP EEPROM detected Active Firmware: 61.20 Active application selected code assigned to host lane 1: 1 Active application selected code assigned to host lane 2: 1 @@ -242,7 +242,7 @@ Media Lane Count: 1 Module Hardware Rev: 1.1 Nominal Bit Rate(100Mbs): 0 - Specification Compliance: sm_media_interface + Specification compliance: sm_media_interface Supported Max Laser Frequency: 196100 Supported Max TX Power: 4.0 Supported Min Laser Frequency: 191300 @@ -307,22 +307,42 @@ Ethernet4: SFP EEPROM Not detected Ethernet64: SFP EEPROM detected - Application Advertisement: N/A - Connector: No separable connector - Encoding: 64B66B - Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx - Extended RateSelect Compliance: QSFP+ Rate Select Version 1 - Identifier: QSFP28 or later - Length Cable Assembly(m): 3 - Nominal Bit Rate(100Mbs): 255 - Specification compliance: - 10/40G Ethernet Compliance Code: 40G Active Cable (XLPPI) - Vendor Date Code(YYYY-MM-DD Lot): 2017-01-13 - Vendor Name: Mellanox - Vendor OUI: 00-02-c9 - Vendor PN: MFA1A00-C003 - Vendor Rev: AC - Vendor SN: MT1706FT02064 + Active Firmware: 61.20 + Active application selected code assigned to host lane 1: 1 + Active application selected code assigned to host lane 2: 1 + Active application selected code assigned to host lane 3: 1 + Active application selected code assigned to host lane 4: 1 + Active application selected code assigned to host lane 5: 1 + Active application selected code assigned to host lane 6: 1 + Active application selected code assigned to host lane 7: 1 + Active application selected code assigned to host lane 8: 1 + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1) + 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, Single Wavelength, Unamplified - Media Assign (0x1) + 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) + CMIS Rev: 4.1 + Connector: LC + Encoding: N/A + Extended Identifier: Power Class 8 (20.0W Max) + Extended RateSelect Compliance: N/A + Host Lane Count: 8 + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Inactive Firmware: 161.10 + Length Cable Assembly(m): 0.0 + Media Interface Technology: 1550 nm DFB + Media Lane Count: 1 + Module Hardware Rev: 1.1 + Nominal Bit Rate(100Mbs): 0 + Specification compliance: sm_media_interface + Supported Max Laser Frequency: 196100 + Supported Max TX Power: 4.0 + Supported Min Laser Frequency: 191300 + Supported Min TX Power: -22.9 + Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 + Vendor Name: Acacia Comm Inc. + Vendor OUI: 7c-b2-5c + Vendor PN: DP04QSDD-E20-001 + Vendor Rev: A + Vendor SN: 214455197 ChannelMonitorValues: RX1Power: 0.3802dBm RX2Power: -0.4871dBm @@ -377,22 +397,42 @@ Ethernet4: SFP EEPROM Not detected Ethernet64: SFP EEPROM detected - Application Advertisement: N/A - Connector: No separable connector - Encoding: 64B66B - Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx - Extended RateSelect Compliance: QSFP+ Rate Select Version 1 - Identifier: QSFP28 or later - Length Cable Assembly(m): 3 - Nominal Bit Rate(100Mbs): 255 - Specification compliance: - 10/40G Ethernet Compliance Code: 40G Active Cable (XLPPI) - Vendor Date Code(YYYY-MM-DD Lot): 2017-01-13 - Vendor Name: Mellanox - Vendor OUI: 00-02-c9 - Vendor PN: MFA1A00-C003 - Vendor Rev: AC - Vendor SN: MT1706FT02064 + Active Firmware: 61.20 + Active application selected code assigned to host lane 1: 1 + Active application selected code assigned to host lane 2: 1 + Active application selected code assigned to host lane 3: 1 + Active application selected code assigned to host lane 4: 1 + Active application selected code assigned to host lane 5: 1 + Active application selected code assigned to host lane 6: 1 + Active application selected code assigned to host lane 7: 1 + Active application selected code assigned to host lane 8: 1 + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1) + 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, Single Wavelength, Unamplified - Media Assign (0x1) + 100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1) + CMIS Rev: 4.1 + Connector: LC + Encoding: N/A + Extended Identifier: Power Class 8 (20.0W Max) + Extended RateSelect Compliance: N/A + Host Lane Count: 8 + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Inactive Firmware: 161.10 + Length Cable Assembly(m): 0.0 + Media Interface Technology: 1550 nm DFB + Media Lane Count: 1 + Module Hardware Rev: 1.1 + Nominal Bit Rate(100Mbs): 0 + Specification compliance: sm_media_interface + Supported Max Laser Frequency: 196100 + Supported Max TX Power: 4.0 + Supported Min Laser Frequency: 191300 + Supported Min TX Power: -22.9 + Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 + Vendor Name: Acacia Comm Inc. + Vendor OUI: 7c-b2-5c + Vendor PN: DP04QSDD-E20-001 + Vendor Rev: A + Vendor SN: 214455197 """ test_sfp_presence_all_output = """\ @@ -506,7 +546,7 @@ def test_qsfp_dd_eeprom_adv_app(self): def test_cmis_info(self): runner = CliRunner() - result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet48"]) + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet64"]) assert result.exit_code == 0 assert result.output == test_cmis_eeprom_output @@ -593,7 +633,7 @@ def test_qsfp_dd_pm_with_ns(self): def test_cmis_sfp_info_with_ns(self): runner = CliRunner() - result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet48 -n asic0"]) + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"], ["Ethernet64 -n asic1"]) assert result.exit_code == 0 assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_cmis_eeprom_output @@ -603,6 +643,12 @@ def test_sfp_eeprom_all(self): assert result.exit_code == 0 assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_sfp_eeprom_all_output + def test_sfp_info_all(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["info"]) + assert result.exit_code == 0 + assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_sfp_eeprom_all_output + def test_sfp_eeprom_dom_all(self): runner = CliRunner() result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["-d"]) diff --git a/utilities_common/sfp_helper.py b/utilities_common/sfp_helper.py index 40aede59d1..a5bf7839a9 100644 --- a/utilities_common/sfp_helper.py +++ b/utilities_common/sfp_helper.py @@ -19,23 +19,7 @@ 'application_advertisement': 'Application Advertisement' } -CMIS_DATA_MAP = { - '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_CMIS_DELTA_DATA_MAP = { 'host_lane_count': 'Host Lane Count', 'media_lane_count': 'Media Lane Count', 'active_apsel_hostlane1': 'Active application selected code assigned to host lane 1', @@ -57,6 +41,8 @@ 'supported_min_laser_freq': 'Supported Min Laser Frequency' } +CMIS_DATA_MAP = {**QSFP_DATA_MAP, **QSFP_CMIS_DELTA_DATA_MAP} + def covert_application_advertisement_to_output_string(indent, sfp_info_dict): key = 'application_advertisement' field_name = '{}{}: '.format(indent, QSFP_DATA_MAP[key]) From df975e17ef6bece92d2395435adc6df92f49e34c Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Thu, 2 Feb 2023 22:28:51 +0000 Subject: [PATCH 6/7] Resolved test_multi_asic_interface_status_all failure --- tests/multi_asic_intfutil_test.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/multi_asic_intfutil_test.py b/tests/multi_asic_intfutil_test.py index 56e11fa0d3..37e5b5b0f0 100644 --- a/tests/multi_asic_intfutil_test.py +++ b/tests/multi_asic_intfutil_test.py @@ -10,18 +10,18 @@ scripts_path = os.path.join(modules_path, "scripts") intf_status_all = """\ - Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC ---------------- ------------ ------- ----- ----- -------------- --------------- ------ ------- --------------- ---------- - Ethernet0 33,34,35,36 40G 9100 N/A Ethernet1/1 PortChannel1002 up up QSFP28 or later off - Ethernet4 29,30,31,32 40G 9100 N/A Ethernet1/2 PortChannel1002 up up N/A off - Ethernet64 29,30,31,32 40G 9100 N/A Ethernet1/17 routed up up QSFP28 or later off - Ethernet-BP0 93,94,95,96 40G 9100 N/A Ethernet-BP0 PortChannel4001 up up N/A off - Ethernet-BP4 97,98,99,100 40G 9100 N/A Ethernet-BP4 PortChannel4001 up up N/A off - Ethernet-BP256 61,62,63,64 40G 9100 N/A Ethernet-BP256 PortChannel4009 up up N/A off - Ethernet-BP260 57,58,59,60 40G 9100 N/A Ethernet-BP260 PortChannel4009 up up N/A off -PortChannel1002 N/A 80G 9100 N/A N/A trunk up up N/A N/A -PortChannel4001 N/A 80G 9100 N/A N/A routed up up N/A N/A -PortChannel4009 N/A 80G 9100 N/A N/A routed up up N/A N/A + Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC +--------------- ------------ ------- ----- ----- -------------- --------------- ------ ------- ----------------------------------------------- ---------- + Ethernet0 33,34,35,36 40G 9100 N/A Ethernet1/1 PortChannel1002 up up QSFP28 or later off + Ethernet4 29,30,31,32 40G 9100 N/A Ethernet1/2 PortChannel1002 up up N/A off + Ethernet64 29,30,31,32 40G 9100 N/A Ethernet1/17 routed up up QSFP-DD Double Density 8X Pluggable Transceiver off + Ethernet-BP0 93,94,95,96 40G 9100 N/A Ethernet-BP0 PortChannel4001 up up N/A off + Ethernet-BP4 97,98,99,100 40G 9100 N/A Ethernet-BP4 PortChannel4001 up up N/A off + Ethernet-BP256 61,62,63,64 40G 9100 N/A Ethernet-BP256 PortChannel4009 up up N/A off + Ethernet-BP260 57,58,59,60 40G 9100 N/A Ethernet-BP260 PortChannel4009 up up N/A off +PortChannel1002 N/A 80G 9100 N/A N/A trunk up up N/A N/A +PortChannel4001 N/A 80G 9100 N/A N/A routed up up N/A N/A +PortChannel4009 N/A 80G 9100 N/A N/A routed up up N/A N/A """ intf_status = """\ Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC From 2a7359587b35bd4d3b41f8140a386bd872407283 Mon Sep 17 00:00:00 2001 From: Mihir Patel Date: Sat, 4 Feb 2023 02:07:55 +0000 Subject: [PATCH 7/7] Addressed PR comments --- scripts/sfpshow | 2 +- tests/mock_tables/asic1/state_db.json | 16 ++++----- tests/mock_tables/state_db.json | 16 ++++----- tests/sfp_test.py | 48 +++++++++++++-------------- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index ce36835ebe..ac0adf5c6e 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -589,7 +589,7 @@ def eeprom(port, dump_dom, namespace): sfp.get_eeprom() sfp.display_eeprom() -# 'eeprom' subcommand +# 'info' subcommand @cli.command() @click.option('-p', '--port', metavar='', help="Display SFP EEPROM data for port only") diff --git a/tests/mock_tables/asic1/state_db.json b/tests/mock_tables/asic1/state_db.json index bb132dbb3b..7397d25b8f 100644 --- a/tests/mock_tables/asic1/state_db.json +++ b/tests/mock_tables/asic1/state_db.json @@ -1,10 +1,10 @@ { "TRANSCEIVER_INFO|Ethernet64": { "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", - "hardware_rev" : "1.1", - "serial" : "214455197", - "manufacturer" : "Acacia Comm Inc.", - "model" : "DP04QSDD-E20-001", + "hardware_rev" : "X.X", + "serial" : "0123456789", + "manufacturer" : "XXXX", + "model" : "XXX", "connector" : "LC", "encoding" : "N/A", "ext_identifier" : "Power Class 8 (20.0W Max)", @@ -14,7 +14,7 @@ "nominal_bit_rate" : "0", "specification_compliance" : "sm_media_interface", "vendor_date" : "2021-11-19", - "vendor_oui" : "7c-b2-5c", + "vendor_oui" : "XX-XX-XX", "application_advertisement" : "{1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, Single Wavelength, Unamplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 3: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85, 'media_lane_assignment_options': 1}}", "host_lane_count" : "8", "media_lane_count" : "1", @@ -27,10 +27,10 @@ "active_apsel_hostlane7" : "1", "active_apsel_hostlane8" : "1", "media_interface_technology" : "1550 nm DFB", - "vendor_rev" : "A", + "vendor_rev" : "XX", "cmis_rev" : "4.1", - "active_firmware" : "61.20", - "inactive_firmware" : "161.10", + "active_firmware" : "X.X", + "inactive_firmware" : "X.X", "supported_max_tx_power" : "4.0", "supported_min_tx_power" : "-22.9", "supported_max_laser_freq" : "196100", diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index 97cf5f3b06..3f7f55ceff 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -375,10 +375,10 @@ }, "TRANSCEIVER_INFO|Ethernet64": { "type" : "QSFP-DD Double Density 8X Pluggable Transceiver", - "hardware_rev" : "1.1", - "serial" : "214455197", - "manufacturer" : "Acacia Comm Inc.", - "model" : "DP04QSDD-E20-001", + "hardware_rev" : "X.X", + "serial" : "0123456789", + "manufacturer" : "XXXX", + "model" : "XXX", "connector" : "LC", "encoding" : "N/A", "ext_identifier" : "Power Class 8 (20.0W Max)", @@ -388,7 +388,7 @@ "nominal_bit_rate" : "0", "specification_compliance" : "sm_media_interface", "vendor_date" : "2021-11-19", - "vendor_oui" : "7c-b2-5c", + "vendor_oui" : "XX-XX-XX", "application_advertisement" : "{1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400ZR, Single Wavelength, Unamplified', 'media_lane_count': 1, 'host_lane_count': 8, 'host_lane_assignment_options': 1, 'media_lane_assignment_options': 1}, 3: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '400ZR, DWDM, amplified', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85, 'media_lane_assignment_options': 1}}", "host_lane_count" : "8", "media_lane_count" : "1", @@ -401,10 +401,10 @@ "active_apsel_hostlane7" : "1", "active_apsel_hostlane8" : "1", "media_interface_technology" : "1550 nm DFB", - "vendor_rev" : "A", + "vendor_rev" : "XX", "cmis_rev" : "4.1", - "active_firmware" : "61.20", - "inactive_firmware" : "161.10", + "active_firmware" : "X.X", + "inactive_firmware" : "X.X", "supported_max_tx_power" : "4.0", "supported_min_tx_power" : "-22.9", "supported_max_laser_freq" : "196100", diff --git a/tests/sfp_test.py b/tests/sfp_test.py index 1c30e005ad..b6b94ebff6 100644 --- a/tests/sfp_test.py +++ b/tests/sfp_test.py @@ -217,7 +217,7 @@ test_cmis_eeprom_output = """\ Ethernet64: SFP EEPROM detected - Active Firmware: 61.20 + Active Firmware: X.X Active application selected code assigned to host lane 1: 1 Active application selected code assigned to host lane 2: 1 Active application selected code assigned to host lane 3: 1 @@ -236,11 +236,11 @@ Extended RateSelect Compliance: N/A Host Lane Count: 8 Identifier: QSFP-DD Double Density 8X Pluggable Transceiver - Inactive Firmware: 161.10 + Inactive Firmware: X.X Length Cable Assembly(m): 0.0 Media Interface Technology: 1550 nm DFB Media Lane Count: 1 - Module Hardware Rev: 1.1 + Module Hardware Rev: X.X Nominal Bit Rate(100Mbs): 0 Specification compliance: sm_media_interface Supported Max Laser Frequency: 196100 @@ -248,11 +248,11 @@ Supported Min Laser Frequency: 191300 Supported Min TX Power: -22.9 Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 - Vendor Name: Acacia Comm Inc. - Vendor OUI: 7c-b2-5c - Vendor PN: DP04QSDD-E20-001 - Vendor Rev: A - Vendor SN: 214455197 + Vendor Name: XXXX + Vendor OUI: XX-XX-XX + Vendor PN: XXX + Vendor Rev: XX + Vendor SN: 0123456789 """ test_sfp_eeprom_dom_all_output = """\ @@ -307,7 +307,7 @@ Ethernet4: SFP EEPROM Not detected Ethernet64: SFP EEPROM detected - Active Firmware: 61.20 + Active Firmware: X.X Active application selected code assigned to host lane 1: 1 Active application selected code assigned to host lane 2: 1 Active application selected code assigned to host lane 3: 1 @@ -326,11 +326,11 @@ Extended RateSelect Compliance: N/A Host Lane Count: 8 Identifier: QSFP-DD Double Density 8X Pluggable Transceiver - Inactive Firmware: 161.10 + Inactive Firmware: X.X Length Cable Assembly(m): 0.0 Media Interface Technology: 1550 nm DFB Media Lane Count: 1 - Module Hardware Rev: 1.1 + Module Hardware Rev: X.X Nominal Bit Rate(100Mbs): 0 Specification compliance: sm_media_interface Supported Max Laser Frequency: 196100 @@ -338,11 +338,11 @@ Supported Min Laser Frequency: 191300 Supported Min TX Power: -22.9 Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 - Vendor Name: Acacia Comm Inc. - Vendor OUI: 7c-b2-5c - Vendor PN: DP04QSDD-E20-001 - Vendor Rev: A - Vendor SN: 214455197 + Vendor Name: XXXX + Vendor OUI: XX-XX-XX + Vendor PN: XXX + Vendor Rev: XX + Vendor SN: 0123456789 ChannelMonitorValues: RX1Power: 0.3802dBm RX2Power: -0.4871dBm @@ -397,7 +397,7 @@ Ethernet4: SFP EEPROM Not detected Ethernet64: SFP EEPROM detected - Active Firmware: 61.20 + Active Firmware: X.X Active application selected code assigned to host lane 1: 1 Active application selected code assigned to host lane 2: 1 Active application selected code assigned to host lane 3: 1 @@ -416,11 +416,11 @@ Extended RateSelect Compliance: N/A Host Lane Count: 8 Identifier: QSFP-DD Double Density 8X Pluggable Transceiver - Inactive Firmware: 161.10 + Inactive Firmware: X.X Length Cable Assembly(m): 0.0 Media Interface Technology: 1550 nm DFB Media Lane Count: 1 - Module Hardware Rev: 1.1 + Module Hardware Rev: X.X Nominal Bit Rate(100Mbs): 0 Specification compliance: sm_media_interface Supported Max Laser Frequency: 196100 @@ -428,11 +428,11 @@ Supported Min Laser Frequency: 191300 Supported Min TX Power: -22.9 Vendor Date Code(YYYY-MM-DD Lot): 2021-11-19 - Vendor Name: Acacia Comm Inc. - Vendor OUI: 7c-b2-5c - Vendor PN: DP04QSDD-E20-001 - Vendor Rev: A - Vendor SN: 214455197 + Vendor Name: XXXX + Vendor OUI: XX-XX-XX + Vendor PN: XXX + Vendor Rev: XX + Vendor SN: 0123456789 """ test_sfp_presence_all_output = """\