1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2020-2021] [HCL Technologies Ltd.] #
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 #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
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 *******************************************************************************/
19 /* This file contains C interface for ODU and stubs to get startup
23 #include "CmInterface.h"
24 #include "GlobalDefs.hpp"
25 #include "UnixSocketClient.hpp"
26 #include "SessionHandler.hpp"
27 #include "InitConfig.hpp"
28 #include "NrCellList.hpp"
32 /*******************************************************************
34 * @brief Get the startup config from Netconf
38 * Function : getStartupConfig
41 * - Get the start up IP and port for DU
43 * @params[in] pointer to StartupConfig
44 * @return O1::SUCCESS - success
45 * O1::FAILURE - failure
46 ******************************************************************/
47 uint8_t getStartupConfig(StartupConfig *cfg)
49 if ( InitConfig::instance().getCurrInterfaceConfig(*cfg) )
51 O1_LOG("\nO1 StartupConfig : "
52 "cfg.DU_IPV4_Addr [%s]",
54 O1_LOG("\nO1 StartupConfig : "
57 O1_LOG("\nO1 StartupConfig : "
58 "cfg.CU_IPV4_Addr [%s]",
60 O1_LOG("\nO1 StartupConfig : "
63 O1_LOG("\nO1 StartupConfig : "
64 "cfg.RIC_IPV4_Addr [%s]",
66 O1_LOG("\nO1 StartupConfig : "
74 /*******************************************************************
76 * @brief Get the startup config from Netconf
80 * Function : getStartupConfig
83 * - Get the start up IP and port for CU and RIC
85 * @params[in] pointer to StartupConfig
86 * @return O1::SUCCESS - success
87 * O1::FAILURE - failure
88 ******************************************************************/
89 uint8_t getStartupConfigForStub(StartupConfig *cfg)
91 SessionHandler sessHdlr;
92 if ( sessHdlr.init() )
94 if ( InitConfig::instance().getCurrInterfaceConfig(*cfg) )
96 O1_LOG("\nO1 StartupConfig : "
97 "cfg.DU_IPV4_Addr [%s]",
99 O1_LOG("\nO1 StartupConfig : "
102 O1_LOG("\nO1 StartupConfig : "
103 "cfg.CU_IPV4_Addr [%s]",
105 O1_LOG("\nO1 StartupConfig : "
108 O1_LOG("\nO1 StartupConfig : "
109 "cfg.RIC_IPV4_Addr [%s]",
111 O1_LOG("\nO1 StartupConfig : "
120 /*******************************************************************
122 * @brief update cell and operational state
126 * Function : setCellOpState
129 * - send update of cell and operational state to it's handler
132 * @params[in] cellId, opState, cellState
133 * @return cell operational in string form
134 ******************************************************************/
137 bool setCellOpState(uint16_t cellId, OpState opState, CellState cellState)
139 O1_LOG("\nO1 CmInterface: Setting cellId = %d, opState=%d, \
140 cellState=%d", cellId, opState, cellState);
141 return NrCellList::instance().setCellOpState(cellId, opState, \
145 /**********************************************************************
147 **********************************************************************/