Skip to content
Snippets Groups Projects
Commit e0fae3f7 authored by Malte Bauch's avatar Malte Bauch
Browse files

Merge branch '67-overhaul-architecture' into 63-pnd-handling-via-cli-and-database-2

parents 0060a016 62af76aa
No related branches found
No related tags found
3 merge requests!97Resolve "PND handling via CLI and database",!91"Overhaul Architecture",!90Develop
......@@ -29,16 +29,16 @@ func main() {
transport := &nucleus.Gnmi{SetNode: sbi.SetNode()}
cfg := &gnmi.Config{
Addr: "localhost:9339",
Addr: "portainer.danet.fbi.h-da.de:6030",
Username: "admin",
Password: "arista",
Encoding: gpb.Encoding_PROTO,
Encoding: gpb.Encoding_JSON_IETF,
}
transport.SetConfig(cfg)
device.Transport = transport
p := []string{"/interfaces/interface[name=en0]/state/name"}
p := []string{"/interfaces/interface[name=*]/state/name"}
errors := 0
for _, path := range p {
err := pnd.RequestAll(path)
......
......@@ -115,6 +115,7 @@ func (g *Gnmi) Capabilities(ctx context.Context) (interface{}, error) {
// Get calls GNMI get
func (g *Gnmi) get(ctx context.Context, paths [][]string, origin string) (interface{}, error) {
ctx = gnmi.NewContext(ctx, g.config)
ctx = context.WithValue(ctx, "config", g.config)
req, err := gnmi.NewGetRequest(ctx, paths, origin)
if err != nil {
......@@ -140,6 +141,7 @@ func (g *Gnmi) getWithRequest(ctx context.Context, req *gpb.GetRequest) (interfa
// Set calls GNMI set
func (g *Gnmi) set(ctx context.Context, setOps []*gnmi.Operation,
exts ...*gnmi_ext.Extension) error {
ctx = gnmi.NewContext(ctx, g.config)
client, err := gnmi.Dial(g.config)
if err != nil {
return err
......@@ -149,6 +151,7 @@ func (g *Gnmi) set(ctx context.Context, setOps []*gnmi.Operation,
// Subscribe calls GNMI subscribe
func (g *Gnmi) subscribe(ctx context.Context) error {
ctx = gnmi.NewContext(ctx, g.config)
client, err := gnmi.Dial(g.config)
if err != nil {
return err
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment