Skip to content

Commit 89012b8

Browse files
authored
[202205] Add transceiver info CLI support to show output from TRANSCEIVER_INFO for ZR (#2740)
1 parent 077de53 commit 89012b8

File tree

9 files changed

+363
-66
lines changed

9 files changed

+363
-66
lines changed

doc/Command-Reference.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ This command displays information for all the interfaces for the transceiver req
933933

934934
- Usage:
935935
```
936-
show interfaces transceiver (eeprom [-d|--dom] | lpmode | presence | error-status [-hw|--fetch-from-hardware] | pm) [<interface_name>]
936+
show interfaces transceiver (eeprom [-d|--dom] | info | lpmode | presence | error-status [-hw|--fetch-from-hardware] | pm) [<interface_name>]
937937
```
938938

939939
- Example (Decode and display information stored on the EEPROM of SFP transceiver connected to Ethernet0):
@@ -971,6 +971,48 @@ This command displays information for all the interfaces for the transceiver req
971971
Vcc : 0.0000Volts
972972
```
973973

974+
- Example (Decode and display information stored on the EEPROM of SFP transceiver connected to Ethernet16):
975+
```
976+
admin@sonic:~$ show interfaces transceiver info Ethernet16
977+
Ethernet16: SFP EEPROM detected
978+
Active Firmware: 61.20
979+
Active application selected code assigned to host lane 1: 1
980+
Active application selected code assigned to host lane 2: 1
981+
Active application selected code assigned to host lane 3: 1
982+
Active application selected code assigned to host lane 4: 1
983+
Active application selected code assigned to host lane 5: 1
984+
Active application selected code assigned to host lane 6: 1
985+
Active application selected code assigned to host lane 7: 1
986+
Active application selected code assigned to host lane 8: 1
987+
Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1)
988+
400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, Single Wavelength, Unamplified - Media Assign (0x1)
989+
100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1)
990+
CMIS Rev: 4.1
991+
Connector: LC
992+
Encoding: N/A
993+
Extended Identifier: Power Class 8 (20.0W Max)
994+
Extended RateSelect Compliance: N/A
995+
Host Lane Count: 8
996+
Identifier: QSFP-DD Double Density 8X Pluggable Transceiver
997+
Inactive Firmware: 61.20
998+
Length Cable Assembly(m): 0.0
999+
Media Interface Technology: 1550 nm DFB
1000+
Media Lane Count: 1
1001+
Module Hardware Rev: 49.49
1002+
Nominal Bit Rate(100Mbs): 0
1003+
Specification Compliance: sm_media_interface
1004+
Supported Max Laser Frequency: 196100
1005+
Supported Max TX Power: 4.0
1006+
Supported Min Laser Frequency: 191300
1007+
Supported Min TX Power: -22.9
1008+
Vendor Date Code(YYYY-MM-DD Lot): 2020-21-02 17
1009+
Vendor Name: Acacia Comm Inc.
1010+
Vendor OUI: 7c-b2-5c
1011+
Vendor PN: DP04QSDD-E20-00E
1012+
Vendor Rev: 01
1013+
Vendor SN: 210753986
1014+
```
1015+
9741016
- Example (Display status of low-power mode of SFP transceiver connected to Ethernet100):
9751017
```
9761018
admin@sonic:~$ show interfaces transceiver lpmode Ethernet100

scripts/sfpshow

+24-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ from natsort import natsorted
1717
from sonic_py_common.interface import front_panel_prefix, backplane_prefix, inband_prefix, recirc_prefix
1818
from sonic_py_common import multi_asic
1919
from utilities_common.sfp_helper import covert_application_advertisement_to_output_string
20-
from utilities_common.sfp_helper import QSFP_DATA_MAP
20+
from utilities_common.sfp_helper import QSFP_DATA_MAP, CMIS_DATA_MAP
2121
from tabulate import tabulate
2222

2323
# Mock the redis DB for unit test purposes
@@ -284,14 +284,16 @@ class SFPShow(object):
284284
def convert_sfp_info_to_output_string(self, sfp_info_dict):
285285
indent = ' ' * 8
286286
output = ''
287+
is_sfp_cmis = 'cmis_rev' in sfp_info_dict
287288

