From 17f66f35b48290c9458028afcf0f4156884b9edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Sterba?= <hda@andre-sterba.de> Date: Wed, 4 Oct 2023 20:00:36 +0200 Subject: [PATCH] Remove networkDomain interfaces and move to ports and model --- controller/interfaces/networkdomain/pnd.go | 20 ------------------- .../interfaces/networkdomain/pndService.go | 13 ------------ .../interfaces/networkdomain/pndStore.go | 18 ----------------- .../domain/model/principalNetworkDomain.go | 4 +--- .../nucleus/domain/ports/networkDomain.go | 11 ++++++++++ 5 files changed, 12 insertions(+), 54 deletions(-) delete mode 100644 controller/interfaces/networkdomain/pnd.go delete mode 100644 controller/interfaces/networkdomain/pndService.go delete mode 100644 controller/interfaces/networkdomain/pndStore.go create mode 100644 controller/nucleus/domain/ports/networkDomain.go diff --git a/controller/interfaces/networkdomain/pnd.go b/controller/interfaces/networkdomain/pnd.go deleted file mode 100644 index dccf0ab56..000000000 --- a/controller/interfaces/networkdomain/pnd.go +++ /dev/null @@ -1,20 +0,0 @@ -package networkdomain - -import ( - "github.com/google/uuid" -) - -// NetworkDomain provides an interface for network domain implementations -// like principal network domain or logical network domain. -type NetworkDomain interface { - GetName() string - GetDescription() string - ID() uuid.UUID -} - -// LoadedPnd represents a PND that was loaded. -type LoadedPnd struct { - ID string `json:"id" bson:"_id,omitempty"` - Name string `json:"name,omitempty"` - Description string `json:"description,omitempty"` -} diff --git a/controller/interfaces/networkdomain/pndService.go b/controller/interfaces/networkdomain/pndService.go deleted file mode 100644 index 4945f247d..000000000 --- a/controller/interfaces/networkdomain/pndService.go +++ /dev/null @@ -1,13 +0,0 @@ -package networkdomain - -// // Service describes an interface for PND service implementation. -// type Service interface { -// Add(NetworkDomain) error -// Delete(NetworkDomain) error -// Get(model.Query) (NetworkDomain, error) -// GetAll() ([]NetworkDomain, error) -// // Note: Implement these in case we want to use cSBI again. -// // PendingChannels(id uuid.UUID, parseErrors ...error) (chan model.Details, error) -// // AddPendingChannel(id uuid.UUID, ch chan model.Details) -// // RemovePendingChannel(id uuid.UUID) -// } diff --git a/controller/interfaces/networkdomain/pndStore.go b/controller/interfaces/networkdomain/pndStore.go deleted file mode 100644 index 548ea284a..000000000 --- a/controller/interfaces/networkdomain/pndStore.go +++ /dev/null @@ -1,18 +0,0 @@ -package networkdomain - -// // PndStore describes an interface for pnd store implementations. -// type PndStore interface { -// Add(NetworkDomain) error -// Delete(NetworkDomain) error -// Get(model.Query) (LoadedPnd, error) -// GetAll() ([]LoadedPnd, error) -// PendingChannels(id uuid.UUID, parseErrors ...error) (chan Details, error) -// AddPendingChannel(id uuid.UUID, ch chan Details) -// RemovePendingChannel(id uuid.UUID) -// } - -// type Details struct { -// ID string -// Address string -// TransportOption *tpb.TransportOption -// } diff --git a/controller/nucleus/domain/model/principalNetworkDomain.go b/controller/nucleus/domain/model/principalNetworkDomain.go index e5e3f5316..c151d01b7 100644 --- a/controller/nucleus/domain/model/principalNetworkDomain.go +++ b/controller/nucleus/domain/model/principalNetworkDomain.go @@ -3,8 +3,6 @@ package model import ( "go.mongodb.org/mongo-driver/bson" - "code.fbi.h-da.de/danet/gosdn/controller/interfaces/networkdomain" - "github.com/google/uuid" log "github.com/sirupsen/logrus" ) @@ -25,7 +23,7 @@ type LoadedPnd struct { } // NewPNDEntity creates a PND object as it is stored in the storage. -func NewPND(pndID uuid.UUID, name string, description string) networkdomain.NetworkDomain { +func NewPND(pndID uuid.UUID, name string, description string) NetworkDomain { pnd := &pndImplementation{ Id: pndID, Name: name, diff --git a/controller/nucleus/domain/ports/networkDomain.go b/controller/nucleus/domain/ports/networkDomain.go new file mode 100644 index 000000000..0a1e10b13 --- /dev/null +++ b/controller/nucleus/domain/ports/networkDomain.go @@ -0,0 +1,11 @@ +package ports + +import "github.com/google/uuid" + +// NetworkDomain provides an interface for network domain implementations +// like principal network domain or logical network domain. +type NetworkDomain interface { + GetName() string + GetDescription() string + ID() uuid.UUID +} -- GitLab