Skip to content

Commit 0f0ec14

Browse files
Junchao-Mellanoxyxieca
authored andcommitted
Fix issue: show interfaces transceiver eeprom -d should display same entry for CMIS cable (#2864)
* Fix issue: show interfaces transceiver eeprom -d should display same entry for CMIS cable * Fix unit test issue
1 parent 1246bc8 commit 0f0ec14

5 files changed

Lines changed: 318 additions & 30 deletions

File tree

scripts/sfpshow

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ class SFPShow(object):
321321
channel_threshold_align = 18
322322
module_threshold_align = 15
323323

324-
if sfp_type.startswith('QSFP'):
324+
if sfp_type.startswith('QSFP') or sfp_type.startswith('OSFP'):
325325
# Channel Monitor
326-
if sfp_type.startswith('QSFP-DD'):
326+
if sfp_type.startswith('QSFP-DD') or sfp_type.startswith('OSFP'):
327327
output_dom += (indent + 'ChannelMonitorValues:\n')
328328
sorted_key_table = natsorted(QSFP_DD_DOM_CHANNEL_MONITOR_MAP)
329329
output_channel = self.format_dict_value_to_string(
@@ -341,7 +341,7 @@ class SFPShow(object):
341341
output_dom += output_channel
342342

343343
# Channel Threshold
344-
if sfp_type.startswith('QSFP-DD'):
344+
if sfp_type.startswith('QSFP-DD') or sfp_type.startswith('OSFP'):
345345
dom_map = SFP_DOM_CHANNEL_THRESHOLD_MAP
346346
else:
347347
dom_map = QSFP_DOM_CHANNEL_THRESHOLD_MAP

sfputil/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ def convert_dom_to_output_string(sfp_type, dom_info_dict):
372372
channel_threshold_align = 18
373373
module_threshold_align = 15
374374

375-
if sfp_type.startswith('QSFP'):
375+
if sfp_type.startswith('QSFP') or sfp_type.startswith('OSFP'):
376376
# Channel Monitor
377-
if sfp_type.startswith('QSFP-DD'):
377+
if sfp_type.startswith('QSFP-DD') or sfp_type.startswith('OSFP'):
378378
output_dom += (indent + 'ChannelMonitorValues:\n')
379379
sorted_key_table = natsorted(QSFP_DD_DOM_CHANNEL_MONITOR_MAP)
380380
output_channel = format_dict_value_to_string(
@@ -392,7 +392,7 @@ def convert_dom_to_output_string(sfp_type, dom_info_dict):
392392
output_dom += output_channel
393393

394394
# Channel Threshold
395-
if sfp_type.startswith('QSFP-DD'):
395+
if sfp_type.startswith('QSFP-DD') or sfp_type.startswith('OSFP'):
396396
dom_map = SFP_DOM_CHANNEL_THRESHOLD_MAP
397397
else:
398398
dom_map = QSFP_DOM_CHANNEL_THRESHOLD_MAP

tests/mock_tables/state_db.json

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,111 @@
410410
"supported_max_laser_freq" : "196100",
411411
"supported_min_laser_freq" : "191300"
412412
},
413+
"TRANSCEIVER_INFO|Ethernet72": {
414+
"active_apsel_hostlane4": "N/A",
415+
"active_firmware": "0.0",
416+
"is_replaceable": "True",
417+
"application_advertisement": "{1: {'host_electrical_interface_id': 'IB NDR', 'module_media_interface_id': 'Copper cable', 'media_lane_count': 4, 'host_lane_count': 4, 'host_lane_assignment_options': 17}, 2: {'host_electrical_interface_id': 'IB SDR (Arch.Spec.Vol.2)', 'module_media_interface_id': 'Copper cable', 'media_lane_count': 4, 'host_lane_count': 4, 'host_lane_assignment_options': 17}}",
418+
"host_electrical_interface": "N/A",
419+
"active_apsel_hostlane2": "N/A",
420+
"supported_min_tx_power": "N/A",
421+
"supported_max_tx_power": "N/A",
422+
"host_lane_assignment_option": "17",
423+
"specification_compliance": "passive_copper_media_interface",
424+
"ext_identifier": "Power Class 1 (0.25W Max)",
425+
"active_apsel_hostlane8": "N/A",
426+
"manufacturer": "vendor1 ",
427+
"cmis_rev": "5.0",
428+
"cable_type": "Length Cable Assembly(m)",
429+
"supported_min_laser_freq": "N/A",
430+
"serial": "serial1 ",
431+
"active_apsel_hostlane7": "N/A",
432+
"inactive_firmware": "N/A",
433+
"active_apsel_hostlane1": "N/A",
434+
"type": "OSFP 8X Pluggable Transceiver",
435+
"cable_length": "1.0",
436+
"active_apsel_hostlane5": "N/A",
437+
"media_lane_assignment_option": "N/A",
438+
"vendor_rev": "A3",
439+
"active_apsel_hostlane6": "N/A",
440+
"encoding": "N/A",
441+
"dom_capability": "N/A",
442+
"media_interface_technology": "Copper cable unequalized",
443+
"nominal_bit_rate": "0",
444+
"hardware_rev": "0.0",
445+
"media_lane_count": "0",
446+
"host_lane_count": "4",
447+
"vendor_oui": "some-oui",
448+
"connector": "No separable connector",
449+
"supported_max_laser_freq": "N/A",
450+
"media_interface_code": "Copper cable",
451+
"active_apsel_hostlane3": "N/A",
452+
"ext_rateselect_compliance": "N/A",
453+
"model": "some-model ",
454+
"vendor_date": "2022-05-28 "
455+
},
456+
"TRANSCEIVER_DOM_SENSOR|Ethernet72": {
457+
"rx_los": "N/A",
458+
"tx_fault": "N/A",
459+
"tx_disabled_channel": "N/A",
460+
"temperature": "40.5",
461+
"voltage": "3.331",
462+
"tx1disable": "N/A",
463+
"tx1bias": "6.5",
464+
"rx1power": "0.5",
465+
"tx1power": "0.6",
466+
"tx2disable": "N/A",
467+
"tx2bias": "6.5",
468+
"rx2power": "0.3",
469+
"tx2power": "0.4",
470+
"tx3disable": "N/A",
471+
"tx3bias": "6.6",
472+
"rx3power": "0.1",
473+
"tx3power": "0.2",
474+
"tx4disable": "N/A",
475+
"tx4bias": "6.7",
476+
"rx4power": "0.7",
477+
"tx4power": "0.8",
478+
"tx5disable": "N/A",
479+
"tx5bias": "6.4",
480+
"rx5power": "0.8",
481+
"tx5power": "0.9",
482+
"tx6disable": "N/A",
483+
"tx6bias": "6.3",
484+
"rx6power": "0.2",
485+
"tx6power": "0.1",
486+
"tx7disable": "N/A",
487+
"tx7bias": "6.2",
488+
"rx7power": "0.2",
489+
"tx7power": "0.5",
490+
"tx8disable": "N/A",
491+
"tx8bias": "6.1",
492+
"rx8power": "0.3",
493+
"tx8power": "0.4",
494+
"laser_temperature": "N/A"
495+
},
496+
"TRANSCEIVER_DOM_THRESHOLD|Ethernet72": {
497+
"temphighalarm": "N/A",
498+
"temphighwarning": "N/A",
499+
"templowalarm": "N/A",
500+
"templowwarning": "N/A",
501+
"vcchighalarm": "N/A",
502+
"vcchighwarning": "N/A",
503+
"vcclowalarm": "N/A",
504+
"vcclowwarning": "N/A",
505+
"rxpowerhighalarm": "N/A",
506+
"rxpowerhighwarning": "N/A",
507+
"rxpowerlowalarm": "N/A",
508+
"rxpowerlowwarning": "N/A",
509+
"txpowerhighalarm": "N/A",
510+
"txpowerhighwarning": "N/A",
511+
"txpowerlowalarm": "N/A",
512+
"txpowerlowwarning": "N/A",
513+
"txbiashighalarm": "N/A",
514+
"txbiashighwarning": "N/A",
515+
"txbiaslowalarm": "N/A",
516+
"txbiaslowwarning": "N/A"
517+
},
413518
"TRANSCEIVER_STATUS|Ethernet0": {
414519
"status": "67",
415520
"error": "Blocking Error|High temperature"

tests/sfp_test.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,75 @@
132132
VccLowWarning : 3.1304Volts
133133
"""
134134

135+
test_osfp_eeprom_with_dom_output = """\
136+
Ethernet72: SFP EEPROM detected
137+
Active Firmware: 0.0
138+
Active application selected code assigned to host lane 1: N/A
139+
Active application selected code assigned to host lane 2: N/A
140+
Active application selected code assigned to host lane 3: N/A
141+
Active application selected code assigned to host lane 4: N/A
142+
Active application selected code assigned to host lane 5: N/A
143+
Active application selected code assigned to host lane 6: N/A
144+
Active application selected code assigned to host lane 7: N/A
145+
Active application selected code assigned to host lane 8: N/A
146+
Application Advertisement: IB NDR - Host Assign (0x11) - Copper cable - Media Assign (Unknown)
147+
IB SDR (Arch.Spec.Vol.2) - Host Assign (0x11) - Copper cable - Media Assign (Unknown)
148+
CMIS Rev: 5.0
149+
Connector: No separable connector
150+
Encoding: N/A
151+
Extended Identifier: Power Class 1 (0.25W Max)
152+
Extended RateSelect Compliance: N/A
153+
Host Lane Count: 4
154+
Identifier: OSFP 8X Pluggable Transceiver
155+
Inactive Firmware: N/A
156+
Length Cable Assembly(m): 1.0
157+
Media Interface Technology: Copper cable unequalized
158+
Media Lane Count: 0
159+
Module Hardware Rev: 0.0
160+
Nominal Bit Rate(100Mbs): 0
161+
Specification compliance: passive_copper_media_interface
162+
Supported Max Laser Frequency: N/A
163+
Supported Max TX Power: N/A
164+
Supported Min Laser Frequency: N/A
165+
Supported Min TX Power: N/A
166+
Vendor Date Code(YYYY-MM-DD Lot): 2022-05-28
167+
Vendor Name: vendor1
168+
Vendor OUI: some-oui
169+
Vendor PN: some-model
170+
Vendor Rev: A3
171+
Vendor SN: serial1
172+
ChannelMonitorValues:
173+
RX1Power: 0.5dBm
174+
RX2Power: 0.3dBm
175+
RX3Power: 0.1dBm
176+
RX4Power: 0.7dBm
177+
RX5Power: 0.8dBm
178+
RX6Power: 0.2dBm
179+
RX7Power: 0.2dBm
180+
RX8Power: 0.3dBm
181+
TX1Bias: 6.5mA
182+
TX1Power: 0.6dBm
183+
TX2Bias: 6.5mA
184+
TX2Power: 0.4dBm
185+
TX3Bias: 6.6mA
186+
TX3Power: 0.2dBm
187+
TX4Bias: 6.7mA
188+
TX4Power: 0.8dBm
189+
TX5Bias: 6.4mA
190+
TX5Power: 0.9dBm
191+
TX6Bias: 6.3mA
192+
TX6Power: 0.1dBm
193+
TX7Bias: 6.2mA
194+
TX7Power: 0.5dBm
195+
TX8Bias: 6.1mA
196+
TX8Power: 0.4dBm
197+
ChannelThresholdValues:
198+
ModuleMonitorValues:
199+
Temperature: 40.5C
200+
Vcc: 3.331Volts
201+
ModuleThresholdValues:
202+
"""
203+
135204
test_sfp_eeprom_output = """\
136205
Ethernet0: SFP EEPROM detected
137206
Application Advertisement: N/A
@@ -519,6 +588,12 @@ def test_qsfp_dd_eeprom_with_dom(self):
519588
result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet8 -d"])
520589
assert result.exit_code == 0
521590
assert result.output == test_qsfp_dd_eeprom_with_dom_output
591+
592+
def test_osfp_eeprom_with_dom(self):
593+
runner = CliRunner()
594+
result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet72", "-d"])
595+
assert result.exit_code == 0
596+
assert result.output == test_osfp_eeprom_with_dom_output
522597

523598
def test_sfp_eeprom(self):
524599
runner = CliRunner()

0 commit comments

Comments
 (0)