Skip to content

[sonic_xcvr] Fix temperature capability and readiness handling - #756

Open
ArthurMicas wants to merge 1 commit into
sonic-net:masterfrom
ArthurMicas:codex/xcvr-temperature-support
Open

ArthurMicas wants to merge 1 commit into
sonic-net:masterfrom
ArthurMicas:codex/xcvr-temperature-support

Conversation

@ArthurMicas

Copy link
Copy Markdown

What I did

Correct temperature capability and readiness handling in the common transceiver APIs. A failed capability read now returns None instead of being reported as unsupported or assumed to support temperature monitoring.

  • Read CMIS Page 01h byte 159 bit 0 after checking the memory model.
  • Check SFF-8472 A2h byte 110 Data_Not_Ready before reading temperature.
  • Preserve failed copper detection in SFF-8436/SFF-8636 and use the raw SFF-8636 revision to honor byte 220 bit 5 for revision codes 0x08 and later.
  • Return None when QSFP revision detection fails, and extend factory dispatch for legacy QSFP/microQSFP and additional CMIS identifiers while preserving the requested bank.
  • Add capability, readiness, raw EEPROM, recovery, and factory dispatch regressions; update the existing CMIS capability test to call the real method instead of a shared mock.

Existing copper-module policy and the pre-2.8 SFF-8636 temperature assumption are preserved. These changes are limited to sonic-platform-common; no platform sfputil or installation scripts are included.

How I verified it

On Ubuntu 22.04 / Python 3.10:

  • Directly affected API and factory tests: 624 passed.
  • python3 -m pytest -o addopts= tests/sonic_xcvr --ignore=tests/sonic_xcvr/test_bailly_optoe_base.py -q --disable-warnings --cov=sonic_platform_base.sonic_xcvr: 1514 passed.
  • All 44 changed executable lines reported by coverage.py were covered; the exercised sonic_xcvr tree had 88% statement coverage.
  • git diff --check: passed.

The unfiltered sonic_xcvr run could not collect test_bailly_optoe_base.py because the local environment lacks the native SONiC swsscommon dependency. That file was explicitly excluded from the 1514-test run. The full repository suite and hardware validation were not run. New identifier tests validate dispatch and bank propagation, not complete hardware qualification of each module family.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@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

Hi, there are workflow run(s) waiting for approval, you may be first-time contributor. I will notify maintainers to help approve once PR is approved. Thanks!

---Powered by SONiC BuildBot

@bgallagher-nexthop bgallagher-nexthop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

0x1f: (self._create_cmis_api, (bank,)),
0x20: (self._create_cmis_api, (bank,)),
0x21: (self._create_cmis_api, (bank,)),
0x22: (self._create_cmis_api, (bank,)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you leave this one undefined in the id_mapping? ELSFPs currently have their own API class separate to CmisApi which is instantiated via a different factory class

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Deleted both elsfp and xpo's mapping in new commit

@@ -0,0 +1,157 @@
"""Temperature capabilities, readiness, and EEPROM read failure regressions."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these tests might better belong split into multiple files:

  • test_cmis.py for CMIS test cases
  • test_sff8436.py for SFF-8436 test cases
  • test_sff8472.py for SFF-8472 test cases
  • test_sff8636.py for SFF-8636 test cases

otherwise a precedent is set to have a test file per capability (e.g test_vcc_support) spanning each API

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, thanks for the tip!

@ArthurMicas
ArthurMicas force-pushed the codex/xcvr-temperature-support branch from 77b6397 to 3d9eed7 Compare September 24, 2026 17:13
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@ArthurMicas
ArthurMicas force-pushed the codex/xcvr-temperature-support branch from 3d9eed7 to ee5549f Compare September 24, 2026 17:14
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Signed-off-by: arthur <arthur@micasnetworks.com>
@ArthurMicas
ArthurMicas force-pushed the codex/xcvr-temperature-support branch from ee5549f to 1143c19 Compare September 24, 2026 18:50
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants