EPIC ID: RICAPP-200 Upgrading rc version to 1.0.3 and fixing E2SM RC control structure
[ric-app/rc.git] / control / rcControl.go
index 5bf5994..34fd310 100644 (file)
@@ -8,7 +8,7 @@ import (
        "strconv"\r
        "sync"\r
        "time"\r
-\r
+       //"encoding/hex"\r
        "gerrit.o-ran-sc.org/r/ric-app/rc/protocol/grpc/ricmsgcommrpc/rc"\r
        "gerrit.o-ran-sc.org/r/ric-plt/xapp-frame/pkg/xapp"\r
 )\r
@@ -242,13 +242,14 @@ func (aRicHoControlMsg *RicHoControlMsg) SendRicControlRequest(aRequestSN int) (
 \r
        lNrOrEUtraCellType := aRicHoControlMsg.RicControlGrpcReqPtr.RICControlMessageData.RICControlCellTypeVal\r
        lTargetCellVal := aRicHoControlMsg.RicControlGrpcReqPtr.RICControlMessageData.TargetCellID\r
+       //lTargetCellValBuf, _:= hex.DecodeString(lTargetCellVal)\r
        lTargetCellValBuf := []byte(lTargetCellVal)\r
        //lNRPlmnId := []byte(aRicHoControlMsg.RicControlGrpcReqPtr.RICControlMessageData.TargetCellID.PlmnID)\r
         //lNRCellId := aRicHoControlMsg.RicControlGrpcReqPtr.RICControlMessageData.TargetCellID.NRCellID\r
 \r
 \r
        var lRicControlMessage []byte = make([]byte, 1024)\r
-       lRicControlMessageEncoded, err := e2sm.SetRicControlMessage(lRicControlMessage, lTargetPrimaryCell, lTargetCell, lNrCGIOrECGI, int64(lNrOrEUtraCellType), lTargetCellValBuf)\r
+       lRicControlMessageEncoded, err := e2sm.SetRicControlMessage(lRicControlMessage, lTargetPrimaryCell, lTargetCell, lNrCGIOrECGI, int64(lNrOrEUtraCellType), ueId_data.pLMNIdentitybuf, lTargetCellValBuf)\r
        if err != nil {\r
                xapp.Logger.Error("SetRicControlMessage Failed: %v, UEID:%v", err, aRicHoControlMsg.RicControlGrpcReqPtr.RICControlHeaderData.UEID)\r
                log.Printf("SetRicControlMessage Failed: %v, UEID:%v", err, aRicHoControlMsg.RicControlGrpcReqPtr.RICControlHeaderData.UEID)\r
@@ -357,8 +358,30 @@ func HandleControlResponse(params *xapp.RMRParams) (err error) {
 \r
 func HandleControlFailure(params *xapp.RMRParams) (err error) {\r
 \r
+       var e2ap *E2ap\r
+\r
        xapp.Logger.Debug("The SubId in RIC_CONTROL_FAILURE is %d", params.SubId)\r
        log.Printf("The SubId in RIC_CONTROL_FAILURE is %d", params.SubId)\r
 \r
+       controlAck, err := e2ap.GetControlFailureMsg(params.Payload)\r
+       if err != nil {\r
+                xapp.Logger.Debug("Failed to decode RIC Control message: %v", err)\r
+                log.Println("Failed to decode RIC Control Ack: %v", err)\r
+                return\r
+        }\r
+        log.Println("E2ap RIC  Control Ack message decoded \n")\r
+        xapp.Logger.Debug("E2ap RIC Control Ack message decoded \n")\r
+\r
+        gControlData.eventRicControlReqExpiredMu.Lock()\r
+        _, ok := gControlData.eventRicControlReqExpiredMap[int(controlAck.InstanceId)]\r
+        if !ok {\r
+                gControlData.eventRicControlReqExpiredMu.Unlock()\r
+                xapp.Logger.Debug("RIC_CONTROL_REQ has been deleted!")\r
+                log.Printf("RIC_CONTROL_REQ has been deleted!")\r
+                return nil\r
+        } else {\r
+                gControlData.eventRicControlReqExpiredMap[int(controlAck.InstanceId)] = true\r
+                gControlData.eventRicControlReqExpiredMu.Unlock()\r
+        }\r
        return nil\r
 }\r