Fix gNMI GET failure for SAI log levels in logger#215
Open
rakshitha-marvell wants to merge 2 commits into
Open
Fix gNMI GET failure for SAI log levels in logger#215rakshitha-marvell wants to merge 2 commits into
rakshitha-marvell wants to merge 2 commits into
Conversation
Problem: SONiC sonic-logger.yang defines LOGLEVEL as a union of two enum typedefs (swss_loglevel and sai_loglevel). During gNMI GET, values like SAI_LOG_LEVEL_DEBUG fail to unmarshal, as the generated ocbinds.go contains only swss enum values and misses SAI enums. RCA: 1. In goyang, enum typedefs with identical structure are treated as equal (Name field is ignored), so sai_loglevel gets dropped during deduplication. 2. In ygot: - Multiple enum typedefs in a union are not handled correctly. - Even if processed, both enums start from 0, causing value conflicts. Fix: - goyang: Include Name in equality check to avoid dropping distinct typedefs. - ygot: - Allow multiple enum typedefs in union. - Merge enums by rebasing values of the second typedef to avoid conflicts. Impact: - Both swss and SAI enum values are generated correctly. - gNMI GET works for all log levels. Note: Upgrading ygot/goyang was avoided due to compatibility issues with existing patches. A minimal patch approach was used instead. Signed-off-by: Rakshitha SK <rsk@marvell.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes : sonic-net/sonic-gnmi#668
Problem:
SONiC sonic-logger.yang defines LOGLEVEL as a union of two enum typedefs (swss_loglevel and sai_loglevel). During gNMI GET, values like SAI_LOG_LEVEL_DEBUG fail to unmarshal, as the generated ocbinds.go contains only swss enum values and misses SAI enums.
RCA:
In goyang, enum typedefs with identical structure are treated as equal (Name field is ignored), so sai_loglevel gets dropped during deduplication.
In ygot:
Fix: