Skip to content

[xcvrd] Replace dom_* configuration flags with XcvrdConfig resolver#854

Open
aditya-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:aditya.xcvrdconfig
Open

[xcvrd] Replace dom_* configuration flags with XcvrdConfig resolver#854
aditya-nexthop wants to merge 1 commit into
sonic-net:masterfrom
nexthop-ai:aditya.xcvrdconfig

Conversation

@aditya-nexthop

@aditya-nexthop aditya-nexthop commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Description

HLD Link

Adds XcvrdConfig, which resolves dom_temperature_poll_interval and dom_update_interval from the "xcvrd" section of pmon_daemon_control.json (hwsku file takes precedence over platform file, no cross-file merge — mirrors docker_init.j2), falling back to built-in defaults (None) when unset.

DaemonXcvrd now builds self.config = XcvrdConfig() (resolved via XcvrdConfig.resolve()) instead of taking dom_temperature_poll_interval/dom_update_interval as constructor args; call sites read from self.config instead of instance attributes.

Motivation and Context

Previously, adding a new xcvrd tunable required threading a new --flag through argparse, the supervisord template, and the DaemonXcvrd constructor. Moving tunables into the per-platform pmon_daemon_control.json file (which platform owners already maintain for other daemons) means a new knob only requires a new dataclass field on XcvrdConfig — no template or constructor changes.

How Has This Been Tested?

Ran the full sonic-xcvrd pytest suite (tests/test_xcvrd_config.py, tests/test_xcvrd.py) inside the SONiC build slave container:

420 passed, 3 warnings in 10.83s
xcvrd/xcvrd_utilities/xcvrd_config.py   88 stmts, 99% coverage

New tests in tests/test_xcvrd_config.py cover: default values, platform-section overrides, partial overrides, None/0 handling, string-to-int coercion, invalid/unknown keys, hwsku-vs-platform file precedence, missing/malformed files, and end-to-end resolve().

tests/test_xcvrd.py updated to verify DaemonXcvrd wires self.config from XcvrdConfig.resolve().

Additional Information (Optional)

After this PR merges, sonic-net/sonic-buildimage#28306 removes the no longer necessary lines from the Jinja template.

Adds XcvrdConfig, which resolves dom_temperature_poll_interval and
dom_update_interval from the "xcvrd" section of pmon_daemon_control.json
(hwsku file taking precedence over platform file), falling back to
built-in defaults (None) when unset. This replaces the old --dom_* argparse
flags and threading a new command-line flag through the supervisord
template, so adding a new tunable only requires a new dataclass field.

DaemonXcvrd now builds self.config = XcvrdConfig() (or resolves it) instead
of taking dom_temperature_poll_interval/dom_update_interval constructor
args; call sites read from self.config instead.

Signed-off-by: aditya-nexthop <aditya@nexthop.ai>
@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.

2 participants