Skip to content

Transceiver CLI changes to support DOM and STATUS table related changes#3844

Merged
prgeor merged 11 commits intosonic-net:masterfrom
mihirpat1:dom_status_cli_parity
May 6, 2025
Merged

Transceiver CLI changes to support DOM and STATUS table related changes#3844
prgeor merged 11 commits intosonic-net:masterfrom
mihirpat1:dom_status_cli_parity

Conversation

@mihirpat1
Copy link
Copy Markdown
Contributor

@mihirpat1 mihirpat1 commented Apr 10, 2025

What I did

  1. With the recent transceiver DOM and STATUS table related changes, the handles of the following CLIs need to be modified to ensure that the CLI function inline to the existing behavior

    1. show int transceiver eeprom -d
    2. show int transceiver status
    3. show int transceiver pm
    4. sfputil show eeprom -d -p EthernetXX
  2. Also, all the diagnostics related tables will not be present only for the first subport for breakout ports. Hence, made the corresponding CLI handler related changes to support this

  3. Modified the sfputil show error-status CLI handler to use TRANSCEIVER_STATUS_SW instead of TRANSCEIVER_STATUS table

How I did it

  1. Replaced function call for get_transceiver_bulk_status with get_transceiver_dom_real_value
  2. As part of displaying o/p for "show int transceiver status" CLI, we are now fetching data from TRANSCEIVER_DOM_FLAG, VDM flag tables and TRANSCEIVER_STATUS_FLAG tables as well since the relevant fields have been moved to these new tables
  3. As part of display o/p for "show int transceiver pm" CLI, we are now fetching data from VDM threshold tables as well since the relevant fields have been moved to these new tables

Related PRs
sonic-net/SONiC#1954
[cmis] Separate Flag-Specific Fields for DOM and Status APIs by mihirpat1 · Pull Request #556 · sonic-net/sonic-platform-common
[xcvrd] Re-organize transceiver DOM and STATUS tables by mihirpat1 · Pull Request #604 · sonic-net/sonic-platform-daemons

How to verify it

Following tests were attempted and confirmed to pass

  1. Diagnostic table related verification
    1. Compare tables with nightly image and ensure non-CMIS transceivers do not change their mapping for DOM and status tables
    2. Compare DOM sensor, threshold and status tables between current and nightly. Ensure units are not shown
    3. Dump TRANSCEIVER_INFO table for CMIS transceiver to ensure is_replaceable field is present
  2. CLI verification
    1. sudo sfputil show error-status - This should dump output for all the ports and the behavior should not change between nightly and private image
    2. Use invalid port name (Ethernet2033) to dump show int transceiver info, status CLI. Ensure to note new errors in PR description for invalid ports
    3. For breakout scenario, keep 2 subports in different CMIS_STATES and ensure the CLI o/p is different for status CLI for both subports
  3. Run transceiver onboarding test due to TRANSCEIVER_INFO table deletion change
  4. XCVRD stop/start
    1. Stop xcvrd and ensure all diagnostic tables are deleted
    2. Start xcvrd and ensure all diagnostic tables are populated
  5. Link flap event handling
    1. Change link flap count for different types of transceivers and ensure no crash is seen. This is to ensure that the link event handler code does not cause any crash for non-CMIS transceivers
    2. Shutdown peer port and ensure the tables get updated which are handled via link event update handler.
      Also, execute sfputil reset on 10 different physical ports and ensure that all the corresponding flags on the remote side are updated for all 8 lanes of a DR8 optic
      Specifically, we need to ensure that the following flags are set wherein X represents the lane number
      1. LOSFlagRxX (page 11, byte 147)
      2. CDRLOLFlagRxX (page 11, byte 148)
      3. OpticalPowerLowAlarmFlagRxX (page 11, byte 150)
      4. OpticalPowerLowWarningFlagRxX (page 11, byte 152)
  6. Transceiver OIR test
    1. Remove transceiver and ensure all diagnostic related tables are deleted
    2. Insert transceiver and ensure all diagnostic tables are populated
    3. Stop xcvrd and remove transceiver and ensure TRANSCEIVER_INFO table is present. Start xcvrd and ensure that the TRANSCEIVER_INFO table is now deleted
    4. Insert the transceiver now
  7. Ensure firmware upgrade is successfull and TRANSCEIVER_FIRMWARE_INFO table changes only for the primary subport eventhough, the upgrade was triggered for a non-primary subport
  8. Ensure SFF manager crash is seen with nightly and is resolved with this PR (since the PR has the fix for SffLoggerForPortUpdateEvent class does not have log_debug function · Issue #605 · sonic-net/sonic-platform-daemons)

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

The output of show int transceiver info and show int transceiver eeprom will change if an invalid port name is passed to the CLI

root@str4-sn5600-3:/home/admin# show int transceiver info Ethernet8
Ethernet8: SFP EEPROM Not detected
root@str4-sn5600-3:/home/admin# 

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

root@str4-sn5600-3:/home/admin# show int transceiver info Ethernet8
Error: Found KeyError while getting first subport for Ethernet8
Error: Unable to get first subport for Ethernet8 while converting SFP info
Ethernet8: SFP EEPROM Not detected
root@str4-sn5600-3:/home/admin# 

MSFT ADO - 32238285

@mihirpat1 mihirpat1 requested a review from Copilot April 10, 2025 02:27
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

Copy link
Copy Markdown
Contributor

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.

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

utilities_common/sfp_helper.py:61

  • The naming convention for transceiver fault keys has changed from 'txfault{n}' to 'tx{n}fault'. Please ensure that all consuming code and CLI output functions are updated consistently to handle the new key names.
    'tx1fault': 'Tx fault flag on media lane 1',

utilities_common/sfp_helper.py:397

  • [nitpick] There appears to be a typo in the function name: 'covert' might be intended as 'convert' for clarity and accuracy.
def covert_application_advertisement_to_output_string(indent, sfp_info_dict):

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

…added support for TRANSCEIVER_STATUS_SW table
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mihirpat1 mihirpat1 requested a review from Copilot April 15, 2025 16:26
Copy link
Copy Markdown
Contributor

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.

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

sfputil/main.py:546

  • There is an inconsistency in the use of the port identifier: while most queries use 'first_subport', this update uses 'interface_name'. Please verify that this mixed usage is intentional and does not lead to mismatched data retrieval.
sfp_status_dict.update(state_db.get_all(state_db.STATE_DB, 'TRANSCEIVER_STATUS_SW|{}'.format(interface_name)) or {})

sfputil/main.py:490

  • Consider adding unit tests for the 'convert_vdm_fields_to_legacy_fields' function to ensure robust handling of both 'FLAG' and 'THRESHOLD' VDM field types.
def convert_vdm_fields_to_legacy_fields(self, state_db, interface_name, dict_to_be_updated, vdm_to_legacy_field_map, vdm_field_type):

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mihirpat1 mihirpat1 force-pushed the dom_status_cli_parity branch from ede1c33 to e87981a Compare April 16, 2025 04:00
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mihirpat1 mihirpat1 force-pushed the dom_status_cli_parity branch from e87981a to b9f63c3 Compare April 16, 2025 04:33
@prgeor prgeor merged commit 05abc9e into sonic-net:master May 6, 2025
7 checks passed
mihirpat1 added a commit to mihirpat1/sonic-utilities that referenced this pull request May 6, 2025
…es (sonic-net#3844)

* Transceiver CLI changes to support DOM and STATUS table related changes

Signed-off-by: Mihir Patel <[email protected]>

* Added details to convert_vdm_fields_to_legacy_fields

* Fixed pre-commit check

* Added CLI support to access diagnostic tables from primary subport + added support for TRANSCEIVER_STATUS_SW table

* Fix pre-commit check

* Fixed unit-test failure by adding TRANSCEIVER_STATUS_SW as part of mocked STATE_DB

* Fixed ycable failure due to TRANSCEIVER_STATUS related change

* Modified update_firmware_info_to_state_db to update DB for first subport

* Increased code coverage for update_firmware_info_to_state_db

* Added test_show_eeprom_dom_real_value_exception

---------

Signed-off-by: Mihir Patel <[email protected]>
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-utilities.msft#176

mssonicbld added a commit to mssonicbld/sonic-platform-common.msft that referenced this pull request May 9, 2025
<!-- Provide a general summary of your changes in the Title above -->

#### Description
<!--
     Describe your changes in detail
-->
The DOM and Status related APIs need to be modified to ensure that the fields which have latched registers are moved to the flag specific API.
Also, all the VDM specific fields have now been removed from DOM and Status related APIs since separate APIs pertaining to processing VDM data have now been created.

This change is in line to the requirements of [SONiC/doc/platform_api/CMIS_Diagnostic_Monitoring_Overview_in_SONiC.md at master · sonic-net/SONiC](https://github.com/sonic-net/SONiC/blob/master/doc/platform_api/CMIS_Diagnostic_Monitoring_Overview_in_SONiC.md)

#### Motivation and Context
<!--
     Why is this change required? What problem does it solve?
     If this pull request closes/resolves an open Issue, make sure you
     include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here
-->
N/A

#### How Has This Been Tested?
<!--
     Please describe in detail how you tested your changes.
     Include details of your testing environment, and the tests you ran to
     see how your change affects other areas of the code, etc.
-->
Please refer to sonic-net/sonic-utilities#3844 for the test details

#### Additional Information (Optional)
MSFT ADO - 30090754

Related PRs
sonic-net/SONiC#1954
sonic-net/sonic-platform-daemons#604
sonic-net/sonic-utilities#3844
mssonicbld added a commit to Azure/sonic-platform-common.msft that referenced this pull request May 9, 2025
<!-- Provide a general summary of your changes in the Title above -->

#### Description
<!--
 Describe your changes in detail
-->
The DOM and Status related APIs need to be modified to ensure that the fields which have latched registers are moved to the flag specific API.
Also, all the VDM specific fields have now been removed from DOM and Status related APIs since separate APIs pertaining to processing VDM data have now been created.

This change is in line to the requirements of [SONiC/doc/platform_api/CMIS_Diagnostic_Monitoring_Overview_in_SONiC.md at master · sonic-net/SONiC](https://github.com/sonic-net/SONiC/blob/master/doc/platform_api/CMIS_Diagnostic_Monitoring_Overview_in_SONiC.md)

#### Motivation and Context
<!--
 Why is this change required? What problem does it solve?
 If this pull request closes/resolves an open Issue, make sure you
 include the text "fixes #xxxx", "closes #xxxx" or "resolves #xxxx" here
-->
N/A

#### How Has This Been Tested?
<!--
 Please describe in detail how you tested your changes.
 Include details of your testing environment, and the tests you ran to
 see how your change affects other areas of the code, etc.
-->
Please refer to sonic-net/sonic-utilities#3844 for the test details

#### Additional Information (Optional)
MSFT ADO - 30090754

Related PRs
sonic-net/SONiC#1954
sonic-net/sonic-platform-daemons#604
sonic-net/sonic-utilities#3844
arlakshm pushed a commit to Azure/sonic-mgmt.msft that referenced this pull request Jun 24, 2025
The changes to the sonic-mgmt testcases are required due to the below
changes:
sonic-net/sonic-platform-common#556
sonic-net/sonic-platform-daemons#604
sonic-net/sonic-utilities#3844

This PR also reverts the changes made by #181 .
nmoray pushed a commit to nmoray/sonic-utilities that referenced this pull request Jun 25, 2025
…es (sonic-net#3844)

* Transceiver CLI changes to support DOM and STATUS table related changes

Signed-off-by: Mihir Patel <[email protected]>

* Added details to convert_vdm_fields_to_legacy_fields

* Fixed pre-commit check

* Added CLI support to access diagnostic tables from primary subport + added support for TRANSCEIVER_STATUS_SW table

* Fix pre-commit check

* Fixed unit-test failure by adding TRANSCEIVER_STATUS_SW as part of mocked STATE_DB

* Fixed ycable failure due to TRANSCEIVER_STATUS related change

* Modified update_firmware_info_to_state_db to update DB for first subport

* Increased code coverage for update_firmware_info_to_state_db

* Added test_show_eeprom_dom_real_value_exception

---------

Signed-off-by: Mihir Patel <[email protected]>
@yejianquan
Copy link
Copy Markdown
Contributor

Hi @mihirpat1 , please fix conflict and create PR to 202505 branch

@yejianquan
Copy link
Copy Markdown
Contributor

202505 branched out around 5/16, this commit is included when created, removing request labels.
and please ignore the conflict notification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants