[Generic-P4Orch] Add infra of supporting unique label to be used for SAI label attribute. - #4176
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
c7a454a to
98c3ab1
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@prsunny can you take a look at this PR to see how this can impact upstream SONiC? |
|
/azp run |
@prsunny, As you suggested, the NameLabelMapper usage document is prepared and raised as a document PR sonic-net/SONiC#2383, and we have updated the description of this PR with more details, can you please review and approve these PRs. |
@prsunny, Could you please review and approve the PR. |
|
Thanks, Can you link the doc to description and mark it ready? Also please fix coverage on this PR |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Related PR - opencomputeproject/SAI#2283 |
|
@ksravani-hcl , please fix coverage for merge. Changes lgtm |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: SRAVANI KANASANI <kanasanis@google.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@prsunny, coverage is fixed, Could you please help to merge this PR. |
…te. (sonic-net#4176) Description The main purpose of this helper class(NameLabelMapper) is to create and manage unique labels for SAI objects. A unique label is a unique string identifier for a SAI object. It is used in warm boot for syncd reconciliation. A SAI object will need a unique label if the existing SAI attrs cannot distinguish the object from each other. The high level flow is the following: Generate a unique label and pass it to the SAI attr when the SAI object is created. For new object, a new label will be generated and added into the NameLabelMapper. For existing object, the saved label will be return from NameLabelMapper. During warmboot shut down, save the NameLabelMapper into STATE_DB. This STATE_DB table will persist across warm boot. This change will be part of the warm boot upstreaming. (Not in the current PR yet). Notice that label is a SAI attr, and hence it is in ASIC_DB as well, which will persist across warm boot. During warmboot start up, read the STATE_DB and populate the NameLabelMapper. During init_view, p4orch will process the requests in APPL_DB. Since NameLabelMapper is already populated, all objects that require labels will use the same labels as before warm boot. Syncd can uniquly identify each SAI object as the label will match in ASIC_DB. The NameLabelMapper usage document PR is sonic-net/SONiC#2383 What I did Adding infra of supporting unique label to be used for SAI label attribute. Implemented the Namelabelmapper utility to map SAI object keys to unique, timestamp-based labels. Integrated this into the Orchdaemon lifecycle, enabling the serialization of these mappings to STATE_DB using the schema SAI_OBJECT_TYPE|KEY to ensure persistent identification.
Description
The main purpose of this helper class(NameLabelMapper) is to create and manage unique labels for SAI objects.
A unique label is a unique string identifier for a SAI object. It is used in warm boot for syncd reconciliation.
A SAI object will need a unique label if the existing SAI attrs cannot distinguish the object from each other.
The high level flow is the following:
The NameLabelMapper usage document PR is sonic-net/SONiC#2383
What I did
Adding infra of supporting unique label to be used for SAI label attribute.
Implemented the Namelabelmapper utility to map SAI object keys to unique, timestamp-based labels. Integrated this into the Orchdaemon lifecycle, enabling the serialization of these mappings to STATE_DB using the schema SAI_OBJECT_TYPE|KEY to ensure persistent identification.
Why I did it
To provide a reliable mechanism to uniquely identify hardware objects during warm boot reconciliation. This prevents resource duplication and enables orchagent to correctly correlate existing hardware state with control plane requests for hitless upgrades.
How I verified it
Validated the logic with new C++ unit tests covering label allocation and collision prevention. Confirmed the end-to-end persistence flow via successful execution of the SWSS test suite.
Details if related