From 9cca50b3d195635981201485646c32cfaab0f1cc Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <manuel.kieweg@h-da.de> Date: Wed, 9 Jun 2021 15:07:06 +0200 Subject: [PATCH] golint --fix --- nucleus/device.go | 11 ++++++++++- nucleus/gnmi_transport.go | 2 ++ nucleus/principalNetworkDomain.go | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/nucleus/device.go b/nucleus/device.go index b92a9eee0..fc74f50e3 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 019d6981b..6e8318e38 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 beec0666b..7192878c3 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 -- GitLab