From 4e2f68cf50335b9940831c734aa70d95e685ee3b Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@stud.h-da.de> Date: Tue, 17 Nov 2020 16:05:49 +0100 Subject: [PATCH] changed pnd and southbound interface - added function to create a pnd and a interface - pnd contains a slice of southbound interfaces - southbound interface contains a slice of clients --- nucleus/principalNetworkDomain.go | 12 ++++++++++++ sbi/restconf/southboundInterface.go | 16 ++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go index f105f8980..f77f544dc 100644 --- a/nucleus/principalNetworkDomain.go +++ b/nucleus/principalNetworkDomain.go @@ -1,6 +1,18 @@ package nucleus +import "code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces" + type pndImplementation struct { + name string + sbiContainer []interfaces.SouthboundInterface +} + +//NewPNDImplementation creates a Principle Network Domain +func NewPNDImplementation(name string, sbi ...interfaces.SouthboundInterface) interfaces.PrincipalNetworkDomain { + return &pndImplementation{ + name: name, + sbiContainer: sbi, + } } // Interface satisfaction diff --git a/sbi/restconf/southboundInterface.go b/sbi/restconf/southboundInterface.go index 18b40efbd..1eae1e67b 100644 --- a/sbi/restconf/southboundInterface.go +++ b/sbi/restconf/southboundInterface.go @@ -1,6 +1,18 @@ package restconf +import "code.fbi.h-da.de/cocsn/gosdn/nucleus/interfaces" + type southboundInterface struct { + name string + clientContainer []interfaces.Client +} + +//NewSouthboundInterface creates a Southbound Interface +func NewSouthboundInterface(name string, clients ...interfaces.Client) interfaces.SouthboundInterface { + return &southboundInterface{ + name: name, + clientContainer: clients, + } } // Interface satisfaction @@ -16,7 +28,7 @@ func (sbi *southboundInterface) CollectHeartbeats() error { return collectHeartbeats() } -func (sbi *southboundInterface) ListClients() error { +func (sbi *southboundInterface) ListClients() map[int]interfaces.Client { return listClients() } @@ -34,6 +46,6 @@ func collectHeartbeats() error { return nil } -func listClients() error { +func listClients() map[int]interfaces.Client { return nil } -- GitLab