288-
sorted_qsfp_data_map_keys = sorted(QSFP_DATA_MAP, key=QSFP_DATA_MAP.get)
289-
for key in sorted_qsfp_data_map_keys:
289+
data_map = CMIS_DATA_MAP if is_sfp_cmis else QSFP_DATA_MAP
290+
sorted_data_map_keys = sorted(data_map, key=data_map.get)
291+
for key in sorted_data_map_keys:
290292
if key == 'cable_type':
291293
output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length'])
292294
elif key == 'cable_length':
293295
pass
294-
elif key == 'specification_compliance':
296+
elif key == 'specification_compliance' and not(is_sfp_cmis):
295297
if sfp_info_dict['type'] == "QSFP-DD Double Density 8X Pluggable Transceiver":
296298
output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP[key], sfp_info_dict[key])
297299
else:
@@ -308,7 +310,7 @@ class SFPShow(object):
308310
elif key == 'application_advertisement':
309311
output += covert_application_advertisement_to_output_string(indent, sfp_info_dict)
310312
else:
311-
output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP[key], sfp_info_dict[key])
313+
output += '{}{}: {}\n'.format(indent, data_map[key], sfp_info_dict[key])
312314

313315
return output
314316

@@ -587,6 +589,23 @@ def eeprom(port, dump_dom, namespace):
587589
sfp.get_eeprom()
588590
sfp.display_eeprom()
589591

592+
# 'info' subcommand
593+
594+
@cli.command()
595+
@click.option('-p', '--port', metavar='<port_name>', help="Display SFP EEPROM data for port <port_name> only")
596+
@click.option('-n', '--namespace', default=None, help="Display interfaces for specific namespace")
597+
def info(port, namespace):
598+
if port and multi_asic.is_multi_asic() and namespace is None:
599+
try:
600+
namespace = multi_asic.get_namespace_for_port(port)
601+
except Exception:
602+
display_invalid_intf_eeprom(port)
603+
sys.exit(1)
604+
605+
sfp = SFPShow(port, namespace)
606+
sfp.get_eeprom()
607+
sfp.display_eeprom()
608+
590609
# 'presence' subcommand
591610

592611

show/interfaces/__init__.py

+22
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,28 @@ def pm(interfacename, namespace, verbose):
469469

470470
clicommon.run_command(cmd, display_cmd=verbose)
471471

472+
@transceiver.command()
473+
@click.argument('interfacename', required=False)
474+
@click.option('--namespace', '-n', 'namespace', default=None, show_default=True,
475+
type=click.Choice(multi_asic_util.multi_asic_ns_choices()), help='Namespace name or all')
476+
@click.option('--verbose', is_flag=True, help="Enable verbose output")
477+
def info(interfacename, namespace, verbose):
478+
"""Show interface transceiver information"""
479+
480+
ctx = click.get_current_context()
481+
482+
cmd = "sfpshow info"
483+
484+
if interfacename is not None:
485+
interfacename = try_convert_interfacename_from_alias(ctx, interfacename)
486+
487+
cmd += " -p {}".format(interfacename)
488+
489+
if namespace is not None:
490+
cmd += " -n {}".format(namespace)
491+
492+
clicommon.run_command(cmd, display_cmd=verbose)
493+
472494
@transceiver.command()
473495
@click.argument('interfacename', required=False)
474496
@click.option('--verbose', is_flag=True, help="Enable verbose output")

tests/mock_tables/asic0/state_db.json

+37
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,43 @@
5151
"vcclowalarm": "2.9700",
5252
"vcclowwarning": "3.1349"
5353
},
54+
"TRANSCEIVER_INFO|Ethernet48": {
55+
"type" : "QSFP-DD Double Density 8X Pluggable Transceiver",
56+
"hardware_rev" : "1.1",
57+
"serial" : "214455197",
58+
"manufacturer" : "Acacia Comm Inc.",
59+
"model" : "DP04QSDD-E20-001",
60+
"connector" : "LC",
61+
"encoding" : "N/A",
62+
"ext_identifier" : "Power Class 8 (20.0W Max)",
63+
"ext_rateselect_compliance" : "N/A",
64+
"cable_type" : "Length Cable Assembly(m)",
65+
"cable_length" : "0.0",
66+
"nominal_bit_rate" : "0",
67+
"specification_compliance" : "sm_media_interface",
68+
"vendor_date" : "2021-11-19",
69+
"vendor_oui" : "7c-b2-5c",
70+
"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}}",
71+
"host_lane_count" : "8",
72+
"media_lane_count" : "1",
73+
"active_apsel_hostlane1" : "1",
74+
"active_apsel_hostlane2" : "1",
75+
"active_apsel_hostlane3" : "1",
76+
"active_apsel_hostlane4" : "1",
77+
"active_apsel_hostlane5" : "1",
78+
"active_apsel_hostlane6" : "1",
79+
"active_apsel_hostlane7" : "1",
80+
"active_apsel_hostlane8" : "1",
81+
"media_interface_technology" : "1550 nm DFB",
82+
"vendor_rev" : "A",
83+
"cmis_rev" : "4.1",
84+
"active_firmware" : "61.20",
85+
"inactive_firmware" : "161.10",
86+
"supported_max_tx_power" : "4.0",
87+
"supported_min_tx_power" : "-22.9",
88+
"supported_max_laser_freq" : "196100",
89+
"supported_min_laser_freq" : "191300"
90+
},
5491
"CHASSIS_INFO|chassis 1": {
5592
"psu_num": "2"
5693
},

