Skip to content
Snippets Groups Projects

"Overhaul Architecture"

Merged Ghost User requested to merge 67-overhaul-architecture into develop
1 file
+ 14
15
Compare changes
  • Side-by-side
  • Inline
@@ -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)
Loading