From 158f1778693c86e0213d6bdd00dbbcd33a770562 Mon Sep 17 00:00:00 2001
From: Martin Stiemerling <martin.stiemerling@h-da.de>
Date: Thu, 24 Sep 2020 14:49:51 +0000
Subject: [PATCH] Spf13 removal take2

---
 main.go                 | 25 +++++++++++++++++++++++--
 nucleus/nucleus-core.go |  2 +-
 nucleus/root.go         | 39 ---------------------------------------
 3 files changed, 24 insertions(+), 42 deletions(-)
 delete mode 100644 nucleus/root.go

diff --git a/main.go b/main.go
index c5a8894e6..d9c5737f9 100644
--- a/main.go
+++ b/main.go
@@ -1,13 +1,34 @@
 package main
 
 import (
-	"nucleus"
+	"flag"
+	"gosdn/nucleus"
 )
 
+
+// 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=yang-processor/gosdnyang.go.go -package_name=gosdnyang -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
+
+type goSDNConfiguration struct {
+	cliServerAddr4 *string
+	cliServerPort4 *int
+}
+
 func main() {
 
+	// register our supported flags
+	cliServerAddr4 := flag.String("cliServerAddr", "127.0.0.1", "The IPv4 Address of the grpcCLI.")
+	cliServerPort4 := flag.Int("cliServerPort", 55055, "The port number of the grpcCLI")
+
+	flag.Parse()
+
+	var myConfiguration = new(goSDNConfiguration)
+	myConfiguration.cliServerAddr4 = cliServerAddr4
+	myConfiguration.cliServerPort4 = cliServerPort4
+
 	// hand off to cmd for further processing
-	nucleus.Execute()
+	nucleus.StartUp()
+	nucleus.Run()
 
 	// nothing to see here, please move on!
 }
diff --git a/nucleus/nucleus-core.go b/nucleus/nucleus-core.go
index e7f60b1d0..765d9ef0f 100644
--- a/nucleus/nucleus-core.go
+++ b/nucleus/nucleus-core.go
@@ -6,7 +6,7 @@ import (
 	"google.golang.org/grpc"
 	"log"
 	"net"
-	pb "project-beachhead/grpc_interface"
+	pb "gosdn/cliInterface"
 	"time"
 )
 
diff --git a/nucleus/root.go b/nucleus/root.go
deleted file mode 100644
index c934fa710..000000000
--- a/nucleus/root.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package nucleus
-
-import (
-	"fmt"
-	"github.com/spf13/cobra"
-	"os"
-)
-
-
-func init() {
-	rootCmd.AddCommand(versionCmd)
-}
-
-var versionCmd = &cobra.Command{
-  Use:   "version",
-  Short: "Print the version number of goSDN",
-  Long:  `A version is a version.`,
-  Run: func(cmd *cobra.Command, args []string) {
-    fmt.Println("Beachead -- unkown HEAD")
-  },
-}
-
-var rootCmd = &cobra.Command{
-	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) {
-		// Do Stuff Here
-		StartUp()
-		Run()
-	},
-}
-
-func Execute() {
-	if err := rootCmd.Execute(); err != nil {
-	fmt.Println(err)
-	os.Exit(1)
-	}
-}
-- 
GitLab