1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2020] [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 InitConfig class header*/
21 #ifndef __INIT_CONFIG_HPP__
22 #define __INIT_CONFIG_HPP__
27 #include "sysrepo-cpp/Session.hpp"
29 #include "Singleton.hpp"
32 #include "GlobalDefs.hpp"
33 #define IP_ADDRESS "interface-address"
35 #define INTERFACE_MODULE_NAME_ORAN "/o-ran-sc-odu-interface-v1:odu"
37 #define NETCONF_STARTUP_CFG "/etc/netconf_startup.cfg"
39 #define DEFAULT_DU_IPV4_ADDR "192.168.130.81"
40 #define DEFAULT_DU_PORT 38472
42 #define DEFAULT_CU_IPV4_ADDR "192.168.130.82"
43 #define DEFAULT_CU_PORT 38472
45 #define DEFAULT_RIC_IPV4_ADDR "192.168.130.80"
46 #define DEFAULT_RIC_PORT 36421
55 class InitConfig : public Singleton<InitConfig>
58 friend Singleton<InitConfig>;
63 typedef std::pair<std::string, uint16_t> Address;
64 typedef std::map<Interface, Address> InterfaceMap;
68 bool init(sysrepo::S_Session sess);
69 bool getCurrInterfaceConfig(StartupConfig & cfg);
73 InterfaceMap mInterfaceList;
74 char xpath[MAX_XPATH];
75 sysrepo::S_Session mSess;
77 /* function to get the data of Interfaces param*/
78 InterfaceMap getInterfaceConfig(sysrepo::S_Session sess);
79 Address getInterfaceData(sysrepo::S_Session sess, Interface inf);
80 char * getInterfaceXpath( std::string sInf, std::string param);
81 std::string getData(sysrepo::S_Session sess,char* xpath);
82 std::string interfaceToString(Interface inf);
83 bool printInterfaceConfig();
84 bool writeInterfaceConfig();
90 /**********************************************************************
92 **********************************************************************/