Skip to content
Snippets Groups Projects

Resolve "Add an option to send gNMI Subscribe requests via SBI"

2 files
+ 11
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -42,15 +42,17 @@ func NewDeviceWatcher(pndStore networkdomain.PndStore) *DeviceWatcher {
}
}
// SubToDevices subscribes to every available device in each network domain with fixed gNMI subscription options (streaming in sample mode each second).
// SubToDevices subscribes to every available device in each network domain according to provided SubscribeOptions.
// Paths should be provided in the following format [][]string{{"system", "config", "hostname"}}
func (d *DeviceWatcher) SubToDevices(paths [][]string) {
// TODO: think about passing opts as parameter for more configurability
opts := &gnmi.SubscribeOptions{
Mode: gNMISubscribeMode,
StreamMode: gNMIStreamMode,
Paths: paths,
SampleInterval: subscribeSampleInterval,
// SubscribeOptions can be nil. Use nil for a fixed, pre-defined set of gNMI subscription options (streaming in sample mode each second).
func (d *DeviceWatcher) SubToDevices(paths [][]string, opts *gnmi.SubscribeOptions) {
if opts == nil {
opts = &gnmi.SubscribeOptions{
Mode: gNMISubscribeMode,
StreamMode: gNMIStreamMode,
Paths: paths,
SampleInterval: subscribeSampleInterval,
}
}
pnds, err := d.pndStore.GetAll()
Loading