diff --git a/Dockerfile.debug b/Dockerfile.debug new file mode 100644 index 0000000000000000000000000000000000000000..a2460463b036732da3b6d6f17539377a8f054f40 --- /dev/null +++ b/Dockerfile.debug @@ -0,0 +1,28 @@ +# syntax = docker/dockerfile:1.2 + +FROM golang:1.16-alpine AS builder +ARG GITLAB_USER +ARG GITLAB_TOKEN +ARG BUILDARGS +WORKDIR /src/gosdn +RUN apk add --no-cache git make build-base +RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de" +COPY go.mod . +COPY go.sum . +RUN go mod download +COPY . . +RUN --mount=type=cache,target=/root/.cache/go-build \ +GOOS=linux go build -o gosdn ./cmd/gosdn + +# Get Delve from a GOPATH not from a Go Modules project +WORKDIR /go/src/ +RUN go get github.com/go-delve/delve/cmd/dlv + +FROM alpine +EXPOSE 8080 +EXPOSE 55055 +EXPOSE 40000 +COPY --from=builder /src/gosdn / +COPY --from=builder /go/bin/dlv / + +CMD ["/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "exec", "/gosdn"] \ No newline at end of file diff --git a/nucleus/gnmi_transport.go b/nucleus/gnmi_transport.go index 06611db2a1a0af73141c55e5ea4ebce52f09e5dc..46fd26558bf560a012e491ca54529f588ed82056 100644 --- a/nucleus/gnmi_transport.go +++ b/nucleus/gnmi_transport.go @@ -267,7 +267,7 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch log.Error(e) } if len(errs) != 0 { - return fmt.Errorf("encountered %v errors during response processing", len(errs)) + return fmt.Errorf("encountered %v errors during response processing\n%v", len(errs), errs) } return nil } diff --git a/nucleus/principalNetworkDomain.go b/nucleus/principalNetworkDomain.go index 30a893e3adac17141fc642527442cd1729aaa75a..148bf56932a9bfdcebb970c404481f141b5a13a1 100644 --- a/nucleus/principalNetworkDomain.go +++ b/nucleus/principalNetworkDomain.go @@ -207,7 +207,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s return pnd.handleCsbiEnrolment(name, opt) case spb.Type_PLUGIN: var err error - sbi, err = pnd.handlePluginAttachment(name, opt) + sbi, err = pnd.requestPlugin(name, opt) if err != nil { return err } @@ -479,7 +479,7 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string, return nil } -func (pnd *pndImplementation) handlePluginAttachment(name string, opt *tpb.TransportOption) (southbound.SouthboundInterface, error) { +func (pnd *pndImplementation) requestPlugin(name string, opt *tpb.TransportOption) (southbound.SouthboundInterface, error) { ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10) defer cancel() req := &cpb.CreateRequest{ @@ -536,5 +536,10 @@ func loadPlugin(id uuid.UUID) (southbound.SouthboundInterface, error) { if !ok { return nil, &errors.ErrInvalidTypeAssertion{} } + log.WithFields(log.Fields{ + "identifier": sbi.SbiIdentifier(), + "id": sbi.ID(), + "type": sbi.Type(), + }).Trace("plugin information") return sbi, nil }