Skip to content
Snippets Groups Projects
Commit b05a327d authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Fixed telemetry.go

parent 5e187d37
No related branches found
No related tags found
3 merge requests!97Resolve "PND handling via CLI and database",!91"Overhaul Architecture",!90Develop
Pipeline #63885 passed with warnings
......@@ -17,33 +17,32 @@ import (
func main() {
log.SetLevel(log.DebugLevel)
sbi := &nucleus.AristaOC{}
transport := &nucleus.Gnmi{
SetNode: sbi.SetNode(),
RespChan: make(chan *gpb.SubscribeResponse),
}
device := nucleus.Device{
GoStruct: sbi.Schema().Root,
SBI: sbi,
Config: nucleus.DeviceConfig{
Uuid: uuid.New(),
Address: "localhost:9339",
Username: "admin",
Password: "arista",
Uuid: uuid.New(),
},
Transport: transport,
}
pnd := nucleus.NewPND("openconfig", "a simple openconfig PND", sbi)
if err := pnd.AddDevice(&device); err != nil {
log.Fatal(err)
}
transport := &nucleus.Gnmi{
SetNode: sbi.SetNode(),
RespChan: make(chan *gpb.SubscribeResponse),
}
cfg := &gnmi.Config{
Addr: device.Config.Address,
Password: device.Config.Password,
Username: device.Config.Username,
Addr: "portainer.danet.fbi.h-da.de:6030",
Username: "admin",
Password: "arista",
Encoding: gpb.Encoding_JSON_IETF,
}
ctx := gnmi.NewContext(context.Background(), cfg)
ctx = context.WithValue(ctx, "config", cfg)
transport.SetConfig(cfg)
device.Transport = transport
paths := []string{"/interfaces/interface/name"}
......@@ -61,7 +60,7 @@ func main() {
}
done := make(chan os.Signal, 1)
signal.Notify(done, syscall.SIGILL, syscall.SIGTERM)
ctx = context.WithValue(ctx, "opts", opts)
ctx := context.WithValue(context.Background(), "opts", opts)
go func() {
if err := transport.Subscribe(ctx); err != nil {
log.Fatal(err)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment