[ODUHIGH-359]:MultiBearer support in UE Context Modification Request 24/6724/6
authorlal.harshita <Harshita.Lal@radisys.com>
Tue, 21 Sep 2021 13:16:26 +0000 (18:46 +0530)
committerlal.harshita <Harshita.Lal@radisys.com>
Tue, 28 Sep 2021 09:32:51 +0000 (15:02 +0530)
Change-Id: I13371e08ed3f8151fb7f3f69a23d7ca98e6c4ac0
Signed-off-by: lal.harshita <Harshita.Lal@radisys.com>
src/cu_stub/cu_f1ap_msg_hdl.c
src/cu_stub/cu_f1ap_msg_hdl.h
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_ue_mgr.c
src/phy_stub/phy_stub.h

index 6bfd46a..344c15e 100644 (file)
@@ -87,6 +87,7 @@
 #include "DLUPTNLInformation-ToBeSetup-Item.h"
 #include "UPTransportLayerInformation.h"
 #include "GTPTunnel.h"
+#include "QoSInformation.h"
 
 /* MACRO for CUtoDURRCInformation */
 #define CELL_GRP_ID 1
 #define SCRAMBLING_ID  NR_PCI
 #define DMRS_ADDITIONAL_POS  0          /* DMRS Additional poistion */
 #define RES_ALLOC_TYPE       1          /* Resource allocation type */
-#define FIVE_QI_VALUE 9  /*spec 23.501, Table 5.7.4-1*/
+#define FIVE_QI_VALUE9 9  /*spec 23.501, Table 5.7.4-1*/
+#define FIVE_QI_VALUE8 8  /*spec 23.501, Table 5.7.4-1*/
 
 /*******************************************************************
  *
@@ -2032,7 +2034,7 @@ uint8_t BuildSRBSetup(SRBs_ToBeSetup_List_t *srbSet)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
+uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos, uint8_t actionType)
 {
    /* NonDynamic5QIDescriptor */
    drbQos->qoS_Characteristics.present = QoS_Characteristics_PR_non_Dynamic_5QI;
@@ -2042,7 +2044,11 @@ uint8_t BuildQOSInfo(QoSFlowLevelQoSParameters_t *drbQos)
       return RFAILED;
    }
    /*FiveQI*/
-   drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = FIVE_QI_VALUE;
+   if(actionType == ProtocolIE_ID_id_DRBs_ToBeModified_Item)
+      drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = FIVE_QI_VALUE8;
+   else
+      drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = FIVE_QI_VALUE9;
+
    /*AveragingWindow*/
    CU_ALLOC(drbQos->qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow,\
         sizeof(AveragingWindow_t));
@@ -2131,17 +2137,17 @@ uint8_t BuildSNSSAI(SNSSAI_t *snssai)
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap)
+uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap , uint8_t actionType)
 {
-   uint8_t  ret;
-   uint8_t  idx;
-   uint8_t  flowCnt;
+   uint8_t  ret = ROK, idx = 0, flowCnt = 0;
+
    flowCnt = 1;
    flowMap->list.count = flowCnt;
    flowMap->list.size = flowCnt * sizeof(Flows_Mapped_To_DRB_Item_t *);
    CU_ALLOC(flowMap->list.array,flowMap->list.size);
    if(flowMap->list.array == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for array in BuildFlowsMap()");
       return RFAILED;
    }
    for(idx=0; idx<flowCnt; idx++)
@@ -2149,14 +2155,17 @@ uint8_t BuildFlowsMap(Flows_Mapped_To_DRB_List_t *flowMap)
       CU_ALLOC(flowMap->list.array[idx],sizeof(Flows_Mapped_To_DRB_Item_t));
       if(flowMap->list.array[idx] == NULLP)
       {
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for arrayIdx[%d] in BuildFlowsMap()", idx);
+         return RFAILED;
       }
    }
    idx = 0;
    flowMap->list.array[idx]->qoSFlowIdentifier = 0;
-   ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters);
+   ret = BuildQOSInfo(&flowMap->list.array[idx]->qoSFlowLevelQoSParameters,\
+         actionType);
    if(ret != ROK)
    {
+      DU_LOG("\nERROR  -->  F1AP : Failed to Build QOS Info in BuildFlowsMap()");
       return RFAILED;
    }
    return ROK;
@@ -2187,7 +2196,8 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    ulInfo->list.size = ulCnt * sizeof(ULUPTNLInformation_ToBeSetup_Item_t *);
    CU_ALLOC(ulInfo->list.array,ulInfo->list.size);
    if(ulInfo->list.array == NULLP)
-   {
+   {  
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for array in BuildULTnlInfo()");
       return RFAILED;
    }
    for(idx=0; idx<ulCnt; idx++)
@@ -2195,7 +2205,8 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
       CU_ALLOC(ulInfo->list.array[idx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
       if(ulInfo->list.array[idx] == NULLP)
       {
-        return RFAILED;
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for arrayIdx [%d] in BuildULTnlInfo()", idx);
+             return RFAILED;
       }
    }
    idx = 0;
@@ -2206,6 +2217,7 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
         sizeof(GTPTunnel_t));
    if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for gTPTunnel in BuildULTnlInfo()");
       return RFAILED;
    }
    ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
@@ -2216,6 +2228,7 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
         transportLayerAddress.buf == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for gtp tunnel arrayIdx[%d] in BuildULTnlInfo()", idx);
       return RFAILED;
    }
    /* NOTE: Below IP address must be changed if running on different IP configuration */
@@ -2238,6 +2251,7 @@ uint8_t BuildULTnlInfo(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    if(ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
         == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for gtp tunnel buffer in BuildULTnlInfo()");
       return RFAILED;
    }
    ulInfo->list.array[idx]->uLUPTNLInformation.choice.gTPTunnel->\
@@ -2274,12 +2288,13 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
    uint8_t BuildFlowsMapret =0, BuildULTnlInforet =0, drbCnt = 0;
    DRBs_ToBeSetup_Item_t *drbSetItem;
    
-   drbCnt = MAX_DRB_SET;
+   drbCnt = MAX_DRB_SET_UE_CONTEXT_SETUP_REQ;
    drbSet->list.count = drbCnt;
    drbSet->list.size = drbCnt*sizeof(DRBs_ToBeSetup_ItemIEs_t *);
    CU_ALLOC(drbSet->list.array,drbSet->list.size);
    if(drbSet->list.array == NULLP)
    {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDRBSetup");
       return RFAILED;
    }
    for(idx=0; idx<drbCnt; idx++)
@@ -2287,6 +2302,7 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
       CU_ALLOC(drbSet->list.array[idx],sizeof(DRBs_ToBeSetup_ItemIEs_t));
       if(drbSet->list.array[idx] == NULLP)
       {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDRBSetup for arry idx [%d]", idx);
              return RFAILED;
       }
 
@@ -2302,6 +2318,7 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
       CU_ALLOC(drbSetItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
       if(drbSetItem->qoSInformation.choice.choice_extension == NULLP)
       {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed for QOS choice extension in BuildDRBSetup");
          return RFAILED;
       }
       drbSetItem->qoSInformation.choice.choice_extension->id = \
@@ -2311,9 +2328,11 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
       drbSetItem->qoSInformation.choice.choice_extension->value.present = \
                                                                       QoSInformation_ExtIEs__value_PR_DRB_Information;
       BuildQOSInforet =  BuildQOSInfo(&drbSetItem->qoSInformation.choice.\
-                             choice_extension->value.choice.DRB_Information.dRB_QoS);
+                             choice_extension->value.choice.DRB_Information.dRB_QoS,\
+                         ProtocolIE_ID_id_DRBs_ToBeSetup_Item);
       if(BuildQOSInforet != ROK)
       {
+         DU_LOG("\nERROR  -->  F1AP : Failed to build QOS Info in BuildDRBSetup");
          return RFAILED;
       }
       /*SNSSAI*/
@@ -2321,31 +2340,27 @@ uint8_t BuildDRBSetup(DRBs_ToBeSetup_List_t *drbSet)
                               choice_extension->value.choice.DRB_Information.sNSSAI);
       if(BuildSNSSAIret != ROK)
       {
+         DU_LOG("\nERROR  -->  F1AP : Failed to build SNSSAI Info in BuildDRBSetup");
          return RFAILED;
       }
       /*Flows mapped to DRB List*/
       BuildFlowsMapret = BuildFlowsMap(&drbSetItem->qoSInformation.choice.\
-                  choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List);
+                  choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List,\
+              ProtocolIE_ID_id_DRBs_ToBeSetup_Item);
       if(BuildFlowsMapret != ROK)
       {
+         DU_LOG("\nERROR  -->  F1AP : Failed to build Flow Map Info in BuildDRBSetup");
          return RFAILED;
       }
       /*ULUPTNLInformation To Be Setup List*/
       BuildULTnlInforet = BuildULTnlInfo(&drbSetItem->uLUPTNLInformation_ToBeSetup_List);
       if(BuildULTnlInforet != ROK)
       {
+         DU_LOG("\nERROR  -->  F1AP : Failed to build tunnel Info in BuildDRBSetup");
          return RFAILED;
       }
       /*RLCMode*/
       drbSetItem->rLCMode = RLCMode_rlc_um_bidirectional;
-
-      /*UL Configuration*/
-      CU_ALLOC(drbSetItem->uLConfiguration,sizeof(ULConfiguration_t));
-      if(drbSetItem->uLConfiguration == NULLP)
-      {
-         return RFAILED;
-      }
-      drbSetItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data;
   }
    return ROK;
 }/* End of BuildDRBSetup*/
@@ -7027,13 +7042,52 @@ void FreeUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
       CU_FREE(ulInfo->list.array,ulInfo->list.size);
    }
 }
+
+/*******************************************************************
+*
+* @brief Deletes the EGTP tunnel
+*
+* @details
+*
+*    Function : deleteEgtpTunnel 
+*
+*    Functionality: Deletes the EGTP tunnel
+*
+* @params[in] uint8_t *buf
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t deleteEgtpTunnel(uint8_t *buf)
+{
+   uint32_t teId = 0;
+   EgtpTnlEvt tnlEvt;
+
+   teIdStringToInt(buf, &teId); 
+   if(teId > MAX_TEID || teId < MIN_TEID)
+   {
+      DU_LOG("\nERROR  -->  EGTP : TEID(%d) OUT Of Range", teId);
+      return RFAILED;
+   }
+   memset(&tnlEvt, 0, sizeof(EgtpTnlEvt));
+   tnlEvt.action = EGTP_TNL_MGMT_DEL;
+   tnlEvt.lclTeid = teId;
+   tnlEvt.remTeid = teId;
+   if((cuEgtpTnlMgmtReq(tnlEvt)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  EGTP : Failed to delete tunnel Id %d", teId);
+   }
+   return ROK;
+}
+
 /*******************************************************************
 *
 * @brief Builds the Uplink Tunnel Info
 *
 * @details
 *
-*    Function : BuildUlTnlInfoforDrb2 
+*    Function : BuildUlTnlInfoforSetupMod 
 *
 *    Functionality: Constructs the UL TnlInfo For DRB list
 *
@@ -7043,7 +7097,7 @@ void FreeUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
 *         RFAILED - failure
 *
 * ****************************************************************/
-uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
+uint8_t BuildUlTnlInfoforSetupMod(ULUPTNLInformation_ToBeSetup_List_t *ulInfo, uint8_t actionType)
 {
    uint8_t arrIdx;
    uint8_t ulCnt;
@@ -7054,7 +7108,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    CU_ALLOC(ulInfo->list.array,ulInfo->list.size);
    if(ulInfo->list.array == NULLP)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforSetupMod");
       return RFAILED;
    }
    for(arrIdx=0; arrIdx<ulCnt; arrIdx++)
@@ -7062,7 +7116,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
       CU_ALLOC(ulInfo->list.array[arrIdx],sizeof(ULUPTNLInformation_ToBeSetup_Item_t));
       if(ulInfo->list.array[arrIdx] == NULLP)
       {
-         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforSetupMod");
         return RFAILED;
       }
    }
@@ -7076,7 +7130,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
         sizeof(GTPTunnel_t));
    if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel == NULLP)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforSetupMod");
       return RFAILED;
    }
    ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
@@ -7087,7 +7141,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
         transportLayerAddress.buf == NULLP)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforSetupMod");
       return RFAILED;
    }
    
@@ -7111,7 +7165,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
    if(ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->gTP_TEID.buf\
         == NULLP)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforDrb2");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildUlTnlInfoforSetupMod");
       return RFAILED;
    }
    ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
@@ -7120,20 +7174,31 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
       gTP_TEID.buf[1] = 0;
    ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
       gTP_TEID.buf[2] = 0;
-   ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
-      gTP_TEID.buf[3] = cuCfgParams.egtpParams.currTunnelId++;
+   if(actionType == ProtocolIE_ID_id_DRBs_ToBeModified_Item)
+   {
+     /*TODO: DRB context to be stored in CU STUB so that tunnel Id can be easily
+      * fetched based on the Drb Id */
+      ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+         gTP_TEID.buf[3] = 2; /* Tunnel Id for Drb is 2. Hence passing the same TeId */
 
+   }
+   else
+   {
+      ulInfo->list.array[arrIdx]->uLUPTNLInformation.choice.gTPTunnel->\
+        gTP_TEID.buf[3] = cuCfgParams.egtpParams.currTunnelId++;
+   }
    return ROK;
 }/*End of BuildULTnlInfo*/
+
 /*******************************************************************
 *
-* @brief freeing the DRB item
+* @brief freeing the DRB item
 *
 * @details
 *
-*    Function : FreeDrb2Item 
+*    Function : FreeDrbItem 
 *
-*    Functionality: freeing the DRB item
+*    Functionality: freeing the DRB item
 *
 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
 *
@@ -7142,7 +7207,7 @@ uint8_t BuildUlTnlInfoforDrb2(ULUPTNLInformation_ToBeSetup_List_t *ulInfo)
 *
 * ****************************************************************/
 
-void FreeDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
+void FreeDrbItem(DRBs_ToBeSetupMod_Item_t *drbItem)
 {
    uint8_t arrIdx =0;
    SNSSAI_t *snssai =NULLP;
@@ -7207,16 +7272,18 @@ void FreeDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
       CU_FREE(drbItem->uLConfiguration,sizeof(ULConfiguration_t));
    }
 }
+
 /*******************************************************************
 *
-* @brief filling the DRB 2 item 
+* @brief filling the DRB setup Mod item 
 *
 * @details
 *
-*    Function : FillDrb2Item 
-*
-*    Functionality: filling the DRB 2 item 
+*    Function : FillDrbItemToSetupMod 
 *
+*    Functionality: filling the DRB setup Mod item
+*    
+*    
 * @params[in] DRBs_ToBeSetupMod_Item_t *drbItem 
 *
 * @return ROK     - success
@@ -7224,12 +7291,12 @@ void FreeDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
 *
 * ****************************************************************/
 
-uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
+uint8_t FillDrbItemToSetupMod(uint8_t arrIdx, DRBs_ToBeSetupMod_Item_t *drbItem)
 {
    uint8_t ret = ROK;
 
    /*Drb Id */
-   drbItem->dRBID = DRB2;
+   drbItem->dRBID = arrIdx + DRB3;
    
    /*qoSInformation*/
    drbItem->qoSInformation.present = QoSInformation_PR_choice_extension;
@@ -7246,7 +7313,7 @@ uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
         CU_ALLOC(drbItem->qoSInformation.choice.eUTRANQoS, sizeof(EUTRANQoS_t));
         if(drbItem->qoSInformation.choice.eUTRANQoS)
         {  
-           DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrb2Item");
+           DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrbItemToSetupMod");
            return RFAILED;
         }
         drbItem->qoSInformation.choice.eUTRANQoS->qCI = QCI;
@@ -7266,14 +7333,15 @@ uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
         CU_ALLOC(drbItem->qoSInformation.choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
         if(drbItem->qoSInformation.choice.choice_extension == NULLP)
         {
-           DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrb2Item"); 
+           DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrbItemToSetupMod"); 
            return RFAILED;
         }
 
         drbItem->qoSInformation.choice.choice_extension->id = ProtocolIE_ID_id_DRB_Information;
         drbItem->qoSInformation.choice.choice_extension->criticality = Criticality_ignore;
         drbItem->qoSInformation.choice.choice_extension->value.present = QoSInformation_ExtIEs__value_PR_DRB_Information;
-        ret =  BuildQOSInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS);
+        ret =  BuildQOSInfo(&drbItem->qoSInformation.choice.choice_extension->value.choice.DRB_Information.dRB_QoS,\
+           ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
         if(ret != ROK)
         {
            DU_LOG("\nERROR  -->  F1AP : BuildQOSInfo failed");
@@ -7291,7 +7359,8 @@ uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
         
         /*Flows mapped to DRB List*/
          ret = BuildFlowsMap(&drbItem->qoSInformation.choice.\
-              choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List);
+              choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List,\ 
+          ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
         if(ret != ROK)
         {
            DU_LOG("\nERROR  -->  F1AP : BuildFlowsMap failed");
@@ -7301,26 +7370,18 @@ uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
    }
    
    /*ULUPTNLInformation To Be Setup List*/
-   ret = BuildUlTnlInfoforDrb2(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+   ret = BuildUlTnlInfoforSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List, ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item);
    if(ret != ROK)
    {
-      DU_LOG("\nERROR  -->  F1AP : BuildUlTnlInfoforDrb2 failed");
+      DU_LOG("\nERROR  -->  F1AP : BuildUlTnlInfoforSetupMod failed");
       return RFAILED;
    }
 
    /*RLCMode*/
    drbItem->rLCMode = RLCMode_rlc_um_bidirectional;
-
-   /*UL Configuration*/
-   CU_ALLOC(drbItem->uLConfiguration,sizeof(ULConfiguration_t));
-   if(drbItem->uLConfiguration == NULLP)
-   {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrb2Item");
-      return RFAILED;
-   }
-   drbItem->uLConfiguration->uLUEConfiguration = ULUEConfiguration_no_data;
    return ROK;
 }
+
 /*******************************************************************
 *
 * @brief Builds the DRB to be Setup Mod ItemIes
@@ -7338,15 +7399,15 @@ uint8_t FillDrb2Item(DRBs_ToBeSetupMod_Item_t *drbItem)
 *
 * ****************************************************************/
 
-uint8_t FillDrbItemList(struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe)
+uint8_t FillDrbItemList(uint8_t arrIdx, struct DRBs_ToBeSetupMod_ItemIEs *drbItemIe)
 {
    drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item;
    drbItemIe->criticality = Criticality_reject;
    drbItemIe->value.present = DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item;
 
-   if(FillDrb2Item(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item)) != ROK)
+   if(FillDrbItemToSetupMod(arrIdx, (&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item))) != ROK)
    {
-      DU_LOG("\nERROR  -->  F1AP : FillDrb2Item failed"); 
+      DU_LOG("\nERROR  -->  F1AP : FillDrbItemToSetupMod failed"); 
       return RFAILED;
    }
    return ROK;
@@ -7381,7 +7442,7 @@ void FreeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
            if(arrIdx == 0)
            {
               drbItemIe = (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx];
-              FreeDrb2Item(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
+              FreeDrbItem(&(drbItemIe->value.choice.DRBs_ToBeSetupMod_Item));
            }
            CU_FREE(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeSetupMod_ItemIEs_t));
         }
@@ -7391,14 +7452,13 @@ void FreeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
    
 }
 
-
 /*******************************************************************
 *
 * @brief Builds the DRB to be Setup Mod list 
 *
 * @details
 *
-*    Function : BuildDrbToBeSetupModList 
+*    Function : BuildDrbToBeSetupList 
 *
 *    Functionality: Constructs the DRB to be Setup Mod list
 *
@@ -7409,33 +7469,34 @@ void FreeDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
 *
 * ****************************************************************/
 
-uint8_t BuildDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
+uint8_t BuildDrbToBeSetupList(DRBs_ToBeSetupMod_List_t *drbSet)
 {
    uint8_t ret = ROK;
    uint8_t arrIdx =0;
    uint8_t drbCnt =0;
 
-   drbCnt = 1;
+   drbCnt = MAX_DRB_SET_UE_CONTEXT_MOD_REQ;
    drbSet->list.count = drbCnt;
    drbSet->list.size = drbCnt * sizeof(DRBs_ToBeSetupMod_ItemIEs_t *);
    CU_ALLOC(drbSet->list.array, drbSet->list.size);
    if(drbSet->list.array == NULLP)
    {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupList");
       return  RFAILED;
    }
+
    for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
    {
       CU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeSetupMod_ItemIEs_t));
       if(drbSet->list.array[arrIdx] == NULLP)
       {
-         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupModList");
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupList for array idx [%d]", arrIdx);
         return  RFAILED;
       }
    }
 
-   arrIdx=0;
-   ret = FillDrbItemList((DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
+   arrIdx = 0;
+   ret = FillDrbItemList(arrIdx, (DRBs_ToBeSetupMod_ItemIEs_t *)drbSet->list.array[arrIdx]);
    if(ret != ROK)
    {
       DU_LOG("\nERROR  -->  F1AP : FillDrbItemList failed");
@@ -7443,6 +7504,322 @@ uint8_t BuildDrbToBeSetupModList(DRBs_ToBeSetupMod_List_t *drbSet)
 
    return ret;
 }
+
+/*******************************************************************
+*
+* @brief Filling the DRB to be modified item 
+*
+* @details
+*
+*    Function : FillDrbToBeModItem
+*
+*    Functionality: filling the DRB to be modified item
+*
+* @params[in] DRBs_ToBeModified_Item_t *drbItem 
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t FillDrbToBeModItem(DRBs_ToBeModified_Item_t *drbItem)
+{
+   uint8_t ret = ROK;
+
+   /*Drb Id */
+   drbItem->dRBID = DRB2;
+
+   /*qoSInformation*/
+   drbItem->qoSInformation = NULLP;
+   CU_ALLOC(drbItem->qoSInformation, sizeof(QoSInformation_t));
+   if(drbItem->qoSInformation != NULLP)
+   {
+      drbItem->qoSInformation->present = QoSInformation_PR_choice_extension;
+
+      switch(drbItem->qoSInformation->present)
+      {
+         case QoSInformation_PR_NOTHING:
+            {
+               break;
+            }
+         case QoSInformation_PR_eUTRANQoS:
+            {
+
+               CU_ALLOC(drbItem->qoSInformation->choice.eUTRANQoS, sizeof(EUTRANQoS_t));
+               if(drbItem->qoSInformation->choice.eUTRANQoS)
+               {  
+                  DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrbToBeModItem");
+                  return RFAILED;
+               }
+               drbItem->qoSInformation->choice.eUTRANQoS->qCI = QCI;
+               drbItem->qoSInformation->choice.eUTRANQoS->allocationAndRetentionPriority.priorityLevel =
+                  PriorityLevel_no_priority;
+
+               drbItem->qoSInformation->choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionCapability =
+                  Pre_emptionCapability_may_trigger_pre_emption;
+
+               drbItem->qoSInformation->choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionVulnerability =
+                  Pre_emptionVulnerability_pre_emptable;
+
+               break;
+            }
+         case QoSInformation_PR_choice_extension:
+            {
+               CU_ALLOC(drbItem->qoSInformation->choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
+               if(drbItem->qoSInformation->choice.choice_extension == NULLP)
+               {
+                  DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in FillDrbItemToSetupMod"); 
+                  return RFAILED;
+               }
+
+               drbItem->qoSInformation->choice.choice_extension->id = ProtocolIE_ID_id_DRB_Information;
+               drbItem->qoSInformation->choice.choice_extension->criticality = Criticality_ignore;
+               drbItem->qoSInformation->choice.choice_extension->value.present = QoSInformation_ExtIEs__value_PR_DRB_Information;
+               ret =  BuildQOSInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.dRB_QoS,\
+                     ProtocolIE_ID_id_DRBs_ToBeModified_Item);
+               if(ret != ROK)
+               {
+                  DU_LOG("\nERROR  -->  F1AP : BuildQOSInfo failed");
+                  return RFAILED;
+               }
+
+               /*SNSSAI*/
+               ret = BuildSNSSAI(&drbItem->qoSInformation->choice.\
+                     choice_extension->value.choice.DRB_Information.sNSSAI);
+               if(ret != ROK)
+               {
+                  DU_LOG("\nERROR  -->  F1AP : BuildSNSSAI failed");
+                  return RFAILED;
+               }
+
+               /*Flows mapped to DRB List*/
+               ret = BuildFlowsMap(&drbItem->qoSInformation->choice.\
+                     choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List,\
+                     ProtocolIE_ID_id_DRBs_ToBeModified_Item);
+               if(ret != ROK)
+               {
+                  DU_LOG("\nERROR  -->  F1AP : BuildFlowsMap failed");
+                  return RFAILED;
+               }
+            }
+      }
+   }/* End of QoS */
+
+   /*ULUPTNLInformation To Be Setup List*/
+   ret = BuildUlTnlInfoforSetupMod(&drbItem->uLUPTNLInformation_ToBeSetup_List,\
+            ProtocolIE_ID_id_DRBs_ToBeModified_Item);
+   if(ret != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : BuildUlTnlInfoforSetupMod failed");
+      return RFAILED;
+   }
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds the DRB to be modified Item IE
+*
+* @details
+*
+*    Function : FillDrbToBeModItemList
+*
+*    Functionality: Constructs the DRB to be modified Mod Item Ies
+*
+* @params[in] struct DRBs_ToBeModified_ItemIEs *drbItemIe
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t FillDrbToBeModItemList(struct DRBs_ToBeModified_ItemIEs *drbItemIe)
+{
+   drbItemIe->id = ProtocolIE_ID_id_DRBs_ToBeModified_Item;
+   drbItemIe->criticality = Criticality_reject;
+   drbItemIe->value.present = DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item;
+   if(FillDrbToBeModItem(&(drbItemIe->value.choice.DRBs_ToBeModified_Item)) != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : FillDrbToBeModItem failed"); 
+      return RFAILED;
+   }
+
+   return ROK;
+}
+
+/*******************************************************************
+*
+* @brief Builds the DRB to be modified list 
+*
+* @details
+*
+*    Function : BuildDrbToBeModList 
+*
+*    Functionality: Constructs the DRB to be modified list
+*
+* @params[in] DRBs_ToBeModified_List_t *drbSet 
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+uint8_t BuildDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet)
+{
+   uint8_t ret = ROK;
+   uint8_t arrIdx =0;
+   uint8_t drbCnt =0;
+
+   drbCnt = 1;
+   drbSet->list.count = drbCnt;
+   drbSet->list.size = drbCnt * sizeof(DRBs_ToBeModified_ItemIEs_t *);
+   CU_ALLOC(drbSet->list.array, drbSet->list.size);
+   if(drbSet->list.array == NULLP)
+   {
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeModifiedList");
+      return  RFAILED;
+   }
+   for(arrIdx=0; arrIdx<drbCnt; arrIdx++)
+   {
+      CU_ALLOC(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeModified_ItemIEs_t));
+      if(drbSet->list.array[arrIdx] == NULLP)
+      {
+         DU_LOG("\nERROR  -->  F1AP : Memory allocation failed in BuildDrbToBeSetupList");
+        return  RFAILED;
+      }
+   }
+
+   arrIdx=0;
+   ret = FillDrbToBeModItemList((DRBs_ToBeModified_ItemIEs_t *)drbSet->list.array[arrIdx]);
+   if(ret != ROK)
+   {
+      DU_LOG("\nERROR  -->  F1AP : FillDrbToBeModItemList failed");
+   }
+
+   return ret;
+}
+
+/*******************************************************************
+*
+* @brief freeing the DRB  item
+*
+* @details
+*
+*    Function : FreeModifiedDrbItem
+*
+*    Functionality: freeing the DRB 2 item
+*
+* @params[in] DRBs_ToBeSetupMod_Item_t *drbItem
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+
+void FreeModifiedDrbItem(DRBs_ToBeModified_Item_t *drbItem)
+{
+   uint8_t arrIdx =0;
+   SNSSAI_t *snssai =NULLP;
+   Flows_Mapped_To_DRB_List_t *flowMap = NULLP;
+
+   if(drbItem->qoSInformation != NULLP)
+   { 
+      switch(drbItem->qoSInformation->present)
+      {
+         case QoSInformation_PR_NOTHING:
+            break;
+         case QoSInformation_PR_eUTRANQoS:
+            {
+               if(drbItem->qoSInformation->choice.eUTRANQoS)
+               {
+                  CU_FREE(drbItem->qoSInformation->choice.eUTRANQoS, sizeof(EUTRANQoS_t));
+               }
+               break;
+            }
+         case QoSInformation_PR_choice_extension:
+            {
+               if(drbItem->qoSInformation->choice.choice_extension)
+               {
+                  FreeQOSInfo(&drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.dRB_QoS);
+
+                  snssai = &drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.sNSSAI;
+                  if(snssai->sST.buf)
+                  {
+                     CU_FREE(snssai->sST.buf,snssai->sST.size);
+                  }
+                  if(snssai->sD)
+                  {
+                     if(snssai->sD->buf)
+                     {
+                        CU_FREE(snssai->sD->buf,snssai->sD->size);
+                     }
+                     CU_FREE(snssai->sD,sizeof(OCTET_STRING_t));
+                  }
+
+                  flowMap = &drbItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information.flows_Mapped_To_DRB_List;
+                  if(flowMap->list.array)
+                  {
+                     for(arrIdx=0; arrIdx<flowMap->list.count; arrIdx++)
+                     {
+                        if(flowMap->list.array[arrIdx] )
+                        {
+                           FreeQOSInfo(&flowMap->list.array[arrIdx]->qoSFlowLevelQoSParameters);
+                           CU_FREE(flowMap->list.array[arrIdx],sizeof(Flows_Mapped_To_DRB_Item_t));
+                        }
+                     }
+                     CU_FREE(flowMap->list.array,flowMap->list.size);
+                  }
+
+                  CU_FREE(drbItem->qoSInformation->choice.choice_extension,sizeof(QoSInformation_ExtIEs_t));
+               }
+               break;
+            }
+      }
+   }
+   FreeUlTnlInfoforDrb2(&drbItem->uLUPTNLInformation_ToBeSetup_List);
+   if(drbItem->uLConfiguration)
+   {
+      CU_FREE(drbItem->uLConfiguration,sizeof(ULConfiguration_t));
+   }
+}
+
+/*******************************************************************
+*
+* @brief free the DRB to be modfified list
+*
+* @details
+*
+*    Function : FreeDrbToBeModifiedList
+*
+*    Functionality: free the DRB to be Setup Mod list
+*
+* @params[in] FreeDrbToBeModifiedList_t *drbSet
+*
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+void FreeDrbToBeModifiedList(DRBs_ToBeModified_List_t *drbSet)
+{
+   uint8_t arrIdx =0;
+   struct DRBs_ToBeModified_ItemIEs *drbItemIe;
+
+   if(drbSet->list.array)
+   {
+      for(arrIdx=0; arrIdx<drbSet->list.count ; arrIdx++)
+      {
+         if(drbSet->list.array[arrIdx] != NULLP)
+         {
+            drbItemIe = (struct DRBs_ToBeModified_ItemIEs *)drbSet->list.array[arrIdx];
+            FreeModifiedDrbItem(&(drbItemIe->value.choice.DRBs_ToBeModified_Item));
+            CU_FREE(drbSet->list.array[arrIdx], sizeof(DRBs_ToBeModified_ItemIEs_t));
+         }
+      }
+      CU_FREE(drbSet->list.array, drbSet->list.size);
+   }
+
+}
+
 /*******************************************************************
  *
  * @brief  free the UeContextModification Request 
@@ -7468,33 +7845,40 @@ void FreeUeContextModicationRequest(F1AP_PDU_t *f1apMsg)
    {
       if(f1apMsg->choice.initiatingMessage)
       {
-        UeContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
-        if(UeContextModifyReq->protocolIEs.list.array)
-        {
-           for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
-           {
-              if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
-              {
-                 ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
-                 switch(ieId)
-                 {
-                    case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
-                       break;
-                    case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
-                       {
-                          FreeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
-                          choice.DRBs_ToBeSetupMod_List);
-                          break;
-                       }
-                 }
-                 CU_FREE(UeContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t));
-              }          
-           }
-           CU_FREE(UeContextModifyReq->protocolIEs.list.array, UeContextModifyReq->protocolIEs.list.size);
-        }
-        CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
+         UeContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
+         if(UeContextModifyReq->protocolIEs.list.array)
+         {
+            for( arrIdx = 0 ; arrIdx<UeContextModifyReq->protocolIEs.list.count ; arrIdx++)
+            {
+               if(UeContextModifyReq->protocolIEs.list.array[arrIdx])
+               {
+                  ieId = UeContextModifyReq->protocolIEs.list.array[arrIdx]->id;
+                  switch(ieId)
+                  {
+                     case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                        break;
+                     case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
+                        {
+                           FreeDrbToBeSetupModList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
+                                 choice.DRBs_ToBeSetupMod_List);
+                           break;
+                        }
+                     case ProtocolIE_ID_id_DRBs_ToBeModified_List:
+                        {
+                           FreeDrbToBeModifiedList(&UeContextModifyReq->protocolIEs.list.array[arrIdx]->value.\
+                                 choice.DRBs_ToBeSetupMod_List);
+                           break;
+                        }
+
+                  }
+                  CU_FREE(UeContextModifyReq->protocolIEs.list.array[arrIdx], sizeof(UEContextModificationRequest_t));
+               }         
+            }
+            CU_FREE(UeContextModifyReq->protocolIEs.list.array, UeContextModifyReq->protocolIEs.list.size);
+         }
+         CU_FREE(f1apMsg->choice.initiatingMessage, sizeof(InitiatingMessage_t));
       }
       CU_FREE(f1apMsg, sizeof(F1AP_PDU_t));
    }
@@ -7549,7 +7933,7 @@ uint8_t BuildAndSendUeContextModificationReq(uint8_t ueId)
 
       ueContextModifyReq =&f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
 
-      elementCnt = 3;
+      elementCnt = 4;
       ueContextModifyReq->protocolIEs.list.count = elementCnt;
       ueContextModifyReq->protocolIEs.list.size = elementCnt*sizeof(UEContextModificationRequest_t *);
 
@@ -7586,13 +7970,26 @@ uint8_t BuildAndSendUeContextModificationReq(uint8_t ueId)
                                                                        UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
       ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.choice.GNB_DU_UE_F1AP_ID = ueId;
 
+      /* DRB to be setup list */
       ieIdx++;
       ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeSetupMod_List;
       ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
       ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
          UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List;
-      ret = BuildDrbToBeSetupModList(&(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+      ret = BuildDrbToBeSetupList(&(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
          value.choice.DRBs_ToBeSetupMod_List));
+
+      /* DRB to be modified list */
+      ieIdx++;
+      ueContextModifyReq->protocolIEs.list.array[ieIdx]->id = ProtocolIE_ID_id_DRBs_ToBeModified_List;
+      ueContextModifyReq->protocolIEs.list.array[ieIdx]->criticality = Criticality_reject;
+      ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present =\
+         UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List;
+      ret = BuildDrbToBeModifiedList(&(ueContextModifyReq->protocolIEs.list.array[ieIdx]->\
+         value.choice.DRBs_ToBeModified_List));
+
+      /* TODO: DRB to be release list */
+         
       if(ret != ROK)
       {
          break;
@@ -7784,7 +8181,7 @@ uint8_t BuildAndSendUeContextReleaseCommand(uint8_t cuUeF1apId, uint8_t duUeF1ap
       ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.size);
       if(!ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf)
       {
-      DU_LOG("\nERROR  -->  F1AP : Memory allocation for BuildAndSendUeContextSetupReq failed");
+      DU_LOG("\nERROR  -->  F1AP : Memory allocation for BuildAndSendUeContextReleaseCommand failed");
       break;
       }
       memset(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->value.choice.RRCContainer.buf, 0, bufLen);
@@ -7995,6 +8392,51 @@ uint8_t buildSliceList(SliceSupportList_t *sliceSupportList)
    return ROK;
 }
 
+/****************************************************************
+ * @brief Function to process Drb Setup Mod List 
+ *
+ * @details
+ *
+ *    Function : procDrbSetupModList
+ *    
+ *    Functionality:
+ *         - Function to process DRB Setup Mod List
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procDrbSetupModList(DRBs_SetupMod_List_t *drbSetupList)
+{
+   uint8_t arrIdx = 0;
+   uint32_t teId = 0;
+   struct DRBs_SetupMod_ItemIEs *drbItemIe = NULLP;
+
+   if(drbSetupList != NULLP)
+   {
+      for(arrIdx = 0; arrIdx < drbSetupList->list.count; arrIdx++)
+      {
+         drbItemIe = ((struct DRBs_SetupMod_ItemIEs *)drbSetupList->list.array[arrIdx]);
+         if(drbItemIe->value.present == DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item)
+         {
+            /* extracting teId */
+            teId  = extractTeId(&drbItemIe->value.choice.DRBs_SetupMod_Item.dLUPTNLInformation_ToBeSetup_List);
+            if(teId > 0)
+            {
+              if(addDrbTunnels(teId)== ROK)
+              {
+                DU_LOG("\nDEBUG  --> EGTP: Tunnel Added for TeId %d", teId);
+              }
+            }
+            else
+               return RFAILED;
+         }
+      }
+   }
+   return ROK;
+}
+
 /*******************************************************************
 *
 * @brief processing of GNB_DU_Served_Cells Plmn list  information
@@ -8053,6 +8495,49 @@ uint8_t procServedCellPlmnList(ServedPLMNs_List_t *srvPlmn)
    }
    return ROK;
 }
+
+/****************************************************************
+ * @brief Function to process Ue Context Modification Response 
+ *
+ * @details
+ *
+ *    Function : procUeContextModificationResponse
+ *    
+ *    Functionality:
+ *         - Function to process Ue Context Modification Response
+ *
+ * @params[in]
+ * @return ROK     - success
+ *         RFAILED - failure
+ *
+ * ****************************************************************/
+uint8_t procUeContextModificationResponse(F1AP_PDU_t *f1apMsg)
+{
+   uint8_t idx, duUeF1apId;
+       UEContextModificationResponse_t *ueCtxtModRsp = NULLP;
+   ueCtxtModRsp = &f1apMsg->choice.successfulOutcome->value.choice.UEContextModificationResponse;
+   
+   for(idx=0; idx < ueCtxtModRsp->protocolIEs.list.count; idx++)
+   {
+      switch(ueCtxtModRsp->protocolIEs.list.array[idx]->id)
+      {
+          case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+             {
+                duUeF1apId = ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.GNB_DU_UE_F1AP_ID;
+                break;
+             }
+          case ProtocolIE_ID_id_DRBs_SetupMod_List:
+             {
+                /* Adding Tunnels for successful DRB */
+                procDrbSetupModList(&ueCtxtModRsp->protocolIEs.list.array[idx]->value.choice.DRBs_SetupMod_List);
+                break; 
+
+             }
+      }
+   }
+   return ROK;
+}
+
 /*******************************************************************
 *
 * @brief processing of F1 setup request
@@ -8113,6 +8598,7 @@ void procF1SetupReq(F1AP_PDU_t *f1apMsg)
        DU_LOG("\nERROR  --> CU_STUB: procF1SetupReq(): Failed to process F1 setup request");
    }
 }
+
 /*******************************************************************
  *
  * @brief Handles received F1AP message and sends back response  
@@ -8257,6 +8743,7 @@ void F1APMsgHdlr(Buffer *mBuf)
                case SuccessfulOutcome__value_PR_UEContextModificationResponse:
                   {
                      DU_LOG("\nINFO  -->  F1AP : UE Context Modification Response received");
+                     procUeContextModificationResponse(f1apMsg);
                      break;
                   }
                case SuccessfulOutcome__value_PR_UEContextReleaseComplete:
index af563e5..b8ceb09 100644 (file)
 #define SRB1 1
 #define SRB2 2
 #define DRB1 1
-#define DRB2 6 //Pls Ignore this; to avoid the collision with DRBID=2 in UE COntext setup
+#define DRB2 2
+#define DRB3 3
 #define QCI  9
-#define MAX_DRB_SET 2
+#define MAX_DRB_SET_UE_CONTEXT_SETUP_REQ 2
+#define MAX_DRB_SET_UE_CONTEXT_MOD_REQ 1
 
 #define CU_UE_F1AP_ID 0
 #define DU_UE_F1AP_ID 1
index 8017d6d..bb82b16 100644 (file)
@@ -7552,7 +7552,7 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
       DU_ALLOC_SHRABL_BUF(macLcToAdd->drbQos, sizeof(DrbQosInfo));
       if(macLcToAdd->drbQos == NULLP)
       {
-         DU_LOG("\nERROR  -->  DUAPP:Memory failed at allocating DrbQos at extractDrbCfg()");
+         DU_LOG("\nERROR  -->  DUAPP:Memory failed at allocating DrbQos at extractDrbQosCfg()");
          return RFAILED;
       }
 
@@ -7567,7 +7567,7 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
       DU_ALLOC_SHRABL_BUF(macLcToAdd->snssai, sizeof(Snssai));
       if(macLcToAdd->snssai == NULLP)
       {
-         DU_LOG("\nERROR  -->  DUAPP : Memory failed at allocating SNSSAI at extractDrbCfg()");
+         DU_LOG("\nERROR  -->  DUAPP : Memory failed at allocating SNSSAI at extractDrbQosCfg()");
          return RFAILED;
       }
    }
@@ -7594,8 +7594,8 @@ uint8_t extractDrbQosCfg(DRB_Information_t *drbInfo, LcCfg *macLcToAdd )
  * @return void
  *
  * ****************************************************************/
-uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem,DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
-LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
+uint8_t extractDrbCfg(DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem,\
+DRBs_ToBeModified_Item_t *drbModItem,  LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
 {
    DRB_Information_t *drbInfo = NULLP;
 
@@ -7642,7 +7642,32 @@ LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
          }
       }
    }
+   else if(drbModItem != NULLP)
+   {
+      if(extractUpTnlInfo(drbModItem->dRBID, CONFIG_MOD, &drbModItem->uLUPTNLInformation_ToBeSetup_List,\
+      upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  -->  DUAPP : Failed to extract tunnel Cfg at extractDrbCfg()");
+         return RFAILED;
+      }
+      if(drbModItem->qoSInformation != NULLP)
+      {
+         if(drbModItem->qoSInformation->present == QoSInformation_PR_choice_extension)
+         {
+            if(drbModItem->qoSInformation->choice.choice_extension->value.present ==\
+                  QoSInformation_ExtIEs__value_PR_DRB_Information)
+            {
+               drbInfo = &drbModItem->qoSInformation->choice.choice_extension->value.choice.DRB_Information;
+               if(extractDrbQosCfg(drbInfo , macLcToAdd) != ROK)
+               {
+                  DU_LOG("\nERROR  -->  DUAPP : Failed to extract qos Cfg at extractDrbCfg()");  
+                  return RFAILED;
+               }
 
+            }
+         }
+      }
+   }
    return ROK;
 }
 
@@ -7662,11 +7687,11 @@ LcCfg *macLcToAdd, UpTnlCfg *upTnlInfo)
  * ****************************************************************/
 
 uint8_t extractMacRbCfg(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbCfg,\
-DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
+DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  DRBs_ToBeModified_Item_t *drbModCfg, LogicalChannelConfig_t *ulLcCfg, LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
    if(drbCfg != NULLP)
    {
-      if(extractDrbCfg(drbCfg, NULL, lcCfg, upTnlInfo) != ROK)
+      if(extractDrbCfg(drbCfg, NULL, NULL, lcCfg, upTnlInfo) != ROK)
       {
          DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
          return RFAILED;
@@ -7674,7 +7699,15 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  LogicalChannelConfig_t *ulLcCfg, LcCf
    }
    else if(drbSetupModCfg != NULLP)
    { 
-      if(extractDrbCfg(NULL, drbSetupModCfg, lcCfg, upTnlInfo) != ROK)
+      if(extractDrbCfg(NULL, drbSetupModCfg, NULL, lcCfg, upTnlInfo) != ROK)
+      {
+         DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
+         return RFAILED;
+      }
+   }
+   else if(drbModCfg != NULLP)
+   { 
+      if(extractDrbCfg(NULL, NULL, drbModCfg, lcCfg, upTnlInfo) != ROK)
       {
          DU_LOG("ERROR  -->  F1AP : Failed to build Drb Qos at extractMacRbCfg()");
          return RFAILED;
@@ -7714,8 +7747,8 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModCfg,  LogicalChannelConfig_t *ulLcCfg, LcCf
  *
  * ****************************************************************/
 
-uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType,\
-DRBs_ToBeSetup_Item_t *drbItem, DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LogicalChannelConfig_t *ulLcCfg,\
+uint8_t procMacLcCfg(uint8_t lcId, uint8_t rbType, uint8_t configType, DRBs_ToBeSetup_Item_t *drbItem,\
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LogicalChannelConfig_t *ulLcCfg,\
 LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
 {
    uint8_t ret = ROK;
@@ -7724,14 +7757,16 @@ LcCfg *lcCfg, UpTnlCfg *upTnlInfo)
    lcCfg->configType = configType;
    if(rbType == RB_TYPE_SRB)
    {
-      ret = extractMacRbCfg(lcId, NULL,NULL, ulLcCfg, lcCfg, NULL);
+      ret = extractMacRbCfg(lcId, NULL, NULL, NULL, ulLcCfg, lcCfg, NULL);
    }
    else if(rbType == RB_TYPE_DRB)
    {
       if(drbItem != NULL)
-        ret = extractMacRbCfg(lcId, drbItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
+        ret = extractMacRbCfg(lcId, drbItem, NULL, NULL, ulLcCfg, lcCfg, upTnlInfo);
       else if(drbSetupModItem != NULL)
-        ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, ulLcCfg, lcCfg, upTnlInfo);
+        ret = extractMacRbCfg(lcId, NULL, drbSetupModItem, NULL, ulLcCfg, lcCfg, upTnlInfo);
+      else if(drbModItem != NULL)
+        ret = extractMacRbCfg(lcId, NULL, NULL, drbModItem, ulLcCfg, lcCfg, upTnlInfo);
    }
    return ret;
 }
@@ -7803,7 +7838,7 @@ uint8_t extractRlcCfgToAddMod(struct CellGroupConfigRrc__rlc_BearerToAddModList
      memset(&ueCfgDb->macLcCfg[idx], 0, sizeof(LcCfg));
      memset(&ueCfgDb->rlcLcCfg[idx], 0, sizeof(RlcBearerCfg));
      procRlcLcCfg(rbId, lcId, rbType, rlcMode, CONFIG_UNKNOWN, f1RlcCfg, &(ueCfgDb->rlcLcCfg[idx]));
-     if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
+     if(procMacLcCfg(lcId, rbType, CONFIG_UNKNOWN, NULL, NULL, NULL, macUlLcCfg, &ueCfgDb->macLcCfg[idx], NULL) != ROK)
      {
         DU_LOG("\nERROR  -->  DU APP : Failed while filling MAC LC config at extractRlcCfgToAddMod()");
         return RFAILED;
@@ -9938,7 +9973,7 @@ uint8_t procSrbListToSetup(SRBs_ToBeSetup_Item_t * srbItem, LcCfg *macLcToAdd, R
    procRlcLcCfg(srbItem->sRBID, srbItem->sRBID, RB_TYPE_SRB, RLC_AM, CONFIG_ADD, NULL, rlcLcToAdd);
 
    /* Filling MAC INFO */
-   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, macLcToAdd, NULL);
+   ret = procMacLcCfg(srbItem->sRBID, RB_TYPE_SRB, CONFIG_ADD, NULL,NULL, NULL, NULL, macLcToAdd, NULL);
    if(ret == RFAILED)
    { 
       DU_LOG("\nERROR  -->  F1AP : Failed at MAC LC Cfg in procSrbListToSetup()");
@@ -10015,7 +10050,7 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
  *
  * @details
  *
- *    Function : procDrbListToSetup
+ *    Function : procDrbListToSetupMod
  *
  *    Functionality: Fills Drb List received by CU
  *                   for both MAC and RLC
@@ -10027,8 +10062,8 @@ uint8_t extractSrbListToSetup(SRBs_ToBeSetup_List_t *srbCfg, DuUeCfg *ueCfgDb)
  *
  * ****************************************************************/
 
-uint8_t procDrbListToSetup(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
-DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
+uint8_t procDrbListToSetupMod(uint8_t lcId, DRBs_ToBeSetup_Item_t *drbItem,\
+DRBs_ToBeSetupMod_Item_t *drbSetupModItem, DRBs_ToBeModified_Item_t *drbModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcLcToAdd, UpTnlCfg *upTnlInfo)
 {
 
    if(drbItem != NULLP)
@@ -10037,9 +10072,9 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL
       procRlcLcCfg(drbItem->dRBID, lcId, RB_TYPE_DRB, drbItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
 
       /* Filling MAC INFO */
-      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, drbItem, NULL, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
       { 
-         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
          return RFAILED;
       }
    }
@@ -10047,9 +10082,19 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL
    {
       procRlcLcCfg(drbSetupModItem->dRBID, lcId, RB_TYPE_DRB, drbSetupModItem->rLCMode, CONFIG_ADD, NULL, rlcLcToAdd);
 
-      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_ADD, NULL, drbSetupModItem, NULL, NULL, macLcToAdd, upTnlInfo) != ROK)
       {
-         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetup()");
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
+         return RFAILED;
+      }
+   }
+   else if(drbModItem != NULLP)
+   {
+      /* Drb to Mod IEs doesnot have rlcMode to be modified
+       * in ASN. Hence no change in RLC configurations */
+      if(procMacLcCfg(lcId, RB_TYPE_DRB, CONFIG_MOD, NULL, NULL, drbModItem, NULL, macLcToAdd, upTnlInfo) != ROK)
+      {
+         DU_LOG("\nERROR  --> F1AP : Failed at RLC LC Cfg in procDrbListToSetupMod()");
          return RFAILED;
       }
    }
@@ -10062,7 +10107,7 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL
  *
  * @details
  *
- *    Function : extractDrbListToSetup
+ *    Function : extractDrbListToSetupMod
  *
  *    Functionality: extract Drb List received by CU
  *                   for both MAC and RLC
@@ -10073,12 +10118,13 @@ DRBs_ToBeSetupMod_Item_t *drbSetupModItem, LcCfg *macLcToAdd, RlcBearerCfg *rlcL
  *
  * ****************************************************************/
 
-uint8_t extractDrbListToSetup(DRBs_ToBeSetup_List_t *drbCfg,DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
-uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap)
+uint8_t extractDrbListToSetupMod(DRBs_ToBeSetup_List_t *drbCfg, DRBs_ToBeSetupMod_List_t *drbSetupModCfg,\
+ DRBs_ToBeModified_List_t *drbModCfg, uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap)
 {
    uint8_t ret, drbIdx, lcId = 0;
    DRBs_ToBeSetup_Item_t *drbItem = NULLP;
    DRBs_ToBeSetupMod_ItemIEs_t *drbSetupModItem = NULLP;
+   DRBs_ToBeModified_ItemIEs_t *drbModItem = NULLP;
 
    ret = ROK;
    if(drbCount > 0)
@@ -10087,58 +10133,80 @@ uint8_t drbCount, DuUeCfg *ueCfgDb, uint32_t *drbBitMap)
       {
          if(ueCfgDb->numMacLcs > MAX_NUM_LC)
          { 
-            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in MAC at extractDrbListToSetup()");
+            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in MAC at extractDrbListToSetupMod()");
             ret = RFAILED;
             break;
          }
          if(ueCfgDb->numRlcLcs > MAX_NUM_LC)
          {
-            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in RLC at extractDrbListToSetup()");
+            DU_LOG("\nERROR  -->  F1AP :  MAX LC Reached in RLC at extractDrbListToSetupMod()");
             ret = RFAILED;
             break;
          }
          memset(&ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], 0, sizeof(LcCfg));
          memset(&ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], 0, sizeof(RlcBearerCfg));
 
-         lcId = getDrbLcId(drbBitMap);
-         if(lcId == RFAILED)
+         if(drbModCfg != NULLP)
          {
-            DU_LOG("\nERROR  -->  F1AP :  InCorrect LCID extractDrbListToSetup()");
-            ret = RFAILED;
-            break;
-         }
-         if(drbCfg != NULL)
-         {
-            drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
-            ret = procDrbListToSetup(lcId, drbItem, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
-               &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+            drbModItem = (DRBs_ToBeModified_ItemIEs_t *) drbModCfg->list.array[drbIdx];
+            lcId = fetchLcId(drbModItem->value.choice.DRBs_ToBeModified_Item.dRBID);
+            if(lcId < MIN_DRB_LCID)
+            {
+               DU_LOG("\nERROR  --> F1AP : Failed fetching LCID %d in extractDrbListToSetupMod() for Modified List", lcId);
+               break;
+            } 
+            ret = procDrbListToSetupMod(lcId, NULL, NULL, &(drbModItem->value.choice.DRBs_ToBeModified_Item),\
+            &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
+            &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
             if(ret == RFAILED)
             {
-               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
+               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for Modified List");
                break;
             }
+
          }
-         else if(drbSetupModCfg != NULL)
+         else
          {
-            drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
-            ret = procDrbListToSetup(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item) ,\
-            &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
-            &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
-            if(ret == RFAILED)
+            lcId = getDrbLcId(drbBitMap);
+            if(lcId == RFAILED)
             {
-               DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
+               DU_LOG("\nERROR  -->  F1AP :  InCorrect LCID extractDrbListToSetupMod()");
+               ret = RFAILED;
                break;
             }
+            if(drbCfg != NULL)
+            {
+               drbItem = &drbCfg->list.array[drbIdx]->value.choice.DRBs_ToBeSetup_Item;
+               ret = procDrbListToSetupMod(lcId, drbItem, NULL, NULL, &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs],\
+                     &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs], &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetup List");
+                  break;
+               }
+            }
+            else if(drbSetupModCfg != NULL)
+            {
+               drbSetupModItem = (DRBs_ToBeSetupMod_ItemIEs_t *) drbSetupModCfg->list.array[drbIdx];
+               ret = procDrbListToSetupMod(lcId, NULL, &(drbSetupModItem->value.choice.DRBs_ToBeSetupMod_Item), NULL,\
+                     &ueCfgDb->macLcCfg[ueCfgDb->numMacLcs], &ueCfgDb->rlcLcCfg[ueCfgDb->numRlcLcs],\
+                     &ueCfgDb->upTnlInfo[ueCfgDb->numDrb]);
+               if(ret == RFAILED)
+               {
+                  DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod() for DrbSetupMod List");
+                  break;
+               }
+            }
+            ueCfgDb->numRlcLcs++;
          }
-         ueCfgDb->numRlcLcs++;
          ueCfgDb->numMacLcs++;
          ueCfgDb->numDrb++;
  
-         DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetup:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
+         DU_LOG("\nDEBUG --> DUAPP: extractDrbListToSetupMod:lcId:%x ,BitMap:%x, [RLC,MAC,NumDrb]:[%x,%x,%x]",\
                             lcId,*drbBitMap, ueCfgDb->numRlcLcs, ueCfgDb->numMacLcs,  ueCfgDb->numDrb);
          if(ret == RFAILED)
          {
-            DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetup()");
+            DU_LOG("\nERROR  --> F1AP : Failed at extractDrbListToSetupMod()");
             break;
          }
       }
@@ -10473,9 +10541,9 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
             {
                   drbCfg = &ueSetReq->protocolIEs.list.array[ieIdx]->value.choice.DRBs_ToBeSetup_List;
 
-                  if(extractDrbListToSetup(drbCfg, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                  if(extractDrbListToSetupMod(drbCfg, NULL, NULL, drbCfg->list.count, &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
                   {
-                     DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetup()");
+                     DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod()");
                      //TODO: Update the failure cause in ue context Setup Response
                      ret = RFAILED;
                   }
@@ -12835,6 +12903,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
    uint8_t  ret = ROK, ieIdx = 0, cellIdx=0, ueIdx=0;
    DuUeCb   *duUeCb = NULLP;
    DRBs_ToBeSetupMod_List_t *drbSetupModCfg;
+   DRBs_ToBeModified_List_t *drbModifiedCfg;
    uint32_t gnbCuUeF1apId, gnbDuUeF1apId;
 
    ueContextModifyReq = &f1apMsg->choice.initiatingMessage->value.choice.UEContextModificationRequest;
@@ -12853,6 +12922,7 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                break;
             }
          case ProtocolIE_ID_id_DRBs_ToBeSetupMod_List:
+         case ProtocolIE_ID_id_DRBs_ToBeModified_List:
             {
                for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
                {
@@ -12863,19 +12933,41 @@ uint8_t procF1UeContextModificationReq(F1AP_PDU_t *f1apMsg)
                      {
 
                         duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                        if(duUeCb->f1UeDb == NULLP)
+                        {
                            DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
-                           if(duUeCb->f1UeDb)
+                        }
+                        if(duUeCb->f1UeDb)
+                        {
+                           duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
+                           if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present ==\
+                                 UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List)
                            {
-                              duUeCb->f1UeDb->actionType = UE_CTXT_MOD;
                               drbSetupModCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
                               choice.DRBs_ToBeSetupMod_List;
-                              if(extractDrbListToSetup(NULL, drbSetupModCfg ,drbSetupModCfg->list.count, \
-                              &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                              
+                              if(extractDrbListToSetupMod(NULL, drbSetupModCfg, NULL, drbSetupModCfg->list.count,\
+                                    &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
                               {
-                                 DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetup()");
+                                 DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbSetupModList");
                                  ret = RFAILED;
                               }
                            }
+
+                           if(ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.present == \
+                                  UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List)
+
+                           {
+                              drbModifiedCfg = &ueContextModifyReq->protocolIEs.list.array[ieIdx]->value.\
+                              choice.DRBs_ToBeModified_List;
+                              if(extractDrbListToSetupMod(NULL, NULL, drbModifiedCfg, drbSetupModCfg->list.count,\
+                                 &duUeCb->f1UeDb->duUeCfg, &duUeCb->drbBitMap))
+                              {
+                                 DU_LOG("\nERROR  -->  DU APP : Failed at extractDrbListToSetupMod() for DrbModifiedList");
+                                 ret = RFAILED;
+                              }
+                           }
+                        }
                         break;
                      }
                   }
index 75a8267..78bac83 100644 (file)
@@ -102,6 +102,86 @@ DuRlcUeDeleteReq packRlcUeDeleteReqOpts[] =
    packDuRlcUeDeleteReq        /* Light weight-loose coupling */
 };
 
+
+/******************************************************************
+ *
+ * @brief Function to fetch lcId based on DRB Id
+ *
+ * @details
+ *
+ *    Function : fetchLcId
+ *
+ *    @params[in] drbId
+ *
+ *    Functionality: Function to fetch lcId based on DRB Id
+ *
+ * Returns: lcId - SUCCESS
+ *          RFAILED - FAILURE
+ *****************************************************************/
+
+uint8_t fetchLcId(uint8_t drbId)
+{
+   uint8_t cellIdx = 0, ueIdx = 0, lcIdx = 0, numLcs = 0, lcId = 0;
+
+   for(cellIdx = 0; cellIdx < MAX_NUM_CELL; cellIdx++)
+   {
+      for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+      {
+         if(duCb.actvCellLst[cellIdx] != NULLP)
+         {
+            numLcs = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.numLcs;
+            for(lcIdx = 0; lcIdx < numLcs; lcIdx++)
+            {
+               if(duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].rbId == drbId)
+               {
+                  lcId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].rlcUeCfg.rlcLcCfg[lcIdx].lcId;
+                  return lcId;
+               }
+            }
+         }
+      }
+   }
+   DU_LOG("\nERROR   -->  DU_APP: fetchLcId() failed for drbId %d", drbId);
+   return RFAILED;
+}
+
+/******************************************************************
+ *
+ * @brief Function to return Drb LcId
+ *
+ * @details
+ *
+ *    Function : getDrbLcId
+ *
+ *    Functionality: Function to return Drb LcId
+ *
+ * @params[in] drbBitMap
+ *
+ * Returns: lcId - SUCCESS
+ *         RFAILED - FAILURE
+ *****************************************************************/
+
+uint8_t getDrbLcId(uint32_t *drbBitMap)
+{
+   uint8_t bitMask = 1, bitPos = 0;
+   bitPos = MIN_DRB_LCID;
+
+   while(bitPos <= MAX_DRB_LCID)
+   {
+      if((*drbBitMap & (bitMask << bitPos)) == 0)
+      {
+         *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
+         return bitPos;
+      }
+      else
+      {
+         bitPos++;
+      }
+   }
+   DU_LOG("\nERROR   -->  DU_APP: Max LC Reached in getDrbLcId()");
+   return RFAILED;
+}
+
 /*******************************************************************
  *
  * @brief Function to fillDlUserDataInfo
@@ -1120,40 +1200,7 @@ uint8_t sendUeReCfgReqToMac(MacUeCfg *macUeCfg)
    return ret;
 }
 
-/******************************************************************
- *
- * @brief Function to return Drb LcId
- *
- * @details
- *
- *    Function : getDrbLcId
- *
- *    Functionality: Function to return Drb LcId
- *
- * Returns: lcId - SUCCESS
- *         RFAILED - FAILURE
- *****************************************************************/
 
-uint8_t getDrbLcId(uint32_t *drbBitMap)
-{
-   uint8_t bitMask = 1, bitPos = 0;
-   bitPos = MIN_DRB_LCID;
-
-   while(bitPos <= MAX_DRB_LCID)
-   {
-      if((*drbBitMap & (bitMask << bitPos)) == 0)
-      {
-        *drbBitMap = ((bitMask << bitPos)| *drbBitMap);
-        return bitPos;
-      }
-      else
-      {
-        bitPos++;
-      }
-   }
-   DU_LOG("\nERROR   -->  DU_APP: Max LC Reached in getDrbLcId()");
-   return RFAILED;
-}
 
 /******************************************************************
  *
@@ -1377,69 +1424,68 @@ void fillDefaultUmDlInfo(UmUniDirDlBearerCfg *UmDlCfg)
 
 uint8_t fillDefaultRlcModeCfg(uint8_t rlcMode, RlcBearerCfg *lcCfg)
 {
-
    if(lcCfg)
    {
       switch(rlcMode)
       {
          case RLC_AM :
             {
-              if(!lcCfg->u.amCfg)
-              {
-                 DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
-                if(lcCfg->u.amCfg)
-                   fillDefaultAmInfo(lcCfg->u.amCfg);
-                else
-                {
-                    DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
-                   return RFAILED;
-                }
-              }
+               if(!lcCfg->u.amCfg)
+               {
+                  DU_ALLOC_SHRABL_BUF(lcCfg->u.amCfg, sizeof(AmBearerCfg));
+                  if(lcCfg->u.amCfg)
+                     fillDefaultAmInfo(lcCfg->u.amCfg);
+                  else
+                  {
+                     DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at AmCfg at fillDefaultRlcModeCfg()");
+                     return RFAILED;
+                  }
+               }
                break;
             }
          case RLC_UM_BI_DIRECTIONAL :
             {
-              if(!lcCfg->u.umBiDirCfg)
-              {
-                 DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
-                if(lcCfg->u.umBiDirCfg)
-                    fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
-                 else
-                {
-                    DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
-                   return RFAILED;
-                }
-              }
+               if(!lcCfg->u.umBiDirCfg)
+               {
+                  DU_ALLOC_SHRABL_BUF(lcCfg->u.umBiDirCfg, sizeof(UmBiDirBearerCfg));
+                  if(lcCfg->u.umBiDirCfg)
+                     fillDefaultUmBiInfo(lcCfg->u.umBiDirCfg);
+                  else
+                  {
+                     DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at UmBiDirCfg at fillDefaultRlcModeCfg()");
+                     return RFAILED;
+                  }
+               }
                break;
             }
          case RLC_UM_UNI_DIRECTIONAL_UL :
             {
-              if(!lcCfg->u.umUniDirUlCfg)
-              {
+               if(!lcCfg->u.umUniDirUlCfg)
+               {
                   DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirUlCfg, sizeof(UmUniDirUlBearerCfg));
-                 if(lcCfg->u.umUniDirUlCfg)
-                    fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
+                  if(lcCfg->u.umUniDirUlCfg)
+                     fillDefaultUmUlInfo(lcCfg->u.umUniDirUlCfg);
                   else
-                 {
+                  {
                      DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at UmUniDirUlCfg at fillDefaultRlcModeCfg()");
-                    return RFAILED;
-                 }
-              }
+                     return RFAILED;
+                  }
+               }
                break;
             }
          case RLC_UM_UNI_DIRECTIONAL_DL :
             {
-              if(!lcCfg->u.umUniDirDlCfg)
-              {
+               if(!lcCfg->u.umUniDirDlCfg)
+               {
                   DU_ALLOC_SHRABL_BUF(lcCfg->u.umUniDirDlCfg, sizeof(UmUniDirDlBearerCfg));
                   if(lcCfg->u.umUniDirDlCfg)
-                  fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
+                     fillDefaultUmDlInfo(lcCfg->u.umUniDirDlCfg);
                   else
-                 {
+                  {
                      DU_LOG("\n ERROR  -->  DU APP : Memory Alloc failed at UmUniDirDlCfg at fillDefaultRlcModeCfg()");
-                    return RFAILED;
-                 }
-              }
+                     return RFAILED;
+                  }
+               }
                break;
             }
          default:
index 759c83c..00620a9 100644 (file)
@@ -25,7 +25,7 @@
 #define MAX_SFN_VALUE    1023
 #define NR_PCI            1
 #define SLOT_DELAY       3
-#define NUM_DRB_TO_PUMP_DATA  2
+#define NUM_DRB_TO_PUMP_DATA  3
 #define NUM_UL_PACKETS   4
 /*UE Ids for RACH IND*/
 #define UE_IDX_0     0