diff --git a/nucleus/device.go b/nucleus/device.go index b92a9eee03d6d174aa54b0682514652d36a99fbf..fc74f50e3f845c66f61287a892b064229a202a3c 100644 --- a/nucleus/device.go +++ b/nucleus/device.go @@ -3,9 +3,9 @@ package nucleus import ( tpb "code.fbi.h-da.de/cocsn/api/go/gosdn/transport" "github.com/docker/docker/pkg/namesgenerator" - "github.com/golang/protobuf/proto" "github.com/google/uuid" "github.com/openconfig/ygot/ygot" + "google.golang.org/protobuf/proto" ) // Device represents an Orchestrated Network Device (OND) which is managed by @@ -21,6 +21,7 @@ type Device interface { isDevice() } +// CommonDevice represents an OND type CommonDevice struct { // UUID represents the Devices UUID UUID uuid.UUID @@ -63,34 +64,42 @@ func (d *CommonDevice) ID() uuid.UUID { return d.UUID } +// Model returns the ygot representation of the Device func (d *CommonDevice) Model() ygot.GoStruct { return d.GoStruct } +// Transport returns the Transport of the device func (d *CommonDevice) Transport() Transport { return d.transport } +// Name returns the name of the device func (d *CommonDevice) Name() string { return d.name } +// SBI returns the sbi of the Device func (d *CommonDevice) SBI() SouthboundInterface { return d.sbi } +// SetTransport sets the Device's Transport func (d *CommonDevice) SetTransport(t Transport) { d.transport = t } +// SetName sets the Device's name func (d *CommonDevice) SetName(n string) { d.name = n } +// SetSBI sets the Device's SBI func (d *CommonDevice) SetSBI(sbi SouthboundInterface) { d.sbi = sbi } +// ProcessResponse processes a response for the Device func (d *CommonDevice) ProcessResponse(resp proto.Message) error { return d.transport.ProcessResponse(resp, d.GoStruct, d.sbi.Schema()) } diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go index 019d6981b27b94fed47e190f8a569f201dca9d9b..6e8318e382e80df2885feefb22a5b35d11a20784 100644 --- a/nucleus/gnmi_transport.go +++ b/nucleus/gnmi_transport.go @@ -342,10 +342,12 @@ func (g *Gnmi) Close() error { return nil } +// SetPassthrough allows to pass an existing SetRequest. Used for cSBI func (g *Gnmi) SetPassthrough(ctx context.Context, req *gpb.SetRequest) (*gpb.SetResponse, error) { return g.client.Set(ctx, req) } +// GetPassthrough allows to pass an existing GetRequest. Used for cSBI func (g *Gnmi) GetPassthrough(ctx context.Context, req *gpb.GetRequest) (*gpb.GetResponse, error) { return g.client.Get(ctx, req) } diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go index beec0666b6f1fe77cf838acccda2a345fde7f96f..7192878c39b172d92200c88b2d1290eebd1eb2c1 100644 --- a/nucleus/principalNetworkDomain.go +++ b/nucleus/principalNetworkDomain.go @@ -11,11 +11,11 @@ import ( "code.fbi.h-da.de/cocsn/gosdn/forks/goarista/gnmi" "code.fbi.h-da.de/cocsn/gosdn/nucleus/errors" - "github.com/golang/protobuf/proto" "github.com/google/uuid" "github.com/openconfig/ygot/ygot" "github.com/openconfig/ygot/ytypes" log "github.com/sirupsen/logrus" + "google.golang.org/protobuf/proto" ) // PrincipalNetworkDomain provides an