Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gNMI simulator to handle update with non-string list key types #1759

Merged
merged 2 commits into from Mar 20, 2024

Conversation

PeterSuna
Copy link
Contributor

the List key was always set as a String for YangInstanceIdentifier generated from gNMI path. This prevented data from being merged into the datastore, as this type of key was not found in the datastore.
Fixing this shows another issue with JsonUtils that prepare Json payload for datastore. JsonUtils using Gson to convert key values from NodeIdentifierWithPredicates. This may produce unexpected outcomes if the key value is not parsable by Gson's default behavior. For instance, the result for Uint8(10) would be {"value":10} instead of simply 10.

Previously, the List key was always set as a String for
YangInstanceIdentifier generated from gNMI path. This prevented data
from being merged into the datastore, as this type of key was not found
in the datastore.

This commit addresses the issue by setting the correct value defined
in the typeDefinition QName.

JIRA: LIGHTY-285
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Utilizing Gson to convert key values from
NodeIdentifierWithPredicates may produce unexpected outcomes
if the key value is not parsable by Gson's default behavior.
For instance, the result for Uint8(10) would be {"value":10}
instead of simply 10.

Ensure custom ODL types are correctly parsed by Gson.

JIRA: LIGHTY-285
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
@ihrasko ihrasko merged commit 1954e7d into PANTHEONtech:main Mar 20, 2024
6 checks passed
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.

None yet

2 participants