Newer
Older
"code.fbi.h-da.de/cocsn/gosdn/database"
// Core is the representation of the controllers core
// deprecated
database database.Database
//Initialize does start-up housekeeping like reading controller config files
c = &Core{
database: database.Database{},
pndc: pndStore{},
sbic: sbiStore{},
}
c.sbic = sbiStore{
store{},
}
c.pndc = pndStore{
store{},
}
if err := createSouthboundInterfaces(); err != nil {
// TODO: Start grpc listener here
if err := httpApi(); err != nil {
// attachDatabase connects to the database and passes the connection to the controller core
// createSouthboundInterfaces initializes the controller with its supported SBIs
sbi := &OpenConfig{id: uuid.New()}
if err := c.sbic.add(sbi); err != nil {
return err
}
return createPrincipalNetworkDomain(sbi)
}
// createPrincipalNetworkDomain initializes the controller with an initial PND
func createPrincipalNetworkDomain(sbi SouthboundInterface) error {
pnd, err := NewPND("base", "gosdn base pnd", uuid.New(), sbi)
if err != nil {
return err
}
err = c.pndc.add(pnd)
if err != nil {
return err
}
return nil
return err
}
log.WithFields(log.Fields{}).Info("initialisation finished")
for {
select {
case <-ctx.Done():
return nil
case <-time.Tick(time.Minute):
log.Debug("up and running")
}