4 "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"
5 "gerrit.o-ran-sc.org/r/ric-app/rc/protocol/grpc/ricmsgcommrpc/rc"
6 "google.golang.org/grpc"
7 "google.golang.org/grpc/health"
8 "google.golang.org/grpc/health/grpc_health_v1"
9 "google.golang.org/grpc/reflection"
13 // RCControlServer represents the grpc server
14 type RCControlServer struct {
17 //Start gRPC Server For receiving Control Messages from dataingestion
18 func StartgRPCRCControlCommServerRoutine() error {
20 //log.Println("Starting Go Routine for Handling gRPC Server for handling gRPC RCControl Handling")
21 xapp.Logger.Info("Starting Go Routine for Handling gRPC Server for handling gRPC RCControl Handling ")
22 port := xapp.Config.GetString("controls.ricHOControlgRpcServerPort")
23 xapp.Logger.Info("GrpcServer started listening on Port port = %v", port)
24 lConnStr := ":" + port
26 // create a listener on TCP port Configured
27 lLis, lErr := net.Listen("tcp", lConnStr)
29 //log.Printf("GrpcServer Listen failed with error", lErr)
30 xapp.Logger.Info("GrpcServer Listen failed with error = %v", lErr)
34 xapp.Logger.Info("GrpcServer started listening on Connection: %v", lConnStr)
35 // create a server instance
36 lRCControlSrv := RCControlServer{}
38 // create a grpc server object
39 lgRPCServer := grpc.NewServer()
41 // attach the Ping service to the server
42 rc.RegisterMsgCommServer(lgRPCServer, &lRCControlSrv)
43 reflection.Register(lgRPCServer)
45 //Register to health service
46 grpc_health_v1.RegisterHealthServer(lgRPCServer, health.NewServer())
48 xapp.Logger.Debug("GrpcServer Serve start with port = %v and lConnStr = %v and lgRPCServer = %v ", lLis, lConnStr, lgRPCServer)
51 if lErr := lgRPCServer.Serve(lLis); lErr != nil {
52 xapp.Logger.Info("GrpcServer Serve failed with error", lErr)