Skip to content
Snippets Groups Projects
Commit a222740d authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

refactored client slice to array

parent 260adbae
Branches
Tags
2 merge requests!26Resolve "restconf client to gosdn core",!18Develop
......@@ -19,7 +19,8 @@ type controllerConfig struct {
}
type Core struct {
clients []interfaces.Client
//Assert type with clients[key].(*MCPClient)
clients map[string]interfaces.Client
database database.Database
config controllerConfig
}
......@@ -47,7 +48,7 @@ func (c *Core) Init(socket, configfile string) {
c.AttachDatabase()
//TODO: Create client config/CLI adapter
c.clients = append(c.clients, ciena.NewMCPClient( "141.100.70.170", "", "", &c.database))
c.clients["ciena-mcp"] = ciena.NewMCPClient( "141.100.70.170", "", "", &c.database)
}
func (c *Core) AttachDatabase() {
......
......@@ -2,6 +2,8 @@ package nucleus
import (
pb "code.fbi.h-da.de/cocsn/gosdn/cliInterface"
"code.fbi.h-da.de/cocsn/gosdn/database"
"code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces"
"context"
_ "github.com/mattn/go-sqlite3"
"google.golang.org/grpc"
......@@ -55,7 +57,11 @@ func StartUp(socket, filename string) {
log.Println("This is the network superintendent...")
log.Println("Starting my ducks")
// Init the Core
core := Core{}
core := Core{
clients: make(map[string]interfaces.Client, 0),
database: database.Database{},
config: nil,
}
core.Init(socket, filename)
// Start the GRCP CLI
go getCLIGoing(&core)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment