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
This commit is part of merge request !238. Comments created here will be created in the context of that merge request.
......@@ -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) {
......
......@@ -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()
......
......@@ -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
......
......@@ -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)
......
......@@ -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
}
......@@ -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",
......
......@@ -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}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment