From 91f9af6eea4ebd3184b651608bf6566d0ca63d3c Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <mail@manuelkieweg.de> Date: Mon, 16 Nov 2020 15:32:57 +0100 Subject: [PATCH] Interface and implementation stubs --- nucleus/interfaces/client.go | 7 ------ nucleus/interfaces/interfaces.go | 31 +++++++++++++++++++++++ nucleus/principalNetworkDomain.go | 31 +++++++++++++++++++++++ sbi/restconf/client/ciena/client.go | 12 +++++++++ sbi/restconf/southboundInterface.go | 39 +++++++++++++++++++++++++++++ 5 files changed, 113 insertions(+), 7 deletions(-) delete mode 100644 nucleus/interfaces/client.go create mode 100644 nucleus/interfaces/interfaces.go create mode 100644 nucleus/principalNetworkDomain.go create mode 100644 sbi/restconf/southboundInterface.go diff --git a/nucleus/interfaces/client.go b/nucleus/interfaces/client.go deleted file mode 100644 index 4d0b9e1ce..000000000 --- a/nucleus/interfaces/client.go +++ /dev/null @@ -1,7 +0,0 @@ -package interfaces - -// Client provides an interface for -// SBI protocol clients -type Client interface { - GetConfig() ClientConfig -} diff --git a/nucleus/interfaces/interfaces.go b/nucleus/interfaces/interfaces.go new file mode 100644 index 000000000..b1fab9242 --- /dev/null +++ b/nucleus/interfaces/interfaces.go @@ -0,0 +1,31 @@ +package interfaces + +// Port provides an interface for +// the device's ports +type Port interface { +} + +// Client provides an interface for +// SBI client implementations +type Client interface { + GetConfig() ClientConfig + ListPorts() map[int]Port + PushReceiver() error +} + +// PrincipalNetworkDomain provides an +// interface for PND implementations +type PrincipalNetworkDomain interface { + Destroy() error + AddSbi() error + RemoveSbi() error +} + +// SouthboundInterface provides an +// interface for SBI implementations +type SouthboundInterface interface { + AddClient() error + RemoveClient() error + CollectHeartbeats() error + ListClients() map[int]Client +} diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go new file mode 100644 index 000000000..f105f8980 --- /dev/null +++ b/nucleus/principalNetworkDomain.go @@ -0,0 +1,31 @@ +package nucleus + +type pndImplementation struct { +} + +// Interface satisfaction +func (pnd *pndImplementation) Destroy() error { + return destroy() +} + +func (pnd *pndImplementation) AddSbi() error { + return addSbi() +} + +func (pnd *pndImplementation) RemoveSbi() error { + return removeSbi() +} + +// Actual implementation, bind to struct if +// neccessary +func destroy() error { + return nil +} + +func addSbi() error { + return nil +} + +func removeSbi() error { + return nil +} diff --git a/sbi/restconf/client/ciena/client.go b/sbi/restconf/client/ciena/client.go index 6e9a772c9..47203c3d3 100644 --- a/sbi/restconf/client/ciena/client.go +++ b/sbi/restconf/client/ciena/client.go @@ -29,6 +29,18 @@ func (c MCPClient) GetConfig() interfaces.ClientConfig { return *c.config } +// ListPorts is a stub to satisfy the interface +// TODO: Implement +func (c MCPClient) ListPorts() map[int]interfaces.Port { + return nil +} + +// PushReceiver is a stub to satisfy the interface +// TODO: Implement +func (c MCPClient) PushReceiver() error { + return nil +} + //NewMCPClient creates a Ciena flavores TAPI client func NewMCPClient(endpoint, username, password string, database *database.Database, config *interfaces.ClientConfig) *MCPClient { // create the transport diff --git a/sbi/restconf/southboundInterface.go b/sbi/restconf/southboundInterface.go new file mode 100644 index 000000000..18b40efbd --- /dev/null +++ b/sbi/restconf/southboundInterface.go @@ -0,0 +1,39 @@ +package restconf + +type southboundInterface struct { +} + +// Interface satisfaction +func (sbi *southboundInterface) AddClient() error { + return addClient() +} + +func (sbi *southboundInterface) RemoveClient() error { + return removeClient() +} + +func (sbi *southboundInterface) CollectHeartbeats() error { + return collectHeartbeats() +} + +func (sbi *southboundInterface) ListClients() error { + return listClients() +} + +// Actual implementation, bind to struct if +// neccessary +func addClient() error { + return nil +} + +func removeClient() error { + return nil +} + +func collectHeartbeats() error { + return nil +} + +func listClients() error { + return nil +} -- GitLab