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__
29 #include "sysrepo-cpp/Session.hpp"
30 #include "Singleton.hpp"
31 #include "CmInterface.h"
32 #include "GlobalDefs.hpp"
34 #define IP_ADDRESS "interface-address"
36 #define INTERFACE_MODULE_NAME_ORAN "/o-ran-sc-odu-interface-v1:odu"
38 #define NETCONF_STARTUP_CFG "/etc/netconf_startup.cfg"
48 class InitConfig : public Singleton<InitConfig>
51 friend Singleton<InitConfig>;
56 typedef std::pair<std::string, uint16_t> Address;
57 typedef std::map<Interface, Address> InterfaceMap;
61 bool init(sysrepo::S_Session sess);
62 bool getCurrInterfaceConfig(StartupConfig & cfg);
63 bool disableNacm(sysrepo::S_Session sess);
67 InterfaceMap mInterfaceList;
68 char xpath[MAX_XPATH];
69 sysrepo::S_Session mSess;
71 /* function to get the data of Interfaces param*/
72 bool getInterfaceData(sysrepo::S_Session sess, \
73 Interface inf, InitConfig::Address & addr);
74 bool getInterfaceConfig(sysrepo::S_Session sess , InitConfig::InterfaceMap &map);
75 char * getInterfaceXpath( std::string sInf, std::string param);
76 bool getData(sysrepo::S_Session sess,char* xpath, string &val);
77 std::string interfaceToString(Interface inf);
78 bool printInterfaceConfig();
79 bool writeInterfaceConfig();
85 /**********************************************************************
87 **********************************************************************/