diff --git a/nucleus/cli-handling.go b/nucleus/cli-handling.go index 282a12b05ae489305e412b879f837c8df04854fe..8fba4a5d35ce14ac0f4c05a02b97c25cd83f9a05 100644 --- a/nucleus/cli-handling.go +++ b/nucleus/cli-handling.go @@ -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 }