Skip to content
Snippets Groups Projects
nucleus-core.go 862 B
Newer Older
  • Learn to ignore specific revisions
  • package nucleus
    
    import (
    
    	"code.fbi.h-da.de/cocsn/gosdn/database"
    	"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
    
    	"log"
    	"time"
    )
    
    
    /*
     * This function is used to start the core of the controller and any auxiliary services.
     */
    
    // Next-up: backend database.
    
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    func StartUp(socket, filename string) {
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	log.Println("This is the network superintendent...")
    
    	log.Println("Starting my ducks")
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	// Init the Core
    
    	core := Core{
    		clients:  make(map[string]interfaces.Client, 0),
    		database: database.Database{},
    		config:   nil,
    	}
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	core.Init(socket, filename)
    
    	// Start the GRCP CLI
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	go getCLIGoing(&core)
    
    	log.Println("and ready for take off")
    
    }
    
    /*
     * nucleus.Run() is the "main loop" of the controller
     */
    
    
    var isRunning = true
    
    
    func Run() {
    
    	for isRunning {
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    		time.Sleep(10 * time.Second)
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    		log.Println("Still alive...")
    
    	}
    
    	log.Println("Good bye....!")
    }