Skip to content
Snippets Groups Projects
nucleus-core.go 838 B
Newer Older
  • Learn to ignore specific revisions
  • package nucleus
    
    import (
    
    	"code.fbi.h-da.de/cocsn/gosdn/database"
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	"code.fbi.h-da.de/cocsn/gosdn/log"
    
    	"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
    
    	"time"
    )
    
    /*
     * This function is used to start the core of the controller and any auxiliary services.
     */
    
    
    func StartAndRun(socket, filename string, IsRunningChannel chan bool) {
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	log.Info("This is the network superintendent...")
    	log.Info("Starting my ducks")
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	// Init the Core
    
    	core := Core{
    
    		clients:  make(map[string]interfaces.Client),
    
    		database: database.Database{},
    	}
    
    	core.Init(socket, filename, IsRunningChannel)
    
    	// Start the GRCP CLI
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	go getCLIGoing(&core)
    
    	log.Info("and ready for take off")
    
    	//Just to produce some signs of vitality...
    	for (true) {
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    		time.Sleep(10 * time.Second)
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    		log.Debug("Still alive...")
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	log.Info("Good bye....!")