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

create csbi device implemented

parent 8f11bfc6
No related branches found
No related tags found
2 merge requests!221Thesis mk,!173Process response overhaul
This commit is part of merge request !173. Comments created here will be created in the context of that merge request.
...@@ -9,8 +9,6 @@ import ( ...@@ -9,8 +9,6 @@ import (
"sync" "sync"
"time" "time"
"code.fbi.h-da.de/cocsn/gosdn/interfaces/southbound"
"github.com/google/uuid" "github.com/google/uuid"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/viper" "github.com/spf13/viper"
...@@ -20,6 +18,7 @@ import ( ...@@ -20,6 +18,7 @@ import (
cpb "code.fbi.h-da.de/cocsn/api/go/gosdn/csbi" cpb "code.fbi.h-da.de/cocsn/api/go/gosdn/csbi"
ppb "code.fbi.h-da.de/cocsn/api/go/gosdn/pnd" ppb "code.fbi.h-da.de/cocsn/api/go/gosdn/pnd"
spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound" spb "code.fbi.h-da.de/cocsn/api/go/gosdn/southbound"
"code.fbi.h-da.de/cocsn/gosdn/interfaces/southbound"
nbi "code.fbi.h-da.de/cocsn/gosdn/northbound/server" nbi "code.fbi.h-da.de/cocsn/gosdn/northbound/server"
"code.fbi.h-da.de/cocsn/gosdn/database" "code.fbi.h-da.de/cocsn/gosdn/database"
......
...@@ -2,9 +2,10 @@ package server ...@@ -2,9 +2,10 @@ package server
import ( import (
"context" "context"
log "github.com/sirupsen/logrus"
"time" "time"
log "github.com/sirupsen/logrus"
cpb "code.fbi.h-da.de/cocsn/api/go/gosdn/csbi" cpb "code.fbi.h-da.de/cocsn/api/go/gosdn/csbi"
"code.fbi.h-da.de/cocsn/gosdn/nucleus" "code.fbi.h-da.de/cocsn/gosdn/nucleus"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
...@@ -25,10 +26,10 @@ func (s csbi) Hello(ctx context.Context, syn *cpb.Syn) (*cpb.Ack, error) { ...@@ -25,10 +26,10 @@ func (s csbi) Hello(ctx context.Context, syn *cpb.Syn) (*cpb.Ack, error) {
ID: syn.Id, ID: syn.Id,
Address: syn.Address, Address: syn.Address,
} }
details := <- ch details := <-ch
log.Infof("ack to csbi %v", syn.Id) log.Infof("ack to csbi %v", syn.Id)
return &cpb.Ack{ return &cpb.Ack{
Timestamp: time.Now().UnixNano(), Timestamp: time.Now().UnixNano(),
TransportOption: details.TransportOption, TransportOption: details.TransportOption,
}, nil }, nil
} }
...@@ -96,31 +96,31 @@ func (d *CommonDevice) ProcessResponse(resp proto.Message) error { ...@@ -96,31 +96,31 @@ func (d *CommonDevice) ProcessResponse(resp proto.Message) error {
return d.transport.ProcessResponse(resp, d.GoStruct, d.sbi.Schema()) return d.transport.ProcessResponse(resp, d.GoStruct, d.sbi.Schema())
} }
type csbiDevice struct { type CsbiDevice struct {
CommonDevice CommonDevice
} }
// ID returns the UUID of the Device // ID returns the UUID of the Device
func (d *csbiDevice) ID() uuid.UUID { func (d *CsbiDevice) ID() uuid.UUID {
return d.UUID return d.UUID
} }
func (d *csbiDevice) Model() ygot.GoStruct { func (d *CsbiDevice) Model() ygot.GoStruct {
return d.GoStruct return d.GoStruct
} }
func (d *csbiDevice) Transport() transport.Transport { func (d *CsbiDevice) Transport() transport.Transport {
return d.transport return d.transport
} }
func (d *csbiDevice) Name() string { func (d *CsbiDevice) Name() string {
return d.name return d.name
} }
func (d *csbiDevice) SBI() southbound.SouthboundInterface { func (d *CsbiDevice) SBI() southbound.SouthboundInterface {
return d.sbi return d.sbi
} }
func (d *csbiDevice) ProcessResponse(resp proto.Message) error { func (d *CsbiDevice) ProcessResponse(resp proto.Message) error {
return &errors.ErrNotYetImplemented{} return &errors.ErrNotYetImplemented{}
} }
...@@ -412,11 +412,11 @@ func (pnd *pndImplementation) createCsbiDevice(name string, d *cpb.Deployment, o ...@@ -412,11 +412,11 @@ func (pnd *pndImplementation) createCsbiDevice(name string, d *cpb.Deployment, o
panic(err) panic(err)
} }
opt.Address = deviceDetails.Address opt.Address = deviceDetails.Address
t, err := NewGnmiTransport(opt, &Csbi{}) t, err := NewTransport(opt, &Csbi{})
if err != nil { if err != nil {
panic(err) panic(err)
} }
d := &csbiDevice{ d := &CsbiDevice{
CommonDevice: CommonDevice{ CommonDevice: CommonDevice{
name: name, name: name,
UUID: id, UUID: id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment