Skip to content
Snippets Groups Projects

Develop

Closed Ghost User requested to merge develop into master
20 files
+ 269
62
Compare changes
  • Side-by-side
  • Inline
Files
20
+ 7
6
@@ -18,20 +18,20 @@ import (
// Subscribe starts a gNMI subscriber requersting the specified paths on the target and
// logs the response to stdout. Only 'stream' mode with 'sample' operation supported.
func Subscribe(a, u, p string, sample, heartbeat int64, args ...string) error {
func Subscribe(address, username, password, deviceName string, sample, heartbeat int64, args ...string) error {
sbi := &nucleus.OpenConfig{}
tOpts := &nucleus.GnmiTransportOptions{
Config: gnmi.Config{
Addr: a,
Username: u,
Password: p,
Addr: address,
Username: username,
Password: password,
Encoding: gpb.Encoding_JSON_IETF,
},
SetNode: sbi.SetNode(),
RespChan: make(chan *gpb.SubscribeResponse),
}
device, err := nucleus.NewDevice(sbi, tOpts)
device, err := nucleus.NewDevice(sbi, tOpts, deviceName)
if err != nil {
return err
}
@@ -46,7 +46,7 @@ func Subscribe(a, u, p string, sample, heartbeat int64, args ...string) error {
HeartbeatInterval: uint64(heartbeat * time.Second.Nanoseconds()),
Paths: gnmi.SplitPaths(args),
Origin: "",
Target: a,
Target: address,
}
done := make(chan os.Signal, 1)
signal.Notify(done, syscall.SIGILL, syscall.SIGTERM)
@@ -59,5 +59,6 @@ func Subscribe(a, u, p string, sample, heartbeat int64, args ...string) error {
fmt.Println("awaiting signal")
<-done
fmt.Println("exiting")
return nil
}
Loading