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

Fixes show interface transceiver info Ethernet0 command failure for CMIS SFP. #3795

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

az-pz
Copy link

@az-pz az-pz commented Mar 6, 2025

What I did

show interface transceiver info Ethernet0 command was failing for CMIS SFP after this change: https://github.com/sonic-net/sonic-platform-daemons/pull/590/files#diff-fc70c43977a1ce57f3a6e9d7d09cb7ea5204f52b3adf3162936205e5680efb2f . Fixed the failing command.

How I did it

Added a check for C-CMIS SFP to pick the right dict to generate data.

How to verify it

Run show interface transceiver info Ethernet0 command on a CMIS SFP.

Previous command output (if the output of a command-line utility has changed)

root@str4-sn5600-2:/home/admin# show int transceiver info Ethernet0
Traceback (most recent call last):
  File "/usr/local/bin/sfpshow", line 733, in <module>
    cli()
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/sfpshow", line 674, in info
    sfp.get_eeprom()
  File "/usr/local/lib/python3.11/dist-packages/utilities_common/multi_asic.py", line 156, in wrapped_run_on_all_asics
    func(self,  *args, **kwargs)
  File "/usr/local/bin/sfpshow", line 556, in get_eeprom
    self.intf_eeprom[self.intf_name] = self.convert_interface_sfp_info_to_cli_output_string(
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/sfpshow", line 454, in convert_interface_sfp_info_to_cli_output_string
    sfp_info_output = self.convert_sfp_info_to_output_string(sfp_info_dict, sfp_firmware_info_dict)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/bin/sfpshow", line 341, in convert_sfp_info_to_output_string
    output += '{}{}: {}\n'.format(indent, data_map[key], sfp_info_dict[key])
                                                         ~~~~~~~~~~~~~^^^^^
KeyError: 'supported_max_laser_freq'
root@str4-sn5600-2:/home/admin#

New command output (if the output of a command-line utility has changed)

CMIS SFP:
admin@str4-sn5600-2:/usr$ show int transceiver info Ethernet4
Ethernet4: SFP EEPROM detected
        Active Firmware: 36.227.0
        Active application selected code assigned to host lane 1: 1
        Active application selected code assigned to host lane 2: 1
        Active application selected code assigned to host lane 3: 1
        Active application selected code assigned to host lane 4: 1
        Active application selected code assigned to host lane 5: 1
        Active application selected code assigned to host lane 6: 1
        Active application selected code assigned to host lane 7: 1
        Active application selected code assigned to host lane 8: 1
        Application Advertisement: 100GAUI-1-L C2M (Annex 120G) - Host Assign (0xff) - 100GBASE-DR (Cl 140) - Media Assign (0xff)
                                   200GAUI-2-L C2M (Annex 120G) - Host Assign (0x55) - Undefined - Media Assign (0x55)
                                   400GAUI-4-L C2M (Annex 120G) - Host Assign (0x11) - 400GBASE-DR4 (Cl 124) - Media Assign (0x11)
                                   IB NDR - Host Assign (0x11) - 400GBASE-DR4 (Cl 124) - Media Assign (0x11)
                                   800G L C2M (placeholder) - Host Assign (0x1) - 800GBASE-DR8 (placeholder) - Media Assign (0x1)
                                   200GAUI-4 C2M (Annex 120E) - Host Assign (0x11) - 200GBASE-DR4 (Cl 121) - Media Assign (0x11)
                                   IB HDR (Arch.Spec.Vol.2) - Host Assign (0x11) - 200GBASE-DR4 (Cl 121) - Media Assign (0x11)
                                   100GAUI-1-S C2M (Annex 120G) - Host Assign (0xff) - 100GBASE-DR (Cl 140) - Media Assign (0xff)
                                   200GAUI-2-S C2M (Annex 120G) - Host Assign (0x55) - Undefined - Media Assign (0x55)
                                   400GAUI-4-S C2M (Annex 120G) - Host Assign (0x11) - 400GBASE-DR4 (Cl 124) - Media Assign (0x11)
                                   800G S C2M (placeholder) - Host Assign (0x1) - 800GBASE-DR8 (placeholder) - Media Assign (0x1)
        CMIS Rev: 5.2
        Connector: MPO 2x12
        Encoding: N/A
        Extended Identifier: Power Class 8 (15.0W Max)
        Extended RateSelect Compliance: N/A
        Host Lane Count: 1
        Identifier: OSFP 8X Pluggable Transceiver
        Inactive Firmware: 36.227.0
        Length Cable Assembly(m): 0.0
        Media Interface Technology: 1310 nm DFB
        Media Lane Count: 1
        Module Hardware Rev: 1.10
        Nominal Bit Rate(100Mbs): N/A
        Specification compliance: sm_media_interface
        Vendor Date Code(YYYY-MM-DD Lot): 2024-09-02   
        Vendor Name: PINEWAVE        
        Vendor OUI: 34-36-07
        Vendor PN: T-OH8CNT-NMT    
        Vendor Rev: 1A
        Vendor SN: IDOBIS130378    
C-CMIS SFP:
admin@sonic:~$ show int trans info Ethernet144                            
Ethernet144: SFP EEPROM detected
        Active Firmware: 3.3.37
        Active application selected code assigned to host lane 1: 1
        Active application selected code assigned to host lane 2: 1
        Active application selected code assigned to host lane 3: 1
        Active application selected code assigned to host lane 4: 1
        Active application selected code assigned to host lane 5: 1
        Active application selected code assigned to host lane 6: 1
        Active application selected code assigned to host lane 7: 1
        Active application selected code assigned to host lane 8: 1
        Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1)
                                   100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1)
        CMIS Rev: 5.0
        Connector: LC
        Encoding: N/A
        Extended Identifier: Power Class 8 (18.0W Max)
        Extended RateSelect Compliance: N/A
        Host Lane Count: 8
        Identifier: QSFP-DD Double Density 8X Pluggable Transceiver
        Inactive Firmware: 3.3.37
        Length Cable Assembly(m): 0.0
        Media Interface Technology: C-band tunable laser
        Media Lane Count: 1
        Module Hardware Rev: 0.0
        Nominal Bit Rate(100Mbs): N/A
        Specification compliance: sm_media_interface
        Supported Max Laser Frequency: 196100
        Supported Max TX Power: -10.3
        Supported Min Laser Frequency: 191300
        Supported Min TX Power: -14.0
        Vendor Date Code(YYYY-MM-DD Lot): 2021-04-20 
        Vendor Name: INPHI CORP      
        Vendor OUI: 00-21-b8
        Vendor PN: IN-Q3JZ1-TC-M1  
        Vendor Rev: 01
        Vendor SN: L2116D0146      
