diff --git a/api/grpc.go b/api/grpc.go index d3a3a6d46032f44a31aa32cbcc8fd4336b12f889..a9ef08f46326e98f8ae012ddef9e23a7426a1227 100644 --- a/api/grpc.go +++ b/api/grpc.go @@ -15,13 +15,14 @@ import ( "github.com/spf13/viper" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) var dialOptions []grpc.DialOption func init() { dialOptions = []grpc.DialOption{ - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), } } @@ -232,6 +233,8 @@ func getDevice(addr, pid string, did ...string) (*ppb.GetOndResponse, error) { return pndClient.GetOnd(ctx, req) } +//nolint +// NOTE: currently not in use, but could be of value later // getDevice requests all devices belonging to a given // PrincipalNetworkDomain from the controller. func getDevices(addr, pid string) (*ppb.GetOndListResponse, error) { diff --git a/api/initialise_test.go b/api/initialise_test.go index 0d4d392d9a67657affa37b9fbe15bd0f137a792e..4dbb90a3e363242f7e1a6afb8fe1ab4eb9594574 100644 --- a/api/initialise_test.go +++ b/api/initialise_test.go @@ -22,6 +22,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/stretchr/testify/mock" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/test/bufconn" gpb "github.com/openconfig/gnmi/proto/gnmi" @@ -48,7 +49,7 @@ var sbiUUID uuid.UUID func bootstrapUnitTest() { dialOptions = []grpc.DialOption{ grpc.WithContextDialer(bufDialer), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), } lis = bufconn.Listen(bufSize) s := grpc.NewServer() diff --git a/controller.go b/controller.go index 2cc38d43545df504e2239191cb58893bcf3521eb..ea7db97e3389368cfa84d046e9680e33e36affe2 100644 --- a/controller.go +++ b/controller.go @@ -13,6 +13,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/viper" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "code.fbi.h-da.de/danet/api/go/gosdn/core" cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi" @@ -104,7 +105,7 @@ func startGrpc() error { }() orchestrator := viper.GetString("csbi-orchestrator") - conn, err := grpc.Dial(orchestrator, grpc.WithInsecure()) + conn, err := grpc.Dial(orchestrator, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatal(err) } @@ -120,7 +121,6 @@ func createSouthboundInterfaces() (southbound.SouthboundInterface, error) { } return sbi, nil - } // createPrincipalNetworkDomain initializes the controller with an initial PND diff --git a/northbound/server/core.go b/northbound/server/core.go index 713cc92c5571b7b212c3e98400b0c26a9c8a6741..b72fe1d017ae6c9939f5dcfd880b2d22be0505cb 100644 --- a/northbound/server/core.go +++ b/northbound/server/core.go @@ -77,7 +77,6 @@ func (s core) CreatePndList(ctx context.Context, request *pb.CreatePndListReques start := metrics.StartHook(labels, grpcRequestsTotal) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) for _, r := range request.Pnd { - sbi, err := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG) if err != nil { return nil, handleRPCError(labels, err) diff --git a/northbound/server/pnd.go b/northbound/server/pnd.go index 3cfdbd6fbcdf00f73c37df37081da888e7e865ea..9d6f71ad83b681330052b6f4ecaafa4a97cc8e25 100644 --- a/northbound/server/pnd.go +++ b/northbound/server/pnd.go @@ -189,7 +189,6 @@ func (p pndServer) GetSbiList(ctx context.Context, request *ppb.GetSbiListReques }, Sbi: sbis, }, nil - } func fillSbis(pnd networkdomain.NetworkDomain, all bool, sid ...string) ([]*spb.SouthboundInterface, error) { @@ -283,7 +282,6 @@ func (p pndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p }, Device: ond[0].Device, }, nil - } func (p pndServer) GetChange(ctx context.Context, request *ppb.GetChangeRequest) (*ppb.GetChangeResponse, error) { @@ -505,7 +503,6 @@ func (p pndServer) SetPathList(ctx context.Context, request *ppb.SetPathListRequ }, }, }, nil - } func (p pndServer) SetSbiList(ctx context.Context, request *ppb.SetSbiListRequest) (*ppb.SetSbiListResponse, error) { @@ -588,5 +585,4 @@ func (p pndServer) DeleteOnd(ctx context.Context, request *ppb.DeleteOndRequest) Timestamp: time.Now().UnixNano(), Status: ppb.Status_STATUS_OK, }, nil - } diff --git a/northbound/server/pnd_test.go b/northbound/server/pnd_test.go index 0f8767850c8caed05a9e4cb2938f4e41dd2a7d01..b2e7595ab319184f92ed2fdf07a414e9150bbe1f 100644 --- a/northbound/server/pnd_test.go +++ b/northbound/server/pnd_test.go @@ -21,6 +21,7 @@ import ( log "github.com/sirupsen/logrus" "github.com/stretchr/testify/mock" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi" ) @@ -55,7 +56,7 @@ func getMockPND() networkdomain.NetworkDomain { log.Fatal(err) } - conn, err := grpc.Dial("orchestrator", grpc.WithInsecure()) + conn, err := grpc.Dial("orchestrator", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatal(err) } @@ -181,7 +182,7 @@ func Test_pnd_Get(t *testing.T) { tests := []struct { name string args args - want pb.GetPndResponse + want *pb.GetPndResponse wantErr bool }{ { @@ -193,7 +194,7 @@ func Test_pnd_Get(t *testing.T) { pndID}, }, }, - want: pb.GetPndResponse{ + want: &pb.GetPndResponse{ Pnd: []*ppb.PrincipalNetworkDomain{ {Id: pndID, Name: "test", diff --git a/nucleus/southbound.go b/nucleus/southbound.go index 5e7b1528feaf8ee6c7e062fa952e392f58159373..4bf8e06ec0a7d2f73bc79d8cd6fe6a689dde6ff1 100644 --- a/nucleus/southbound.go +++ b/nucleus/southbound.go @@ -36,7 +36,6 @@ func NewSBI(southbound spb.Type, sbUUID ...uuid.UUID) (southbound.SouthboundInte return &OpenConfig{id: id}, nil default: return nil, errors.ErrTypeNotSupported{Type: southbound} - } }