diff --git a/main.go b/main.go index 088523b32fd53705030b1f2ddffd6b9efc82d13f..080ba4e696fb5b6e643ca7ed69a16734626894ef 100644 --- a/main.go +++ b/main.go @@ -5,10 +5,9 @@ import ( ) // Generate the code out of the yang modules -//go:generate go run $GOPATH/src/github.com/openconfig/ygot/generator/generator.go -path=yang -output_file=goSDN/goSDNgo.go -package_name=gosdn -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang yang/openconfig-if-ip.yang +//go:generate go run $GOPATH/src/github.com/openconfig/ygot/generator/generator.go -path=yang -output_file=cliInterface/cliInterface.go -package_name=cliInterface -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang yang/openconfig-if-ip.yang func main() { - println("This is the network superintendent...") // hand off to cmd for further processing nucleus.Execute() diff --git a/nucleus/controller.go b/nucleus/controller.go index b35703203877512934e3d823f910d03e5995b1b1..cf30cc842ddf838466b453aba01c63b22563e176 100644 --- a/nucleus/controller.go +++ b/nucleus/controller.go @@ -2,29 +2,31 @@ package nucleus import ( "fmt" + "github.com/openconfig/ygot/ygot" "net" + cliIf "gosdn/cliInterface" ) +// This is a test function in order to see how to generate JSON encoded openconfig stuff + func AssembleJSON() { // Build my device - //d := &gosdn.Device{} + d := &cliIf.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: " ", @@ -35,5 +37,5 @@ func AssembleJSON() { if err != nil { panic(fmt.Sprintf("JSON demo error: %v", err)) } - fmt.Println(json)*/ + fmt.Println(json) } \ No newline at end of file diff --git a/nucleus/nucleus-core.go b/nucleus/nucleus-core.go index 2b4de231c4ea14bf13469ad30dcc7b0e6a61d4e6..e7f60b1d0748230757b96c8ad869d772e4a340b0 100644 --- a/nucleus/nucleus-core.go +++ b/nucleus/nucleus-core.go @@ -52,13 +52,12 @@ func getCLIGoing() { func StartUp() { + log.Println ("This is the network superintendent...") log.Println("Starting my ducks") + // Start the GRCP CLI go getCLIGoing() - - AssembleJSON() - - log.Println("and ready for take off") + } /* @@ -69,6 +68,12 @@ func StartUp() { func Run() { isRunning := true + + // Test ygot + AssembleJSON() + + + for isRunning { time.Sleep(10*time.Second) isRunning = false diff --git a/nucleus/root.go b/nucleus/root.go index acb8fff77fe09f75334d181de99cbede95780fbf..c934fa7103018aebb7aac480af3a82ff17bde378 100644 --- a/nucleus/root.go +++ b/nucleus/root.go @@ -21,7 +21,7 @@ var versionCmd = &cobra.Command{ } var rootCmd = &cobra.Command{ - Use: "beachhead", + Use: "goSDN", Short: "A yet still incomplete attempt to build an network operating system, but...:-)", Long: "Incomplete network operating system. Complete documentation is available at XXX", Run: func(cmd *cobra.Command, args []string) {