Skip to content

Commit 23e0920

Browse files
authored
[sfpshow] Enhance QSFP-DD DOM information (sonic-net#1207)
New driver support fetching additional pages from the cable EEPROM. There are additional information to parse now: RX/TX power, TX bias, TX fault and RX LOS. Signed-off-by: Shlomi Bitton <[email protected]>
1 parent f4edba1 commit 23e0920

File tree

3 files changed

+224
-10
lines changed

3 files changed

+224
-10
lines changed

scripts/sfpshow

+52-10
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,19 @@ qsfp_dom_channel_monitor_map = {'rx1power': 'RX1Power', 'rx2power': 'RX2Power',
9797
'tx1power': 'TX1Power', 'tx2power': 'TX2Power',
9898
'tx3power': 'TX3Power', 'tx4power': 'TX4Power'}
9999

100+
qsfp_dd_dom_channel_monitor_map = {'rx1power': 'RX1Power', 'rx2power': 'RX2Power',
101+
'rx3power': 'RX3Power', 'rx4power': 'RX4Power',
102+
'rx5power': 'RX5Power', 'rx6power': 'RX6Power',
103+
'rx7power': 'RX7Power', 'rx8power': 'RX8Power',
104+
'tx1bias': 'TX1Bias', 'tx2bias': 'TX2Bias',
105+
'tx3bias': 'TX3Bias', 'tx4bias': 'TX4Bias',
106+
'tx5bias': 'TX5Bias', 'tx6bias': 'TX6Bias',
107+
'tx7bias': 'TX7Bias', 'tx8bias': 'TX8Bias',
108+
'tx1power': 'TX1Power', 'tx2power': 'TX2Power',
109+
'tx3power': 'TX3Power', 'tx4power': 'TX4Power',
110+
'tx5power': 'TX5Power', 'tx6power': 'TX6Power',
111+
'tx7power': 'TX7Power', 'tx8power': 'TX8Power'}
112+
100113
dom_module_monitor_map = {'temperature': 'Temperature', 'voltage': 'Vcc'}
101114

102115
dom_channel_threshold_unit_map = {
@@ -133,6 +146,20 @@ dom_value_unit_map = {'rx1power': 'dBm', 'rx2power': 'dBm',
133146
'tx3power': 'dBm', 'tx4power': 'dBm',
134147
'temperature': 'C', 'voltage': 'Volts'}
135148

149+
qsfp_dd_dom_value_unit_map = {'rx1power': 'dBm', 'rx2power': 'dBm',
150+
'rx3power': 'dBm', 'rx4power': 'dBm',
151+
'rx5power': 'dBm', 'rx6power': 'dBm',
152+
'rx7power': 'dBm', 'rx8power': 'dBm',
153+
'tx1bias': 'mA', 'tx2bias': 'mA',
154+
'tx3bias': 'mA', 'tx4bias': 'mA',
155+
'tx5bias': 'mA', 'tx6bias': 'mA',
156+
'tx7bias': 'mA', 'tx8bias': 'mA',
157+
'tx1power': 'dBm', 'tx2power': 'dBm',
158+
'tx3power': 'dBm', 'tx4power': 'dBm',
159+
'tx5power': 'dBm', 'tx6power': 'dBm',
160+
'tx7power': 'dBm', 'tx8power': 'dBm',
161+
'temperature': 'C', 'voltage': 'Volts'}
162+
136163
def display_invalid_intf_eeprom(intf_name):
137164
output = intf_name + ': ' + 'SFP EEPROM Not detected' + '\n'
138165
click.echo(output)
@@ -186,22 +213,37 @@ class SFPShow(object):
186213

187214
if sfp_type.startswith('QSFP'):
188215
#Channel Monitor
189-
out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues'
190-
+ newline_ident)
191-
sorted_key_table = natsorted(qsfp_dom_channel_monitor_map)
192-
out_put_channel = self.format_dict_value_to_string(
193-
sorted_key_table, dom_info_dict,
194-
qsfp_dom_channel_monitor_map,
195-
dom_value_unit_map)
196-
out_put_dom = out_put_dom + out_put_channel
216+
if sfp_type.startswith('QSFP-DD'):
217+
out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues'
218+
+ newline_ident)
219+
sorted_key_table = natsorted(qsfp_dd_dom_channel_monitor_map)
220+
out_put_channel = self.format_dict_value_to_string(
221+
sorted_key_table, dom_info_dict,
222+
qsfp_dd_dom_channel_monitor_map,
223+
qsfp_dd_dom_value_unit_map)
224+
out_put_dom = out_put_dom + out_put_channel
225+
else:
226+
out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues'
227+
+ newline_ident)
228+
sorted_key_table = natsorted(qsfp_dom_channel_monitor_map)
229+
out_put_channel = self.format_dict_value_to_string(
230+
sorted_key_table, dom_info_dict,
231+
qsfp_dom_channel_monitor_map,
232+
dom_value_unit_map)
233+
out_put_dom = out_put_dom + out_put_channel
197234

198235
#Channel Threshold
236+
if sfp_type.startswith('QSFP-DD'):
237+
dom_map = sfp_dom_channel_threshold_map
238+
else:
239+
dom_map = qsfp_dom_channel_threshold_map
240+
199241
out_put_dom = (out_put_dom + ident + 'ChannelThresholdValues'
200242
+ newline_ident)
201-
sorted_key_table = natsorted(qsfp_dom_channel_threshold_map)
243+
sorted_key_table = natsorted(dom_map)
202244
out_put_channel_threshold = self.format_dict_value_to_string(
203245
sorted_key_table, dom_info_dict,
204-
qsfp_dom_channel_threshold_map,
246+
dom_map,
205247
dom_channel_threshold_unit_map,
206248
channel_threshold_align)
207249
out_put_dom = out_put_dom + out_put_channel_threshold

tests/mock_tables/state_db.json

+66
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,72 @@
4949
"vcclowalarm": "2.9700",
5050
"vcclowwarning": "3.1349"
5151
},
52+
"TRANSCEIVER_INFO|Ethernet8": {
53+
"type": "QSFP-DD Double Density 8X Pluggable Transceiver",
54+
"hardware_rev": "2A",
55+
"serial": "INKAO2900002A",
56+
"manufacturer": "INNOLIGHT",
57+
"model": "C-DQ8FNM010-N00",
58+
"vendor_oui": "44-7c-7f",
59+
"vendor_date": "2020-05-22 ",
60+
"connector": "No separable connector",
61+
"encoding": "Not supported for CMIS cables",
62+
"ext_identifier": "Power Class 1(10.0W Max)",
63+
"ext_rateselect_compliance": "Not supported for CMIS cables",
64+
"cable_type": "Length Cable Assembly(m)",
65+
"cable_length": "10",
66+
"specification_compliance": "Not supported for CMIS cables",
67+
"nominal_bit_rate": "Not supported for CMIS cables",
68+
"application_advertisement": "400GAUI-8 C2M (Annex 120E) - Active Cable assembly with BER < 2.6x10^-4\n\t\t\t\t IB EDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 5x10^-5\n\t\t\t\t IB QDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 10^-12\n\t\t\t\t "
69+
},
70+
"TRANSCEIVER_DOM_SENSOR|Ethernet8": {
71+
"temperature": "44.9883",
72+
"voltage": "3.2999",
73+
"rx1power": "-3.8595",
74+
"rx2power": "8.1478",
75+
"rx3power": "-22.9243",
76+
"rx4power": "1.175",
77+
"rx5power": "1.2421",
78+
"rx6power": "8.1489",
79+
"rx7power": "-3.5962",
80+
"rx8power": "-3.6131",
81+
"tx1bias": "17.4760",
82+
"tx2bias": "17.4760",
83+
"tx3bias": "0.0000",
84+
"tx4bias": "0.0000",
85+
"tx5bias": "0.0000",
86+
"tx6bias": "8.2240",
87+
"tx7bias": "8.2240",
88+
"tx8bias": "8.2240",
89+
"tx1power": "1.175",
90+
"tx2power": "1.175",
91+
"tx3power": "1.175",
92+
"tx4power": "1.175",
93+
"tx5power": "1.175",
94+
"tx6power": "1.175",
95+
"tx7power": "1.175",
96+
"tx8power": "1.175",
97+
"rxpowerhighalarm": "6.9999",
98+
"rxpowerhighwarning": "4.9999",
99+
"rxpowerlowalarm": "-11.9044",
100+
"rxpowerlowwarning": "-8.9008",
101+
"txbiashighalarm": "14.9960",
102+
"txbiashighwarning": "12.9980",
103+
"txbiaslowalarm": "4.4960",
104+
"txbiaslowwarning": "5.0000",
105+
"temphighalarm": "80.0000",
106+
"temphighwarning": "75.0000",
107+
"templowalarm": "-10.0000",
108+
"templowwarning": "-5.0000",
109+
"vcchighalarm": "3.6352",
110+
"vcchighwarning": "3.4672",
111+
"vcclowalarm": "2.9696",
112+
"vcclowwarning": "3.1304",
113+
"txpowerhighalarm": "6.9999",
114+
"txpowerhighwarning": "4.9999",
115+
"txpowerlowalarm": "-10.5012",
116+
"txpowerlowwarning": "-7.5007"
117+
},
52118
"CHASSIS_INFO|chassis 1": {
53119
"psu_num": "2"
54120
},

