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

[sfpshow] Add dom_capability to transceiver eeprom #1003

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
11 changes: 9 additions & 2 deletions scripts/sfpshow
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ qsfp_data_map = {'model': 'Vendor PN',
'specification_compliance': 'Specification compliance',
'encoding': 'Encoding',
'connector': 'Connector',
'application_advertisement': 'Application Advertisement'
'application_advertisement': 'Application Advertisement',
'dom_capability': 'DOM Capability'
}

sfp_dom_channel_monitor_map = {'rx1power': 'RXPower',
Expand Down Expand Up @@ -270,6 +271,12 @@ class SFPShow(object):
sorted_compliance_key_table = natsorted(spefic_compliance_dict)
for compliance_key in sorted_compliance_key_table:
out_put = out_put + ident + ident + compliance_key + ': ' + spefic_compliance_dict[compliance_key] + '\n'
elif key1 == 'dom_capability':
dom_capability_dict = eval(sfp_info_dict['dom_capability'])
sorted_dom_capability_key_table = natsorted(dom_capability_dict)
out_put = out_put + ident + qsfp_data_map['dom_capability'] + ': ' + '\n'
for dom_capability_key in sorted_dom_capability_key_table:
out_put = out_put + ident + ident + dom_capability_key + ': ' + dom_capability_dict[dom_capability_key] + '\n'
else:
out_put = out_put + ident + qsfp_data_map[key1] + ': ' + sfp_info_dict[key1] + '\n'

Expand All @@ -281,7 +288,7 @@ class SFPShow(object):
sfp_info_dict = state_db.get_all(state_db.STATE_DB, 'TRANSCEIVER_INFO|{}'.format(interface_name))
out_put = interface_name + ': ' + 'SFP EEPROM detected' + '\n'
sfp_info_output = self.convert_sfp_info_to_output_string(sfp_info_dict)
out_put = out_put + sfp_info_output
out_put = out_put + sfp_info_output.decode('utf-8', errors='ignore')

if dump_dom:
sfp_type = sfp_info_dict['type']
Expand Down
1 change: 1 addition & 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
4 changes: 4 additions & 0 deletions tests/sfp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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 @@ -64,6 +66,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