From 23e092074f73e515e39cf3378138a9bf630ca829 Mon Sep 17 00:00:00 2001 From: shlomibitton <60430976+shlomibitton@users.noreply.github.com> Date: Thu, 21 Jan 2021 10:42:59 +0200 Subject: [PATCH] [sfpshow] Enhance QSFP-DD DOM information (#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 --- scripts/sfpshow | 62 ++++++++++++++++--- tests/mock_tables/state_db.json | 66 ++++++++++++++++++++ tests/sfp_test.py | 106 ++++++++++++++++++++++++++++++++ 3 files changed, 224 insertions(+), 10 deletions(-) diff --git a/scripts/sfpshow b/scripts/sfpshow index 5b6ee830337e..64ec64707817 100755 --- a/scripts/sfpshow +++ b/scripts/sfpshow @@ -97,6 +97,19 @@ qsfp_dom_channel_monitor_map = {'rx1power': 'RX1Power', 'rx2power': 'RX2Power', 'tx1power': 'TX1Power', 'tx2power': 'TX2Power', 'tx3power': 'TX3Power', 'tx4power': 'TX4Power'} +qsfp_dd_dom_channel_monitor_map = {'rx1power': 'RX1Power', 'rx2power': 'RX2Power', + 'rx3power': 'RX3Power', 'rx4power': 'RX4Power', + 'rx5power': 'RX5Power', 'rx6power': 'RX6Power', + 'rx7power': 'RX7Power', 'rx8power': 'RX8Power', + 'tx1bias': 'TX1Bias', 'tx2bias': 'TX2Bias', + 'tx3bias': 'TX3Bias', 'tx4bias': 'TX4Bias', + 'tx5bias': 'TX5Bias', 'tx6bias': 'TX6Bias', + 'tx7bias': 'TX7Bias', 'tx8bias': 'TX8Bias', + 'tx1power': 'TX1Power', 'tx2power': 'TX2Power', + 'tx3power': 'TX3Power', 'tx4power': 'TX4Power', + 'tx5power': 'TX5Power', 'tx6power': 'TX6Power', + 'tx7power': 'TX7Power', 'tx8power': 'TX8Power'} + dom_module_monitor_map = {'temperature': 'Temperature', 'voltage': 'Vcc'} dom_channel_threshold_unit_map = { @@ -133,6 +146,20 @@ dom_value_unit_map = {'rx1power': 'dBm', 'rx2power': 'dBm', 'tx3power': 'dBm', 'tx4power': 'dBm', 'temperature': 'C', 'voltage': 'Volts'} +qsfp_dd_dom_value_unit_map = {'rx1power': 'dBm', 'rx2power': 'dBm', + 'rx3power': 'dBm', 'rx4power': 'dBm', + 'rx5power': 'dBm', 'rx6power': 'dBm', + 'rx7power': 'dBm', 'rx8power': 'dBm', + 'tx1bias': 'mA', 'tx2bias': 'mA', + 'tx3bias': 'mA', 'tx4bias': 'mA', + 'tx5bias': 'mA', 'tx6bias': 'mA', + 'tx7bias': 'mA', 'tx8bias': 'mA', + 'tx1power': 'dBm', 'tx2power': 'dBm', + 'tx3power': 'dBm', 'tx4power': 'dBm', + 'tx5power': 'dBm', 'tx6power': 'dBm', + 'tx7power': 'dBm', 'tx8power': 'dBm', + 'temperature': 'C', 'voltage': 'Volts'} + def display_invalid_intf_eeprom(intf_name): output = intf_name + ': ' + 'SFP EEPROM Not detected' + '\n' click.echo(output) @@ -186,22 +213,37 @@ class SFPShow(object): if sfp_type.startswith('QSFP'): #Channel Monitor - out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues' - + newline_ident) - sorted_key_table = natsorted(qsfp_dom_channel_monitor_map) - out_put_channel = self.format_dict_value_to_string( - sorted_key_table, dom_info_dict, - qsfp_dom_channel_monitor_map, - dom_value_unit_map) - out_put_dom = out_put_dom + out_put_channel + if sfp_type.startswith('QSFP-DD'): + out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues' + + newline_ident) + sorted_key_table = natsorted(qsfp_dd_dom_channel_monitor_map) + out_put_channel = self.format_dict_value_to_string( + sorted_key_table, dom_info_dict, + qsfp_dd_dom_channel_monitor_map, + qsfp_dd_dom_value_unit_map) + out_put_dom = out_put_dom + out_put_channel + else: + out_put_dom = (out_put_dom + ident + 'ChannelMonitorValues' + + newline_ident) + sorted_key_table = natsorted(qsfp_dom_channel_monitor_map) + out_put_channel = self.format_dict_value_to_string( + sorted_key_table, dom_info_dict, + qsfp_dom_channel_monitor_map, + dom_value_unit_map) + out_put_dom = out_put_dom + out_put_channel #Channel Threshold + if sfp_type.startswith('QSFP-DD'): + dom_map = sfp_dom_channel_threshold_map + else: + dom_map = qsfp_dom_channel_threshold_map + out_put_dom = (out_put_dom + ident + 'ChannelThresholdValues' + newline_ident) - sorted_key_table = natsorted(qsfp_dom_channel_threshold_map) + sorted_key_table = natsorted(dom_map) out_put_channel_threshold = self.format_dict_value_to_string( sorted_key_table, dom_info_dict, - qsfp_dom_channel_threshold_map, + dom_map, dom_channel_threshold_unit_map, channel_threshold_align) out_put_dom = out_put_dom + out_put_channel_threshold diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index c7d56da1333d..cd92dda58324 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -49,6 +49,72 @@ "vcclowalarm": "2.9700", "vcclowwarning": "3.1349" }, + "TRANSCEIVER_INFO|Ethernet8": { + "type": "QSFP-DD Double Density 8X Pluggable Transceiver", + "hardware_rev": "2A", + "serial": "INKAO2900002A", + "manufacturer": "INNOLIGHT", + "model": "C-DQ8FNM010-N00", + "vendor_oui": "44-7c-7f", + "vendor_date": "2020-05-22 ", + "connector": "No separable connector", + "encoding": "Not supported for CMIS cables", + "ext_identifier": "Power Class 1(10.0W Max)", + "ext_rateselect_compliance": "Not supported for CMIS cables", + "cable_type": "Length Cable Assembly(m)", + "cable_length": "10", + "specification_compliance": "Not supported for CMIS cables", + "nominal_bit_rate": "Not supported for CMIS cables", + "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 " + }, + "TRANSCEIVER_DOM_SENSOR|Ethernet8": { + "temperature": "44.9883", + "voltage": "3.2999", + "rx1power": "-3.8595", + "rx2power": "8.1478", + "rx3power": "-22.9243", + "rx4power": "1.175", + "rx5power": "1.2421", + "rx6power": "8.1489", + "rx7power": "-3.5962", + "rx8power": "-3.6131", + "tx1bias": "17.4760", + "tx2bias": "17.4760", + "tx3bias": "0.0000", + "tx4bias": "0.0000", + "tx5bias": "0.0000", + "tx6bias": "8.2240", + "tx7bias": "8.2240", + "tx8bias": "8.2240", + "tx1power": "1.175", + "tx2power": "1.175", + "tx3power": "1.175", + "tx4power": "1.175", + "tx5power": "1.175", + "tx6power": "1.175", + "tx7power": "1.175", + "tx8power": "1.175", + "rxpowerhighalarm": "6.9999", + "rxpowerhighwarning": "4.9999", + "rxpowerlowalarm": "-11.9044", + "rxpowerlowwarning": "-8.9008", + "txbiashighalarm": "14.9960", + "txbiashighwarning": "12.9980", + "txbiaslowalarm": "4.4960", + "txbiaslowwarning": "5.0000", + "temphighalarm": "80.0000", + "temphighwarning": "75.0000", + "templowalarm": "-10.0000", + "templowwarning": "-5.0000", + "vcchighalarm": "3.6352", + "vcchighwarning": "3.4672", + "vcclowalarm": "2.9696", + "vcclowwarning": "3.1304", + "txpowerhighalarm": "6.9999", + "txpowerhighwarning": "4.9999", + "txpowerlowalarm": "-10.5012", + "txpowerlowwarning": "-7.5007" + }, "CHASSIS_INFO|chassis 1": { "psu_num": "2" }, diff --git a/tests/sfp_test.py b/tests/sfp_test.py index 168f8fcbd1f6..3cbd9ecda89d 100644 --- a/tests/sfp_test.py +++ b/tests/sfp_test.py @@ -61,6 +61,78 @@ VccLowWarning : 3.1349Volts """ +test_qsfp_dd_eeprom_with_dom_output = """\ +Ethernet8: SFP EEPROM detected + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Active Cable assembly with BER < 2.6x10^-4 + IB EDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 5x10^-5 + IB QDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 10^-12 + + Connector: No separable connector + Encoding: Not supported for CMIS cables + Extended Identifier: Power Class 1(10.0W Max) + Extended RateSelect Compliance: Not supported for CMIS cables + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Length Cable Assembly(m): 10 + Nominal Bit Rate(100Mbs): Not supported for CMIS cables + Specification compliance: Not supported for CMIS cables + Vendor Date Code(YYYY-MM-DD Lot): 2020-05-22 + Vendor Name: INNOLIGHT + Vendor OUI: 44-7c-7f + Vendor PN: C-DQ8FNM010-N00 + Vendor Rev: 2A + Vendor SN: INKAO2900002A + ChannelMonitorValues: + RX1Power: -3.8595dBm + RX2Power: 8.1478dBm + RX3Power: -22.9243dBm + RX4Power: 1.175dBm + RX5Power: 1.2421dBm + RX6Power: 8.1489dBm + RX7Power: -3.5962dBm + RX8Power: -3.6131dBm + TX1Bias: 17.4760mA + TX1Power: 1.175dBm + TX2Bias: 17.4760mA + TX2Power: 1.175dBm + TX3Bias: 0.0000mA + TX3Power: 1.175dBm + TX4Bias: 0.0000mA + TX4Power: 1.175dBm + TX5Bias: 0.0000mAmA + TX5Power: 1.175dBm + TX6Bias: 8.2240mAmA + TX6Power: 1.175dBm + TX7Bias: 8.2240mAmA + TX7Power: 1.175dBm + TX8Bias: 8.2240mAmA + TX8Power: 1.175dBm + ChannelThresholdValues: + RxPowerHighAlarm : 6.9999dBm + RxPowerHighWarning: 4.9999dBm + RxPowerLowAlarm : -11.9044dBm + RxPowerLowWarning : -8.9008dBm + TxBiasHighAlarm : 14.9960mA + TxBiasHighWarning : 12.9980mA + TxBiasLowAlarm : 4.4960mA + TxBiasLowWarning : 5.0000mA + TxPowerHighAlarm : 6.9999dBm + TxPowerHighWarning: 4.9999dBm + TxPowerLowAlarm : -10.5012dBm + TxPowerLowWarning : -7.5007dBm + ModuleMonitorValues: + Temperature: 44.9883C + Vcc: 3.2999Volts + ModuleThresholdValues: + TempHighAlarm : 80.0000C + TempHighWarning: 75.0000C + TempLowAlarm : -10.0000C + TempLowWarning : -5.0000C + VccHighAlarm : 3.6352Volts + VccHighWarning : 3.4672Volts + VccLowAlarm : 2.9696Volts + VccLowWarning : 3.1304Volts +""" + test_sfp_eeprom_output = """\ Ethernet0: SFP EEPROM detected Application Advertisement: N/A @@ -81,6 +153,28 @@ Vendor SN: MT1706FT02064 """ +test_qsfp_dd_eeprom_output = """\ +Ethernet8: SFP EEPROM detected + Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Active Cable assembly with BER < 2.6x10^-4 + IB EDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 5x10^-5 + IB QDR (Arch.Spec.Vol.2) - Active Cable assembly with BER < 10^-12 + + Connector: No separable connector + Encoding: Not supported for CMIS cables + Extended Identifier: Power Class 1(10.0W Max) + Extended RateSelect Compliance: Not supported for CMIS cables + Identifier: QSFP-DD Double Density 8X Pluggable Transceiver + Length Cable Assembly(m): 10 + Nominal Bit Rate(100Mbs): Not supported for CMIS cables + Specification compliance: Not supported for CMIS cables + Vendor Date Code(YYYY-MM-DD Lot): 2020-05-22 + Vendor Name: INNOLIGHT + Vendor OUI: 44-7c-7f + Vendor PN: C-DQ8FNM010-N00 + Vendor Rev: 2A + Vendor SN: INKAO2900002A +""" + test_sfp_eeprom_dom_all_output = """\ Ethernet0: SFP EEPROM detected Application Advertisement: N/A @@ -260,6 +354,12 @@ def test_sfp_eeprom_with_dom(self): assert result.exit_code == 0 assert "\n".join([ l.rstrip() for l in result.output.split('\n')]) == test_sfp_eeprom_with_dom_output + def test_qsfp_dd_eeprom_with_dom(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet8 -d"]) + assert result.exit_code == 0 + assert "result.output == test_qsfp_dd_eeprom_with_dom_output" + def test_sfp_eeprom(self): runner = CliRunner() result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet0"]) @@ -271,6 +371,12 @@ def test_sfp_eeprom(self): expected = "Ethernet200: SFP EEPROM Not detected" assert result_lines == expected + def test_qsfp_dd_eeprom(self): + runner = CliRunner() + result = runner.invoke(show.cli.commands["interfaces"].commands["transceiver"].commands["eeprom"], ["Ethernet8"]) + assert result.exit_code == 0 + assert "result.output == test_qsfp_dd_eeprom_output" + @classmethod def teardown_class(cls): print("TEARDOWN")