tests/mock_tables/asic1/state_db.json

+35-16
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,40 @@
11
{
22
"TRANSCEIVER_INFO|Ethernet64": {
3-
"type": "QSFP28 or later",
4-
"vendor_rev": "AC",
5-
"serial": "MT1706FT02064",
6-
"manufacturer": "Mellanox",
7-
"model": "MFA1A00-C003",
8-
"vendor_oui": "00-02-c9",
9-
"vendor_date": "2017-01-13 ",
10-
"connector": "No separable connector",
11-
"encoding": "64B66B",
12-
"ext_identifier": "Power Class 3(2.5W max), CDR present in Rx Tx",
13-
"ext_rateselect_compliance": "QSFP+ Rate Select Version 1",
14-
"cable_type": "Length Cable Assembly(m)",
15-
"cable_length": "3",
16-
"specification_compliance": "{'10/40G Ethernet Compliance Code': '40G Active Cable (XLPPI)'}",
17-
"nominal_bit_rate": "255",
18-
"application_advertisement": "N/A"
3+
"type" : "QSFP-DD Double Density 8X Pluggable Transceiver",
4+
"hardware_rev" : "X.X",
5+
"serial" : "0123456789",
6+
"manufacturer" : "XXXX",
7+
"model" : "XXX",
8+
"connector" : "LC",
9+
"encoding" : "N/A",
10+
"ext_identifier" : "Power Class 8 (20.0W Max)",
11+
"ext_rateselect_compliance" : "N/A",
12+
"cable_type" : "Length Cable Assembly(m)",
13+
"cable_length" : "0.0",
14+
"nominal_bit_rate" : "0",
15+
"specification_compliance" : "sm_media_interface",
16+
"vendor_date" : "2021-11-19",
17+
"vendor_oui" : "XX-XX-XX",
18+
"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}}",
19+
"host_lane_count" : "8",
20+
"media_lane_count" : "1",
21+
"active_apsel_hostlane1" : "1",
22+
"active_apsel_hostlane2" : "1",
23+
"active_apsel_hostlane3" : "1",
24+
"active_apsel_hostlane4" : "1",
25+
"active_apsel_hostlane5" : "1",
26+
"active_apsel_hostlane6" : "1",
27+
"active_apsel_hostlane7" : "1",
28+
"active_apsel_hostlane8" : "1",
29+
"media_interface_technology" : "1550 nm DFB",
30+
"vendor_rev" : "XX",
31+
"cmis_rev" : "4.1",
32+
"active_firmware" : "X.X",
33+
"inactive_firmware" : "X.X",
34+
"supported_max_tx_power" : "4.0",
35+
"supported_min_tx_power" : "-22.9",
36+
"supported_max_laser_freq" : "196100",
37+
"supported_min_laser_freq" : "191300"
1938
},
2039
"TRANSCEIVER_DOM_SENSOR|Ethernet64": {
2140
"temperature": "30.9258",

tests/mock_tables/state_db.json

+37
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,43 @@
373373
"rx_sig_power_min": "-40",
374374
"rx_sig_power_max": "40"
375375
},
376+
"TRANSCEIVER_INFO|Ethernet64": {
377+
"type" : "QSFP-DD Double Density 8X Pluggable Transceiver",
378+
"hardware_rev" : "X.X",
379+
"serial" : "0123456789",
380+
"manufacturer" : "XXXX",
381+
"model" : "XXX",
382+
"connector" : "LC",
383+
"encoding" : "N/A",
384+
"ext_identifier" : "Power Class 8 (20.0W Max)",
385+
"ext_rateselect_compliance" : "N/A",
386+
"cable_type" : "Length Cable Assembly(m)",
387+
"cable_length" : "0.0",
388+
"nominal_bit_rate" : "0",
389+
"specification_compliance" : "sm_media_interface",
390+
"vendor_date" : "2021-11-19",
391+
"vendor_oui" : "XX-XX-XX",
392+
"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}}",
393+
"host_lane_count" : "8",
394+
"media_lane_count" : "1",
395+
"active_apsel_hostlane1" : "1",
396+
"active_apsel_hostlane2" : "1",
397+
"active_apsel_hostlane3" : "1",
398+
"active_apsel_hostlane4" : "1",
399+
"active_apsel_hostlane5" : "1",
400+
"active_apsel_hostlane6" : "1",
401+
"active_apsel_hostlane7" : "1",
402+
"active_apsel_hostlane8" : "1",
403+
"media_interface_technology" : "1550 nm DFB",
404+
"vendor_rev" : "XX",
405+
"cmis_rev" : "4.1",
406+
"active_firmware" : "X.X",
407+
"inactive_firmware" : "X.X",
408+
"supported_max_tx_power" : "4.0",
409+
"supported_min_tx_power" : "-22.9",
410+
"supported_max_laser_freq" : "196100",
411+
"supported_min_laser_freq" : "191300"
412+
},
376413
"TRANSCEIVER_STATUS|Ethernet0": {
377414
"status": "67",
378415
"error": "Blocking Error|High temperature"

tests/multi_asic_intfutil_test.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
scripts_path = os.path.join(modules_path, "scripts")
1111

1212
intf_status_all = """\
13-
Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC
14-
--------------- ------------ ------- ----- ----- -------------- --------------- ------ ------- --------------- ----------
15-
Ethernet0 33,34,35,36 40G 9100 N/A Ethernet1/1 PortChannel1002 up up QSFP28 or later off
16-
Ethernet4 29,30,31,32 40G 9100 N/A Ethernet1/2 PortChannel1002 up up N/A off
17-
Ethernet64 29,30,31,32 40G 9100 N/A Ethernet1/17 routed up up QSFP28 or later off
18-
Ethernet-BP0 93,94,95,96 40G 9100 N/A Ethernet-BP0 PortChannel4001 up up N/A off
19-
Ethernet-BP4 97,98,99,100 40G 9100 N/A Ethernet-BP4 PortChannel4001 up up N/A off
20-
Ethernet-BP256 61,62,63,64 40G 9100 N/A Ethernet-BP256 PortChannel4009 up up N/A off
21-
Ethernet-BP260 57,58,59,60 40G 9100 N/A Ethernet-BP260 PortChannel4009 up up N/A off
22-
PortChannel1002 N/A 80G 9100 N/A N/A trunk up up N/A N/A
23-
PortChannel4001 N/A 80G 9100 N/A N/A routed up up N/A N/A
24-
PortChannel4009 N/A 80G 9100 N/A N/A routed up up N/A N/A
13+
Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC
14+
--------------- ------------ ------- ----- ----- -------------- --------------- ------ ------- ----------------------------------------------- ----------
15+
Ethernet0 33,34,35,36 40G 9100 N/A Ethernet1/1 PortChannel1002 up up QSFP28 or later off
16+
Ethernet4 29,30,31,32 40G 9100 N/A Ethernet1/2 PortChannel1002 up up N/A off
17+
Ethernet64 29,30,31,32 40G 9100 N/A Ethernet1/17 routed up up QSFP-DD Double Density 8X Pluggable Transceiver off
18+
Ethernet-BP0 93,94,95,96 40G 9100 N/A Ethernet-BP0 PortChannel4001 up up N/A off
19+
Ethernet-BP4 97,98,99,100 40G 9100 N/A Ethernet-BP4 PortChannel4001 up up N/A off
20+
Ethernet-BP256 61,62,63,64 40G 9100 N/A Ethernet-BP256 PortChannel4009 up up N/A off
21+
Ethernet-BP260 57,58,59,60 40G 9100 N/A Ethernet-BP260 PortChannel4009 up up N/A off
22+
PortChannel1002 N/A 80G 9100 N/A N/A trunk up up N/A N/A
23+
PortChannel4001 N/A 80G 9100 N/A N/A routed up up N/A N/A
24+
PortChannel4009 N/A 80G 9100 N/A N/A routed up up N/A N/A
2525
"""
2626
intf_status = """\
2727
Interface Lanes Speed MTU FEC Alias Vlan Oper Admin Type Asym PFC

0 commit comments

Comments
 (0)