[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-535] Processing of E2 Removal Procedure(RIC... 47/11947/3
authorpborla <pborla@radisys.com>
Fri, 20 Oct 2023 11:38:23 +0000 (17:08 +0530)
committerpborla <pborla@radisys.com>
Wed, 25 Oct 2023 08:31:04 +0000 (14:01 +0530)
Change-Id: I5f61779e24a9c15e4016902e177aa9c58219e710
Signed-off-by: pborla <pborla@radisys.com>
src/du_app/du_e2ap_mgr.c
src/du_app/du_e2ap_mgr.h
src/du_app/du_e2ap_msg_hdl.c
src/ric_stub/ric_e2ap_msg_hdl.c

index e003e2f..0c4b0b3 100644 (file)
@@ -1432,6 +1432,40 @@ void fetchRicSubsToBeDeleted(CmLListCp *ricSubsToBeDelList)
    }
 }
 
+/******************************************************************
+ *
+ * @brief Delete e2 node information from the database
+ *
+ * @details
+ *
+ *    Function : removeE2NodeInformation 
+ *
+ *    Functionality: Delete e2 node information from the database 
+ *
+ * @params[in]
+ *
+ * @return void 
+ *
+******************************************************************/
+void removeE2NodeInformation()
+{
+   uint16_t ranFuncIdx = 0;
+   
+   DU_LOG("\nINFO  -->  E2AP : Deleting all the E2 node configuration");
+   for(ranFuncIdx=0; ranFuncIdx<MAX_RAN_FUNCTION; ranFuncIdx++)
+   {
+      if(duCb.e2apDb.ranFunction[ranFuncIdx].id >0)
+      {
+         deleteRicSubscriptionList(&(duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList));
+         memset(&(duCb.e2apDb.ranFunction[ranFuncIdx].pendingSubsRspInfo), 0, MAX_PENDING_SUBSCRIPTION_RSP*sizeof(PendingSubsRspInfo));
+      }
+   }
+   memset(&duCb.e2apDb.ricId, 0, sizeof(GlobalRicId));
+   duCb.e2apDb.numOfTNLAssoc = 0;
+   memset(&duCb.e2apDb.tnlAssoc, 0, MAX_TNL_ASSOCIATION*sizeof(TNLAssociation));
+   cmInetClose(&ricParams.sockFd);
+   memset(&ricParams, 0, sizeof(DuSctpDestCb));
+}
 /**********************************************************************
   End of file
  **********************************************************************/
index a4d05f9..df06ada 100644 (file)
@@ -518,6 +518,7 @@ void deleteRicSubscriptionNode(CmLList *ricSubscriptionInfo);
 void deleteMeasurementInfoList(CmLListCp *measInfoList);
 void deleteActionSequence(ActionInfo *action);
 void deleteMeasuredValueList(CmLListCp *measuredValueList);
+void removeE2NodeInformation();
 /**********************************************************************
   End of file
  **********************************************************************/
index ece43c8..83be943 100644 (file)
@@ -482,6 +482,7 @@ uint8_t BuildAndSendRemovalResponse(uint8_t transId)
    }while(true);
 
    FreeE2RemovalResponse(e2apMsg);
+   removeE2NodeInformation();
    return ret;
 }
 
@@ -537,14 +538,13 @@ void freeAperDecodingOfE2RemovalReq(E2RemovalRequest_t *removalReq)
 
 void procE2RemovalRequest(E2AP_PDU_t  *e2apMsg)
 {
-   uint8_t arrIdx =0, transId =0, count =0;
+   uint8_t arrIdx =0, transId =0;
    E2FailureCause failureCause;
    E2RemovalRequest_t *removalReq=NULLP;
 
    DU_LOG("\nINFO   -->  E2AP : E2 Removal request received");
    removalReq = &e2apMsg->choice.initiatingMessage->value.choice.E2RemovalRequest;
    
-   count =removalReq->protocolIEs.list.count;
    for(arrIdx=0; arrIdx<removalReq->protocolIEs.list.count; arrIdx++)
    {
       switch(removalReq->protocolIEs.list.array[arrIdx]->id)
index b8b4888..5f8b115 100644 (file)
@@ -5983,6 +5983,104 @@ void ProcE2RemovalFailure(E2RemovalFailure_t *e2RemovalFailure)
    }
 }
 
+/*******************************************************************
+ *
+ * @brief process the E2 node information from ric db
+ *
+ * @details
+ *
+ *    Function : deleteE2NodeInfo
+ *
+ * Functionality: process the E2 node information from ric db
+ *
+ * @params[in] 
+ *       du Id
+ *      
+ * @return void
+ *
+ ******************************************************************/
+void deleteE2NodeInfo(DuDb *duDb)
+{
+   uint16_t ranFuncIdx =0;
+   RanFunction *ranFuncDb=NULLP;
+
+   DU_LOG("\nINFO  -->  E2AP : Removing all the E2 node information");
+   for(ranFuncIdx = 0; ranFuncIdx < MAX_RAN_FUNCTION; ranFuncIdx++)
+   {
+      ranFuncDb = &duDb->ranFunction[ranFuncIdx];
+      if(ranFuncDb->id > 0)
+      {
+         deleteRicSubscriptionList(&ranFuncDb->subscriptionList);
+      }
+   }
+
+   cmInetClose(&sctpCb.e2LstnSockFd);
+}
+
+/*******************************************************************
+ *
+ * @brief process the E2 Removal Response
+ *
+ * @details
+ *
+ *    Function : ProcRemovalResponse 
+ *
+ * Functionality: Process E2 Removal Response 
+ *
+ * @params[in] 
+ *       du Id
+ *       Pointer to removal response 
+ * @return void
+ *
+ ******************************************************************/
+
+void ProcRemovalResponse(uint32_t duId, E2RemovalResponse_t *removalRsp)
+{
+   uint8_t ieIdx = 0, duIdx =0;
+   DuDb *duDb = NULLP;
+   RanFunction *ranFuncDb = NULLP;
+   uint16_t ranFuncIdx = 0;
+
+   SEARCH_DU_DB(duIdx, duId, duDb);
+   if(duDb == NULLP)
+   {
+      DU_LOG("\nERROR  -->  E2AP : duDb is not present for duId %d",duId);
+      return;
+   }
+
+   if(!removalRsp)
+   {
+      DU_LOG("\nERROR  -->  E2AP : removalRsp pointer is null"); 
+      return;
+   }
+
+   if(!removalRsp->protocolIEs.list.array)      
+   {
+      DU_LOG("\nERROR  -->  E2AP : removalRsp array pointer is null");
+      return;
+   }
+
+   for(ieIdx=0; ieIdx < removalRsp->protocolIEs.list.count; ieIdx++)
+   {
+      if(removalRsp->protocolIEs.list.array[ieIdx])
+      {
+         switch(removalRsp->protocolIEs.list.array[ieIdx]->id)
+         {
+            case ProtocolIE_IDE2_id_TransactionID:
+               {
+                  deleteE2NodeInfo(duDb);
+                  break;
+               }
+            default:
+               {
+                  DU_LOG("\nERROR  -->  E2AP : Received Invalid Ie [%ld]", removalRsp->protocolIEs.list.array[ieIdx]->id);
+                  break;
+               }
+         }
+      }
+   }
+}
+
 /*******************************************************************
 *
 * @brief Handles received E2AP message and sends back response  
@@ -6131,6 +6229,7 @@ void E2APMsgHdlr(uint32_t *duId, Buffer *mBuf)
                   }
                case SuccessfulOutcomeE2__value_PR_E2RemovalResponse:
                   {
+                     ProcRemovalResponse(*duId, &e2apMsg->choice.successfulOutcome->value.choice.E2RemovalResponse);
                      break;
                   }
                default: