Skip to content
Snippets Groups Projects
Commit 16aeb0b3 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

plugin SBI kinda works

parent d20693e8
Branches
Tags
1 merge request!221Thesis mk
Pipeline #77771 passed with warnings
# 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
...@@ -267,7 +267,7 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch ...@@ -267,7 +267,7 @@ func (g *Gnmi) ProcessResponse(resp interface{}, root interface{}, s *ytypes.Sch
log.Error(e) log.Error(e)
} }
if len(errs) != 0 { 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 return nil
} }
......
...@@ -207,7 +207,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s ...@@ -207,7 +207,7 @@ func (pnd *pndImplementation) AddDevice(name string, opt *tpb.TransportOption, s
return pnd.handleCsbiEnrolment(name, opt) return pnd.handleCsbiEnrolment(name, opt)
case spb.Type_PLUGIN: case spb.Type_PLUGIN:
var err error var err error
sbi, err = pnd.handlePluginAttachment(name, opt) sbi, err = pnd.requestPlugin(name, opt)
if err != nil { if err != nil {
return err return err
} }
...@@ -479,7 +479,7 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string, ...@@ -479,7 +479,7 @@ func (pnd *pndImplementation) createCsbiDevice(ctx context.Context, name string,
return nil 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) ctx, cancel := context.WithTimeout(context.Background(), time.Minute*10)
defer cancel() defer cancel()
req := &cpb.CreateRequest{ req := &cpb.CreateRequest{
...@@ -536,5 +536,10 @@ func loadPlugin(id uuid.UUID) (southbound.SouthboundInterface, error) { ...@@ -536,5 +536,10 @@ func loadPlugin(id uuid.UUID) (southbound.SouthboundInterface, error) {
if !ok { if !ok {
return nil, &errors.ErrInvalidTypeAssertion{} return nil, &errors.ErrInvalidTypeAssertion{}
} }
log.WithFields(log.Fields{
"identifier": sbi.SbiIdentifier(),
"id": sbi.ID(),
"type": sbi.Type(),
}).Trace("plugin information")
return sbi, nil return sbi, nil
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment