Skip to content
Snippets Groups Projects

"Overhaul Architecture"

Merged Ghost User requested to merge 67-overhaul-architecture into develop
3 files
+ 53
2
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 42
0
 
package main
 
 
import (
 
"code.fbi.h-da.de/cocsn/yang-models/generated/openconfig"
 
"fmt"
 
"github.com/openconfig/goyang/pkg/yang"
 
)
 
 
type PathElement struct {
 
Children []*PathElement
 
Name string
 
}
 
 
func main() {
 
tree := openconfig.SchemaTree
 
paths := make(map[string]*PathElement)
 
 
for k,v := range tree {
 
if v.Parent.Name == "device" {
 
paths[k] = processEntry(v)
 
}
 
}
 
fmt.Println("stop")
 
}
 
 
func processEntry(e *yang.Entry) *PathElement {
 
if e.Dir != nil {
 
elem := &PathElement{
 
Children: make([]*PathElement, len(e.Dir)),
 
Name: e.Name,
 
}
 
for _,v := range e.Dir {
 
child := processEntry(v)
 
elem.Children = append(elem.Children, child)
 
}
 
 
}
 
leaf := &PathElement{
 
Name: e.Name,
 
}
 
return leaf
 
}
 
\ No newline at end of file
Loading