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

Resolve "The key for more complex paths in the map containing information of...

Resolve "The key for more complex paths in the map containing information of update events should be improved"

See merge request !576
parent 5011a5ff
No related branches found
No related tags found
1 merge request!576Resolve "The key for more complex paths in the map containing information of update events should be improved"
Pipeline #164320 failed
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"context" "context"
"fmt" "fmt"
"strconv" "strconv"
"strings"
"code.fbi.h-da.de/danet/gosdn/controller/customerrs" "code.fbi.h-da.de/danet/gosdn/controller/customerrs"
"code.fbi.h-da.de/danet/gosdn/controller/event" "code.fbi.h-da.de/danet/gosdn/controller/event"
...@@ -15,6 +14,7 @@ import ( ...@@ -15,6 +14,7 @@ import (
"code.fbi.h-da.de/danet/gosdn/forks/goarista/gnmi" "code.fbi.h-da.de/danet/gosdn/forks/goarista/gnmi"
"github.com/google/uuid" "github.com/google/uuid"
gpb "github.com/openconfig/gnmi/proto/gnmi" gpb "github.com/openconfig/gnmi/proto/gnmi"
"github.com/openconfig/ygot/ygot"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
...@@ -184,13 +184,9 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib ...@@ -184,13 +184,9 @@ func (n *NetworkElementWatcher) handleSubscribeResponseUpdate(resp *gpb.Subscrib
pathsAndValues := make(map[string]string, len(resp.Update.Update)) pathsAndValues := make(map[string]string, len(resp.Update.Update))
for _, update := range resp.Update.Update { for _, update := range resp.Update.Update {
pathString := "" pathString, err := ygot.PathToString(update.Path)
if err != nil {
// go through elem to build full path log.Errorf("Error trying to create a string from path: %v", err)
for _, elem := range update.Path.Elem {
// remove unwanted parts of path string example: "name:\"system\"" -> "system"
filteredElem := elem.String()[strings.Index(elem.String(), ":\"")+2 : len(elem.String())-1]
pathString += filteredElem + "/"
} }
pathsAndValues[pathString] = update.Val.GetStringVal() pathsAndValues[pathString] = update.Val.GetStringVal()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment