TranslClient: use PathValidator to sanitize the request paths#112
Merged
anand-kumar-subramanian merged 5 commits intosonic-net:masterfrom Jun 16, 2023
Merged
Conversation
TranslClient now uses the PathValidator utility to preprocess get, set and subscribe request paths before calling translib APIs. PathValidator is setup to performs following actions: * Verify the get/set/subscribe paths are known to translib * Insert missing module name prefixes in get/set/subscribe paths. gNMI allows the clients to omit them but translib APIs need them * Insert missing wildcard keys in subscribe paths Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
Contributor
|
Please fix the build. |
edf889f to
d80fc23
Compare
- Set ENABLE_TRANSLIB_WRITE=y during pipeline tests to enable all TranslClient based write tests. They were skipped earlier - Setup correct translib test env in makefile 'check_gotest' target - Fixed path & payload of existing TranslClient based write tests - Added more get and set tests to cover path validator calls with prefixed and unprefixed paths - Skip unsupported gNOI tests
d80fc23 to
796a459
Compare
|
@ayelrod can you please help to approve this PR? Thanks. |
anand-kumar-subramanian
approved these changes
Jun 16, 2023
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.
Why I did it
gNMI specification allows the clients to use both fully qualified and bare yang paths. It also allows omitting wildcard keys. But all translib APIs expect fully qualified yang paths, with wildcard keys explicitly set. Server is expected to set the missing module prefixes and wildcard keys.
Today telemetry server directly passes the paths from the request to translib APIs. Hence it works only if the client uses fully qualified paths.
Part of the gNMI subscription enhancements discussed in HLD sonic-net/SONiC#1287
How I did it
Enhanced the TranslClient to use the PathValidator utility to preprocess get, set and subscribe request paths before calling translib APIs. PathValidator is setup to performs following actions:
How to verify it
Gotests
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)