X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=control%2FrcService.go;fp=control%2FrcService.go;h=39175e9763f0036c31d80cbd5ab5265d0e4779e0;hb=21b61dd76570beb43afc74289296e831914d9060;hp=0000000000000000000000000000000000000000;hpb=73cdf410d29f46c3047686694e828de4aee6633c;p=ric-app%2Frc.git diff --git a/control/rcService.go b/control/rcService.go new file mode 100644 index 0000000..39175e9 --- /dev/null +++ b/control/rcService.go @@ -0,0 +1,59 @@ +package control + +import ( + "log" + "runtime/debug" + _ "strings" + "time" + + "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp" + "gerrit.o-ran-sc.org/r/scp/ric-app/protocol/grpc/ricmsgcommrpc/rc" + "golang.org/x/net/context" +) + +func (aPtrSendMsgSrv *RCControlServer) SendRICControlReqServiceGrpc(aCtx context.Context, aPtrRicControlGrpcReq *rc.RicControlGrpcReq) (*rc.RicControlGrpcRsp, error) { + + xapp.Logger.Info("SendRICControlReqServiceGrpc Enter ") + + defer func() { + if r := recover(); r != nil { + log.Println("Encountered panic:", r) + xapp.Logger.Error("Encountered panic:", r) + debug.SetTraceback("all") + time.Sleep(100 * time.Millisecond) + panic(r) + } + }() + + var lRicControlGrpcRsp rc.RicControlGrpcRsp + lRicControlGrpcRsp.RspCode = GRPC_ERROR + lRicControlGrpcRsp.Description = "The client specified an invalid argument. or some parameters are missing " + if aPtrRicControlGrpcReq == nil { + xapp.Logger.Error("Received nil data from Send error rsp") + } else { + if len(aPtrRicControlGrpcReq.E2NodeID) == 0 || len(aPtrRicControlGrpcReq.RICControlMessageData.TargetCellID) == 0 || len(aPtrRicControlGrpcReq.RICControlHeaderData.UEID) == 0 { + xapp.Logger.Error("Mandatory parameters are not received send Error rsp to client,no control Request will be initiated ") + } else { + xapp.Logger.Info("GRPC Control request validated, initiate Control Request to RAN") + gChan_RicControlReq_handle <- aPtrRicControlGrpcReq + xapp.Logger.Debug("Received RIC Control Request with RicRequestorID: %d", aPtrRicControlGrpcReq.RICE2APHeaderData.RICRequestorID) + xapp.Logger.Debug("Received RIC Control Request with RicActionId: %d", aPtrRicControlGrpcReq.RICE2APHeaderData.RanFuncId) + + xapp.Logger.Debug("Received RIC Control Request with UEID: %s", aPtrRicControlGrpcReq.RICControlHeaderData.UEID) + xapp.Logger.Debug("Received RIC Control Request with ControlStyle: %d", aPtrRicControlGrpcReq.RICControlHeaderData.ControlStyle) + xapp.Logger.Debug("Received RIC Control Request with ControlActionId: %d", aPtrRicControlGrpcReq.RICControlHeaderData.ControlActionId) + + xapp.Logger.Debug("Received RIC Control Request with CellType: %d", aPtrRicControlGrpcReq.RICControlMessageData.RICControlCellTypeVal) + xapp.Logger.Debug("Received RIC Control Request with TargetCellID: %s", aPtrRicControlGrpcReq.RICControlMessageData.TargetCellID) + xapp.Logger.Debug("Received RIC Control Request with RanName: %s", aPtrRicControlGrpcReq.RanName) + lRicControlGrpcRsp.RspCode = GRPC_SUCCESS //int32(lGrpcRspStatusCode) + lRicControlGrpcRsp.Description = "Success Response" + xapp.Logger.Debug("RICHOCONTROL_EVENT: Success Response sent with RspCode:%d, Description:%s", lRicControlGrpcRsp.RspCode, lRicControlGrpcRsp.Description) + } + } + + xapp.Logger.Info("RICHOCONTROL_EVENT: Response sent with RspCode:%d, Description:%s", lRicControlGrpcRsp.RspCode, lRicControlGrpcRsp.Description) + + log.Printf(" Response sent to , rsp: {Code: ", lRicControlGrpcRsp.RspCode, ", Description: ", lRicControlGrpcRsp.Description, "}") + return &lRicControlGrpcRsp, nil +}