Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show dom_capability information in command: "show interfaces transceiver eeprom" #3620

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion scripts/sfpshow
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class SFPShow(object):
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':
if key == 'cable_type' and sfp_info_dict['cable_type'] != 'N/A':
output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length'])
elif key == 'cable_length':
pass
Expand All @@ -337,6 +337,18 @@ class SFPShow(object):
elif key.startswith(('e1_', 'e2_')):
if key in sfp_firmware_info_dict:
output += '{}{}: {}\n'.format(indent, data_map[key], sfp_firmware_info_dict[key])
elif key == 'dom_capability':
if sfp_info_dict['dom_capability'] == 'N/A':
output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP['dom_capability'], 'N/A')
else:
try:
dom_capability_dict = ast.literal_eval(sfp_info_dict['dom_capability'])
sorted_dom_capability_key_table = natsorted(dom_capability_dict)
output += '{}{}:\n'.format(indent, QSFP_DATA_MAP['dom_capability'])
for dom_capability_key in sorted_dom_capability_key_table:
output += '{}{}: {}\n'.format((indent * 2), dom_capability_key, dom_capability_dict[dom_capability_key])
except ValueError as e:
output += '{}N/A\n'.format((indent * 2))
else:
output += '{}{}: {}\n'.format(indent, data_map[key], sfp_info_dict[key])

Expand Down
1 change: 1 addition & 0 deletions tests/mock_tables/asic0/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"connector": "No separable connector",
"encoding": "64B66B",
"ext_identifier": "Power Class 3(2.5W max), CDR present in Rx Tx",
"dom_capability": "{'sff8472_dom_support': 'yes'}",
"ext_rateselect_compliance": "QSFP+ Rate Select Version 1",
"cable_type": "Length Cable Assembly(m)",
"cable_length": "3",
Expand Down
1 change: 1 addition & 0 deletions tests/mock_tables/asic1/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"vendor_date" : "2021-11-19",
"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}}",
"dom_capability": "{'Rx_power_support': 'yes', 'Temp_support': 'yes', 'Voltage_support': 'yes', 'Tx_power_support': 'yes'}",
"host_lane_count" : "8",
"media_lane_count" : "1",
"active_apsel_hostlane1" : "1",
Expand Down
4 changes: 4 additions & 0 deletions tests/mock_tables/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"connector": "No separable connector",
"encoding": "64B66B",
"ext_identifier": "Power Class 3(2.5W max), CDR present in Rx Tx",
"dom_capability": "{'sff8472_dom_support': 'yes'}",
"ext_rateselect_compliance": "QSFP+ Rate Select Version 1",
"cable_type": "Length Cable Assembly(m)",
"cable_length": "3",
Expand Down Expand Up @@ -80,6 +81,7 @@
"connector": "No separable connector",
"encoding": "Not supported for CMIS cables",
"ext_identifier": "Power Class 1(10.0W Max)",
"dom_capability": "{'Rx_power_support': 'yes', 'Temp_support': 'yes', 'Voltage_support': 'yes', 'Tx_power_support': 'yes'}",
"ext_rateselect_compliance": "Not supported for CMIS cables",
"cable_type": "Length Cable Assembly(m)",
"cable_length": "10",
Expand Down Expand Up @@ -200,6 +202,7 @@
"vendor_oui": "44-7c-7f",
"vendor_date": "2020-05-22",
"connector": "No separable connector",
"dom_capability": "{'Rx_power_support': 'yes', 'Temp_support': 'yes', 'Voltage_support': 'yes', 'Tx_power_support': 'yes'}",
"encoding": "Not supported for CMIS cables",
"ext_identifier": "Power Class 1(10.0W Max)",
"ext_rateselect_compliance": "Not supported for CMIS cables",
Expand Down Expand Up @@ -644,6 +647,7 @@
"manufacturer" : "XXXX",
"model" : "XXX",
"connector" : "LC",
"dom_capability": "{'Rx_power_support': 'yes', 'Temp_support': 'yes', 'Voltage_support': 'yes', 'Tx_power_support': 'yes'}",
"encoding" : "N/A",
"ext_identifier" : "Power Class 8 (20.0W Max)",
"ext_rateselect_compliance" : "N/A",
Expand Down
39 changes: 39 additions & 0 deletions tests/sfp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Ethernet0: SFP EEPROM detected
Application Advertisement: N/A
Connector: No separable connector
DOM Capability:
sff8472_dom_support: yes
Encoding: 64B66B
Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx
Extended RateSelect Compliance: QSFP+ Rate Select Version 1
Expand Down Expand Up @@ -68,6 +70,11 @@
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
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: Not supported for CMIS cables
Extended Identifier: Power Class 1(10.0W Max)
Extended RateSelect Compliance: Not supported for CMIS cables
Expand Down Expand Up @@ -148,6 +155,7 @@
IB SDR (Arch.Spec.Vol.2) - Host Assign (0x11) - Copper cable - Media Assign (Unknown)
CMIS Rev: 5.0
Connector: No separable connector
DOM Capability: N/A
Encoding: N/A
Extended Identifier: Power Class 1 (0.25W Max)
Extended RateSelect Compliance: N/A
Expand Down Expand Up @@ -206,6 +214,8 @@
Ethernet0: SFP EEPROM detected
Application Advertisement: N/A
Connector: No separable connector
DOM Capability:
sff8472_dom_support: yes
Encoding: 64B66B
Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx
Extended RateSelect Compliance: QSFP+ Rate Select Version 1
Expand All @@ -228,6 +238,11 @@
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
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: Not supported for CMIS cables
Extended Identifier: Power Class 1(10.0W Max)
Extended RateSelect Compliance: Not supported for CMIS cables
Expand All @@ -248,6 +263,11 @@
Application Advertisement: 400G CR8 - Host Assign (0x1) - Copper cable - Media Assign (0x2)
200GBASE-CR4 (Clause 136) - Host Assign (Unknown) - Unknown - Media Assign (Unknown)
Connector: No separable connector
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: Not supported for CMIS cables
Extended Identifier: Power Class 1(10.0W Max)
Extended RateSelect Compliance: Not supported for CMIS cables
Expand Down Expand Up @@ -606,6 +626,11 @@
E2 Active Firmware: X.X
E2 Inactive Firmware: Y.Y
E2 Server Firmware: A.B.C.D
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: N/A
Extended Identifier: Power Class 8 (20.0W Max)
Extended RateSelect Compliance: N/A
Expand Down Expand Up @@ -634,6 +659,8 @@
Ethernet0: SFP EEPROM detected
Application Advertisement: N/A
Connector: No separable connector
DOM Capability:
sff8472_dom_support: yes
Encoding: 64B66B
Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx
Extended RateSelect Compliance: QSFP+ Rate Select Version 1
Expand Down Expand Up @@ -702,6 +729,11 @@
E2 Active Firmware: X.X
E2 Inactive Firmware: Y.Y
E2 Server Firmware: A.B.C.D
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: N/A
Extended Identifier: Power Class 8 (20.0W Max)
Extended RateSelect Compliance: N/A
Expand Down Expand Up @@ -760,6 +792,8 @@
Ethernet0: SFP EEPROM detected
Application Advertisement: N/A
Connector: No separable connector
DOM Capability:
sff8472_dom_support: yes
Encoding: 64B66B
Extended Identifier: Power Class 3(2.5W max), CDR present in Rx Tx
Extended RateSelect Compliance: QSFP+ Rate Select Version 1
Expand Down Expand Up @@ -798,6 +832,11 @@
E2 Active Firmware: X.X
E2 Inactive Firmware: Y.Y
E2 Server Firmware: A.B.C.D
DOM Capability:
Rx_power_support: yes
Temp_support: yes
Tx_power_support: yes
Voltage_support: yes
Encoding: N/A
Extended Identifier: Power Class 8 (20.0W Max)
Extended RateSelect Compliance: N/A
Expand Down
6 changes: 6 additions & 0 deletions tests/sfputil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ def test_format_dict_value_to_string(self):
# expected_output
" Application Advertisement: N/A\n"
" Connector: No separable connector\n"
" DOM Capability: {\n"
" 'Tx_power_support': 'no',\n"
" 'Rx_power_support': 'no',\n"
" 'Voltage_support': 'no',\n"
" 'Temp_support': 'no'\n"
" }"
" Encoding: 64B66B\n"
" Extended Identifier: Power Class 1(1.5W max)\n"
" Extended RateSelect Compliance: QSFP+ Rate Select Version 1\n"
Expand Down
3 changes: 2 additions & 1 deletion utilities_common/sfp_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
'specification_compliance': 'Specification compliance',
'encoding': 'Encoding',
'connector': 'Connector',
'application_advertisement': 'Application Advertisement'
'application_advertisement': 'Application Advertisement',
'dom_capability': 'DOM Capability'
}

QSFP_CMIS_DELTA_DATA_MAP = {
Expand Down
Loading