Merge "Automation scripts"
authorHarshita Lal <harshita.lal@radisys.com>
Mon, 7 Jun 2021 12:20:28 +0000 (12:20 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Mon, 7 Jun 2021 12:20:28 +0000 (12:20 +0000)
45 files changed:
build/common/o1.mak
build/common/ves.mak
build/config/nacm_config.xml [new file with mode: 0644]
build/yang/o-ran-sc-du-hello-world.yang [new file with mode: 0644]
docs/README
docs/installation-guide.rst
src/5gnrmac/mac_msg_hdl.c
src/5gnrmac/mac_slot_ind.c
src/5gnrmac/mac_ue_mgr.c
src/5gnrrlc/rlc_cfg_dl.c
src/5gnrrlc/rlc_cfg_ul.c
src/5gnrrlc/rlc_dbm_dl.c
src/5gnrrlc/rlc_dl_ul_inf_ul.c
src/5gnrrlc/rlc_layer_mgr.c
src/5gnrrlc/rlc_mgr.h
src/5gnrrlc/rlc_msg_hdl.c
src/5gnrrlc/rlc_tmr.c
src/5gnrrlc/rlc_ul.h
src/5gnrrlc/rlc_utils.h
src/5gnrrlc/rlc_utl_dl.c
src/5gnrsch/sch.c
src/5gnrsch/sch_slot_ind.c
src/cm/ckw.x
src/cm/common_def.h
src/cm/du_app_mac_inf.h
src/cm/du_app_rlc_inf.h
src/du_app/du_cell_mgr.c
src/du_app/du_f1ap_msg_hdl.c
src/du_app/du_f1ap_msg_hdl.h
src/du_app/du_mgr.h
src/du_app/du_mgr_main.c
src/du_app/du_msg_hdl.c
src/du_app/du_ue_mgr.c
src/du_app/du_ue_mgr.h
src/o1/ConfigInterface.cpp
src/o1/ConfigInterface.h
src/o1/GlobalDefs.hpp
src/o1/InitConfig.hpp
src/o1/NrCellCb.cpp [new file with mode: 0644]
src/o1/NrCellCb.hpp [new file with mode: 0644]
src/o1/NrCellInfo.cpp [new file with mode: 0644]
src/o1/NrCellInfo.hpp [new file with mode: 0644]
src/o1/NrCellList.cpp [new file with mode: 0644]
src/o1/NrCellList.hpp [new file with mode: 0644]
src/o1/SessionHandler.cpp

index 4b27b80..f643f37 100755 (executable)
@@ -25,6 +25,10 @@ CPP_SRCS=$(wildcard $(SRC_DIR)/*.cpp)
 CPP_OBJS=$(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(CPP_SRCS))
 
 PLTFRM_FLAGS=
+ifeq ($(NODE),TEST_STUB)
+PLTFRM_FLAGS+=-DODU_TEST_STUB
+endif
+
 lib: $(LIB_DIR)/libo1.a
 include $(COM_BUILD_DIR)/compile.mak
 
index 4f50d2a..c03ea9b 100644 (file)
@@ -41,14 +41,14 @@ I_OPTS+=-I$(ROOT_DIR)/src/o1
 
 $(LIB_DIR)/libo1.a:$(CPP_OBJS)
                  @echo -e "Creating Archive $(COLOR) $@ $(REVERT_COLOR)"
-                 $(Q)ar -cr $(LIB_DIR)/libo1.a $(CPP_OBJS)
+                 $(Q)ar -cr $(LIB_DIR)/libves.a $(CPP_OBJS)
 
 #-------------------------------------------------------------#
 #Clean macros
 #-------------------------------------------------------------#
 clean:
                  @echo -e "$(COLOR_RED)Cleaning O1$(REVERT_COLOR)"
-                 $(Q)\rm -f $(LIB_DIR)/libo1.a $(CPP_OBJS)
+                 $(Q)\rm -f $(LIB_DIR)/libves.a $(CPP_OBJS)
 
 #**********************************************************************
 #         End of file
diff --git a/build/config/nacm_config.xml b/build/config/nacm_config.xml
new file mode 100644 (file)
index 0000000..8c60f40
--- /dev/null
@@ -0,0 +1,25 @@
+<nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm">
+  <enable-nacm>true</enable-nacm>
+  <read-default>permit</read-default>
+  <write-default>deny</write-default>
+  <exec-default>permit</exec-default>
+  <enable-external-groups>true</enable-external-groups>
+  <groups>
+    <group>
+      <name>sudo</name>
+      <user-name>netconf</user-name>
+    </group>
+  </groups>
+  <rule-list>
+    <name>sudo-rules</name>
+    <group>sudo</group>
+    <rule>
+      <name>allow-all-sudo</name>
+      <module-name>*</module-name>
+      <path>/</path>
+      <access-operations>*</access-operations>
+      <action>permit</action>
+      <comment>Corresponds all the rules under the sudo group as defined in O-RAN.WG4.MP.0-v05.00</comment>
+    </rule>
+  </rule-list>
+</nacm>
diff --git a/build/yang/o-ran-sc-du-hello-world.yang b/build/yang/o-ran-sc-du-hello-world.yang
new file mode 100644 (file)
index 0000000..1106717
--- /dev/null
@@ -0,0 +1,275 @@
+module o-ran-sc-du-hello-world {
+  yang-version 1.1;
+  namespace "urn:o-ran-sc:yang:o-ran-sc-du-hello-world";
+  prefix duhw;
+
+  organization
+    "O-RAN Software Community";
+  contact
+    "www.o-ran-sc.org";
+  description
+    "This module contains the O-RAN Software Community Distributed Unit
+     API description. This schema was created to support the
+     O-RAN-SC D-Release RSAC use case.
+     This standalone model is the absolute minimum and therefore
+     called 'hello-world'.
+
+     Copyright 2021 the O-RAN Software Community.
+
+     Licensed under the Apache License, Version 2.0 (the 'License');
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an 'AS IS' BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.";
+
+  revision 2021-04-08 {
+    description
+      "Updates based on the RSAC call 2021-04-08.";
+    reference
+      "https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=20878423";
+  }
+  revision 2021-03-06 {
+    description
+      "initial revision";
+    reference
+      "https://wiki.o-ran-sc.org/pages/viewpage.action?pageId=20878423";
+  }
+
+  // TypeDefinitions
+
+  typedef connection-status {
+    type enumeration {
+      enum disconnected {
+        value 0;
+        description
+          "The connection to the remote network function is not established.";
+      }
+      enum connecting {
+        value 1;
+        description
+          "The system is about to connect to the remote network function.";
+      }
+      enum connected {
+        value 2;
+        description
+          "The system is connected to the remote network function.";
+      }
+      enum disconnecting {
+        value 3;
+        description
+          "The system is about to disconnect from the remote network
+           function.";
+      }
+      enum unable-to-connect {
+        value 4;
+        description
+          "This value is reported, when the system tried several times
+           to connect and finally gave up.";
+      }
+    }
+    description
+      "A non extensible enumeration representing a connection status.";
+  }
+
+  typedef o-ru-reference {
+    type leafref {
+      path "/network-function/du-to-ru-connection/name";
+    }
+    description
+      "A reference to a remote network function representing an O-RU.";
+  }
+
+  // Abstract object classes - groupings
+
+  grouping connection-grp {
+    description
+      "An abstract object class representing a connection or link to an
+       external component.";
+    leaf name {
+      type string;
+      description
+        "It is proposed to use the network unique identifier of the remote
+         network function.
+         Note: After discussion the string was not restricted by a 'length'
+         statement of a 'pattern' statement. Please avoid leading and ending
+         spaces and consecutive spaces and any character outside of UTF-8-";
+    }
+    leaf operational-state {
+      type enumeration {
+        enum DISABLED {
+          description
+            "The resource is not functional.";
+        }
+        enum ENABLED {
+          description
+            "The resource is functional.";
+        }
+      }
+      config false;
+      description
+        "Operational state of a connection. Indicates
+         whether the resource is functional (ENABLED) or not (DISABLED).";
+      reference
+        "3GPP TS 28.625 and ITU-T X.731";
+    }
+    leaf administrative-state {
+      type enumeration {
+        enum LOCKED {
+          description
+            "LOCKED refers to a situation which is NOT considered as
+             â€˜normal operation'. Therefore, the O-DU will shut down the
+             connection to the related O-RU, when the value is set to LOCKED.";
+        }
+        enum UNLOCKED {
+          description
+            "UNLOCKED refers to a situation which is considered as
+             'normal operation'. Therefore, the O-DU will establish the
+             connection to the related O-RU, when the value is set to UNLOCKED.";
+        }
+        enum SHUTTING_DOWN {
+          description
+            "This value should not be used. At least the system
+             behavior is not defined.";
+        }
+      }
+      default "LOCKED";
+      description
+        "Administrative state of a connection.";
+      reference
+        "3GPP TS 28.625 and ITU-T X.731";
+    }
+    leaf cell-state {
+      type enumeration {
+        enum IDLE {
+          description
+            "Indicates whether the O-RU is not in use.";
+        }
+        enum INACTIVE {
+          description
+            "Indicates whether the O-RU is in use but not
+             configured to carry traffic.";
+        }
+        enum ACTIVE {
+          description
+            "Indicates whether the O-RU is in use and
+             configured to carry traffic.";
+        }
+      }
+      config false;
+      description
+        "Cell state of the O-RU instance.";
+      reference
+        "3GPP TS 28.625";
+    }
+    leaf status {
+      type connection-status;
+      default "disconnected";
+      config false;
+      description
+        "The value represents the connection status. ";
+    }
+  }
+
+  grouping network-function-grp {
+    description
+      "An abstract object class grouping the O-RAN-SC-DU parameters with
+       focus on RSAC D-release Closed-Loop use case.";
+    list du-to-ru-connection {
+      key "name";
+      description
+        "A list of connection objects to O-RAN-SC radio units.";
+      uses connection-grp;
+    }
+  }
+
+  grouping rpc-output {
+    description
+      "A generic RPC output syntax.";
+    leaf response-status {
+      type enumeration {
+        enum ok {
+          value 200;
+          description
+            "The system has successfully performed that request.";
+        }
+        enum accepted {
+          value 202;
+          description
+            "The system has received and accepted the request. It continues
+             processing the request. The final status of the processing
+             procedures are reported by a notification service. This response
+             status is typically for long running transactions.";
+        }
+        enum internal-server-error {
+          value 500;
+          description
+            "The request cannot be performed.";
+        }
+      }
+      mandatory true;
+      description
+        "The response status related to the corresponding request.
+         Its values are inspired by HTTP response status codes.";
+      reference
+        "RFC 7231 â€“ Response Status Codes - Section 6.3.4";
+    }
+    leaf message {
+      type string;
+      description
+        "A human readable text complementary to the response status. ";
+    }
+  }
+
+  // Data nodes
+
+  container network-function {
+    description
+      "The root container for the configuration and operational data.
+       The object implements the 'network-function-grp'";
+    uses network-function-grp;
+  }
+
+  // Remote procedure calls - actions on root level
+
+  rpc connect {
+    status deprecated;
+    description
+      "An action to establish the connection to a remote network function.";
+    input {
+      leaf remote-network-function {
+        type o-ru-reference;
+        mandatory true;
+        description
+          "An reference to a remote network function - an O-RU - to which
+           a connection should be established.";
+      }
+    }
+    output {
+      uses rpc-output;
+    }
+  }
+
+  rpc disconnect {
+    status deprecated;
+    description
+      "An action to destroy the connection to a remote network function.";
+    input {
+      leaf remote-network-function {
+        type o-ru-reference;
+        mandatory true;
+        description
+          "An reference to a remote network function - an O-RU - to which
+           the connection should be destroyed.";
+      }
+    }
+    output {
+      uses rpc-output;
+    }
+  }
+}
index 98d5b6c..9eb9fe7 100644 (file)
@@ -58,6 +58,7 @@ C. Pre-requisite for O1 Interface (Required only if run with O1 interface enable
    $cd l2/build/yang
    $sysrepoctl -i o-ran-sc-odu-alarm-v1.yang
    $sysrepoctl -i o-ran-sc-odu-interface-v1.yang
+   $sysrepoctl -i o-ran-sc-du-hello-world.yang
 
 4. Configure the startup IP and Port configurations for DU, CU and RIC
 
@@ -72,13 +73,22 @@ C. Pre-requisite for O1 Interface (Required only if run with O1 interface enable
 
    $cd l2/build/config
 
-   Open the netconfConfig.xml and edit the desired MAC address, IP, Port, Username and Password for VES PNF Registration.
+   Open the netconfConfig.json and edit the desired MAC address, IP, Port, Username and Password for VES PNF Registration.
 
 6. Configure the VES server details to send VES Events
 
    $cd l2/build/config
 
-   Open the vesConfig.xml and edit the desired IP, Port, Username and Password to send VES Event.
+   Open the vesConfig.json and edit the desired IP, Port, Username and Password to send VES Event.
+
+7. Configure the nacm module to provide access to new user
+
+   $cd l2/build/config
+
+   Open the nacm_config.xml and edit the desired user-name to provide the access to that user.
+
+   $sysrepocfg --import=nacm_config.xml --datastore running --module  ietf-netconf-acm
+
 
 
 D. How to Clean and Build:
index 78d620b..e8c005b 100644 (file)
@@ -147,22 +147,50 @@ Setting up Netconf server
 
 - Install the YANG modules
 
-   - Ubuntu : 
-    
+   - Ubuntu :
+
       | cd <O-DU High Directory>/l2/build/yang
       | sysrepoctl -i ./yang/o-ran-sc-odu-alarm-v1.yang
       | sysrepoctl -i ./yang/o-ran-sc-odu-interface-v1.yang
+      | sysrepoctl -i ./yang/o-ran-sc-du-hello-world.yang
 
 - Configure the startup IP and Port configurations for DU, CU and RIC
 
-   - Ubuntu : 
-    
+   - Ubuntu :
+
       | cd <O-DU High Directory>/l2/build/config
       |
       | Open the startup_config.xml and edit the desired IP and Port for CU, DU and RIC.
       | Then load the configuration in the sysrepo running datastore using the command below
       |
-      | sysrepocfg --import=startup_config.xml --datastore running --module  o-ran-sc-odu-interface-v1 
+      | sysrepocfg --import=startup_config.xml --datastore running --module  o-ran-sc-odu-interface-v1
+
+- Configure the netconf server details for VES PNF Event
+
+   - Ubuntu :
+
+      | cd <O-DU High Directory>/l2/build/config
+      |
+      | Open the netconfConfig.json and edit the desired MAC address, IP, Port, Username and Password for VES PNF Registration.
+
+-  Configure the VES server details to send VES Events
+
+   - Ubuntu :
+
+      | cd <O-DU High Directory>/l2/build/config
+      |
+      |  Open the vesConfig.json and edit the desired IP, Port, Username and Password to send VES Event.
+
+- Configure the nacm module to provide access to new user
+
+   - Ubuntu :
+
+      | cd <O-DU High Directory>/l2/build/config
+      |
+      | Open the nacm_config.xml and edit the desired user-name to provide the access to that user.
+      |
+      | $sysrepocfg --import=nacm_config.xml --datastore running --module  ietf-netconf-acm
+
 
 Compilation
 ------------
index c3a4b80..cdfe295 100644 (file)
@@ -213,11 +213,11 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
    uint8_t   pduIdx =0;
    uint8_t   lcIdx = 0;
    uint8_t   *txPdu =NULLP;
-   uint16_t  tbSize =0;
+   uint16_t  tbSize =0,cellIdx=0;
    MacDlData macDlData;
    MacDlSlot *currDlSlot = NULLP;
    DlRlcBoInfo dlBoInfo;
-  
+
    memset(&macDlData , 0, sizeof(MacDlData));
    DU_LOG("\nDEBUG  -->  MAC: Received DL data for sfn=%d slot=%d numPdu= %d", \
       dlData->slotInfo.sfn, dlData->slotInfo.slot, dlData->numPdu);
@@ -230,24 +230,27 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
       macDlData.pduInfo[pduIdx].dlPdu = dlData->pduInfo[pduIdx].pduBuf;
    }
 
+   GET_CELL_IDX(dlData->cellId, cellIdx);
    /* Store DL data in the scheduled slot */
-   currDlSlot = &macCb.macCell[dlData->cellId -1]->dlSlot[dlData->slotInfo.slot];
-   if(currDlSlot)
+   if(macCb.macCell[cellIdx] ==NULLP)
    {
-      if(currDlSlot->dlInfo.dlMsgAlloc)
+      DU_LOG("\nERROR  -->  MAC : MacProcRlcDlData(): macCell does not exists");
+      return RFAILED;
+   }
+   currDlSlot = &macCb.macCell[cellIdx]->dlSlot[dlData->slotInfo.slot];
+   if(currDlSlot->dlInfo.dlMsgAlloc)
+   {
+      tbSize = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize;
+      MAC_ALLOC(txPdu, tbSize);
+      if(!txPdu)
       {
-        tbSize = currDlSlot->dlInfo.dlMsgAlloc->dlMsgPdschCfg.codeword[0].tbSize;
-        MAC_ALLOC(txPdu, tbSize);
-        if(!txPdu)
-        {
-           DU_LOG("\nERROR  -->  MAC : Memory allocation failed in MacProcRlcDlData");
-           return RFAILED;
-        }
-        macMuxPdu(&macDlData, NULLP, txPdu, tbSize);
-
-        currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = tbSize;
-        currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu = txPdu;
+         DU_LOG("\nERROR  -->  MAC : Memory allocation failed in MacProcRlcDlData");
+         return RFAILED;
       }
+      macMuxPdu(&macDlData, NULLP, txPdu, tbSize);
+
+      currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPduLen = tbSize;
+      currDlSlot->dlInfo.dlMsgAlloc->dlMsgInfo.dlMsgPdu = txPdu;
    }
 
    for(lcIdx = 0; lcIdx < dlData->numLc; lcIdx++)
@@ -267,11 +270,11 @@ uint8_t MacProcRlcDlData(Pst* pstInfo, RlcData *dlData)
    for(pduIdx = 0; pduIdx < dlData->numPdu; pduIdx++)
    {
       MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData->pduInfo[pduIdx].pduBuf,\
-         dlData->pduInfo[pduIdx].pduLen);
+            dlData->pduInfo[pduIdx].pduLen);
    }
    if(pstInfo->selector == ODU_SELECTOR_LWLC)
    {
-     MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData));
+      MAC_FREE_SHRABL_BUF(pstInfo->region, pstInfo->pool, dlData, sizeof(RlcData));
    }
    return ROK;
 }
@@ -478,10 +481,13 @@ uint8_t MacProcCellStop(Pst *pst, OduCellId  *cellId)
 
    DU_LOG("\nINFO  -->  MAC : Sending cell stop request to Lower Mac");
    GET_CELL_IDX(cellId->cellId, cellIdx);
-   slotInfo.cellId = cellId->cellId;
-   slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn;
-   slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot;
-   sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo);
+   if(macCb.macCell[cellIdx])
+   {
+      slotInfo.cellId = cellId->cellId;
+      slotInfo.sfn = macCb.macCell[cellIdx]->currTime.sfn;
+      slotInfo.slot = macCb.macCell[cellIdx]->currTime.slot;
+      sendToLowerMac(FAPI_STOP_REQUEST, 0, &slotInfo);
+   }
 #endif
 
    MAC_FREE_SHRABL_BUF(pst->region, pst->pool, cellId, \
index 37cb687..0233223 100644 (file)
@@ -303,7 +303,13 @@ uint8_t macProcSlotInd(SlotIndInfo slotInd)
    uint16_t  cellIdx = 0;
 
    GET_CELL_IDX(slotInd.cellId, cellIdx);
-
+   
+   if(macCb.macCell[cellIdx] == NULLP)
+   {
+      DU_LOG("ERROR  --> MAC : macProcSlotInd(): CellId[%d] does not exist. Error occurred at SFN [%d] Slot [%d]",\
+      slotInd.cellId, slotInd.sfn, slotInd.slot);
+      return RFAILED;
+   }
    /* Store current time info */
    macCb.macCell[cellIdx]->currTime.cellId = slotInd.cellId;
    macCb.macCell[cellIdx]->currTime.slot = slotInd.slot;
index 8262eee..965e2f7 100644 (file)
@@ -2462,7 +2462,7 @@ uint8_t MacSendUeDeleteRsp(uint16_t cellId, uint16_t crnti, UeDeleteStatus resul
 
    /* Filling UE delete response */
    deleteRsp->cellId = cellId;
-   GET_UE_IDX(crnti,deleteRsp->ueIdx);
+   GET_UE_IDX(crnti,deleteRsp->ueId);
    deleteRsp->result = result;
 
    /* Fill Post structure and send UE delete response*/
@@ -2746,7 +2746,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
    MacUeCb  *ueCb = NULLP;
    MacCellCb *cellCb = NULLP;
 
-   DU_LOG("\nINFO   -->  MAC : UE Delete Request received for ueIdx[%d]", ueDelete->ueIdx);
+   DU_LOG("\nINFO   -->  MAC : UE Delete Request received for ueId[%d]", ueDelete->ueId);
 
    if(ueDelete)
    {
@@ -2754,7 +2754,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
       cellCb = macCb.macCell[cellIdx];
       if(cellCb)
       {
-         ueCb = &cellCb->ueCb[ueDelete->ueIdx-1];
+         ueCb = &cellCb->ueCb[ueDelete->ueId-1];
          if(ueCb->crnti == ueDelete->crnti)
          {
             ret = sendUeDelReqToSch(pst, ueDelete);
@@ -2772,7 +2772,7 @@ uint8_t MacProcUeDeleteReq(Pst *pst, MacUeDelete *ueDelete)
       }
       else
       {
-         DU_LOG("\nERROR  -->  MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeIdx = %d",ueDelete->ueIdx);
+         DU_LOG("\nERROR  -->  MAC : MacProcUeDeleteReq(): Failed to find the MacUeCb of UeIdx = %d",ueDelete->ueId);
          result = CELLID_INVALID;
       }
 
index dcc1a2c..89c4318 100755 (executable)
@@ -706,14 +706,9 @@ RlcEntCfgCfmInfo   *entCfm
                return RFAILED;
             }
             /* Start throughput calculation for this UE */
-            gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].ueIdx = ueId;
-            gCb->rlcThpt.thptPerUe[gCb->rlcThpt.numActvUe].dataVol = 0;
+            gCb->rlcThpt.thptPerUe[ueId -1].ueId  = ueId;
+            gCb->rlcThpt.thptPerUe[ueId -1].dataVol = 0;
             gCb->rlcThpt.numActvUe++;
-            
-            if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE)
-            {
-               rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR);
-            }
          }
 
          /* Validate LChId for UM and AM modes */
index 6d64fc0..ea54ed5 100755 (executable)
@@ -639,6 +639,7 @@ RlcUlCfgTmpData   *cfgTmpData
                   return RFAILED;
                }
                rlcDbmAddUlUeCb(gCb, cfgTmpData->ueId, cfgTmpData->cellId, cfgTmpData->ueCb);
+               cfgTmpData->ueCb->ueDeleteInfo.ueDelTmr.tmrEvnt = TMR_NONE;
             }
             else
             {
index 68be787..040d37a 100755 (executable)
@@ -468,6 +468,9 @@ Void rlcDbmDelDlUeCb(RlcCb *gCb,RlcDlUeCb *ueCb,Bool abortFlag)
       DU_LOG("\nERROR  -->  RLC_DL : UeId[%u] HashList Insertion Failed",
             ueCb->ueId);
    }
+   memset(&gCb->rlcThpt.thptPerUe[ueCb->ueId -1], 0, sizeof(RlcThptPerUe));
+   gCb->rlcThpt.numActvUe--;
+   
    /* kw005.201 ccpu00117318, updating the statistics */
    gCb->genSts.numUe--;
    
index 0831de8..b97cf15 100755 (executable)
@@ -271,7 +271,7 @@ RlcCfgCfmInfo   *cfmInfo
    else if (tRlcCb->u.ulCb->rlcUlUdxEventType == EVENT_RLC_UE_DELETE_REQ)
    {
       FILL_PST_RLC_TO_DUAPP(rspPst, RLC_UL_INST, EVENT_RLC_UE_DELETE_RSP);
-      if(sendRlcUeDeleteRspToDu(cfgCfm->ueId, cfgCfm->cellId, SUCCESSFUL) != ROK)
+      if(sendRlcUeDeleteRspToDu(cfgCfm->cellId, cfgCfm->ueId, SUCCESSFUL) != ROK)
       {
          DU_LOG("ERROR  --> RLC_UL: rlcUlUdxCfgCfm(): Failed to send UE delete response ");
          return RFAILED;
index f08d4e4..8fc762a 100755 (executable)
@@ -392,6 +392,17 @@ static S16 rlcLmmGenCfg(RlcCb  *gCb,RlcGenCfg *cfg)
 
    gCb->init.cfgDone = TRUE;
 
+   /* TODO : make this generic for DL and UL after support for UL throughput calculation is added */
+   if(gCb->genCfg.rlcMode == LKW_RLC_MODE_DL)
+   {
+      /* Starting timer to print throughput */
+      if((rlcChkTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR)) == FALSE)
+      {
+         DU_LOG("\nINFO   --> RLC_DL : Starting Throughput timer");
+         rlcStartTmr(gCb, (PTR)(&gCb->rlcThpt), EVENT_RLC_THROUGHPUT_TMR);
+      }
+   }
+
    return (LCM_REASON_NOT_APPL);
 } 
 
index d89b95a..dd5432c 100644 (file)
@@ -19,7 +19,7 @@
 /* This file stores defines used at RLC interface */
 uint8_t fillRlcUeCfgRsp(RlcUeCfgRsp *rlcCfgRsp, RlcCfgCfmInfo *rlcCRsp);
 uint8_t SendRlcUeCfgRspToDu(Pst *pst, RlcCfgCfmInfo *cfgRsp);
-uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result);
+uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId, uint8_t ueId, UeDeleteResult result);
 
 /**********************************************************************
          End of file
index 063d9e5..d3fdff6 100644 (file)
@@ -730,13 +730,13 @@ uint8_t RlcProcDlUserDataTransfer(Pst *pst, RlcDlUserDataInfo *dlDataMsgInfo)
  *    Functionality:
  *      sending UE delete response to DU 
  *
- * @params[in] uint8_t ueIdx, uint8_t cellId, UeDeleteResult result 
+ * @params[in] uint8_t cellId, uint8_t ueIdx, UeDeleteResult result 
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult result)
+uint8_t sendRlcUeDeleteRspToDu(uint16_t cellId,uint8_t ueId, UeDeleteResult result)
 {
    Pst pst;  
    RlcUeDeleteRsp *ueDeleteRsp = NULLP;
@@ -752,7 +752,7 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re
    else
    {
       ueDeleteRsp->cellId = cellId;
-      ueDeleteRsp->ueIdx = ueIdx;
+      ueDeleteRsp->ueId = ueId;
       ueDeleteRsp->result = result;
   
       if(rlcSendUeDeleteRspToDu(&pst, ueDeleteRsp) == ROK)
@@ -769,41 +769,6 @@ uint8_t sendRlcUeDeleteRspToDu(uint8_t ueIdx, uint16_t cellId, UeDeleteResult re
    return ROK;
 }
 
-/* ****************************************************************
-*
-* @brief filling RLC UE delete configuration  
-*
-* @details
-*
-*    Function : fillRlcCfgInfo 
-*
-*    Functionality: filling RLC UE delete configuration
-*
-* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg
-*
-* @return void
-*
-* ****************************************************************/
-
-void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg)
-{
-   uint8_t lcIdx;
-   
-   rlcUeCfg->ueId    = ueCb->ueId;
-   rlcUeCfg->cellId  = ueCb->cellId;
-   rlcUeCfg->numEnt = 0;
-   for(lcIdx=0; lcIdx<RLC_MAX_LCH_PER_UE && rlcUeCfg->numEnt < 1; lcIdx++)
-   {
-      if(ueCb->lCh[lcIdx].ulRbCb != NULLP)
-      {
-         rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId    = 0;
-         rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType  = 0;
-         rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE;
-         rlcUeCfg->numEnt++;
-      }
-   }
-}
-
 /*******************************************************************
 *
 * @brief Handles Ue delete Request from DU APP
@@ -826,35 +791,23 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
 {
    uint8_t ret = ROK;
    RlcCb *gRlcCb = NULLP;
-   RlcCfgInfo *rlcUeCfg = NULLP;
    RlcUlUeCb *ueCb = NULLP;
    UeDeleteResult result=SUCCESSFUL;
 
-   DU_LOG("\nDEBUG  -->  RLC: UE Delete request received. CellID[%d] UEIDX[%d]",ueDelete->cellId, ueDelete->ueIdx);
+   DU_LOG("\nDEBUG  -->  RLC: UE Delete request received. CellID[%d] UEID[%d]",ueDelete->cellId, ueDelete->ueId);
 
    if(ueDelete != NULLP)
    {
       gRlcCb = RLC_GET_RLCCB(pst->dstInst);
-      rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueIdx, ueDelete->cellId, &ueCb);
+      rlcDbmFetchUlUeCb(gRlcCb,ueDelete->ueId, ueDelete->cellId, &ueCb);
       if(ueCb != NULLP)
       {
          if(ueDelete->cellId == ueCb->cellId)
          {
-            RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo));
-            if(rlcUeCfg == NULLP)
-            {
-               DU_LOG("\nERROR  -->  RLC: deleteRlcUeCb(): Failed to allocate memory");
-               ret = RFAILED;
-            }
-            else
+            memcpy(&ueCb->ueDeleteInfo.pst, pst, sizeof(Pst));
+            if((rlcChkTmr(gRlcCb, (PTR)ueCb, EVENT_RLC_UE_DELETE_TMR)) == FALSE)
             {
-               memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
-               fillRlcUeDelInfo(ueCb, rlcUeCfg);
-               if(RlcProcCfgReq(pst, rlcUeCfg) != ROK)
-               {
-                  DU_LOG("\nERROR  -->  RLC: deleteRlcUeCb(): Failed to delete UE information");
-                  result = INVALID_UEID;
-               }
+               rlcStartTmr(gRlcCb,(PTR)ueCb, EVENT_RLC_UE_DELETE_TMR);
             }
          }
          else
@@ -869,7 +822,7 @@ uint8_t RlcProcUeDeleteReq(Pst *pst, RlcUeDelete *ueDelete)
 
       if(result != SUCCESSFUL)
       {
-         ret = sendRlcUeDeleteRspToDu(ueDelete->ueIdx, ueDelete->cellId, result);
+         ret = sendRlcUeDeleteRspToDu(ueDelete->cellId, ueDelete->ueId, result);
          if(ret != ROK)
          {
             DU_LOG("\nERROR  -->  RLC: RlcProcUeDeleteReq():Failed to send UE Delete response to DU");
index d7ecd63..bd7ccfe 100755 (executable)
 #include "kwu.x"           /* KWU */
 #include "rgu.x"           /* RGU */
 
+#include "du_app_rlc_inf.h"
 #include "rlc_utils.h"            /* RLC defines */
 #include "rlc_dl_ul_inf.h"
 #include "rlc_dl.h"
 #include "rlc_ul.h"
+#include "rlc_mgr.h"
+
 /** 
  * @file gp_tmr.c
  * @brief RLC Timer Module
@@ -81,7 +84,6 @@
 
 /* private function declarations */
 static Void rlcBndTmrExpiry(PTR cb);
-void rlcThptTmrExpiry(PTR cb);
 
 /**
  * @brief Handler to start timer
@@ -183,6 +185,14 @@ void rlcStartTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt)
          arg.max = RLC_MAX_THPT_TMR; 
          break;
       }
+      case EVENT_RLC_UE_DELETE_TMR:
+      {
+         RlcUlUeCb *ulUeCb = (RlcUlUeCb*)cb;
+         RLC_TMR_CALCUATE_WAIT(arg.wait, RLC_UE_DELETE_WAIT_TIME, gCb->genCfg.timeRes);
+         arg.timers = &ulUeCb->ueDeleteInfo.ueDelTmr;
+         arg.max = RLC_MAX_UE_TMR;
+         break;
+      }
       default:
       {
          DU_LOG("\nERROR  -->  RLC : rlcStartTmr: Invalid tmr Evnt [%d]", tmrEvnt);
@@ -270,6 +280,11 @@ void rlcStopTmr(RlcCb *gCb, PTR cb, uint8_t tmrType)
          arg.timers   = &((RlcThpt *)cb)->thptTmr;
          arg.max  = RLC_MAX_THPT_TMR;
       }
+      case EVENT_RLC_UE_DELETE_TMR:
+      {
+         arg.timers   = &((RlcUlUeCb*)cb)->ueDeleteInfo.ueDelTmr;
+         arg.max  = EVENT_RLC_UE_DELETE_TMR;
+      }
       default:
       {
          DU_LOG("\nERROR  -->  RLC : rlcStopTmr: Invalid tmr Evnt[%d]", tmrType);
@@ -348,6 +363,11 @@ Void rlcTmrExpiry(PTR cb,S16 tmrEvnt)
          rlcThptTmrExpiry(cb);
          break;
       }
+      case EVENT_RLC_UE_DELETE_TMR:
+      {
+         rlcUeDeleteTmrExpiry(cb);
+         break;
+      }
       default:
       {
          break;
@@ -401,6 +421,10 @@ bool rlcChkTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt)
       {
          return (((RlcThpt *)cb)->thptTmr.tmrEvnt == EVENT_RLC_THROUGHPUT_TMR);
       }
+      case EVENT_RLC_UE_DELETE_TMR:
+      {
+         return (((RlcUlUeCb *)cb)->ueDeleteInfo.ueDelTmr.tmrEvnt == EVENT_RLC_UE_DELETE_TMR);
+      }
       default:
       {
          DU_LOG("\nERROR  -->  RLC : rlcChkTmr: Invalid tmr Evnt [%d]", tmrEvnt);
@@ -414,17 +438,17 @@ bool rlcChkTmr(RlcCb *gCb, PTR cb, int16_t tmrEvnt)
  * @brief Handler to do processing on expiry of the bind timer
  *
  * @details
- *    This function processes the RLC bind timer expiry. If the number of 
- *    retries is less than the maximum retry counter, bind request is sent 
+ *    This function processes the RLC bind timer expiry. If the number of
+ *    retries is less than the maximum retry counter, bind request is sent
  *    again, else an alarm is raised to the layer manager.
- *       
+ *
  * @param[in] cb  Pointer to the Rgu sap
  *
  * @return  Void
 */
 static Void rlcBndTmrExpiry(PTR cb)
 {
-   RlcRguSapCb *rguSapCb; 
+   RlcRguSapCb *rguSapCb;
 
    rguSapCb = (RlcRguSapCb *) cb;
 
@@ -434,9 +458,9 @@ static Void rlcBndTmrExpiry(PTR cb)
       {
          /* start timer to wait for bind confirm */
          rlcStartTmr(RLC_GET_RLCCB(rguSapCb->pst.srcInst),
-                    (PTR)rguSapCb, 
+                    (PTR)rguSapCb,
                     EVENT_RLC_WAIT_BNDCFM);
-         
+
          /* Send bind request */
          rguSapCb->retryCnt++;
          RlcLiRguBndReq (&rguSapCb->pst, rguSapCb->suId, rguSapCb->spId);
@@ -449,17 +473,17 @@ static Void rlcBndTmrExpiry(PTR cb)
          /* Send alarm to the layer manager */
 #ifdef LTE_L2_MEAS
          rlcLmmSendAlarm(RLC_GET_RLCCB(rguSapCb->pst.srcInst),
-                        LCM_CATEGORY_INTERFACE, 
+                        LCM_CATEGORY_INTERFACE,
                         LCM_EVENT_BND_FAIL,
-                        LCM_CAUSE_TMR_EXPIRED, 
-                        0, 
-                        0, 
+                        LCM_CAUSE_TMR_EXPIRED,
+                        0,
+                        0,
                         0);
 #else
          rlcLmmSendAlarm(RLC_GET_RLCCB(rguSapCb->pst.srcInst),
-                        LCM_CATEGORY_INTERFACE, 
+                        LCM_CATEGORY_INTERFACE,
                         LCM_EVENT_BND_FAIL,
-                        LCM_CAUSE_TMR_EXPIRED, 
+                        LCM_CAUSE_TMR_EXPIRED,
                         0, /* suId */
                         0 /* ueId */);
 #endif
@@ -484,22 +508,36 @@ void rlcThptTmrExpiry(PTR cb)
    uint16_t  ueIdx;
    long double tpt;
    RlcThpt *rlcThptCb = (RlcThpt*)cb; 
+   
+   /* If cell is not up, throughput details cannot be printed */
+   if(gCellStatus != CELL_UP)
+   {
+      /* Restart timer */
+      rlcStartTmr(RLC_GET_RLCCB(rlcThptCb->inst), (PTR)rlcThptCb, EVENT_RLC_THROUGHPUT_TMR);
+      return;
+   }
 
-   /* Print throughput */
+   /* If cell is up, print throughout for each UE attached to the cell */
    DU_LOG("\n===================== DL Throughput ==============================");
    DU_LOG("\nNumber of UEs : %d", rlcThptCb->numActvUe);
-   for(ueIdx = 0; ueIdx < rlcThptCb->numActvUe; ueIdx++)
+   if(rlcThptCb->numActvUe)
    {
-      /* Spec 28.552, section 5.1.1.3 : 
-       * Throughput in kilobits/sec = (dataVol in kiloBits * 1000)/time in milligseconds
-       * 
-       * Since our dataVol is in bytes, multiplying 0.008 to covert into kilobits i.e. 
-       * Throughput[kbits/sec] = (dataVol * 0.008 * 1000)/time in ms
-       */
-      tpt = (double)(rlcThptCb->thptPerUe[ueIdx].dataVol * 8)/(double)ODU_THROUGHPUT_PRINT_TIME_INTERVAL;
+      for(ueIdx = 0; ueIdx < MAX_NUM_UE; ueIdx++)
+      {
+         if(rlcThptCb->thptPerUe[ueIdx].ueId)
+         {
+            /* Spec 28.552, section 5.1.1.3 : 
+             * Throughput in kilobits/sec = (dataVol in kiloBits * 1000)/time in milligseconds
+             * 
+             * Since our dataVol is in bytes, multiplying 0.008 to covert into kilobits i.e. 
+             * Throughput[kbits/sec] = (dataVol * 0.008 * 1000)/time in ms
+             */
+             tpt = (double)(rlcThptCb->thptPerUe[ueIdx].dataVol * 8)/(double)ODU_THROUGHPUT_PRINT_TIME_INTERVAL;
       
-      DU_LOG("\nUE Id : %d   DL Tpt : %.2Lf", rlcThptCb->thptPerUe[ueIdx].ueIdx, tpt);
-      rlcThptCb->thptPerUe[ueIdx].dataVol = 0;
+             DU_LOG("\nUE Id : %d   DL Tpt : %.2Lf", rlcThptCb->thptPerUe[ueIdx].ueId, tpt);
+             rlcThptCb->thptPerUe[ueIdx].dataVol = 0;
+         }
+      }
    }
    DU_LOG("\n==================================================================");
 
@@ -509,6 +547,75 @@ void rlcThptTmrExpiry(PTR cb)
    return;
 }
 
+/**
+*
+* @brief filling RLC UE delete configuration
+*
+* @details
+*    filling RLC UE delete configuration
+*
+* @params[in] RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg
+*
+* @return void
+*
+*/
+
+void fillRlcUeDelInfo(RlcUlUeCb *ueCb, RlcCfgInfo *rlcUeCfg)
+{
+   uint8_t lcIdx;
+
+   rlcUeCfg->ueId    = ueCb->ueId;
+   rlcUeCfg->cellId  = ueCb->cellId;
+   rlcUeCfg->numEnt = 0;
+   for(lcIdx=0; lcIdx<RLC_MAX_LCH_PER_UE && rlcUeCfg->numEnt < 1; lcIdx++)
+   {
+      if(ueCb->lCh[lcIdx].ulRbCb != NULLP)
+      {
+         rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbId    = 0;
+         rlcUeCfg->entCfg[rlcUeCfg->numEnt].rbType  = 0;
+         rlcUeCfg->entCfg[rlcUeCfg->numEnt].cfgType = CKW_CFG_DELETE_UE;
+         rlcUeCfg->numEnt++;
+      }
+   }
+}
+
+/**
+* @brief Handler to do processing on expiry of the UE delete timer
+*
+* @details
+*    This function processes the RLC UE delete timer expiry.
+*
+* @param[in] cb  Pointer to the RlcUlUeCb  
+*
+* @return  uint8_t
+*/
+
+uint8_t rlcUeDeleteTmrExpiry(PTR cb)
+{
+   RlcCb *gRlcCb = NULLP;
+   RlcCfgInfo *rlcUeCfg = NULLP;
+   RlcUlUeCb *ueCb = (RlcUlUeCb*)cb;
+
+   gRlcCb = RLC_GET_RLCCB(ueCb->ueDeleteInfo.pst.dstInst);
+   RLC_ALLOC(gRlcCb, rlcUeCfg, sizeof(RlcCfgInfo));
+   if(rlcUeCfg == NULLP)
+   {
+      DU_LOG("\nERROR  -->  RLC: rlcUeDeleteTmrExpiry(): Failed to allocate memory");
+      return RFAILED;
+   }
+   memset(rlcUeCfg, 0, sizeof(RlcCfgInfo));
+   fillRlcUeDelInfo(ueCb, rlcUeCfg);
+   if(RlcProcCfgReq(&ueCb->ueDeleteInfo.pst, rlcUeCfg) != ROK)
+   {
+      DU_LOG("\nERROR  -->  RLC: rlcUeDeleteTmrExpiry(): Failed to delete UE");
+      if(sendRlcUeDeleteRspToDu(rlcUeCfg->cellId, rlcUeCfg->ueId, INVALID_UEID) != ROK)
+      {
+         DU_LOG("ERROR  --> RLC: rlcUeDeleteTmrExpiry(): Failed to send UE delete response ");
+         return RFAILED;
+      }
+   }
+   return ROK;
+}
 \f  
 /********************************************************************30**
   
index f00d445..69a4d71 100755 (executable)
@@ -295,6 +295,19 @@ typedef struct rlcUlLch
    RlcUlRbCb *ulRbCb;   /**< Pointer to Uplink RbCb */
 }RlcUlLch;                                  
 
+/**
+* @brief  Structure to hold ue delete information 
+*
+* @details
+*    - pst      :  Pst 
+*    - ueDelTmr :  Ue delete timer
+*/
+typedef struct rlcUeDeleteInfo
+{
+   Pst        pst;        /*Pst */ 
+   CmTimer    ueDelTmr;   /*Ue delete timer*/
+}RlcUeDeleteInfo;
+
 /** 
  * @brief  Structure to hold uplink information about the Cells
  *
@@ -329,17 +342,18 @@ typedef struct rlcUlCellCb
 struct rlcUlUeCb
 {
    CmHashListEnt   ueHlEnt;                   /**< Hash list entry for UeCb */
-   CmLteRnti     ueId;     /*!< UE Id */
-   CmLteCellId   cellId;   /*!< Cell Id */
-   RlcUlRbCb        *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */ 
-   RlcUlRbCb        *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */ 
-   RlcUlLch         lCh[RLC_MAX_LCH_PER_UE];    /**< Logical channels of an UE*/
+   CmLteRnti       ueId;     /*!< UE Id */
+   CmLteCellId     cellId;   /*!< Cell Id */
+   RlcUlRbCb       *srbCb[RLC_MAX_SRB_PER_UE]; /**< SRB RbCbs within an UE */ 
+   RlcUlRbCb       *drbCb[RLC_MAX_DRB_PER_UE]; /**< DRB RbCbs within an UE */ 
+   RlcUlLch        lCh[RLC_MAX_LCH_PER_UE];    /**< Logical channels of an UE*/
 /* kw005.201 added support for L2 Measurement */
 #ifdef LTE_L2_MEAS
-   uint32_t             firstPacketTTI;            /*!< is first packet of the burst */
-   uint16_t             numActRb[LKW_MAX_QCI];     /**< number of RBs Active */
-   Bool              isUlBurstActive;   /*!<Has the Burst started for UL IP Thrpt meas */
+   uint32_t        firstPacketTTI;            /*!< is first packet of the burst */
+   uint16_t        numActRb[LKW_MAX_QCI];     /**< number of RBs Active */
+   Bool            isUlBurstActive;   /*!<Has the Burst started for UL IP Thrpt meas */
 #endif /* LTE_L2_MEAS */
+   RlcUeDeleteInfo ueDeleteInfo;    /*!<Ue Delete Info */
 };
 
 /** 
index 0eb9b78..5d15d17 100755 (executable)
@@ -421,10 +421,11 @@ extern "C" {
 #define RLC_MAX_UM_TMR                  1
 #define RLC_MAX_AM_TMR                  3
 #define RLC_MAX_THPT_TMR                1
+#define RLC_MAX_UE_TMR                  1
 
 /* Timer events */
 #define EVENT_RLC_UMUL_REASSEMBLE_TMR     1
-#define EVENT_RLC_AMUL_REASSEMBLE_TMR          2
+#define EVENT_RLC_AMUL_REASSEMBLE_TMR     2
 #define EVENT_RLC_AMUL_STA_PROH_TMR       3
 #define EVENT_RLC_AMDL_POLL_RETX_TMR      4
 #define EVENT_RLC_WAIT_BNDCFM             5
@@ -433,6 +434,10 @@ extern "C" {
 #define EVENT_RLC_L2_TMR                  6
 #endif /* LTE_L2_MEAS */
 #define EVENT_RLC_THROUGHPUT_TMR          7
+#define EVENT_RLC_UE_DELETE_TMR           8
+
+/* Wait time for RLC Timers */
+#define RLC_UE_DELETE_WAIT_TIME           1 /*in milliseconds */
 
 /*******************************************************************************
  *                              DBM Defines 
@@ -1672,7 +1677,7 @@ typedef struct rlcUlCb
 
 typedef struct rlcThptPerUe
 {
-   uint16_t ueIdx;
+   uint16_t ueId;
    uint64_t dataVol;
 }RlcThptPerUe;
 
@@ -1738,6 +1743,10 @@ void rlcStopTmr  ARGS((RlcCb *gCb, PTR cb, uint8_t tmrType));
 
 bool rlcChkTmr ARGS((RlcCb *gCb,PTR cb, S16 tmrEvnt));
 
+void rlcThptTmrExpiry(PTR cb);
+
+uint8_t  rlcUeDeleteTmrExpiry(PTR cb);
+
 #ifdef LTE_L2_MEAS
 Void rlcLmmSendAlarm ARGS (( RlcCb *gCb,
                                    uint16_t category, 
index 4050de7..ff7c636 100755 (executable)
@@ -380,8 +380,7 @@ uint8_t rlcSendDedLcDlData(Pst *post, SpId spId, RguDDatReqInfo *datReqInfo)
 uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
 {
    uint8_t           numPdu = 0;
-   uint16_t          ueIdx;
-   uint16_t          actvUeIdx;
+   uint16_t          ueId;
    RlcDlUeCb         *ueCb;         /* UE control block */
    uint32_t          count;         /* Loop Counter */
    uint32_t          numTb;         /* Number of Tbs */
@@ -420,8 +419,8 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
    {
       staInd = &staIndInfo->staInd[idx];
       /* Fetch Ue control block */
-      GET_UE_IDX(staInd->rnti, ueIdx);
-      if(ROK != rlcDbmFetchDlUeCb(gCb, ueIdx, staIndInfo->cellId,&ueCb))
+      GET_UE_IDX(staInd->rnti, ueId);
+      if(ROK != rlcDbmFetchDlUeCb(gCb, ueId, staIndInfo->cellId,&ueCb))
       {
          /* Fetch UeCb failed */
          DU_LOG("\nERROR  -->  RLC_DL : rlcUtlSendToMac: UeId[%u]:ueCb not found",
@@ -430,13 +429,6 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
          continue; 
       }
       
-      /* Find ueIdx for throughput calculation */
-      for(actvUeIdx = 0; actvUeIdx < gCb->rlcThpt.numActvUe; actvUeIdx++)
-      {
-         if(gCb->rlcThpt.thptPerUe[actvUeIdx].ueIdx == ueIdx)
-            break;
-      }
-
       /* kw002.201 Removed the allocation of RlcDatReq */
       /* kw004.201 Used SSI function to initialize the variable */
       memset(&datReq, 0, sizeof(RlcDatReq) ); 
@@ -468,7 +460,8 @@ uint8_t rlcUtlSendToMac(RlcCb *gCb, SuId suId, KwDStaIndInfo *staIndInfo)
             if (rbCb && (!rlcDlUtlIsReestInProgress(rbCb)))
             { 
                /* Cosider buffer size for throughput calculation */
-               gCb->rlcThpt.thptPerUe[actvUeIdx].dataVol += staIndTb->lchStaInd[count].totBufSize;
+               if(gCb->rlcThpt.thptPerUe[ueId-1].ueId == ueId)
+                  gCb->rlcThpt.thptPerUe[ueId-1].dataVol += staIndTb->lchStaInd[count].totBufSize;
 
                staIndSz += staIndTb->lchStaInd[count].totBufSize;
                datReq.pduSz = staIndTb->lchStaInd[count].totBufSize;
index ef72d1a..ebdab07 100644 (file)
@@ -900,12 +900,18 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
    DU_LOG("\nDEBUG  -->  SCH : Received RLC BO Status indication");
    cell = schCb[inst].cells[inst];
 
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  -->  SCH : MacSchDlRlcBoInfo(): Cell does not exists");
+      return RFAILED;
+   }
+
    GET_UE_IDX(dlBoInfo->crnti, ueIdx);
    ueCb = &cell->ueCb[ueIdx-1];
    lcId  = dlBoInfo->lcId;
 
    if(lcId == SRB1_LCID || lcId == SRB2_LCID || lcId == SRB3_LCID || \
-      (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
+         (lcId >= MIN_DRB_LCID && lcId <= MAX_DRB_LCID))
    {
       SET_ONE_BIT(ueIdx, cell->boIndBitMap);
       ueCb->dlInfo.dlLcCtxt[lcId].bo = dlBoInfo->dataVolume;
@@ -924,20 +930,27 @@ uint8_t MacSchDlRlcBoInfo(Pst *pst, DlRlcBoInfo *dlBoInfo)
       slotIdx++;
       if(slotIdx==cell->numSlots)
       {
-          DU_LOG("\nERROR  -->  SCH : No DL Slot available");
-          return RFAILED;
+         DU_LOG("\nERROR  -->  SCH : No DL Slot available");
+         return RFAILED;
       }
    }
 #endif
+
    schDlSlotInfo = cell->schDlSlotInfo[slot];
 
+   if(schDlSlotInfo == NULLP)
+   {
+      DU_LOG("\nERROR  -->  SCH : MacSchDlRlcBoInfo(): schDlSlotInfo does not exists");
+      return RFAILED;
+   }
    SCH_ALLOC(schDlSlotInfo->dlMsgInfo, sizeof(DlMsgInfo));
-   if(!schDlSlotInfo->dlMsgInfo)
+   if(schDlSlotInfo->dlMsgInfo == NULLP)
    {
       DU_LOG("\nERROR  -->  SCH : Memory allocation failed for dlMsgInfo");
       schDlSlotInfo = NULL;
       return RFAILED;
    }
+   
    schDlSlotInfo->dlMsgInfo->crnti = dlBoInfo->crnti;
    schDlSlotInfo->dlMsgInfo->ndi = 1;
    schDlSlotInfo->dlMsgInfo->harqProcNum = 0;
index 4267906..92a17d7 100644 (file)
@@ -241,6 +241,11 @@ uint8_t schProcessSlotInd(SlotIndInfo *slotInd, Inst schInst)
    dlBrdcstAlloc->sib1Trans = NO_SIB1;
 
    cell = schCb[schInst].cells[schInst];
+   if(cell == NULLP)
+   {
+      DU_LOG("\nERROR  -->  SCH : Cell Does not exist");
+      return RFAILED;
+   }
    ssb_rep = cell->cellCfg.ssbSchCfg.ssbPeriod;
    memcpy(&cell->slotInfo, slotInd, sizeof(SlotIndInfo));
    dlBrdcstAlloc->ssbIdxSupported = 1;
index 6d69588..2728805 100755 (executable)
@@ -170,10 +170,10 @@ typedef struct rlcEntCfgCfmInfo
    Configuration Confirmation Informatin RLC to RRC */
 typedef struct rlcCfgCfmInfo
 {
-   uint32_t                  transId;             /*!< Transaction Id */
+   uint32_t             transId;             /*!< Transaction Id */
    CmLteRnti            ueId;                /*!< UE ID */
    CmLteCellId          cellId;              /*!< Cell ID */
-   uint8_t                   numEnt;              /*!< Number of entities configured */
+   uint8_t              numEnt;              /*!< Number of entities configured */
    RlcEntCfgCfmInfo     entCfgCfm[CKW_MAX_ENT_CFG];   /*!< Array of Entity cfg
                                                          confiramations */
 }RlcCfgCfmInfo;
index 230445a..af3ccca 100644 (file)
@@ -223,6 +223,12 @@ typedef enum
    SCS_240KHZ
 }SCS;
 
+typedef enum
+{
+   CELL_UP,
+   CELL_DOWN
+}OduCellStatus;
+
 typedef struct slotIndInfo
 {
    uint16_t cellId;
@@ -250,7 +256,7 @@ typedef struct tddCfg
 }TDDCfg;
 #endif
 
-
+OduCellStatus gCellStatus;
 uint64_t gSlotCount;
 uint64_t gDlDataRcvdCnt;   /* Number of DL data received at EGTP */
 
index 5b770d1..ed44441 100644 (file)
@@ -1252,14 +1252,14 @@ typedef struct ueCfgRsp
 typedef struct ueDelete
 {
     uint16_t cellId;
-    uint8_t  ueIdx;
+    uint8_t  ueId;
     uint16_t crnti;
 }MacUeDelete;
 
 typedef struct ueDeleteRsp
 {
    uint16_t cellId;
-   uint8_t  ueIdx;
+   uint8_t  ueId;
    UeDeleteStatus result;
 }MacUeDeleteRsp;
 
index 7c6b973..0929506 100644 (file)
@@ -212,13 +212,13 @@ typedef struct rlcUeCfgRsp
 typedef struct rlcUeDelete
 {
    uint16_t      cellId;
-   uint8_t       ueIdx;
+   uint8_t       ueId;
 }RlcUeDelete;
 
 typedef struct rlcUeDeleteRsp
 {
    uint16_t       cellId;
-   uint8_t        ueIdx;
+   uint8_t        ueId;
    UeDeleteResult result;
 }RlcUeDeleteRsp;
 
index a06b642..f1d4486 100644 (file)
 #include "du_cell_mgr.h"
 
 #ifdef O1_ENABLE
+
 #include "AlarmInterface.h"
-  
+#include "ConfigInterface.h"
+
 #endif
 
 /*******************************************************************
@@ -199,10 +200,12 @@ uint8_t duHandleCellUpInd(Pst *pst, OduCellId *cellId)
    {
       DU_LOG("\nINFO   -->  DU APP : 5G-NR Cell %d is UP", cellId->cellId);
       cellCb->cellStatus = ACTIVATED;
+      gCellStatus = CELL_UP;
 
 #ifdef O1_ENABLE
       DU_LOG("\nINFO   -->  DU APP : Raise cell UP alarm for cell id=%d", cellId->cellId);
       raiseCellAlrm(CELL_UP_ALARM_ID, cellId->cellId);
+      setCellOpState(cellId->cellId, ENABLED, ACTIVE);
 #endif
    }
 
index 524fe27..b9c1c89 100644 (file)
@@ -10073,7 +10073,7 @@ uint8_t procF1UeContextSetupReq(F1AP_PDU_t *f1apMsg)
    if(ret == RFAILED)
    {
       /*TODO : Negative case*/
-      // BuildAndSendUeContextSetupRsp(ueIdx, cellId);
+      // BuildAndSendUeContextSetupRsp(cellId,ueIdx);
       DU_LOG("\nERROR  -->  F1AP: Failed to process UE CNTXT SETUP REQ at procF1UeContextSetupReq()"); 
    }
    else
@@ -10420,13 +10420,13 @@ uint8_t fillDrbSetupList(DRBs_Setup_List_t *drbSetupList, DuUeCfg *ueCfg)
  *    Functionality: Constructs the UE Setup Response and sends
  *                   it to the DU through SCTP.
  *
- * @params[in] 
+ * @params[in] uint8_t cellId,uint8_t ueIdx
  *
  * @return ROK     - success
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
+uint8_t BuildAndSendUeContextSetupRsp(uint8_t cellId,uint8_t ueIdx)
 {
    uint8_t   idx, ret, cellIdx, elementCnt;
    uint32_t  gnbCuUeF1apId;   /* gNB-CU UE F1AP Id */
@@ -10621,7 +10621,7 @@ uint8_t BuildAndSendUeContextSetupRsp(uint8_t ueIdx, uint8_t cellId)
 *         failure = RFAILED
 *
 * ****************************************************************/
-uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
+uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx)
 {
    uint8_t cellIdx = 0, actionType = 0; 
 
@@ -10631,11 +10631,15 @@ uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId)
    switch(actionType)
    {
       case UE_CTXT_SETUP:
-         BuildAndSendUeContextSetupRsp(ueIdx, cellId);
-         break;
+         {
+            BuildAndSendUeContextSetupRsp(cellId,ueIdx);
+            break;
+         }
       case UE_CTXT_MOD:
-         BuildAndSendUeContextModResp(ueIdx, cellId);
-         break;
+         {
+            BuildAndSendUeContextModRsp(cellId, ueIdx);
+            break;
+         }
       default:
          DU_LOG("ERROR  -->  F1AP: Invalid Action Type %d at BuildAndSendUeCtxtRsp()", actionType);
          break;
@@ -11813,17 +11817,17 @@ void FreeUeContextModResp(F1AP_PDU_t *f1apMsg)
 *
 * @details
 *
-*    Function : BuildAndSendUeContextModResp 
+*    Function : BuildAndSendUeContextModRsp 
 *
 *    Functionality:
 *         - Creating the ue context modifcation response 
 *
-* @params[in]
+* @params[in] uint8_t cellId,uint8_t ueIdx
 * @return ROK     - success
 *         RFAILED - failure
 *
 * ****************************************************************/
-uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId)
+uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx)
 {
    uint8_t   ieIdx = 0;
    uint8_t   cellIdx =0;
@@ -12527,12 +12531,12 @@ void FreeUeContextReleaseComplete(F1AP_PDU_t *f1apMsg)
  *    Functionality:
  *         - Build and Send UE Context Release Complete
  *
- * @params[in]
+ * @params[in]  cellId,  gnbCuUeF1apId, gnbDuUeF1apId
  * @return ROK     - success
  *         RFAILED - failure
  *
  * *************************************************************/
-uint8_t BuildAndSendUeContextReleaseComplete(uint32_t  gnbCuUeF1apId, uint32_t  gnbDuUeF1apId)
+uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t gnbCuUeF1apId, uint32_t gnbDuUeF1apId)
 {
    bool memAllocFail = false;
    uint8_t ieIdx =0, ret = RFAILED, elementCnt = 0;
@@ -12637,13 +12641,22 @@ uint8_t BuildAndSendUeContextReleaseComplete(uint32_t  gnbCuUeF1apId, uint32_t
       ret = ROK;
       break;
    }while(true);
-
+   
+   if(ret == ROK)
+   {
+      duCb.actvCellLst[cellId-1]->cellStatus = DELETION_IN_PROGRESS;
+      ret = duSendCellDeletReq(cellId);
+      if(ret != ROK)
+      {
+         DU_LOG("\nERROR  -->  F1AP: BuildAndSendUeContextReleaseComplete(): Failed to process cell\
+               Delete req for CellId");
+      }
+   }
    FreeUeContextReleaseComplete(f1apMsg);
    return ret;
 
-   /*TODO: To add trigger for UE context release complete, once the operations of UE context
-    * release command are done*/
 }
+
 /*******************************************************************
 *
 * @brief added free part for the memory allocated by aper_decoder 
@@ -12714,10 +12727,116 @@ void freeAperDecodeUeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 * ****************************************************************/
 uint8_t procF1UeContextReleaseCommand(F1AP_PDU_t *f1apMsg)
 {
-   /*TODO: processing of DL RRC Msg Transfer to RLC->SCH->MAC-LOWER-MAC->PHY, if RRC container is received */
-   
+   uint8_t  ieIdx=0, ret=ROK, ueIdx=0;
+   uint16_t cellIdx =0;
+   bool ueIdxFound;
+   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId=0;
+   DuUeCb   *duUeCb = NULLP;
+   UEContextReleaseCommand_t *ueContextReleaseCommand = NULLP;
+
+   ueContextReleaseCommand = &f1apMsg->choice.initiatingMessage->value.choice.UEContextReleaseCommand;
+
+   if(ueContextReleaseCommand->protocolIEs.list.array)
+   {
+      for(ieIdx=0; ieIdx < ueContextReleaseCommand->protocolIEs.list.count; ieIdx++)
+      {
+         if(ueContextReleaseCommand->protocolIEs.list.array[ieIdx])
+         {
+            switch(ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id)
+            {
+               case ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID:
+                  {
+                     gnbCuUeF1apId= ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                    value.choice.GNB_CU_UE_F1AP_ID;
+                     break;
+                  }
+
+               case ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID:
+                  {
+                     gnbDuUeF1apId = ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                     value.choice.GNB_DU_UE_F1AP_ID;
+                     break;
+                  }
+
+               case ProtocolIE_ID_id_Cause:
+                  {
+                     break;
+                  }
+
+               case ProtocolIE_ID_id_RRCContainer:
+                  {
+                     for(cellIdx = 0; cellIdx < duCb.numActvCells; cellIdx++)
+                     {
+                        for(ueIdx = 0; ueIdx < duCb.numUe; ueIdx++)
+                        {
+                           if((duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbDuUeF1apId == gnbDuUeF1apId)&&\
+                                 (duCb.actvCellLst[cellIdx]->ueCb[ueIdx].gnbCuUeF1apId == gnbCuUeF1apId))
+                           {
+                              duUeCb = &duCb.actvCellLst[cellIdx]->ueCb[ueIdx];
+                              DU_ALLOC(duUeCb->f1UeDb, sizeof(F1UeContextSetupDb));
+                              if(duUeCb->f1UeDb)
+                              {
+                                 memset(duUeCb->f1UeDb, 0, sizeof(F1UeContextSetupDb));
+                                 duUeCb->f1UeDb->actionType = UE_CTXT_RELEASE;
+                                 duUeCb->f1UeDb->cellIdx = cellIdx;
+                                 /* Filling Dl RRC Msg Info */
+                                 DU_ALLOC_SHRABL_BUF(duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+                                 if(!duUeCb->f1UeDb->dlRrcMsg)
+                                 {
+                                    DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                    Memory allocation failed ");
+                                    ret = RFAILED;
+                                 }
+                                 else
+                                 {
+                                    duUeCb->f1UeDb->dlRrcMsgPres = true;
+                                    memset(duUeCb->f1UeDb->dlRrcMsg, 0, sizeof(F1DlRrcMsg));
+                                    ret = extractDlRrcMsg(gnbDuUeF1apId, gnbCuUeF1apId, duUeCb->f1UeDb->dlRrcMsg,\
+                                          &ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->\
+                                          value.choice.RRCContainer);
+                                 }
+
+                              }
+                              else
+                              {
+                                 DU_LOG("\nERROR  -->  DU APP : procF1UeContextReleaseCommand(): \
+                                 Memory allocation failed ");
+                                 ret = RFAILED;
+
+                              }
+
+                              ueIdxFound = true;
+                              break;
+                           }
+                        }
+                        if(ueIdxFound == true)
+                        {
+                           break;
+                        }
+                     }
+                     if(!ueIdxFound)
+                     {
+                        DU_LOG("\nERROR  -->  F1AP: DuUeCb is not found at procF1UeContextSetupReq()");
+                        ret = RFAILED;
+                     }
+
+
+                     break;
+                  }
+               default :
+                  DU_LOG("\nERROR  -->  F1AP: freeAperDecodeUeContextReleaseCommand():Invalid IE Received: %ld"\
+                        ,ueContextReleaseCommand->protocolIEs.list.array[ieIdx]->id);
+                  break;
+            }
+         }
+      }
+   }
+   if(ret != RFAILED)
+   {
+      duProcUeContextReleaseCommand(duUeCb);
+   }
    freeAperDecodeUeContextReleaseCommand(f1apMsg);
-   return ROK;
+   return ret;
 }
 /**************************************************************
  *
index c52a835..c956fe0 100644 (file)
@@ -36,7 +36,7 @@ uint8_t BuildAndSendInitialRrcMsgTransfer(uint32_t gnbDuUeF1apId, uint16_t crnti
 uint8_t BuildAndSendULRRCMessageTransfer(DuUeCb  ueCb, uint8_t lcId,  uint16_t msgLen, uint8_t *rrcMsg);
 uint8_t procUeReCfgCellInfo(MacUeCfg *macUeCfg, void *cellGrp);
 void freeUeReCfgCellGrpInfo(MacUeCfg *macUeCfg);
-uint8_t BuildAndSendUeCtxtRsp(uint8_t ueIdx, uint8_t cellId);
+uint8_t BuildAndSendUeCtxtRsp(uint8_t cellId, uint8_t ueIdx);
 uint8_t getDrbLcId(uint32_t *drbBitMap);
 void  freeMacLcCfg(LcCfg *lcCfg);
 void  freeRlcLcCfg(RlcBearerCfg *lcCfg);
@@ -48,10 +48,12 @@ void duFillModulationDetails(MacUeCfg *ueCfg, MacUeCfg *oldUeCfg, void *ueCap);
 int8_t getReAsmblTmr(uint8_t reAsmblTmrCfg);
 int16_t getStatProhTmr(uint8_t statProhTmrCfg);
 uint8_t duProcUeContextModReq(DuUeCb *ueCb);
-uint8_t BuildAndSendUeContextModResp(uint8_t ueIdx, uint8_t cellId);
+uint8_t BuildAndSendUeContextModRsp(uint8_t cellId,uint8_t ueIdx);
 uint8_t duBuildAndSendUeContextModReq(uint16_t cellId, uint16_t crnti, DuUeCfg *duUeCfg);
 uint8_t BuildAndSendUeContextReleaseReq(uint16_t cellId, uint8_t ueIdx);
-uint8_t BuildAndSendUeContextReleaseComplete(uint32_t  gnbCuUeF1apId, uint32_t  gnbDuUeF1apId);
+uint8_t BuildAndSendUeContextReleaseComplete(uint16_t cellId, uint32_t  gnbCuUeF1apId, uint32_t  gnbDuUeF1apId);
+uint8_t duSendCellDeletReq(uint16_t cellId); 
+uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb);
 /**********************************************************************
          End of file
 **********************************************************************/
index 4dfc709..0378748 100644 (file)
@@ -75,7 +75,8 @@ typedef enum
 {
    UE_CTXT_UNKNOWN,
    UE_CTXT_SETUP,
-   UE_CTXT_MOD
+   UE_CTXT_MOD,
+   UE_CTXT_RELEASE
 }UeCtxtActionType;
 
 /** F1AP Msg IE **/
@@ -260,7 +261,7 @@ uint8_t duSendEgtpTnlMgmtReq(uint8_t action, uint32_t teIdMod, GtpTnlCfg *tnlInf
 uint8_t duSendEgtpDatInd(Buffer *mBuf);
 uint8_t duHdlSchCfgComplete(Pst *pst, RgMngmt *cfm);
 uint8_t duBuildAndSendMacCellStart();
-uint8_t duBuildAndSendMacCellStop();
+uint8_t duBuildAndSendMacCellStop(uint16_t cellId);
 #endif
 
 /**********************************************************************
index 6bc11c8..76066da 100644 (file)
@@ -33,6 +33,7 @@
 #ifdef O1_ENABLE
 
 #include "O1Interface.h"
+#include "ConfigInterface.h"
 
 #endif
 
@@ -84,6 +85,52 @@ uint8_t duAppInit(SSTskId sysTskId)
    return ROK;
 }
 
+#ifdef O1_ENABLE
+/*******************************************************************
+ *
+ * @brief Bring the cell Up
+ *
+ * @details
+ *
+ *    Function : bringCellUp
+ *
+ *    Functionality:
+ *       - Bring the cell Up when requested from OAM
+ *
+ * @params[in] Cell Id
+ * @return true     - success
+ *         false    - failure
+ *
+ * ****************************************************************/
+
+bool bringCellUp(uint16_t cellId)
+{
+   return true;
+}
+
+/*******************************************************************
+ *
+ * @brief Bring the cell Down
+ *
+ * @details
+ *
+ *    Function : bringCellDown
+ *
+ *    Functionality:
+ *       - Bring the cell Down when requested from OAM
+ *
+ * @params[in] Cell Id
+ * @return true     - success
+ *         false    - failure
+ *
+ * ****************************************************************/
+
+bool bringCellDown(uint16_t cellId)
+{
+   return true;
+}
+#endif
+
 /*******************************************************************
  *
  * @brief Initializes EGTP
@@ -444,7 +491,6 @@ uint8_t tst(void)
    if(start_O1_module() != ROK)
       return RFAILED;
 #endif
-
    //Initialize TAPA layers
    if(duInit() != ROK)
    {
index 5a09fe3..d236c9a 100644 (file)
@@ -43,6 +43,7 @@
 #ifdef O1_ENABLE
 
 #include "AlarmInterface.h"
+#include "ConfigInterface.h"
 
 #endif 
 
@@ -334,40 +335,41 @@ uint8_t duProcCfgComplete()
    for(idx=0; idx< DEFAULT_CELLS; idx++)
    {
       DuCellCb *cell = NULLP;
-      DU_ALLOC(cell, sizeof(DuCellCb))
+      DU_ALLOC(cell, sizeof(DuCellCb));
       if(cell == NULLP)
       {
-        DU_LOG("\nERROR  -->  DU_APP : Memory Allocation failed in duProcCfgComplete");
-        ret = RFAILED;
+         DU_LOG("\nERROR  -->  DU_APP : Memory Allocation failed in duProcCfgComplete");
+         ret = RFAILED;
       }
       else
       {
-        uint8_t idx1=0; 
-        memset(cell, 0, sizeof(DuCellCb));
-        cell->cellId = ++cellId;
-        memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
-        cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
-        cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
-        cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
-        cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
-        cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
-        cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
-        cell->cellInfo.nrPci = NR_PCI; 
-        cell->cellInfo.fiveGsTac = DU_TAC;
-        memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
-        for(idx1=0; idx1<MAX_PLMN; idx1++)
-        {
-           cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
-           cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
-           cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
-           cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
-           cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
-        }
-        cell->cellInfo.maxUe = duCfgParam.maxUe;
-        cell->cellStatus = CELL_OUT_OF_SERVICE;
-
-        duCb.cfgCellLst[duCb.numCfgCells] = cell;
-        duCb.numCfgCells++;
+         uint8_t idx1=0; 
+         memset(cell, 0, sizeof(DuCellCb));
+         cell->cellId = ++cellId;
+         memset(&cell->cellInfo.nrEcgi.plmn, 0, sizeof(Plmn));
+         cell->cellInfo.nrEcgi.plmn.mcc[0] = PLMN_MCC0;
+         cell->cellInfo.nrEcgi.plmn.mcc[1] = PLMN_MCC1;
+         cell->cellInfo.nrEcgi.plmn.mcc[2] = PLMN_MCC2;
+         cell->cellInfo.nrEcgi.plmn.mnc[0] = PLMN_MNC0;
+         cell->cellInfo.nrEcgi.plmn.mnc[1] = PLMN_MNC1;
+         cell->cellInfo.nrEcgi.cellId = NR_CELL_ID;
+         cell->cellInfo.nrPci = NR_PCI; 
+         cell->cellInfo.fiveGsTac = DU_TAC;
+         memset(&cell->cellInfo.plmn[idx1], 0, sizeof(Plmn));
+         for(idx1=0; idx1<MAX_PLMN; idx1++)
+         {
+            cell->cellInfo.plmn[idx1].mcc[0] = PLMN_MCC0;
+            cell->cellInfo.plmn[idx1].mcc[1] = PLMN_MCC1;
+            cell->cellInfo.plmn[idx1].mcc[2] = PLMN_MCC2;
+            cell->cellInfo.plmn[idx1].mnc[0] = PLMN_MNC0;
+            cell->cellInfo.plmn[idx1].mnc[1] = PLMN_MNC1;
+         }
+         cell->cellInfo.maxUe = duCfgParam.maxUe;
+         cell->cellStatus = CELL_OUT_OF_SERVICE;
+         gCellStatus = CELL_DOWN;
+
+         duCb.cfgCellLst[duCb.numCfgCells] = cell;
+         duCb.numCfgCells++;
       }
    }
    if(ret != RFAILED)
@@ -1558,26 +1560,38 @@ uint8_t duBuildAndSendMacCellStart()
  *         RFAILED - failure
  *
  * ****************************************************************/
-uint8_t duBuildAndSendMacCellStop()
+uint8_t duBuildAndSendMacCellStop(uint16_t cellId)
 {
    Pst pst;
-   OduCellId *cellId = NULL;
-
+   uint16_t cellIdx=0;
+   OduCellId *oduCellId = NULL;
+   
    DU_LOG("\nINFO   -->  DU APP : Building and Sending cell stop request to MAC");
 
-   /* Send Cell Stop Request to MAC */
-   DU_ALLOC_SHRABL_BUF(cellId, sizeof(OduCellId));
-   if(!cellId)
+   GET_CELL_IDX(cellId, cellIdx);
+   if(duCb.actvCellLst[cellIdx] != NULLP)
    {
-      DU_LOG("\nERROR  -->  DU APP : Memory alloc failed while building cell stop request");
-      return RFAILED;
-   }
-   cellId->cellId = duCb.actvCellLst[0]->cellId;
+      /* Send Cell Stop Request to MAC */
+      DU_ALLOC_SHRABL_BUF(oduCellId, sizeof(OduCellId));
+      if(!oduCellId)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duBuildAndSendMacCellStop():  Memory allocation failed ");
+         return RFAILED;
+      }
 
-   /* Fill Pst */
-   FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
+      oduCellId->cellId = duCb.actvCellLst[cellIdx]->cellId;
 
-   return (*packMacCellStopOpts[pst.selector])(&pst, cellId);
+      /* Fill Pst */
+      FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_CELL_STOP);
+
+      return (*packMacCellStopOpts[pst.selector])(&pst, oduCellId);
+   }
+   else
+   {
+      DU_LOG("\nERROR  -->  DU APP : duBuildAndSendMacCellStop(): cellId[%d] doesnot exists", cellId);
+      return RFAILED;
+   }
+   return ROK;
 }
 
 /*******************************************************************
@@ -1616,6 +1630,7 @@ uint8_t duHandleStopInd(Pst *pst, OduCellId *cellId)
 #ifdef O1_ENABLE
       DU_LOG("\nINFO   -->  DU APP : Raise cell down alarm for cell id=%d", cellId->cellId);
       raiseCellAlrm(CELL_DOWN_ALARM_ID, cellId->cellId);
+      setCellOpState(cellId->cellId, DISABLED, INACTIVE);
 #endif
    }
 
index d6adbc6..5b0a146 100644 (file)
@@ -2200,7 +2200,7 @@ uint8_t DuProcMacUeCfgRsp(Pst *pst, MacUeCfgRsp *cfgRsp)
                macUeCfg.macUeCfgState = UE_RECFG_COMPLETE;
             if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
             {
-               BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
+               BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx);
             }
          }
       }
@@ -2321,7 +2321,7 @@ uint8_t DuProcRlcUeCfgRsp(Pst *pst, RlcUeCfgRsp *cfgRsp)
                rlcUeCfg.rlcUeCfgState = UE_RECFG_COMPLETE;
             if((ret = duUpdateDuUeCbCfg(cfgRsp->ueIdx, cfgRsp->cellId)) == ROK)
             {
-               BuildAndSendUeCtxtRsp(cfgRsp->ueIdx, cfgRsp->cellId);
+               BuildAndSendUeCtxtRsp(cfgRsp->cellId, cfgRsp->ueIdx);
             }   
          }
       }
@@ -2508,6 +2508,15 @@ uint8_t DuProcRlcDlRrcMsgRsp(Pst *pst, RlcDlRrcMsgRsp *dlRrcMsg)
             if(ret == RFAILED)
                DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Mod Request in DuProcRlcDlRrcMsgRsp()");
          }
+         if(ueCb->f1UeDb->actionType == UE_CTXT_RELEASE)
+         {
+            ret = duBuildAndSendUeDeleteReq(dlRrcMsg->cellId);
+            if(ret == RFAILED)
+            {
+               DU_LOG("\nERROR  -->  DU APP : Failed to process UE Context Release Request in DuProcRlcDlRrcMsgRsp()");
+            }
+
+         }
       }
    }
    else
@@ -2829,13 +2838,12 @@ uint8_t  deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
       }
       else
       {
-         DU_LOG("INFO  --> DU APP : deleteUeCfg(): MAC or RLC UE configuration state not UE_DELETE_COMPLETE");
          return RFAILED;
       }
    }
    else
    {
-      DU_LOG("ERROR  --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx);
+      DU_LOG("\nERROR  --> DU APP : deleteUeCfg(): CellIdx[%d] is not found", cellIdx);
       return RFAILED;
    }
    return ROK;
@@ -2860,36 +2868,29 @@ uint8_t  deleteUeCfg(uint16_t cellIdx, uint8_t ueIdx)
 
 uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
 {
-   uint8_t  ueIdx = 0,ret =ROK;
+   uint8_t  ret =ROK;
    uint16_t cellIdx=0;
-   uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0;
 
    if(deleteRsp)
    {
       if(deleteRsp->result == SUCCESS)
       {
-         DU_LOG("\nINFO   -->  DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueIdx);
+         DU_LOG("\nINFO   -->  DU APP : MAC UE Delete Response : SUCCESS [UE IDX : %d]", deleteRsp->ueId);
          GET_CELL_IDX(deleteRsp->cellId, cellIdx);
-         ueIdx = deleteRsp->ueIdx;
          if(duCb.actvCellLst[cellIdx])
          {
-            duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueIdx -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
-            gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
-            gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
-            if(deleteUeCfg(cellIdx, ueIdx) == ROK)
+            duCb.actvCellLst[cellIdx]->ueCb[deleteRsp->ueId -1].macUeCfg.macUeCfgState = UE_DELETE_COMPLETE;
+            if(sendUeDeleteReqToRlc(deleteRsp->cellId, deleteRsp->ueId) == RFAILED)
             {
-                 ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId);
-                 if(ret !=ROK)
-                 {   
-                    DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
-                 }
+               DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp():Failed to build UE  delete req for RLC ");
+               ret = RFAILED;
             }
          }
       }
       else
       {
          DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): MAC UE Delete Response : FAILURE [UE IDX : %d]",\
-         deleteRsp->ueIdx);
+         deleteRsp->ueId);
          ret =  RFAILED;
       }
       DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp));
@@ -2922,36 +2923,36 @@ uint8_t DuProcMacUeDeleteRsp(Pst *pst, MacUeDeleteRsp *deleteRsp)
 
 uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
 {
-   uint8_t  ueIdx = 0, ret = ROK;
+   uint8_t  ueId = 0, ret = ROK;
    uint16_t cellIdx = 0;
    uint32_t gnbCuUeF1apId=0, gnbDuUeF1apId =0;   
 
    if(delRsp)
    {
-      ueIdx = delRsp->ueIdx;
+      ueId = delRsp->ueId;
       GET_CELL_IDX(delRsp->cellId, cellIdx);
 
       if(delRsp->result == SUCCESSFUL)
       {
-         DU_LOG("\nINFO   -->  DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueIdx);
+         DU_LOG("\nINFO   -->  DU_APP: RLC UE Delete Response : SUCCESS [UE IDX:%d]", ueId);
          if(duCb.actvCellLst[cellIdx]!=NULLP)
          {
-            duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
-            gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbDuUeF1apId;
-            gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueIdx-1].gnbCuUeF1apId;
-            if(deleteUeCfg(cellIdx, ueIdx) == ROK)
+            duCb.actvCellLst[cellIdx]->ueCb[ueId-1].rlcUeCfg.rlcUeCfgState = UE_DELETE_COMPLETE;
+            gnbCuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbDuUeF1apId;
+            gnbDuUeF1apId = duCb.actvCellLst[cellIdx]->ueCb[ueId-1].gnbCuUeF1apId;
+            if(deleteUeCfg(cellIdx, ueId) == ROK)
             {
-                ret = BuildAndSendUeContextReleaseComplete(gnbCuUeF1apId, gnbDuUeF1apId);
-                if(ret != ROK)
-                {
-                   DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
-                }
+               ret = BuildAndSendUeContextReleaseComplete(delRsp->cellId, gnbCuUeF1apId, gnbDuUeF1apId);
+               if(ret != ROK)
+               {
+                  DU_LOG("\nERROR  -->  DU APP : DuProcMacUeDeleteRsp(): failed to send UE context release complete");
+               }
             }
          }
       }
       else
       {
-         DU_LOG("\nERROR   -->  DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueIdx);
+         DU_LOG("\nERROR   -->  DU_APP: RLC UE Delete Response : FAILED [UE IDX:%d]", ueId);
          ret = RFAILED;
       }
       DU_FREE_SHRABL_BUF(pst->region, pst->pool, delRsp, sizeof(RlcUeDeleteRsp));
@@ -2971,13 +2972,13 @@ uint8_t DuProcRlcUeDeleteRsp(Pst *pst, RlcUeDeleteRsp *delRsp)
 *    Functionality:
 *     sending UE Delete Req To Mac
 *
-*  @params[in]    cellId, ueIdx, crnti 
+*  @params[in]    cellId, ueId, crnti 
 *  @return ROK     - success
 *          RFAILED - failure
 *
 *****************************************************************/
 
-uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti)
+uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti)
 {
    Pst pst;
    uint8_t ret=ROK;
@@ -2987,11 +2988,10 @@ uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti)
    if(ueDelete)
    {
       ueDelete->cellId = cellId;
-      ueDelete->ueIdx  = ueIdx;
+      ueDelete->ueId   = ueId;
       ueDelete->crnti  = crnti;
       FILL_PST_DUAPP_TO_MAC(pst, EVENT_MAC_UE_DELETE_REQ);
 
-      /* Processing one Ue at a time to MAC */
       DU_LOG("\nDEBUG  -->  DU_APP: Sending UE delete Request to MAC ");
       ret = (*packMacUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
       if(ret == RFAILED)
@@ -3019,13 +3019,13 @@ uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueIdx, uint16_t crnti)
  *    Functionality:
  *     Sending UE Delete Req To Rlc
  *
- *  @params[in]  cellId, ueIdx 
+ *  @params[in]  cellId, ueId 
  *  @return ROK     - success
  *          RFAILED - failure
  *
  *****************************************************************/
 
-uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx)
+uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId)
 {
    uint8_t ret;
    Pst pst;
@@ -3035,7 +3035,7 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx)
    if(ueDelete !=NULLP)
    {
       ueDelete->cellId = cellId;
-      ueDelete->ueIdx = ueIdx;
+      ueDelete->ueId = ueId;
       FILL_PST_DUAPP_TO_RLC(pst, RLC_UL_INST, EVENT_RLC_UE_DELETE_REQ);
 
       ret = (*packRlcUeDeleteReqOpts[pst.selector])(&pst, ueDelete);
@@ -3059,7 +3059,7 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx)
  *
  * @details
  *
- *    Function : duProcUeDeleteReq
+ *    Function : duBuildAndSendUeDeleteReq
  *
  *    Functionality: DU processes UE delete req from CU and sends to MAC 
  *                   and RLC 
@@ -3070,37 +3070,30 @@ uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueIdx)
  *
  * ****************************************************************/
 
-uint8_t duProcUeDeleteReq(uint16_t cellId)
+uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId)
 {
    uint8_t  ueIdx = 0, ueId =0;
    uint16_t cellIdx = 0, crnti   = 0;
 
-   DU_LOG("\nDEBUG   -->  DU_APP: Processing UE Delete Request ");
+   DU_LOG("\nDEBUG  -->  DU_APP: Processing UE Delete Request ");
    GET_CELL_IDX(cellId, cellIdx);
-   GET_CRNTI(crnti,ueIdx);
 
    if(duCb.actvCellLst[cellIdx] != NULLP)
    {
       for(ueIdx =0;ueIdx< duCb.actvCellLst[cellIdx]->numActvUes; ueIdx++)
       {
-         ueId = ueIdx+1;
-         if(sendUeDeleteReqToRlc(cellId, ueId) == RFAILED)
-         {
-            DU_LOG("\nERROR  -->  DU APP : duProcUeDeleteReq():Failed to build UE  delete req for RLC ");
-            return RFAILED;
-         }
-
-         GET_CRNTI(crnti,ueId);
+         crnti = duCb.actvCellLst[cellIdx]->ueCb[ueIdx].crnti;
+         GET_UE_IDX(crnti,ueId);
          if(sendUeDeleteReqToMac(cellId, ueId, crnti) == RFAILED)
          {
-            DU_LOG("\nERROR  -->  DU APP : duProcUeDeleteReq(): Failed to build UE  delete req for MAC ");
+            DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeDeleteReq(): Failed to build UE  delete req for MAC ");
             return RFAILED;
          }
       }
    }
    else
    {
-      DU_LOG("\nERROR  -->  DU APP : duProcUeDeleteReq(): Cell Id is not found");
+      DU_LOG("\nERROR  -->  DU APP : duBuildAndSendUeDeleteReq(): Cell Id is not found");
       return RFAILED;
    }
 
@@ -3228,6 +3221,7 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
          if(duCb.actvCellLst[cellIdx]->cellId == deleteRsp->cellId)
          {
             deleteDuCellCb(duCb.actvCellLst[cellIdx]);
+            gCellStatus = CELL_DOWN;
             duCb.numActvCells--;
             DU_FREE(duCb.actvCellLst[cellIdx], sizeof(DuCellCb));
          }
@@ -3243,7 +3237,7 @@ uint8_t DuProcMacCellDeleteRsp(Pst *pst, MacCellDeleteRsp *deleteRsp)
          [CELL IDX : %d]", deleteRsp->cellId);
          ret = RFAILED;
       }
-      DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacUeDeleteRsp));
+      DU_FREE_SHRABL_BUF(pst->region, pst->pool, deleteRsp, sizeof(MacCellDeleteRsp));
    }
    else
    {
@@ -3306,7 +3300,7 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId)
  *
  * @details
  *
- *    Function : duProcCellDeleteReq 
+ *    Function : duSendCellDeletReq 
  *
  *    Functionality: DU process Cell Delete Req to MAC 
  *
@@ -3316,42 +3310,112 @@ uint8_t sendCellDeleteReqToMac(uint16_t cellId)
  *
  * ****************************************************************/
 
-uint8_t duProcCellDeleteReq(uint16_t cellId)
+uint8_t duSendCellDeletReq(uint16_t cellId)
 {
    uint16_t cellIdx = 0;
-   
    DU_LOG("\nINFO   -->  DU APP : Processing Cell Delete Request ");
    GET_CELL_IDX(cellId, cellIdx);
 
-   if(duCb.actvCellLst[cellIdx] != NULLP)
+   if(duCb.actvCellLst[cellIdx] == NULLP)
    {
-      if(duBuildAndSendMacCellStop() == RFAILED)
-      {
-         DU_LOG("\nERROR  -->  DU APP : duProcCellDeleteReq(): Failed to process Cell delete req for cellId[%d]",cellId);
-         return RFAILED;
-      }
-      
-      if(duCb.actvCellLst[cellIdx]->numActvUes)
-      {
-         DU_LOG("\nERROR  -->  DU APP : duProcCellDeleteReq(): Active UEs present Failed to process cell Delete\
-         Req for cellID[%d]", cellId);
-         return RFAILED;
-      }
-      if(sendCellDeleteReqToMac(cellId) == RFAILED)
-      {
-         DU_LOG("\nERROR  -->  DU APP : duProcCellDeleteReq(): Failed to build and send Cell delete req for MAC for\
-         cellId[%d]",cellId);
-         return RFAILED;
-      }
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
+      return RFAILED;
    }
-   else
+   
+   if(duCb.actvCellLst[cellIdx]->cellId != cellId)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellId[%d] is not found", cellId);
+      return RFAILED;
+
+   }  
+   
+   if(duCb.actvCellLst[cellIdx]->cellStatus != DELETION_IN_PROGRESS)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): CellStatus[%d] of cellId[%d] is not correct.\
+      Expected CellStatus is DELETION_IN_PROGRESS",duCb.actvCellLst[cellIdx]->cellStatus, cellId);
+      return RFAILED;  
+   }
+
+   if(duCb.actvCellLst[cellIdx]->numActvUes)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Active UEs still present in cellId[%d].\
+      Failed to delete cell", cellId);
+      return RFAILED;
+   }
+
+   if(duBuildAndSendMacCellStop(cellId) == RFAILED)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to build and send cell stop request to MAC for\
+            cellId[%d]",cellId);
+      return RFAILED;
+   }
+
+   if(sendCellDeleteReqToMac(cellId) == RFAILED)
    {
-      DU_LOG("\nERROR  -->  DU APP : duProcCellDeleteReq(): CellId[%d] is not found", cellId);
+      DU_LOG("\nERROR  -->  DU APP : duSendCellDeletReq(): Failed to send Cell delete req to MAC for\
+            cellId[%d]",cellId);
       return RFAILED;
    }
 
    return ROK;
 }
+/*******************************************************************
+*
+* @brief Du process Ue Context Release Command
+*
+* @details
+*
+*    Function : duProcUeContextReleaseCommand 
+*
+*    Functionality: Du process Ue Context Release Command 
+*
+* @params[in] DuUeCb *duUeCb 
+* @return ROK     - success
+*         RFAILED - failure
+*
+* ****************************************************************/
+uint8_t duProcUeContextReleaseCommand(DuUeCb *duUeCb)
+{
+   uint8_t ret =ROK, ueIdx=0;
+   uint16_t cellId=0;
+   if(duUeCb == NULLP)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : duUeCb is null");
+      return RFAILED;
+   }
+   if(duUeCb->f1UeDb == NULLP)
+   {
+      DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : f1UeDb is null");
+      return RFAILED;
+   }
+   
+   cellId = duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->cellId;
+   /* Send DL RRC msg for RRC release */
+   if(duUeCb->f1UeDb->dlRrcMsg)
+   {
+      if(duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu != NULLP)
+      {
+         ret = duBuildAndSendDlRrcMsgToRlc(cellId, duCb.actvCellLst[duUeCb->f1UeDb->cellIdx]->ueCb[ueIdx].rlcUeCfg,\
+               duUeCb->f1UeDb->dlRrcMsg);
+         if(ret == RFAILED)
+         {
+            DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand() : Failed to send DL RRC msg");
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg->rrcMsgPdu,\
+                  duUeCb->f1UeDb->dlRrcMsg->rrcMsgSize);
+            DU_FREE_SHRABL_BUF(DU_APP_MEM_REGION, DU_POOL, duUeCb->f1UeDb->dlRrcMsg, sizeof(F1DlRrcMsg));
+         }
+      }
+   }
+   else
+   {
+      ret = duBuildAndSendUeDeleteReq(cellId);
+      if(ret == RFAILED)
+      {
+         DU_LOG("\nERROR  -->  DU APP : duProcUeContextReleaseCommand(): Failed to build and send Ue Delete request");
+      }
+   }
+   return ret;
+}
 
 /**********************************************************************
   End of file
index 0fa49eb..52c0574 100644 (file)
@@ -28,9 +28,11 @@ uint8_t duBuildAndSendUeCreateReqToMac(uint16_t cellId, uint8_t ueIdx,\
 uint8_t duBuildAndSendUeCreateReqToRlc(uint16_t cellId, uint8_t ueIdx, RlcUeCfg *duRlcUeCfg);
 uint8_t duCreateUeCb(UeCcchCtxt *ueCcchCtxt, uint32_t gnbCuUeF1apId);
 uint8_t duProcUlCcchInd(UlCcchIndInfo *ulCcchIndInfo);
-uint8_t duProcUeDeleteReq(uint16_t cellId);
+uint8_t duBuildAndSendUeDeleteReq(uint16_t cellId);
 void deleteRlcUeCfg(RlcUeCfg *ueCfg);
 void freeF1UeDb(F1UeContextSetupDb *f1UeDb);
+uint8_t sendUeDeleteReqToMac(uint16_t cellId, uint8_t ueId, uint16_t crnti);
+uint8_t sendUeDeleteReqToRlc(uint16_t cellId, uint8_t ueId);
 #endif
 
 /**********************************************************************
index 0a283ae..76c584d 100644 (file)
@@ -25,6 +25,7 @@
 #include "UnixSocketClient.hpp"
 #include "SessionHandler.hpp"
 #include "InitConfig.hpp"
+#include "NrCellList.hpp"
 
 StartupConfig g_cfg;
 
@@ -145,6 +146,30 @@ uint8_t getStartupConfigForStub(StartupConfig *cfg)
    return O1::FAILURE;
 }
 
+/*******************************************************************
+ *
+ * @brief update cell and operational state
+ *
+ * @details
+ *
+ *    Function : setCellOpState
+ *
+ *    Functionality:
+ *      - send update of cell and operational state to it's handler
+ *
+ *
+ * @params[in] cellId, opState, cellState
+ * @return cell operational in string form
+ ******************************************************************/
+
+
+bool setCellOpState(uint16_t cellId, OpState opState, CellState cellState)
+{
+   O1_LOG("\nO1  ConfigInterface: Setting cellId = %d, opState=%d, \
+cellState=%d\n", cellId, opState, cellState);
+   return NrCellList::instance().setCellOpState(cellId, opState, \
+                                                      cellState);
+}
 
 /**********************************************************************
          End of file
index 0f4929e..a8c8d1d 100644 (file)
@@ -44,10 +44,28 @@ typedef struct
    uint16_t RIC_Port;
 }StartupConfig;
 
+typedef enum {
+   INACTIVE,
+   ACTIVE,
+   IDLE
+}CellState;
+
+typedef enum {
+   DISABLED,
+   ENABLED
+}OpState;
+
 
 uint8_t getStartupConfig(StartupConfig *cfg);
 uint8_t getStartupConfigForStub(StartupConfig *cfg);
+bool setCellOpState(uint16_t cellId, OpState opState, \
+                             CellState cellState);
 
+#ifndef ODU_TEST_STUB
+//Defined in odu high
+bool bringCellUp(uint16_t cellId);
+bool bringCellDown(uint16_t cellId);
+#endif //ODU_TEST_STUB
 #ifdef __cplusplus
 }
 #endif
index 759e725..6bf2578 100644 (file)
@@ -35,7 +35,10 @@ using std::string;
 #define ALARM_MODULE_PATH_3GPP "/_3gpp-common-fm:AlarmListGrp"
 #define ALARM_MODULE_NAME_ORAN "o-ran-sc-odu-alarm-v1"
 #define ALARM_MODULE_PATH_ORAN "/o-ran-sc-odu-alarm-v1:odu"
-
+#define CELL_STATE_MODULE_NAME "o-ran-sc-du-hello-world"
+#define CELL_STATE_MODULE_PATH "/o-ran-sc-du-hello-world:network-function"
+#define IETF_NACM_MODULE_NAME "ietf-netconf-acm"
+#define IETF_NACM_MODULE_PATH "/ietf-netconf-acm:nacm"
 #define MAX_ALARM_ID_LEN 10
 
 class O1 
index 1b58f08..5626ba9 100644 (file)
@@ -60,6 +60,7 @@ class InitConfig : public Singleton<InitConfig>
       ~InitConfig();
       bool init(sysrepo::S_Session sess);
       bool getCurrInterfaceConfig(StartupConfig & cfg);
+      bool disableNacm(sysrepo::S_Session sess);
 
    private:
 
diff --git a/src/o1/NrCellCb.cpp b/src/o1/NrCellCb.cpp
new file mode 100644 (file)
index 0000000..e97358b
--- /dev/null
@@ -0,0 +1,290 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains Cell state update handler for CLA use case. It handles
+   get and change callback for o-ran-sc-du-hello-world yang module  */
+
+#include <sstream>
+#include "NrCellCb.hpp"
+#define MAX_LEN 100
+
+using namespace std;
+
+/*******************************************************************
+ *
+ * @brief override oper_get_items to handle callback
+ *
+ * @details
+ *
+ *    Function : oper_get_items
+ *
+ *    Functionality:
+ *      - override oper_get_items to handle callback of get of
+ *        o-ran-sc-du-hello-world yang module
+ *
+ *
+ * @params[in] sysrepo::S_Session session, const char *module_name,
+ *             const char *path, const char *request_xpath,
+ *             uint32_t request_id, libyang::S_Data_Node &parent,
+ *             void *private_data
+ * @return SR_ERR_OK  - success
+ *         SR_ERR_OK  - failure
+ ******************************************************************/
+
+int NrCellCb::oper_get_items(sysrepo::S_Session session, \
+                                       const char *module_name, \
+                                       const char *path, \
+                                       const char *request_xpath, \
+                                       uint32_t request_id, \
+                                       libyang::S_Data_Node &parent, \
+                                       void *private_data)
+{
+   O1_LOG("O1 NrCellCb : Callback called for path=%s on get request", path);
+   libyang::S_Context ctx = session->get_context();
+   libyang::S_Module mod = ctx->get_module(module_name);
+
+   //first create root of the tree then add nodes and leaves and fill data
+   parent.reset(new libyang::Data_Node(ctx, CELL_STATE_MODULE_PATH, \
+                nullptr, LYD_ANYDATA_CONSTSTRING, 0));
+   libyang::S_Data_Node connection(new libyang::Data_Node(parent, mod, \
+                                   "du-to-ru-connection"));
+
+   libyang::S_Data_Node name;
+   libyang::S_Data_Node operational_state;
+   libyang::S_Data_Node cell_state;
+   libyang::S_Data_Node administrative_state;
+
+   NrCellList & cellList  = NrCellList::instance();
+   NrCellInfo cellInfo;
+   const NrCellList::CellOpStateMap & cellOpStateMap = cellList.getCellOpStateList();
+   //read the data from CellOpStateMap
+   std::map<uint16_t, NrCellInfo>::const_iterator it;
+   for(it = cellOpStateMap.begin(); it !=cellOpStateMap.end(); it++)
+   {
+      O1_LOG("\nO1 NrCellCb : cellId = %d, opState=%d, cellState=%d\n", \
+              it->first, (int) it->second.getOpState(), (int) it->second.getCellState());
+      name.reset(new libyang::Data_Node(connection, mod, "name", \
+                 to_string(it->first).c_str()));
+      operational_state.reset(new libyang::Data_Node(connection, mod, \
+                        "operational-state", \
+                        cellInfo.enumToOperationalStateString(it->second.getOpState()).c_str()));
+      cell_state.reset(new libyang::Data_Node(connection, mod, "cell-state", \
+                       cellInfo.enumToCellStateString(it->second.getCellState()).c_str()));
+   }
+   return SR_ERR_OK;
+}
+
+/*******************************************************************
+ *
+ * @brief print changes of given operation
+ *
+ * @details
+ *
+ *    Function : oper_get_items
+ *
+ *    Functionality:
+ *      -  print changes of given operation, old and new value
+ *
+ *
+ * @params[in] sysrepo::S_Change change
+ * @return void
+ ******************************************************************/
+
+void NrCellCb::printChange(sysrepo::S_Change change) {
+   switch(change->oper()) {
+      case SR_OP_CREATED:
+         if (nullptr != change->new_val()) {
+            O1_LOG("O1 NrCellCb : CREATED: %s", \
+                    change->new_val()->to_string().c_str());
+         }
+         break;
+      case SR_OP_DELETED:
+         if (nullptr != change->old_val()) {
+             O1_LOG("O1 NrCellCb : DELETED:  %s", \
+                     change->old_val()->to_string().c_str());
+         }
+         break;
+      case SR_OP_MODIFIED:
+         if (nullptr != change->old_val() && nullptr != change->new_val()) {
+            O1_LOG("O1 NrCellCb : MODIFIED: old value %s :new value %s", \
+                    change->old_val()->to_string().c_str(), \
+                    change->new_val()->to_string().c_str());
+        }
+        break;
+     case SR_OP_MOVED:
+        if (nullptr != change->old_val() && nullptr != change->new_val()) {
+           O1_LOG("O1 NrCellCb : MOVED: %s :after %s ", \
+                    change->new_val()->xpath(), \
+                    change->old_val()->xpath());
+        }
+        else if (nullptr != change->new_val()) {
+           O1_LOG("O1 NrCellCb : MOVED: %s : first\n", \
+                   change->new_val()->xpath());
+        }
+        break;
+    }
+}
+
+/*******************************************************************
+ *
+ * @brief convert event type to string
+ *
+ * @details
+ *
+ *    Function : evToStr
+ *
+ *    Functionality:
+ *      - convert event type to string
+ *
+ *
+ * @params[in] sr_event_t event
+ * @return event name in string form
+ ******************************************************************/
+
+/* Helper function for printing events. */
+const char *NrCellCb::evToStr(sr_event_t ev) {
+   switch (ev) {
+      case SR_EV_CHANGE:
+         return "change";
+      case SR_EV_DONE:
+         return "done";
+      case SR_EV_ABORT:
+      default:
+         return "abort";
+   }
+}
+
+/*******************************************************************
+ *
+ * @brief override module_change to handle callback
+ *
+ * @details
+ *
+ *    Function : module_change
+ *
+ *    Functionality:
+ *      - override module_change to handle callback of modification of
+ *        o-ran-sc-du-hello-world yang module
+ *
+ *
+ * @params[in] sysrepo::S_Session session, const char *module_name,
+ *             const char *xpath, sr_event_t event, uint32_t request_id,
+ *             void *private_data
+ * @return SR_ERR_OK  - success
+ *         SR_ERR_OK  - failure
+ ******************************************************************/
+
+int NrCellCb::module_change(sysrepo::S_Session sess, \
+                                    const char *module_name, \
+                                    const char *xpath, \
+                                    sr_event_t event, \
+                                    uint32_t request_id, \
+                                    void *private_data)
+{
+   char change_path[MAX_LEN];
+
+   try {
+      O1_LOG("O1 NrCellCb : Notification %s\n", evToStr(event));
+      if (SR_EV_CHANGE == event)
+      {
+         NrCellList & cellList  = NrCellList::instance();
+         NrCellInfo cellInfo;
+         const NrCellList::CellOpStateMap & cellOpStateMap = cellList.getCellOpStateList();
+         snprintf(change_path, MAX_LEN, "/%s:*//.", module_name);
+         auto it = sess->get_changes_iter(change_path);
+         uint16_t cellId;
+         while (auto change = sess->get_change_next(it)) {
+         //printChange(change); //enable only for debugging
+         if(nullptr != change->new_val())
+         {
+            O1_LOG("O1 NrCellCb : Parameter value has been \
+changed val=%s\n", change->new_val()->val_to_string().c_str());
+            std::map<uint16_t, NrCellInfo>::const_iterator it;
+            for(it = cellOpStateMap.begin(); it !=cellOpStateMap.end(); it++)
+            {
+               stringstream xpath;
+               xpath << CELL_STATE_MODULE_PATH << "/du-to-ru-connection[name='" \
+               << it->first << "']/administrative-state";
+               O1_LOG("O1 NrCellCb : created xpath = %s", \
+                      xpath.str().c_str());
+
+               if((change->new_val()->to_string().find(xpath.str().c_str()) != \
+                   std::string::npos))
+               {
+                  printChange(change);
+                  string val = change->new_val()->val_to_string();
+                  AdminState newVal = cellInfo.adminStateToEnum(val);
+                  O1_LOG("O1 NrCellCb : Update admin state \
+cellId =%d with admin-state value=%s\n", it->first, val.c_str());
+                 if(!setAdminState(it->first, newVal)) {
+                    O1_LOG("O1 NrCellCb : Could not change \
+parameter value =%s\n", change->new_val()->val_to_string().c_str());
+                    return SR_ERR_INTERNAL;
+                 }
+               }
+            }
+         }
+     }
+   }//if evToStr(event) check
+   }
+   catch( const std::exception& e ) {
+      O1_LOG("exception : %s\n", e.what());
+   }
+   return SR_ERR_OK;
+}
+
+/*******************************************************************
+ *
+ * @brief bring cell status according to the admin state
+ *
+ * @details
+ *
+ *    Function : setAdminState
+ *
+ *    Functionality:
+ *      - bring cell status according to the admin state
+ *
+ *
+ * @params[in] cellId, Admin state
+ * @return true   - success
+ *         false  - failure
+ ******************************************************************/
+bool NrCellCb::setAdminState(uint16_t cellId, AdminState newAdminState)
+{
+   if(newAdminState == UNLOCKED)
+   {
+      O1_LOG("\nNrCellList : set Admin State UNLOCKED" );
+#ifndef ODU_TEST_STUB
+      return bringCellUp(cellId);
+#endif
+   }
+   else
+   {
+      O1_LOG("\nNrCellList : set Admin State LOCKED" );
+#ifndef ODU_TEST_STUB
+      return bringCellDown(cellId);
+#endif
+   }
+   return true;
+}
+
+
+/**********************************************************************
+         End of file
+**********************************************************************/
+
diff --git a/src/o1/NrCellCb.hpp b/src/o1/NrCellCb.hpp
new file mode 100644 (file)
index 0000000..00655d2
--- /dev/null
@@ -0,0 +1,65 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains Cell state update handler for CLA use case. It handles
+   get and change callback for o-ran-sc-du-hello-world yang module  */
+
+
+#ifndef __NR_CELL_CB_HPP__
+#define __NR_CELL_CB_HPP__
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include "sysrepo-cpp/Session.hpp"
+#include "ConfigInterface.h"
+#include "GlobalDefs.hpp"
+#include "Singleton.hpp"
+#include "NrCellInfo.hpp"
+#include "NrCellList.hpp"
+
+class NrCellCb : public sysrepo::Callback
+{
+
+   public:
+      int oper_get_items(sysrepo::S_Session session,\
+                         const char *module_name,\
+                         const char *path,\
+                         const char *request_xpath,\
+                         uint32_t request_id,\
+                         libyang::S_Data_Node &parent,\
+                         void *private_data); //override
+      int module_change(sysrepo::S_Session sess, \
+                         const char *module_name, \
+                         const char *xpath, \
+                         sr_event_t event, \
+                         uint32_t request_id, \
+                         void *private_data); //override
+
+      bool setAdminState(uint16_t cellId, AdminState newAdminState);
+
+   private:
+      static void printChange(sysrepo::S_Change change);
+      const char *evToStr(sr_event_t ev);
+};
+
+#endif
+
+/**********************************************************************
+         End of file
+**********************************************************************/
diff --git a/src/o1/NrCellInfo.cpp b/src/o1/NrCellInfo.cpp
new file mode 100644 (file)
index 0000000..6fc5516
--- /dev/null
@@ -0,0 +1,132 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains parameters list of a cell for CLA use case*/
+
+#include "NrCellInfo.hpp"
+
+using namespace std;
+
+/*******************************************************************
+ *
+ * @brief convert admin state to enum
+ *
+ * @details
+ *
+ *    Function : adminStateToEnum
+ *
+ *    Functionality:
+ *      - convert admin state to enum
+ *
+ *
+ * @params[in] admin state in string form
+ * @return admin state in enum form
+ ******************************************************************/
+
+AdminState NrCellInfo::adminStateToEnum(string val)
+{
+   AdminState ret=LOCKED;
+   if( val == "LOCKED")
+      ret = LOCKED;
+   else if(val == "UNLOCKED")
+      ret = UNLOCKED;
+   else if(val ==  "SHUTTING_DOWN")
+      ret = SHUTTING_DOWN;
+   else
+      O1_LOG("O1 NrCellInfo : %s admin state not handled\n", \
+              val.c_str());
+
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief convert enum of cell state to string
+ *
+ * @details
+ *
+ *    Function : enumToCellStateString
+ *
+ *    Functionality:
+ *      - convert enum of cell state to string
+ *
+ *
+ * @params[in] enum of cell state
+ * @return cell state in string form
+ ******************************************************************/
+
+
+string NrCellInfo::enumToCellStateString(CellState val)
+{
+   string ret = "IDLE";
+   switch(val)
+   {
+      case INACTIVE:
+         ret = "INACTIVE";
+         break;
+      case ACTIVE:
+         ret = "ACTIVE";
+         break;
+      case IDLE:
+         ret = "IDLE";
+         break;
+      default :
+         O1_LOG("O1 NrCellInfo : %d cell state not handled\n", val);
+
+   }
+   return ret;
+}
+
+/*******************************************************************
+ *
+ * @brief convert enum of operational state to string
+ *
+ * @details
+ *
+ *    Function : enumToOperationalStateString
+ *
+ *    Functionality:
+ *      - convert enum of operational state to string
+ *
+ *
+ * @params[in] enum of operational state
+ * @return cell operational in string form
+ ******************************************************************/
+
+string NrCellInfo::enumToOperationalStateString(OpState val)
+{
+   string ret = "DISABLED";
+   switch(val)
+   {
+      case DISABLED:
+         ret = "DISABLED";
+         break;
+      case ENABLED:
+         ret = "ENABLED";
+         break;
+      default :
+         O1_LOG("O1 NrCellInfo : %d operational state not handled\n", val);
+
+   }
+   return ret;
+}
+
+/**********************************************************************
+         End of file
+**********************************************************************/
+
diff --git a/src/o1/NrCellInfo.hpp b/src/o1/NrCellInfo.hpp
new file mode 100644 (file)
index 0000000..2c27b13
--- /dev/null
@@ -0,0 +1,64 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains parameters list of a cell for CLA use case*/
+
+#ifndef __NR_CELL_INFO_HPP__
+#define __NR_CELL_INFO_HPP__
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include "sysrepo-cpp/Session.hpp"
+#include "ConfigInterface.h"
+#include "GlobalDefs.hpp"
+#include "Singleton.hpp"
+#include "NrCellInfo.hpp"
+
+
+typedef enum AdminState{
+   LOCKED,
+   UNLOCKED,
+   SHUTTING_DOWN
+}adminState;
+      
+class NrCellInfo
+{
+   public:
+      inline void setCellId(uint16_t id) { mCellId = id;}
+      inline void setOpState(OpState state) { mOpState = state;}
+      inline void setCellState( CellState state) { mCellState = state;} 
+      inline uint16_t getCellId() const {return mCellId;}
+      inline OpState getOpState() const { return mOpState;}
+      inline CellState getCellState() const { return mCellState;}
+      string enumToOperationalStateString(OpState val);
+      string enumToCellStateString(CellState val);
+      AdminState adminStateToEnum(string val);
+
+   private:
+      uint16_t mCellId;
+      OpState mOpState;
+      CellState mCellState;
+};
+
+#endif
+
+/**********************************************************************
+         End of file
+**********************************************************************/
diff --git a/src/o1/NrCellList.cpp b/src/o1/NrCellList.cpp
new file mode 100644 (file)
index 0000000..9ea92e0
--- /dev/null
@@ -0,0 +1,84 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains List of the Cell and it's parameters values for CLA 
+   use case*/
+
+#include <sstream>
+#include "NrCellList.hpp"
+#define MAX_LEN 100
+
+using namespace std;
+
+/*******************************************************************
+ *
+ * @brief update cell and operational state in the map
+ *
+ * @details
+ *
+ *    Function : setCellOpState
+ *
+ *    Functionality:
+ *      - update cell and operational state in the map using cellId
+ *        as key
+ *
+ *
+ * @params[in] cellId, opState, cellState
+ * @return true   - success
+ *         false  - failure
+ ******************************************************************/
+
+
+bool NrCellList::setCellOpState(uint16_t cellId, \
+                                OpState opState, \
+                                CellState cellState)
+{
+   O1_LOG("\nO1 NrCellList : Setting cellId = %d, opState=%d, \
+cellState=%d\n", cellId, opState, cellState);
+   NrCellInfo cellInfo ;
+   cellInfo.setCellId( cellId);
+   cellInfo.setOpState(opState);
+   cellInfo.setCellState (cellState);
+   mCellOpStateMap[cellId] = cellInfo;
+   return true;
+}
+
+/*******************************************************************
+ *
+ * @brief provide the cell list 
+ *
+ * @details
+ *
+ *    Function : getCellOpStateList
+ *
+ *    Functionality:
+ *      - provide the cell list
+ *
+ *
+ * @params[in] na
+ * @return map of cell   - success
+ ******************************************************************/
+
+const std::map<uint16_t, NrCellInfo> & NrCellList::getCellOpStateList()
+{
+   return mCellOpStateMap;
+}
+/**********************************************************************
+         End of file
+**********************************************************************/
+
diff --git a/src/o1/NrCellList.hpp b/src/o1/NrCellList.hpp
new file mode 100644 (file)
index 0000000..45dd0f6
--- /dev/null
@@ -0,0 +1,54 @@
+/*******************************************************************************
+################################################################################
+#   Copyright (c) [2020-2021] [HCL Technologies Ltd.]                          #
+#                                                                              #
+#   Licensed under the Apache License, Version 2.0 (the "License");            #
+#   you may not use this file except in compliance with the License.           #
+#   You may obtain a copy of the License at                                    #
+#                                                                              #
+#       http://www.apache.org/licenses/LICENSE-2.0                             #
+#                                                                              #
+#   Unless required by applicable law or agreed to in writing, software        #
+#   distributed under the License is distributed on an "AS IS" BASIS,          #
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+#   See the License for the specific language governing permissions and        #
+#   limitations under the License.                                             #
+################################################################################
+*******************************************************************************/
+
+/* This file contains List of the Cell and it's parameters values for CLA 
+   use case*/
+
+#ifndef __NR_CELL_LIST_HPP__
+#define __NR_CELL_LIST_HPP__
+
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <map>
+#include "sysrepo-cpp/Session.hpp"
+#include "ConfigInterface.h"
+#include "GlobalDefs.hpp"
+#include "Singleton.hpp"
+#include "NrCellInfo.hpp"
+
+class NrCellList : public Singleton<NrCellList>
+{
+   public:
+      friend Singleton<NrCellList>;
+      typedef std::map<uint16_t, NrCellInfo> CellOpStateMap;
+
+      bool setCellOpState(uint16_t cellId, OpState opState, \
+                          CellState cellState);
+      const std::map<uint16_t, NrCellInfo> & getCellOpStateList();
+
+
+   private:
+      std::map<uint16_t, NrCellInfo> mCellOpStateMap;
+};
+
+#endif
+
+/**********************************************************************
+         End of file
+**********************************************************************/
index 1f9c0cf..7c745ac 100644 (file)
@@ -24,7 +24,7 @@
 #include "sysrepo.h"
 #include "SessionHandler.hpp"
 #include "InitConfig.hpp"
-#include <iostream>
+#include "NrCellCb.hpp"
 
 using namespace std;
 /* Default constructor */
@@ -155,6 +155,15 @@ bool SessionHandler::subscribeModule(sysrepo::S_Subscribe subscrb)
    subscrb->oper_get_items_subscribe(ALARM_MODULE_NAME_ORAN, \
                                      ALARM_MODULE_PATH_ORAN, \
                                      alarmOranCb);
+
+   sysrepo::S_Callback nrCellCb(new NrCellCb());
+
+   subscrb->oper_get_items_subscribe(CELL_STATE_MODULE_NAME, \
+                                     CELL_STATE_MODULE_PATH, \
+                                     nrCellCb);
+   subscrb->module_change_subscribe(CELL_STATE_MODULE_NAME, nrCellCb);
+
+
    return true;
 }