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"
12 // RCControlServer represents the grpc server
13 type RCControlServer struct {
16 //Start gRPC Server For receiving Control Messages from dataingestion
17 func StartgRPCRCControlCommServerRoutine() error {
19 //log.Println("Starting Go Routine for Handling gRPC Server for handling gRPC RCControl Handling")
20 xapp.Logger.Info("Starting Go Routine for Handling gRPC Server for handling gRPC RCControl Handling ")
21 port := xapp.Config.GetString("controls.ricHOControlgRpcServerPort")
22 xapp.Logger.Info("GrpcServer started listening on Port port = %v", port)
23 lConnStr := ":" + port
25 // create a listener on TCP port Configured
26 lLis, lErr := net.Listen("tcp", lConnStr)
28 //log.Printf("GrpcServer Listen failed with error", lErr)
29 xapp.Logger.Info("GrpcServer Listen failed with error = %v", lErr)
33 xapp.Logger.Info("GrpcServer started listening on Connection: %v", lConnStr)
34 // create a server instance
35 lRCControlSrv := RCControlServer{}
37 // create a grpc server object
38 lgRPCServer := grpc.NewServer()
40 // attach the Ping service to the server
41 rc.RegisterMsgCommServer(lgRPCServer, &lRCControlSrv)
43 //Register to health service
44 grpc_health_v1.RegisterHealthServer(lgRPCServer, health.NewServer())
46 xapp.Logger.Debug("GrpcServer Serve start with port = %v and lConnStr = %v and lgRPCServer = %v ", lLis, lConnStr, lgRPCServer)
49 if lErr := lgRPCServer.Serve(lLis); lErr != nil {
50 xapp.Logger.Info("GrpcServer Serve failed with error", lErr)