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

add sbi and ond to cetAllCore and write config on Init

parent 36bd331d
No related branches found
No related tags found
9 merge requests!246Develop,!245Develop into Master,!244Master into develop2 into master,!219Draft: Testing,!214Test pipelines,!195DO NOT MERGE 2,!194DO NOT MERGE! just for testing,!160Resolve "GRPC Init Broken",!138Develop
Pipeline #74455 failed
...@@ -41,6 +41,7 @@ func Init(addr string) error { ...@@ -41,6 +41,7 @@ func Init(addr string) error {
log.Infof("SBI: %v", sbi) log.Infof("SBI: %v", sbi)
} }
} }
viper.WriteConfig()
return nil return nil
} }
......
...@@ -9,6 +9,8 @@ import ( ...@@ -9,6 +9,8 @@ import (
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/nucleus" "code.fbi.h-da.de/cocsn/gosdn/nucleus"
"github.com/google/uuid" "github.com/google/uuid"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
) )
type core struct { type core struct {
...@@ -24,7 +26,7 @@ func (s core) Get(ctx context.Context, request *pb.GetRequest) (*pb.GetResponse, ...@@ -24,7 +26,7 @@ func (s core) Get(ctx context.Context, request *pb.GetRequest) (*pb.GetResponse,
var err error var err error
pndList, err = stringToUUID(request.Pid) pndList, err = stringToUUID(request.Pid)
if err != nil { if err != nil {
return nil, err return nil, status.Errorf(codes.Aborted, "%v", err)
} }
} }
...@@ -34,10 +36,23 @@ func (s core) Get(ctx context.Context, request *pb.GetRequest) (*pb.GetResponse, ...@@ -34,10 +36,23 @@ func (s core) Get(ctx context.Context, request *pb.GetRequest) (*pb.GetResponse,
if err != nil { if err != nil {
return nil, err return nil, err
} }
ond, err := fillOnds(pnd, true)
if err != nil {
return nil, status.Errorf(codes.Aborted, "%v", err)
}
sbi, err := fillSbis(pnd, true)
if err != nil {
return nil, status.Errorf(codes.Aborted, "%v", err)
}
pnds[i] = &ppb.PrincipalNetworkDomain{ pnds[i] = &ppb.PrincipalNetworkDomain{
Id: pnd.ID().String(), Id: pnd.ID().String(),
Name: pnd.GetName(), Name: pnd.GetName(),
Description: pnd.GetDescription(), Description: pnd.GetDescription(),
Ond: ond,
Sbi: sbi,
} }
} }
return &pb.GetResponse{ return &pb.GetResponse{
...@@ -52,10 +67,10 @@ func (s core) Set(ctx context.Context, request *pb.SetRequest) (*pb.SetResponse, ...@@ -52,10 +67,10 @@ func (s core) Set(ctx context.Context, request *pb.SetRequest) (*pb.SetResponse,
pnd, err := nucleus.NewPND(r.Name, r.Description, uuid.New(), sbi) pnd, err := nucleus.NewPND(r.Name, r.Description, uuid.New(), sbi)
if err != nil { if err != nil {
return nil, err return nil, status.Errorf(codes.Aborted, "%v", err)
} }
if err := pndc.Add(pnd); err != nil { if err := pndc.Add(pnd); err != nil {
return nil, err return nil, status.Errorf(codes.Aborted, "%v", err)
} }
} }
return &pb.SetResponse{ return &pb.SetResponse{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment