From b7e75d811ab9388ddab4aa4cc93d63f8f4c74bf2 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Fri, 7 Feb 2025 01:02:32 +0800 Subject: [PATCH 1/2] Add 800G innolight PNs (#540) #### Motivation and Context These part numbers require a different API for firmware get operations. Using the default firmware operations causes an optoe driver debug message. #### How Has This Been Tested? Tested with these additional part numbers, firmware version can be seen and link comes up. show interface transceiver info Ethernet256 Ethernet256: SFP EEPROM detected Active Firmware: 94.6.0 Active application selected code assigned to host lane 1: 3 Active application selected code assigned to host lane 2: 3 Active application selected code assigned to host lane 3: 3 Active application selected code assigned to host lane 4: 3 Active application selected code assigned to host lane 5: 3 Active application selected code assigned to host lane 6: 3 Active application selected code assigned to host lane 7: 3 Active application selected code assigned to host lane 8: 3 Application Advertisement: 100GAUI-1-L C2M (Annex 120G) - Host Assign (0xff) - 100G-FR/100GBASE-FR1 (Cl 140) - Media Assign (0xff) 400GAUI-4-L C2M (Annex 120G) - Host Assign (0x11) - 400GBASE-DR4 (Cl 124) - Media Assign (0x11) 800G L C2M (placeholder) - Host Assign (0x1) - Undefined - Media Assign (0x1) 100GAUI-1-S C2M (Annex 120G) - Host Assign (0xff) - 100G-FR/100GBASE-FR1 (Cl 140) - Media Assign (0xff) 400GAUI-4-S C2M (Annex 120G) - Host Assign (0x11) - 400GBASE-DR4 (Cl 124) - Media Assign (0x11) 800G S C2M (placeholder) - Host Assign (0x1) - Undefined - Media Assign (0x1) CMIS Rev: 4.0 Connector: MPO 1x16 Encoding: N/A Extended Identifier: Power Class 8 (17.0W Max) Extended RateSelect Compliance: N/A Host Lane Count: 8 Identifier: QSFP-DD Double Density 8X Pluggable Transceiver Inactive Firmware: 0.0.0 Length Cable Assembly(m): 0.0 Media Interface Technology: 1310 nm EML Media Lane Count: 8 Module Hardware Rev: 1.10 Nominal Bit Rate(100Mbs): 0 Specification compliance: sm_media_interface Supported Max Laser Frequency: N/A Supported Max TX Power: N/A Supported Min Laser Frequency: N/A Supported Min TX Power: N/A Vendor Date Code(YYYY-MM-DD Lot): 2023-10-07 Vendor Name: INNOLIGHT Vendor OUI: 44-7c-7f Vendor PN: T-DP8CNT-NNO Vendor Rev: 1A Vendor SN: NK2339P0233 --- sonic_platform_base/sonic_xcvr/xcvr_api_factory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py b/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py index ad35f7d..6b3148c 100644 --- a/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py +++ b/sonic_platform_base/sonic_xcvr/xcvr_api_factory.py @@ -37,7 +37,7 @@ VENDOR_PART_NUM_LENGTH = 16 CREDO_800G_AEC_VENDOR_PN_LIST = ["CAC81X321M2MC1MS", "CAC815321M2MC1MS", "CAC82X321M2MC1MS"] -INL_800G_VENDOR_PN_LIST = ["T-DL8CNT-NCI", "T-DH8CNT-NCI", "T-DH8CNT-N00", "T-DP4CNH-NCI"] +INL_800G_VENDOR_PN_LIST = ["T-DL8CNT-NCI", "T-DH8CNT-NCI", "T-DH8CNT-N00", "T-DP4CNH-NCI", "T-DP8CNT-NNO", "T-DP8CNH-NNO", "T-DC8CNT-NNO", "T-DP8CNL-NNO"] EOP_800G_VENDOR_PN_LIST = ["EOLD-168HG-02-41", "EOLD-138HG-02-41"] class XcvrApiFactory(object): From c735073a02d5478b84212f9095ab6d266ed7d993 Mon Sep 17 00:00:00 2001 From: Aryeh Feigin <101218333+arfeigin@users.noreply.github.com> Date: Wed, 12 Feb 2025 16:28:23 +0200 Subject: [PATCH 2/2] [202411][cmis] Fix cmis.get_error_description speed for passive module (#538) * [cmis] Optimize cmis.get_error_description speed for passive module * Update azure pipeline to use Bookworm --- azure-pipelines.yml | 16 ++-- .../sonic_xcvr/api/public/cmis.py | 31 +++---- tests/sonic_xcvr/test_cmis.py | 86 ++++++++++++------- 3 files changed, 82 insertions(+), 51 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 637849b..a4cb4db 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,7 @@ pool: vmImage: 'ubuntu-20.04' container: - image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bullseye:latest + image: sonicdev-microsoft.azurecr.io:443/sonic-slave-bookworm:latest steps: - task: DownloadPipelineArtifact@2 @@ -49,7 +49,7 @@ steps: libnl-nf-3-200_*.deb \ libswsscommon_1.0.0_amd64.deb \ python3-swsscommon_1.0.0_amd64.deb - workingDirectory: $(Build.ArtifactStagingDirectory)/target/debs/bullseye/ + workingDirectory: $(Build.ArtifactStagingDirectory)/target/debs/bookworm/ displayName: 'Install Debian dependencies' - script: | @@ -59,7 +59,7 @@ steps: sudo pip3 install sonic_yang_mgmt-1.0-py3-none-any.whl sudo pip3 install sonic_yang_models-1.0-py3-none-any.whl sudo pip3 install sonic_config_engine-1.0-py3-none-any.whl - workingDirectory: $(Build.ArtifactStagingDirectory)/target/python-wheels/bullseye/ + workingDirectory: $(Build.ArtifactStagingDirectory)/target/python-wheels/bookworm/ displayName: 'Install Python dependencies' - script: | @@ -69,12 +69,15 @@ steps: . /etc/os-release sudo apt-add-repository https://packages.microsoft.com/debian/$VERSION_ID/prod sudo apt-get update - sudo apt-get install -y dotnet-sdk-5.0 + sudo apt-get install -y dotnet-sdk-8.0 displayName: "Install .NET CORE" # Python 3 - script: | - python3 setup.py test + set -ex + pip3 install ".[testing]" + pip3 uninstall --yes sonic-platform-common + pytest displayName: 'Test Python 3' - task: PublishTestResults@2 @@ -93,8 +96,7 @@ steps: displayName: 'Publish Python 3 test coverage' - script: | - set -e - python3 setup.py bdist_wheel + python3 -m build -n displayName: 'Build Python 3 wheel' - publish: '$(System.DefaultWorkingDirectory)/dist/' diff --git a/sonic_platform_base/sonic_xcvr/api/public/cmis.py b/sonic_platform_base/sonic_xcvr/api/public/cmis.py index 78bfb4d..429c3ab 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/cmis.py +++ b/sonic_platform_base/sonic_xcvr/api/public/cmis.py @@ -3144,21 +3144,22 @@ def stage_custom_si_settings(self, host_lanes_mask, optics_si_dict): return True def get_error_description(self): - dp_state = self.get_datapath_state() - conf_state = self.get_config_datapath_hostlane_status() - for lane in range(self.NUM_CHANNELS): - name = "{}_{}_{}".format(consts.STAGED_CTRL_APSEL_FIELD, 0, lane + 1) - appl = self.xcvr_eeprom.read(name) - if (appl is None) or ((appl >> 4) == 0): - continue - - name = "DP{}State".format(lane + 1) - if dp_state[name] != CmisCodes.DATAPATH_STATE[4]: - return dp_state[name] - - name = "ConfigStatusLane{}".format(lane + 1) - if conf_state[name] != CmisCodes.CONFIG_STATUS[1]: - return conf_state[name] + if not self.is_flat_memory(): + dp_state = self.get_datapath_state() + conf_state = self.get_config_datapath_hostlane_status() + for lane in range(self.NUM_CHANNELS): + name = "{}_{}_{}".format(consts.STAGED_CTRL_APSEL_FIELD, 0, lane + 1) + appl = self.xcvr_eeprom.read(name) + if (appl is None) or ((appl >> 4) == 0): + continue + + name = "DP{}State".format(lane + 1) + if dp_state[name] != CmisCodes.DATAPATH_STATE[4]: + return dp_state[name] + + name = "ConfigStatusLane{}".format(lane + 1) + if conf_state[name] != CmisCodes.CONFIG_STATUS[1]: + return conf_state[name] state = self.get_module_state() if state != CmisCodes.MODULE_STATE[3]: diff --git a/tests/sonic_xcvr/test_cmis.py b/tests/sonic_xcvr/test_cmis.py index a763ef6..8a43568 100644 --- a/tests/sonic_xcvr/test_cmis.py +++ b/tests/sonic_xcvr/test_cmis.py @@ -3054,35 +3054,63 @@ def test_set_module_OutputAmplitudeTargetRx_settings(self): assert self.api.xcvr_eeprom.write.call_count == 4 def test_get_error_description(self): - self.api.get_module_state = MagicMock() - self.api.get_module_state.return_value = 'ModuleReady' - self.api.get_datapath_state = MagicMock() - self.api.get_datapath_state.return_value = { - 'DP1State': 'DataPathActivated', - 'DP2State': 'DataPathActivated', - 'DP3State': 'DataPathActivated', - 'DP4State': 'DataPathActivated', - 'DP5State': 'DataPathActivated', - 'DP6State': 'DataPathActivated', - 'DP7State': 'DataPathActivated', - 'DP8State': 'DataPathActivated' - } - self.api.get_config_datapath_hostlane_status = MagicMock() - self.api.get_config_datapath_hostlane_status.return_value = { - 'ConfigStatusLane1': 'ConfigSuccess', - 'ConfigStatusLane2': 'ConfigSuccess', - 'ConfigStatusLane3': 'ConfigSuccess', - 'ConfigStatusLane4': 'ConfigSuccess', - 'ConfigStatusLane5': 'ConfigSuccess', - 'ConfigStatusLane6': 'ConfigSuccess', - 'ConfigStatusLane7': 'ConfigSuccess', - 'ConfigStatusLane8': 'ConfigSuccess' - } - self.api.xcvr_eeprom.read = MagicMock() - self.api.xcvr_eeprom.read.return_value = 0x10 - - result = self.api.get_error_description() - assert result is 'OK' + with patch.object(self.api, 'is_flat_memory') as mock_method: + mock_method.return_value = False + self.api.get_module_state = MagicMock() + self.api.get_module_state.return_value = 'ModuleReady' + self.api.get_datapath_state = MagicMock() + self.api.get_datapath_state.return_value = { + 'DP1State': 'DataPathActivated', + 'DP2State': 'DataPathActivated', + 'DP3State': 'DataPathActivated', + 'DP4State': 'DataPathActivated', + 'DP5State': 'DataPathActivated', + 'DP6State': 'DataPathActivated', + 'DP7State': 'DataPathActivated', + 'DP8State': 'DataPathActivated' + } + self.api.get_config_datapath_hostlane_status = MagicMock() + self.api.get_config_datapath_hostlane_status.return_value = { + 'ConfigStatusLane1': 'ConfigSuccess', + 'ConfigStatusLane2': 'ConfigSuccess', + 'ConfigStatusLane3': 'ConfigSuccess', + 'ConfigStatusLane4': 'ConfigSuccess', + 'ConfigStatusLane5': 'ConfigSuccess', + 'ConfigStatusLane6': 'ConfigSuccess', + 'ConfigStatusLane7': 'ConfigSuccess', + 'ConfigStatusLane8': 'ConfigSuccess' + } + self.api.xcvr_eeprom.read = MagicMock() + self.api.xcvr_eeprom.read.return_value = 0x10 + + result = self.api.get_error_description() + assert result is 'OK' + + self.api.get_config_datapath_hostlane_status.return_value = { + 'ConfigStatusLane1': 'ConfigRejected', + 'ConfigStatusLane2': 'ConfigRejected', + 'ConfigStatusLane3': 'ConfigRejected', + 'ConfigStatusLane4': 'ConfigRejected', + 'ConfigStatusLane5': 'ConfigRejected', + 'ConfigStatusLane6': 'ConfigRejected', + 'ConfigStatusLane7': 'ConfigRejected', + 'ConfigStatusLane8': 'ConfigRejected' + } + result = self.api.get_error_description() + assert result is 'ConfigRejected' + + self.api.get_datapath_state.return_value = { + 'DP1State': 'DataPathDeactivated', + 'DP2State': 'DataPathActivated', + 'DP3State': 'DataPathActivated', + 'DP4State': 'DataPathActivated', + 'DP5State': 'DataPathActivated', + 'DP6State': 'DataPathActivated', + 'DP7State': 'DataPathActivated', + 'DP8State': 'DataPathActivated' + } + result = self.api.get_error_description() + assert result is 'DataPathDeactivated' def test_random_read_fail(self): def mock_read_raw(offset, size):