diff --git a/nucleus/controller.go b/nucleus/controller.go deleted file mode 100644 index 1c7edae0d43013e7bef2ab9f720ac0a2d12de2dd..0000000000000000000000000000000000000000 --- a/nucleus/controller.go +++ /dev/null @@ -1,49 +0,0 @@ -package nucleus - -import ( - "fmt" - "github.com/openconfig/ygot/ygot" - "net" - yangPro "gosdn/yang-processor" -) - -// This is a test function in order to see how to generate JSON encoded openconfig stuff - -func AssembleJSON() { - // Build my device - d := &yangPro.Device{} - - interfaces, _ := net.Interfaces() - for _, iface := range interfaces { - fmt.Println(iface.Name) - - i, err := d.NewInterface(iface.Name) - if err != nil { - panic(err) - } - i.Mtu = ygot.Uint16(234) - //i.Mtu = ygot.Uint16(iface.MTU) - } - - // EmitJSON from the ygot library directly does .Validate() and outputs JSON in - // the specified format. - json, err := ygot.EmitJSON(d, &ygot.EmitJSONConfig{ - Format: ygot.RFC7951, - Indent: " ", - RFC7951Config: &ygot.RFC7951JSONConfig{ - AppendModuleName: true, - }, - }) - if err != nil { - panic(fmt.Sprintf("JSON demo error: %v", err)) - } - fmt.Println(json) - - // and now try to read the data from it... - // Device struct to unmarshal into. - loadd := &yangPro.Device{} - if err := yangPro.Unmarshal([]byte(json), loadd); err != nil { - panic(fmt.Sprintf("Cannot unmarshal JSON: %v", err)) - } - -} \ No newline at end of file