Skip to content

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

Closed
jianyuewu wants to merge 1 commit into
sonic-net:masterfrom
jianyuewu:xcvrd_remove_api
Closed

xcvrd: Remove SFP API object when SFP is removed#615
jianyuewu wants to merge 1 commit into
sonic-net:masterfrom
jianyuewu:xcvrd_remove_api

Conversation

@jianyuewu

@jianyuewu jianyuewu commented May 15, 2025

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).

@jianyuewu jianyuewu closed this May 15, 2025
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