[Epic-ID: ODUHIGH-516][Task-ID: ODUHIGH-532] RIC Subscription Delete Required
[o-du/l2.git] / src / du_app / du_e2ap_mgr.c
index 6bdbe58..f813ef0 100644 (file)
@@ -640,6 +640,9 @@ uint8_t e2ProcStatsRsp(MacStatsRsp *statsRsp)
    }
    else
    {
+      /* Once RIC subscription is successful, mark the config action as unknown */
+      ricSubscriptionInfo->action = CONFIG_UNKNOWN;
+
       /* Start RIC Subscription reporting timer */
       switch(ricSubscriptionInfo->eventTriggerDefinition.formatType)
       {
@@ -1058,7 +1061,6 @@ void deleteMeasuredValueList(CmLListCp *measuredValueList)
  * @return void 
  *
  * ****************************************************************/
-
 void deleteMeasurementInfoList(CmLListCp *measInfoList)
 {
    CmLList *measInfoNode = NULLP;
@@ -1117,6 +1119,7 @@ void deleteActionSequence(ActionInfo *action)
    memset(action, 0, sizeof(ActionInfo));
    action->actionId = -1;
 }
+
 /******************************************************************
  *
  * @brief Delete Ric subscription node 
@@ -1132,7 +1135,6 @@ void deleteActionSequence(ActionInfo *action)
  * @return void 
  *
  * ****************************************************************/
-
 void deleteRicSubscriptionNode(CmLList *subscriptionNode)
 {
    uint8_t actionIdx=0;
@@ -1174,8 +1176,6 @@ void deleteRicSubscriptionNode(CmLList *subscriptionNode)
  * @return void 
  *
  * ****************************************************************/
-
-
 void deleteRicSubscriptionList(CmLListCp *subscriptionList)
 {
    CmLList *subscriptionNode=NULLP;
@@ -1190,6 +1190,53 @@ void deleteRicSubscriptionList(CmLListCp *subscriptionList)
    }
 }
 
+/*******************************************************************
+ *
+ * @brief Find all RIC subscriptions to be deleted in all RAN
+ *    Functions
+ *
+ * @details
+ *
+ *    Function : fetchRicSubsToBeDeleted
+ *
+ * Functionality: Find all RIC subscriptions to be deleted in all
+ *    RAN functions and store in a temporary list
+ *
+ * @parameter Temporary list to store subscriptions to be deleted
+ * @return void
+ *
+ ******************************************************************/
+void fetchRicSubsToBeDeleted(CmLListCp *ricSubsToBeDelList)
+{
+   uint16_t ranFuncIdx = 0;
+   CmLList *subsNode = NULLP;
+   CmLList *subsToDelNode = NULLP;
+
+   for(ranFuncIdx = 0; ranFuncIdx < MAX_RAN_FUNCTION; ranFuncIdx++)
+   {
+      if(duCb.e2apDb.ranFunction[ranFuncIdx].id > 0)
+      {
+         CM_LLIST_FIRST_NODE(&duCb.e2apDb.ranFunction[ranFuncIdx].subscriptionList, subsNode);
+         while(subsNode)
+         {
+            if(((RicSubscription *)subsNode->node)->action == CONFIG_DEL)
+            {
+               DU_ALLOC(subsToDelNode, sizeof(CmLList));
+               if(!subsToDelNode)
+               {
+                  DU_LOG("\nERROR  -->  E2AP : %s: Memory allocation failure at %d", __func__, __LINE__); 
+                  return;
+               }
+               subsToDelNode->node = subsNode->node;
+               cmLListAdd2Tail(ricSubsToBeDelList, subsToDelNode);
+            }
+            subsToDelNode = NULLP;
+            subsNode = subsNode->next;
+         }
+      }
+   }
+}
+
 /**********************************************************************
   End of file
  **********************************************************************/