Skip to content
Snippets Groups Projects

Path traversal demo

Merged Ghost User requested to merge path-traversal-demo into 67-overhaul-architecture
3 files
+ 16
14
Compare changes
  • Side-by-side
  • Inline
Files
3
package main
import (
"code.fbi.h-da.de/cocsn/yang-models/generated/openconfig"
schema "code.fbi.h-da.de/cocsn/yang-models/generated/arista"
"fmt"
"github.com/openconfig/goyang/pkg/yang"
)
@@ -12,12 +12,14 @@ type PathElement struct {
}
func main() {
tree := openconfig.SchemaTree
tree := schema.SchemaTree
paths := make(map[string]*PathElement)
for k,v := range tree {
if v.Parent.Name == "device" {
paths[k] = processEntry(v)
if v.Parent != nil {
if v.Parent.Name == "device" {
paths[k] = processEntry(v)
}
}
}
fmt.Println("stop")
@@ -33,7 +35,7 @@ func processEntry(e *yang.Entry) *PathElement {
child := processEntry(v)
elem.Children = append(elem.Children, child)
}
return elem
}
leaf := &PathElement{
Name: e.Name,
Loading