tests/sfp_test.py

+106
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,78 @@
6161
VccLowWarning : 3.1349Volts
6262
"""
6363

64+
test_qsfp_dd_eeprom_with_dom_output = """\
65+
Ethernet8: SFP EEPROM detected
66+
Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Active Cable assembly with BER < 2.6x10^-4
67+
IB EDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 5x10^-5
68+
IB QDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 10^-12
69+
70+
Connector: No separable connector
71+
Encoding: Not supported for CMIS cables
72+
Extended Identifier: Power Class 1(10.0W Max)
73+
Extended RateSelect Compliance: Not supported for CMIS cables
74+
Identifier: QSFP-DD Double Density 8X Pluggable Transceiver
75+
Length Cable Assembly(m): 10
76+
Nominal Bit Rate(100Mbs): Not supported for CMIS cables
77+
Specification compliance: Not supported for CMIS cables
78+
Vendor Date Code(YYYY-MM-DD Lot): 2020-05-22
79+
Vendor Name: INNOLIGHT
80+
Vendor OUI: 44-7c-7f
81+
Vendor PN: C-DQ8FNM010-N00
82+
Vendor Rev: 2A
83+
Vendor SN: INKAO2900002A
84+
ChannelMonitorValues:
85+
RX1Power: -3.8595dBm
86+
RX2Power: 8.1478dBm
87+
RX3Power: -22.9243dBm
88+
RX4Power: 1.175dBm
89+
RX5Power: 1.2421dBm
90+
RX6Power: 8.1489dBm
91+
RX7Power: -3.5962dBm
92+
RX8Power: -3.6131dBm
93+
TX1Bias: 17.4760mA
94+
TX1Power: 1.175dBm
95+
TX2Bias: 17.4760mA
96+
TX2Power: 1.175dBm
97+
TX3Bias: 0.0000mA
98+
TX3Power: 1.175dBm
99+
TX4Bias: 0.0000mA
100+
TX4Power: 1.175dBm
101+
TX5Bias: 0.0000mAmA
102+
TX5Power: 1.175dBm
103+
TX6Bias: 8.2240mAmA
104+
TX6Power: 1.175dBm
105+
TX7Bias: 8.2240mAmA
106+
TX7Power: 1.175dBm
107+
TX8Bias: 8.2240mAmA
108+
TX8Power: 1.175dBm
109+
ChannelThresholdValues:
110+
RxPowerHighAlarm : 6.9999dBm
111+
RxPowerHighWarning: 4.9999dBm
112+
RxPowerLowAlarm : -11.9044dBm
113+
RxPowerLowWarning : -8.9008dBm
114+
TxBiasHighAlarm : 14.9960mA
115+
TxBiasHighWarning : 12.9980mA
116+
TxBiasLowAlarm : 4.4960mA
117+
TxBiasLowWarning : 5.0000mA
118+
TxPowerHighAlarm : 6.9999dBm
119+
TxPowerHighWarning: 4.9999dBm
120+
TxPowerLowAlarm : -10.5012dBm
121+
TxPowerLowWarning : -7.5007dBm
122+
ModuleMonitorValues:
123+
Temperature: 44.9883C
124+
Vcc: 3.2999Volts
125+
ModuleThresholdValues:
126+
TempHighAlarm : 80.0000C
127+
TempHighWarning: 75.0000C
128+
TempLowAlarm : -10.0000C
129+
TempLowWarning : -5.0000C
130+
VccHighAlarm : 3.6352Volts
131+
VccHighWarning : 3.4672Volts
132+
VccLowAlarm : 2.9696Volts
133+
VccLowWarning : 3.1304Volts
134+
"""
135+
64136
test_sfp_eeprom_output = """\
65137
Ethernet0: SFP EEPROM detected
66138
Application Advertisement: N/A
@@ -81,6 +153,28 @@
81153
Vendor SN: MT1706FT02064
82154
"""
83155

156+
test_qsfp_dd_eeprom_output = """\
157+
Ethernet8: SFP EEPROM detected
158+
Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Active Cable assembly with BER < 2.6x10^-4
159+
IB EDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 5x10^-5
160+
IB QDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 10^-12
161+
162+
Connector: No separable connector
163+
Encoding: Not supported for CMIS cables
164+
Extended Identifier: Power Class 1(10.0W Max)
165+
Extended RateSelect Compliance: Not supported for CMIS cables
166+
Identifier: QSFP-DD Double Density 8X Pluggable Transceiver
167+
Length Cable Assembly(m): 10
168+
Nominal Bit Rate(100Mbs): Not supported for CMIS cables
169+
Specification compliance: Not supported for CMIS cables
170+
Vendor Date Code(YYYY-MM-DD Lot): 2020-05-22
171+
Vendor Name: INNOLIGHT
172+
Vendor OUI: 44-7c-7f
173+
Vendor PN: C-DQ8FNM010-N00
174+
Vendor Rev: 2A
175+
Vendor SN: INKAO2900002A
176+
"""
177+
84178
test_sfp_eeprom_dom_all_output = """\
85179
Ethernet0: SFP EEPROM detected
86180
Application Advertisement: N/A
@@ -260,6 +354,12 @@ def test_sfp_eeprom_with_dom(self):
260354
assert result.exit_code == 0
261355
assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_sfp_eeprom_with_dom_output
262356

357+
def test_qsfp_dd_eeprom_with_dom(self):
358+
runner = CliRunner()
359+
result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet8 -d"])
360+
assert result.exit_code == 0
361+
assert "result.output == test_qsfp_dd_eeprom_with_dom_output"
362+
263363
def test_sfp_eeprom(self):
264364
runner = CliRunner()
265365
result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet0"])
@@ -271,6 +371,12 @@ def test_sfp_eeprom(self):
271371
expected = "Ethernet200: SFP EEPROM Not detected"
272372
assert result_lines == expected
273373

374+
def test_qsfp_dd_eeprom(self):
375+
runner = CliRunner()
376+
result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet8"])
377+
assert result.exit_code == 0
378+
assert "result.output == test_qsfp_dd_eeprom_output"
379+
274380
@classmethod
275381
def teardown_class(cls):
276382
print("TEARDOWN")

0 commit comments

Comments
 (0)