Skip to content
Snippets Groups Projects
Commit cbc0d7a6 authored by Malte Bauch's avatar Malte Bauch
Browse files

small cli-handling changes

parent 3b086065
Branches
Tags
3 merge requests!97Resolve "PND handling via CLI and database",!91"Overhaul Architecture",!90Develop
This commit is part of merge request !91. Comments created here will be created in the context of that merge request.
......@@ -166,6 +166,7 @@ func (s *server) CreatePND(ctx context.Context, in *pb.CreatePNDRequest) (*pb.Cr
}
func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDsReply, error) {
log.Info("Received: Get all PNDs")
var pnds []*pb.PND
for uuidPND, pnd := range s.core.principalNetworkDomains {
var devices []*pb.Device
......@@ -189,6 +190,7 @@ func (s *server) GetAllPNDs(ctx context.Context, in *emptypb.Empty) (*pb.AllPNDs
}
func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.AddDeviceReply, error) {
path := viper.GetString("pnd.path")
uuidPND, err := uuid.Parse(in.UuidPND)
pnd := s.core.principalNetworkDomains[uuidPND]
......@@ -204,5 +206,8 @@ func (s *server) AddDevice(ctx context.Context, in *pb.AddDeviceRequest) (*pb.Ad
}
devicesMap := pnd.(*pndImplementation).Devices
devicesMap[newDevice.Uuid] = newDevice
if err := s.core.savePNDs(path); err != nil {
log.Info(err)
}
return &pb.AddDeviceReply{Message: "Added new Device: " + newDevice.Uuid.String()}, err
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment