Skip to content
Snippets Groups Projects

"Overhaul Architecture"

Merged Ghost User requested to merge 67-overhaul-architecture into develop
5 files
+ 33
119
Compare changes
  • Side-by-side
  • Inline
Files
5
  • 57b8bb9e
    additional the JSON un-/marshalling was removed. -> therefore there is
    currently no persistance of pnds,sbis and devices.
    in the future we want to handle this via a database anyways.
+ 4
4
@@ -162,7 +162,6 @@ func (s *server) CreatePND(ctx context.Context, in *pb.CreatePNDRequest) (*pb.Cr
sbi := s.core.southboundInterfaces[in.GetSbi()]
id := uuid.New()
s.core.principalNetworkDomains[id] = NewPND(in.GetName(), in.GetDescription(), sbi)
s.core.MarshallPNDs()
return &pb.CreatePNDReply{Message: "Created new PND: " + id.String()}, nil
}
@@ -172,7 +171,7 @@ func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDs
var pnds []*pb.PND
for uuidPND, pnd := range s.core.principalNetworkDomains {
var devices []*pb.Device
for uuidDevice, device := range pnd.(*pndImplementation).Devices {
for uuidDevice, device := range pnd.(*pndImplementation).devices {
tmpDevice := pb.Device{
Uuid: uuidDevice.String(),
Address: device.Config.Address,
@@ -230,9 +229,9 @@ func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.Ad
},
Transport: transport,
}
newDevice.GoStruct = sbi.Schema().Root
devicesMap := pnd.GetDevices()
devicesMap[newDevice.Config.Uuid] = &newDevice
s.core.MarshallPNDs()
return &pb.AddDeviceReply{Message: "Added new Device: " + newDevice.Config.Uuid.String()}, err
}
@@ -262,11 +261,12 @@ func (s *server) HandleDeviceGetRequest(ctx context.Context, in *pb.DeviceGetReq
if err != nil {
return &pb.DeviceGetReply{Message: err.Error()}, err
}
log.Info(device)
d, err := json.MarshalIndent(device, "", "\t")
if err != nil {
return &pb.DeviceGetReply{Message: err.Error()}, err
}
return &pb.DeviceGetReply{Message: string(d)}, nil
return &pb.DeviceGetReply{Message: string(string(d))}, nil
}
Loading