Skip to content
Snippets Groups Projects

Process response overhaul

Merged Ghost User requested to merge process-response-overhaul into develop
2 files
+ 21
27
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 0
16
@@ -3,7 +3,6 @@ package nucleus
@@ -3,7 +3,6 @@ package nucleus
import (
import (
"context"
"context"
"reflect"
"reflect"
"strings"
"code.fbi.h-da.de/cocsn/gosdn/interfaces/southbound"
"code.fbi.h-da.de/cocsn/gosdn/interfaces/southbound"
@@ -242,21 +241,6 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch
@@ -242,21 +241,6 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch
path := update.Path
path := update.Path
val, ok := update.Val.Value.(*gpb.TypedValue_JsonVal)
val, ok := update.Val.Value.(*gpb.TypedValue_JsonVal)
if ok {
if ok {
buf := strings.Builder{}
for _,e := range path.Elem {
key := strings.Title(e.Name)
buf.WriteString(key)
buf.WriteString("_")
}
filter := buf.String()
filter = strings.TrimSuffix(filter,"_")
keys := make([]string, 0)
for k := range models {
if strings.Contains(k, filter) {
keys = append(keys, k)
}
}
//TODO: Fetch field by name
opts := []ytypes.UnmarshalOpt{&ytypes.IgnoreExtraFields{}}
opts := []ytypes.UnmarshalOpt{&ytypes.IgnoreExtraFields{}}
return g.Unmarshal(val.JsonVal, pathutils.ToStrings(path), d, opts...)
return g.Unmarshal(val.JsonVal, pathutils.ToStrings(path), d, opts...)
}
}
Loading