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

TranslClient: Use new translib subscription APIs #122

Merged
merged 4 commits into from
Jun 16, 2023

Conversation

sachinholla
Copy link
Contributor

Why I did it

PR sonic-net/sonic-mgmt-common#92 modified the translib APIs to implement the new subscription feature (HLD sonic-net/SONiC#1287). The gNMI server code also needs to be changed accordingly.

How I did it

  • Modified the TranslClient to use the new translib subscription APIs
  • Enhanced gnmi server to use TranslClient for handling subscription when the origin is set to "openconfig". Existing target based handling will be used when origin is not specified

This PR requires sonic-net/sonic-mgmt-common#92 to be merged first.

How to verify it

Verified subscription for openconfig-interfaces and openconfig-acl paths

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Added gnmipb.Notification as a member of the Value messgae object
defined by sonic_internal.proto. Data clients now can fill a complete
Notification object instead of timestamp, path, TypedValue separately.
Use TranslClient to handle the subscribe requests when origin is
"openconfig". Fallback to the existing target based identification
logic if origin is not given.
StreamRun() enhancements:
 - Create a new SubscribeSession in the beginning and pass it to all
   further translib API calls
 - Call translib.IsSubscribeSupported() to reasolve preferences of the
   requested paths. This also splits the target_defined request into
   on_change and sample paths.
 - Use one translib.Subscribe() call passing all on_change enabled
   paths, if there are any. This will handle initial updates and
   subsequent on_change notifications.
 - Use one translib.Stream() call for each sample subscribe path, if
   present. This will be called in a loop at every sample interval.
 - Maintain the ygot objects received for each translib.Stream() call
   in a cache. Diff the current set of objects with the objects from
   the previous iteration to resolve deleted paths and modified values
   (when suppress_redundant is enabled).

PollRun() and OnceRun() enhancements:
 - Call translib.Stream() with each subscribed path to generate
   notification data.
 - In poll mode, this is repeated when a poll message is received
@anand-kumar-subramanian anand-kumar-subramanian merged commit 214fa1c into sonic-net:master Jun 16, 2023
3 checks passed
@sachinholla sachinholla deleted the subscribe_api branch August 16, 2023 15:34
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.

2 participants