From a2f64d55efc2da9611f3cabe11a36370a553c186 Mon Sep 17 00:00:00 2001 From: sjana Date: Tue, 2 Jun 2020 02:14:29 -0400 Subject: [PATCH] Update HW Policy Type ID Issue-ID: RICAPP-110 Signed-off-by: sjana Change-Id: I34f501d01b115e7de3322d5c70b84980b91f7c4d --- container-tag.yaml | 2 +- docs/release-notes.rst | 2 +- src/hw_xapp_main.cc | 9 ++---- src/xapp-utils/xapp_config.hpp | 2 +- src/xapp.cc | 65 +++++++++++++++++++++++++++++------------- src/xapp.hpp | 4 +-- 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/container-tag.yaml b/container-tag.yaml index d99f50d..5f150a0 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -1,4 +1,4 @@ # this is used by CI jobs to apply a tag when it builds the image --- -tag: '1.0.1' +tag: '1.0.2' diff --git a/docs/release-notes.rst b/docs/release-notes.rst index a5c1671..2b4a530 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -21,7 +21,7 @@ Version history | **Date** | **Ver.** | **Author** | **Comment** | | | | | | +--------------------+--------------------+--------------------+--------------------+ -| 2020-21-05 | 1.0.1 | Shraboni Jana | Second draft | +| 2020-21-05 | 1.0.2 | Shraboni Jana | Second draft | | | | | | +--------------------+--------------------+--------------------+--------------------+ diff --git a/src/hw_xapp_main.cc b/src/hw_xapp_main.cc index 655f452..01601fb 100644 --- a/src/hw_xapp_main.cc +++ b/src/hw_xapp_main.cc @@ -60,25 +60,22 @@ int main(int argc, char *argv[]){ //Create Subscription Handler if Xapp deals with Subscription. - bool sub_required = true; std::unique_ptr sub_handler = std::make_unique(); //create HelloWorld Xapp Instance. std::unique_ptr hw_xapp; - if(sub_required) - hw_xapp = std::make_unique(std::ref(config),std::ref(*rmr), std::ref(*sub_handler)); - else - hw_xapp = std::make_unique(std::ref(config),std::ref(*rmr)); + hw_xapp = std::make_unique(std::ref(config),std::ref(*rmr)); mdclog_write(MDCLOG_INFO, "Created Hello World Xapp Instance"); sleep(1); //Startup E2 subscription and A1 policy - hw_xapp->startup(); + hw_xapp->startup(std::ref(*sub_handler)); //start listener threads and register message handlers. int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]); + bool sub_required = true; for(int j=0; j < num_threads; j++) { std::unique_ptr mp_handler; if(sub_required) diff --git a/src/xapp-utils/xapp_config.hpp b/src/xapp-utils/xapp_config.hpp index ad9399e..67cf440 100644 --- a/src/xapp-utils/xapp_config.hpp +++ b/src/xapp-utils/xapp_config.hpp @@ -40,7 +40,7 @@ #define ASN_BUFF_MAX_SIZE 4096 #define MAX_SUBSCRIPTION_ATTEMPTS 10 -#define HELLOWORLD_POLICY_ID 00000 +#define HELLOWORLD_POLICY_ID 2 using namespace std; diff --git a/src/xapp.cc b/src/xapp.cc index 4fe395c..1fb2b5b 100644 --- a/src/xapp.cc +++ b/src/xapp.cc @@ -23,6 +23,7 @@ */ #include "xapp.hpp" +#define BUFFER_SIZE 1024 Xapp::Xapp(XappSettings &config, XappRmr &rmr){ @@ -33,16 +34,6 @@ return; } -Xapp::Xapp(XappSettings &config, XappRmr &rmr, SubscriptionHandler &sub_ref){ - rmr_ref = &rmr; - config_ref = &config; - xapp_mutex = NULL; - subhandler_ref = &sub_ref; - set_rnib_gnblist(); - - return; - }; - Xapp::~Xapp(void){ //Joining the threads @@ -75,7 +66,11 @@ void Xapp::stop(void){ sleep(10); } -void Xapp::startup() { +void Xapp::startup(SubscriptionHandler &sub_ref) { + + subhandler_ref = &sub_ref; + set_rnib_gnblist(); + //send subscriptions. startup_subscribe_requests(); @@ -129,30 +124,60 @@ void Xapp::startup_subscribe_requests(void ){ unsigned char meid[RMR_MAX_MEID]; std::string xapp_id = config_ref->operator [](XappSettings::SettingName::XAPP_ID); - mdclog_write(MDCLOG_INFO,"Sending subscription in file= %s, line=%d",__FILE__,__LINE__); + mdclog_write(MDCLOG_INFO,"Preparing to send subscription in file= %s, line=%d",__FILE__,__LINE__); auto gnblist = get_rnib_gnblist(); + int sz = gnblist.size(); + if(sz <= 0) + mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL"); + for(int i = 0; imanage_subscription_request(meid, transmitter); - if(res){ + int result = subhandler_ref->manage_subscription_request(meid, transmitter); + if(result){ mdclog_write(MDCLOG_INFO,"Subscription SUCCESSFUL in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid); } diff --git a/src/xapp.hpp b/src/xapp.hpp index a769b43..1f1e7d0 100644 --- a/src/xapp.hpp +++ b/src/xapp.hpp @@ -55,13 +55,12 @@ class Xapp{ public: Xapp(XappSettings &, XappRmr &); - Xapp(XappSettings &, XappRmr &, SubscriptionHandler &); ~Xapp(void); void stop(void); - void startup(); + void startup(SubscriptionHandler &); void shutdown(void); void start_xapp_receiver(XappMsgHandler &); @@ -94,7 +93,6 @@ private: std::vector xapp_rcv_thread; std::vector rnib_gnblist; std::vector _callbacks; - }; -- 2.16.6