Skip to content

xcvrd: Remove SFP API object when SFP is removed#616

Merged
keboliu merged 1 commit into
sonic-net:masterfrom
jianyuewu:xcvrd_remove_api
Jun 18, 2025
Merged

xcvrd: Remove SFP API object when SFP is removed#616
keboliu merged 1 commit into
sonic-net:masterfrom
jianyuewu:xcvrd_remove_api

Conversation

@jianyuewu

Copy link
Copy Markdown
Contributor

Depends on: sonic-net/sonic-platform-common#562

When an SFP is physically removed from a port, the SFP API object should be removed from the sfp_obj_dict to prevent stale object references and ensure proper cleanup. This change ensures that when the SFP status is detected as removed, the corresponding SFP API object is properly deleted from the dictionary.

Description

Add check for SFP_STATUS_REMOVED in SfpStateUpdateTask.
Remove SFP API object from sfp_obj_dict when SFP is removed.
Add unit test to verify SFP object removal functionality.

Motivation and Context

Make sure SFP API object is removed when SFP removed, so cmis cache can also be re-created.

How Has This Been Tested?

Tested with config reload.

When an SFP is physically removed from a port, the SFP API object should be
removed from the sfp_obj_dict to prevent stale object references and ensure
proper cleanup. This change ensures that when the SFP status is detected as
removed, the corresponding SFP API object is properly deleted from the
dictionary.

Signed-off-by: Jianyue Wu <jianyuew@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@keboliu

keboliu commented May 23, 2025

Copy link
Copy Markdown
Collaborator

@prgeor would you please review?

Comment thread sonic-xcvrd/xcvrd/xcvrd.py
@liat-grozovik

Copy link
Copy Markdown
Collaborator

@prgeor kindly reminder to review and merge.

@jianyuewu

Copy link
Copy Markdown
Contributor Author

@prgeor kindly reminder to review and merge.

Hi @liat-grozovik I raised a meeting with @prgeor to discuss it in June 12nd 6pm PST.

@keboliu

keboliu commented Jun 16, 2025

Copy link
Copy Markdown
Collaborator

@prgeor would you please review and approve?

@keboliu keboliu merged commit 099f023 into sonic-net:master Jun 18, 2025
5 checks passed
@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #627

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202412: Azure/sonic-platform-daemons.msft#22

@mssonicbld

Copy link
Copy Markdown
Collaborator

Cherry-pick PR to msft-202405: Azure/sonic-platform-daemons.msft#68

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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

10 participants