Skip to content
Snippets Groups Projects
Commit 9be63670 authored by Malte Bauch's avatar Malte Bauch Committed by Fabian Seidl
Browse files

Linter pleasing

parent 15223e20
No related branches found
No related tags found
1 merge request!238Stfaseid http refactor
...@@ -15,13 +15,14 @@ import ( ...@@ -15,13 +15,14 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
) )
var dialOptions []grpc.DialOption var dialOptions []grpc.DialOption
func init() { func init() {
dialOptions = []grpc.DialOption{ dialOptions = []grpc.DialOption{
grpc.WithInsecure(), grpc.WithTransportCredentials(insecure.NewCredentials()),
} }
} }
...@@ -232,6 +233,8 @@ func getDevice(addr, pid string, did ...string) (*ppb.GetOndResponse, error) { ...@@ -232,6 +233,8 @@ func getDevice(addr, pid string, did ...string) (*ppb.GetOndResponse, error) {
return pndClient.GetOnd(ctx, req) 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 // getDevice requests all devices belonging to a given
// PrincipalNetworkDomain from the controller. // PrincipalNetworkDomain from the controller.
func getDevices(addr, pid string) (*ppb.GetOndListResponse, error) { func getDevices(addr, pid string) (*ppb.GetOndListResponse, error) {
......
...@@ -22,6 +22,7 @@ import ( ...@@ -22,6 +22,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/test/bufconn" "google.golang.org/grpc/test/bufconn"
gpb "github.com/openconfig/gnmi/proto/gnmi" gpb "github.com/openconfig/gnmi/proto/gnmi"
...@@ -48,7 +49,7 @@ var sbiUUID uuid.UUID ...@@ -48,7 +49,7 @@ var sbiUUID uuid.UUID
func bootstrapUnitTest() { func bootstrapUnitTest() {
dialOptions = []grpc.DialOption{ dialOptions = []grpc.DialOption{
grpc.WithContextDialer(bufDialer), grpc.WithContextDialer(bufDialer),
grpc.WithInsecure(), grpc.WithTransportCredentials(insecure.NewCredentials()),
} }
lis = bufconn.Listen(bufSize) lis = bufconn.Listen(bufSize)
s := grpc.NewServer() s := grpc.NewServer()
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
pb "code.fbi.h-da.de/danet/api/go/gosdn/core" pb "code.fbi.h-da.de/danet/api/go/gosdn/core"
cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi" cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi"
...@@ -104,7 +105,7 @@ func startGrpc() error { ...@@ -104,7 +105,7 @@ func startGrpc() error {
}() }()
orchestrator := viper.GetString("csbi-orchestrator") orchestrator := viper.GetString("csbi-orchestrator")
conn, err := grpc.Dial(orchestrator, grpc.WithInsecure()) conn, err := grpc.Dial(orchestrator, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
...@@ -120,7 +121,6 @@ func createSouthboundInterfaces() (southbound.SouthboundInterface, error) { ...@@ -120,7 +121,6 @@ func createSouthboundInterfaces() (southbound.SouthboundInterface, error) {
} }
return sbi, nil return sbi, nil
} }
// createPrincipalNetworkDomain initializes the controller with an initial PND // createPrincipalNetworkDomain initializes the controller with an initial PND
......
...@@ -77,7 +77,6 @@ func (s core) CreatePndList(ctx context.Context, request *pb.CreatePndListReques ...@@ -77,7 +77,6 @@ func (s core) CreatePndList(ctx context.Context, request *pb.CreatePndListReques
start := metrics.StartHook(labels, grpcRequestsTotal) start := metrics.StartHook(labels, grpcRequestsTotal)
defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds) defer metrics.FinishHook(labels, start, grpcRequestDurationSecondsTotal, grpcRequestDurationSeconds)
for _, r := range request.Pnd { for _, r := range request.Pnd {
sbi, err := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG) sbi, err := nucleus.NewSBI(spb.Type_TYPE_OPENCONFIG)
if err != nil { if err != nil {
return nil, handleRPCError(labels, err) return nil, handleRPCError(labels, err)
......
...@@ -189,7 +189,6 @@ func (p pndServer) GetSbiList(ctx context.Context, request *ppb.GetSbiListReques ...@@ -189,7 +189,6 @@ func (p pndServer) GetSbiList(ctx context.Context, request *ppb.GetSbiListReques
}, },
Sbi: sbis, Sbi: sbis,
}, nil }, nil
} }
func fillSbis(pnd networkdomain.NetworkDomain, all bool, sid ...string) ([]*spb.SouthboundInterface, error) { 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 ...@@ -283,7 +282,6 @@ func (p pndServer) GetPath(ctx context.Context, request *ppb.GetPathRequest) (*p
}, },
Device: ond[0].Device, Device: ond[0].Device,
}, nil }, nil
} }
func (p pndServer) GetChange(ctx context.Context, request *ppb.GetChangeRequest) (*ppb.GetChangeResponse, error) { 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 ...@@ -505,7 +503,6 @@ func (p pndServer) SetPathList(ctx context.Context, request *ppb.SetPathListRequ
}, },
}, },
}, nil }, nil
} }
func (p pndServer) SetSbiList(ctx context.Context, request *ppb.SetSbiListRequest) (*ppb.SetSbiListResponse, error) { 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) ...@@ -588,5 +585,4 @@ func (p pndServer) DeleteOnd(ctx context.Context, request *ppb.DeleteOndRequest)
Timestamp: time.Now().UnixNano(), Timestamp: time.Now().UnixNano(),
Status: ppb.Status_STATUS_OK, Status: ppb.Status_STATUS_OK,
}, nil }, nil
} }
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/stretchr/testify/mock" "github.com/stretchr/testify/mock"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi" cpb "code.fbi.h-da.de/danet/api/go/gosdn/csbi"
) )
...@@ -55,7 +56,7 @@ func getMockPND() networkdomain.NetworkDomain { ...@@ -55,7 +56,7 @@ func getMockPND() networkdomain.NetworkDomain {
log.Fatal(err) log.Fatal(err)
} }
conn, err := grpc.Dial("orchestrator", grpc.WithInsecure()) conn, err := grpc.Dial("orchestrator", grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
...@@ -181,7 +182,7 @@ func Test_pnd_Get(t *testing.T) { ...@@ -181,7 +182,7 @@ func Test_pnd_Get(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
args args args args
want pb.GetPndResponse want *pb.GetPndResponse
wantErr bool wantErr bool
}{ }{
{ {
...@@ -193,7 +194,7 @@ func Test_pnd_Get(t *testing.T) { ...@@ -193,7 +194,7 @@ func Test_pnd_Get(t *testing.T) {
pndID}, pndID},
}, },
}, },
want: pb.GetPndResponse{ want: &pb.GetPndResponse{
Pnd: []*ppb.PrincipalNetworkDomain{ Pnd: []*ppb.PrincipalNetworkDomain{
{Id: pndID, {Id: pndID,
Name: "test", Name: "test",
......
...@@ -36,7 +36,6 @@ func NewSBI(southbound spb.Type, sbUUID ...uuid.UUID) (southbound.SouthboundInte ...@@ -36,7 +36,6 @@ func NewSBI(southbound spb.Type, sbUUID ...uuid.UUID) (southbound.SouthboundInte
return &OpenConfig{id: id}, nil return &OpenConfig{id: id}, nil
default: default:
return nil, errors.ErrTypeNotSupported{Type: southbound} return nil, errors.ErrTypeNotSupported{Type: southbound}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment