Skip to content

Commit

Permalink
Translib APIs for subscription (sonic-net#92)
Browse files Browse the repository at this point in the history
Added/updated following translib APIs:
 - Subscribe() for handling ON_CHANGE notifications
 - Stream() for handling SAMPLE, POLL, ONCE subscriptions
 - IsSubscribeSupported() for collecting subscription capabilities
 - NewSubscribeSession() to create a SubscribeSession object

These APIs use the new appInterafce functions translateSubscribe() and
processSubscribe() to process subscription request and responses.

Signed-off-by: Sachin Holla <sachin.holla@broadcom.com>
  • Loading branch information
sachinholla authored Jun 16, 2023
1 parent b64a80e commit f24fc03
Show file tree
Hide file tree
Showing 9 changed files with 2,127 additions and 662 deletions.
1 change: 1 addition & 0 deletions translib/db/subscribe.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type SKey struct {
Ts *TableSpec
Key *Key
SEMap map[SEvent]bool // nil map indicates subscribe to all
Opaque interface{} // opaque data set by the caller
}

type SEvent int
Expand Down
4 changes: 2 additions & 2 deletions translib/path/path_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ func (pv *pathValidator) validateListKeyValues(schema *yang.Entry, gPath *gnmi.P
log.Warningf(errStr)
return tlerr.NotFoundError{Format: fmt.Sprintf("Invalid key present in the node path: %v; error: %s", gPath, errStr)}
}
if log.V(4) {
pretty.Print(ygotStruct)
if log.V(6) {
log.Infof("ygotStruct = %s", pretty.Sprint(ygotStruct))
}
if err := ygotStruct.Validate(&ytypes.LeafrefOptions{IgnoreMissingData: true}); err != nil {
errStr := fmt.Sprintf("error in ValidatedGoStruct.Validate: %v", err)
Expand Down
Loading

0 comments on commit f24fc03

Please sign in to comment.