Implement OnceRun for MixedDbClient and DbClient Subscribe ONCE#685
Open
ashwnsri wants to merge 3 commits into
Open
Implement OnceRun for MixedDbClient and DbClient Subscribe ONCE#685ashwnsri wants to merge 3 commits into
ashwnsri wants to merge 3 commits into
Conversation
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
60005a6 to
e2d3f33
Compare
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Author
|
@hdwhdw @zbud-msft please help review, thanks! |
Contributor
|
@zbud-msft can you take a look? |
Subscribe ONCE mode (gnmi_cli -query_type=once) was broken because OnceRun() in both MixedDbClient and DbClient were no-op stubs that returned immediately without sending any data to the client. Implement OnceRun to perform a single-shot data fetch from Redis, enqueue the results to the priority queue, and send a sync_response to signal completion. This follows the same pattern as PollRun but executes only one iteration. Changes: - sonic_data_client/mixed_db_client.go: Implement MixedDbClient.OnceRun() - sonic_data_client/db_client.go: Implement DbClient.OnceRun() - test/utils.py: Add gnmi_subscribe_once() and gnmi_subscribe_once_multiple() - test/test_gnmi_configdb.py: Add TestGNMISubscribeOnce with 7 test cases Without this fix, any gNMI client using Subscribe ONCE hangs until timeout (rc=124) because the server never sends data or sync_response. Signed-off-by: Ashwin Srinivasan <asrinivasan@juniper.net>
The CI test environment's mock DB only has bgp_asn and cloudtype in DEVICE_METADATA|localhost, not hostname. test_gnmi_once_multiple_paths: Changed the second path from /CONFIG_DB/localhost/PORT to /CONFIG_DB/localhost/DEVICE_METADATA. The PORT table doesn't exist in the CI test environment. Signed-off-by: Ashwin Srinivasan <asrinivasan@juniper.net>
e2d3f33 to
9c0d0c0
Compare
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Tests added: - TestDbClientOnceRun: Success path, channel closed early exit and no-data path - TestMixedDbClientOnceRun: Success path, channel closed early exit, getDbtablePath error (putFatalMsg), and tableData2TypedValue error Signed-off-by: Ashwin Srinivasan <asrinivasan@juniper.net>
9c0d0c0 to
6d01585
Compare
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Author
|
@zbud-msft please take a look when you can, thanks! |
Author
|
@hdwhdw could you please help review, thanks |
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
Subscribe ONCE mode (gnmi_cli -query_type=once) was broken because OnceRun() in both MixedDbClient and DbClient were no-op stubs that returned immediately without sending any data to the client.
Implement OnceRun to perform a single-shot data fetch from Redis, enqueue the results to the priority queue, and send a sync_response to signal completion. This follows the same pattern as PollRun but executes only one iteration.
How I did it
Changes:
Without this fix, any gNMI client using Subscribe ONCE hangs until timeout (rc=124) because the server never sends data or sync_response.
How to verify it
Inside gnmi container with TLS + client auth configured:
gnmi_cli -client_types=gnmi -a :8080
-client_crt /etc/sonic/telemetry/gnmiclient.crt
-client_key /etc/sonic/telemetry/gnmiclient.key
-ca_crt /etc/sonic/telemetry/gnmiCA.pem
-logtostderr -origin=sonic-db -query_type=once
-q /CONFIG_DB/localhost/DEVICE_METADATA/localhost
Expected Behavior
OnceRunshould perform a single-shot data fetch (equivalent to one iteration ofPollRun) and then send async_responseto indicate completion. The client should receive the requested data and disconnect cleanly.Console Logs from DUT
Logs without this change
Logs with this change
Description for the changelog
Implement OnceRun for MixedDbClient and DbClient Subscribe ONCE
Fixes #688