X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Fo1%2FSessionHandler.cpp;h=1f9c0cf0696fdfb56f634947390d6a7568b493c7;hb=2dc9d6735bc5ff973a761b7d6b3f71f97e95d60e;hp=f4108c003a86ff9188236ffaa497019ee88f4ab8;hpb=762bc0a2a50222d74b01d9a88071bfaf5d90979b;p=o-du%2Fl2.git diff --git a/src/o1/SessionHandler.cpp b/src/o1/SessionHandler.cpp index f4108c003..1f9c0cf06 100644 --- a/src/o1/SessionHandler.cpp +++ b/src/o1/SessionHandler.cpp @@ -19,9 +19,14 @@ /* This file contains methods of Session/Connection creation and Subscription to YANG modules */ +#include +#include +#include "sysrepo.h" #include "SessionHandler.hpp" +#include "InitConfig.hpp" +#include - +using namespace std; /* Default constructor */ SessionHandler::SessionHandler() { @@ -46,10 +51,45 @@ bool SessionHandler::init() try { mConn = createConnection(); - mSess = createSession(mConn); - mSub = createSubscribe(mSess); - O1_LOG("\nO1 SessionHandler : Initialization done"); - return true; + if(mConn != NULL) + { + O1_LOG("\nO1 SessionHandler : Connection created"); + //removing nacm module temperary for auth issue resolve + //mConn.remove_module("ietf-netconf-acm"); + mSess = createSession(mConn); + if(mSess != NULL) + { + O1_LOG("\nO1 SessionHandler : Session created"); + mSub = createSubscribe(mSess); + if(mSub != NULL) + { + O1_LOG("\nO1 SessionHandler : Subscription created"); + if(InitConfig::instance().init(mSess)) + { + return true; + } + else + { + return false; + } + } + else + { + O1_LOG("\nO1 SessionHandler : Subscription failed"); + return false; + } + } + else + { + O1_LOG("\nO1 SessionHandler : Session failed"); + return false; + } + } + else + { + O1_LOG("\nO1 SessionHandler : connection failed"); + return false; + } } catch( const std::exception& e ) {