Newer
Older
"code.fbi.h-da.de/cocsn/gosdn/nucleus/types"
"github.com/google/uuid"
log "github.com/sirupsen/logrus"
var coreLock sync.RWMutex
var coreOnce sync.Once
// Core is the representation of the controllers core
// deprecated
database database.Database
pndc *nucleus.PndStore
sbic *nucleus.SbiStore
httpServer *http.Server
stopChan chan os.Signal
pndc: nucleus.NewPndStore(),
sbic: nucleus.NewSbiStore(),
// Setting up signal capturing
signal.Notify(c.stopChan, os.Interrupt)
}
// initialize does start-up housekeeping like reading controller config files
func initialize() error {
if err := createSouthboundInterfaces(); err != nil {
// createSouthboundInterfaces initializes the controller with its supported SBIs
sbi := nucleus.NewSBI(types.Openconfig)
if err := c.sbic.Add(sbi); err != nil {
return err
}
return createPrincipalNetworkDomain(sbi)
}
// createPrincipalNetworkDomain initializes the controller with an initial PND
func createPrincipalNetworkDomain(s nucleus.SouthboundInterface) error {
pnd, err := nucleus.NewPND("base", "gosdn base pnd", uuid.New(), s)
return err
}
return nil
// Run calls initialize to start the controller
initError = initialize()
})
if initError != nil {
log.WithFields(log.Fields{}).Error(initError)
return initError
}
log.WithFields(log.Fields{}).Info("initialisation finished")
for {
select {
case <-time.Tick(time.Minute):
log.Debug("up and running")
}