QSFP Interface:
admin@sonic:~$ show int trans info Ethernet260
Ethernet260: SFP EEPROM detected
        Application Advertisement: N/A
        Connector: LC
        Encoding: 64B/66B
        Extended Identifier: GBIC/SFP defined by two-wire interface ID
        Extended RateSelect Compliance: Unknown
        Identifier: SFP/SFP+/SFP28
        Length OM3(10m): 30.0
        Nominal Bit Rate(100Mbs): 103
        Specification compliance:
                10G Ethernet Compliance: 10GBASE-SR
                ESCON Compliance: Unknown
                Ethernet Compliance: Unknown
                Fibre Channel Link Length: Unknown
                Fibre Channel Speed: Unknown
                Fibre Channel Transmission Media: Unknown
                Fibre Channel Transmitter Technology: Unknown
                Infiniband Compliance: Unknown
                SFP+CableTechnology: Unknown
                SONET Compliance Codes: Unknown
        Vendor Date Code(YYYY-MM-DD Lot): 2014-02-08   
        Vendor Name: FINISAR CORP.   
        Vendor OUI: 00-90-65
        Vendor PN: FTLX8571D3BCL   
        Vendor Rev: A   
        Vendor SN: AR62NDY 
400ZR:
admin@sonic:/usr$ show int trans info Ethernet144                                                   
Ethernet144: SFP EEPROM detected
        Active Firmware: 3.3.37
        Active application selected code assigned to host lane 1: 1
        Active application selected code assigned to host lane 2: 1
        Active application selected code assigned to host lane 3: 1
        Active application selected code assigned to host lane 4: 1
        Active application selected code assigned to host lane 5: 1
        Active application selected code assigned to host lane 6: 1
        Active application selected code assigned to host lane 7: 1
        Active application selected code assigned to host lane 8: 1
        Application Advertisement: 400GAUI-8 C2M (Annex 120E) - Host Assign (0x1) - 400ZR, DWDM, amplified - Media Assign (0x1)
                                   100GAUI-2 C2M (Annex 135G) - Host Assign (0x55) - 400ZR, DWDM, amplified - Media Assign (0x1)
        CMIS Rev: 5.0
        Connector: LC
        Encoding: N/A
        Extended Identifier: Power Class 8 (18.0W Max)
        Extended RateSelect Compliance: N/A
        Host Lane Count: 8
        Identifier: QSFP-DD Double Density 8X Pluggable Transceiver
        Inactive Firmware: 3.3.37
        Length Cable Assembly(m): 0.0
        Media Interface Technology: C-band tunable laser
        Media Lane Count: 1
        Module Hardware Rev: 0.0
        Nominal Bit Rate(100Mbs): N/A
        Specification compliance: sm_media_interface
        Supported Max Laser Frequency: 196100
        Supported Max TX Power: -10.3
        Supported Min Laser Frequency: 191300
        Supported Min TX Power: -14.0
        Vendor Date Code(YYYY-MM-DD Lot): 2021-04-20 
        Vendor Name: INPHI CORP      
        Vendor OUI: 00-21-b8
        Vendor PN: IN-Q3JZ1-TC-M1  
        Vendor Rev: 01
        Vendor SN: L2116D0146     

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

linux-foundation-easycla bot commented Mar 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@prgeor prgeor requested review from Copilot and mihirpat1 March 6, 2025 23:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR fixes the failure of the "show interface transceiver info Ethernet0" command for CMIS SFP by ensuring the correct data map is used based on the SFP type.

  • Added a check for the 'supported_max_tx_power' key to distinguish C-CMIS SFP.
  • Updated the data map selection logic in the SFP show command and refactored related SFP helper dictionaries.

Reviewed Changes

File Description
scripts/sfpshow Updated data map selection logic to support C-CMIS SFP devices.
utilities_common/sfp_helper.py Refactored SFP helper dictionaries and removed redundant keys.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@prgeor prgeor added the Bug label Mar 6, 2025
'supported_max_laser_freq': 'Supported Max Laser Frequency',
'supported_min_laser_freq': 'Supported Min Laser Frequency',
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mihirpat1 should we fix the CMIS_DATA_MAP also which includes QSFP_DATA_MAP fields not applicable for CMIS?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor Sure - Yes, we can fix here and at the below location as well
https://github.com/sonic-net/sonic-platform-common/blob/c6f6bed9eae562d1a045bbf62601216707969ca9/sonic_platform_base/sonic_xcvr/api/public/cmis.py#L81

Some of the unwanted fields in CMIS are

  1. encoding
  2. ext_rateselect_compliance
  3. nominal_bit_rate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@az-pz can you address this

Copy link
Contributor

@mihirpat1 mihirpat1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@az-pz Please attach the output of show int transceiver info for the following types of optics

  1. CMIS optic
  2. C-CMIS optic
  3. 400ZR

@mihirpat1
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@az-pz
Copy link
Author

az-pz commented Mar 7, 2025

@mihirpat1 I have added the output for CMIS and C-CMIS SFPs in the description. I will add the output for 400ZR soon.

@az-pz
Copy link
Author

az-pz commented Mar 7, 2025

@mihirpat1 , I have added the output of 400ZR as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants