[JIRA ID: ODUHIGH-246]-DeCoupling of F1AP functions
[o-du/l2.git] / src / du_app / du_cell_mgr.c
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /* This file contains message handling functionality for DU cell management */
20 #include "common_def.h"
21 #include "lrg.h"
22 #include "legtp.h"
23 #include "lrg.x"
24 #include "lkw.x"
25 #include "rgr.h"
26 #include "rgr.x"
27 #include "du_app_mac_inf.h"
28 #include "du_app_rlc_inf.h"
29 #include "du_cfg.h"
30 #include "du_mgr.h"
31 #include "du_cell_mgr.h"
32
33 /*******************************************************************
34  *
35  * @brief Processes cells to be activated
36  *
37  * @details
38  *
39  *    Function : duProcCellsToBeActivated
40  *
41  *    Functionality:
42  *      - Processes cells to be activated list received in F1SetupRsp
43  *
44  * @params[in] void
45  * @return ROK     - success
46  *         RFAILED - failure
47  *
48  * ****************************************************************/
49 uint8_t duProcCellsToBeActivated(uint16_t nci, uint16_t nRPci)
50 {
51    uint8_t ret = ROK;
52    DuCellCb *cellCb = NULLP;
53
54    cellCb = duCb.cfgCellLst[nci-1];
55
56    if(!cellCb)
57    {
58       DU_LOG("\nDU APP : No Cell found for NCI %d", nci);
59       return RFAILED;
60    }
61
62    cellCb->cellStatus = ACTIVATION_IN_PROGRESS; 
63    cellCb->cellInfo.nrPci = nRPci;
64
65    /* Now remove this cell from configured list and move to active list */
66    duCb.cfgCellLst[nci-1] = NULL;
67    duCb.actvCellLst[nci-1] = cellCb;
68    duCb.numActvCells++;
69    /* Build and send Mac Cell Cfg for the number of active cells */
70    ret = duBuildAndSendMacCellCfg();
71    if(ret != ROK)
72    {
73       DU_LOG("\nDU APP : MacCellCfg build and send failed at procCellsToBeActivated()");
74       /* Move cellCb back to cfgCellList */
75       duCb.cfgCellLst[nci-1] = duCb.actvCellLst[nci-1];
76       duCb.actvCellLst[nci-1] = NULLP;
77       duCb.numActvCells--;
78       return RFAILED;
79    }
80    return ret;
81 }
82
83 /*******************************************************************
84  *
85  * @brief Handles DU F1Setup Rsp received in F1AP
86  *
87  * @details
88  *
89  *    Function : duProcF1SetupRsp
90  *
91  *    Functionality:
92  *      - Handles DU F1Setup Rsp received in F1AP
93  *
94  * @params[in] Pointer to F1SetupRsp 
95  * @return void
96  *
97  ******************************************************************/
98 void duProcF1SetupRsp()
99 {
100    DU_LOG("\nDU_APP : F1 Setup Response received");
101    duCb.f1Status = TRUE; //Set F1 status as true
102 }
103
104 /*******************************************************************
105  *
106  * @brief Handles GNB DU Cfg Update Ack received in F1AP
107  *
108  * @details
109  *
110  *    Function : duProcGnbDuCfgUpdAckMsg
111  *
112  *    Functionality:
113  *      - Handles GNB DU Cfg Update Ack received in F1AP
114  *
115  * @params[in] Pointer to F1GnbDuCfgUpdAck
116  * @return void
117  *  
118  ******************************************************************/
119 void duProcGnbDuCfgUpdAckMsg()
120 {
121    DU_LOG("\nDU APP: GNB-DU config update Ack received ");
122 }
123
124 /**********************************************************************
125   End of file
126  **********************************************************************/