From 4106226658af4b86362a8b0df6f6284ca83569ba Mon Sep 17 00:00:00 2001
From: Manuel Kieweg <mail@manuelkieweg.de>
Date: Wed, 10 Feb 2021 12:33:17 +0000
Subject: [PATCH] Fixed authentication failed issue

---
 cmd/gnmi/gnmi.go          | 4 ++--
 nucleus/gnmi_transport.go | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/cmd/gnmi/gnmi.go b/cmd/gnmi/gnmi.go
index fe2ee8a28..df0a9121d 100644
--- a/cmd/gnmi/gnmi.go
+++ b/cmd/gnmi/gnmi.go
@@ -29,7 +29,7 @@ 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,
@@ -38,7 +38,7 @@ func main() {
 
 	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)
diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go
index 2c0ad0c01..ce667b015 100644
--- a/nucleus/gnmi_transport.go
+++ b/nucleus/gnmi_transport.go
@@ -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 {
-- 
GitLab