From a8631828d42bfedb441479f6c9e376c8234cbfe8 Mon Sep 17 00:00:00 2001 From: yagoda Date: Wed, 4 Jan 2023 11:15:05 +0100 Subject: [PATCH] e2ap: adding logger to e2ap class --- srsgnb/hdr/stack/ric/e2ap.h | 6 ++++-- srsgnb/src/stack/ric/e2ap.cc | 2 ++ srsgnb/src/stack/ric/ric_client.cc | 5 ++--- srsgnb/src/stack/ric/test/e2ap_test.cc | 6 ++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/srsgnb/hdr/stack/ric/e2ap.h b/srsgnb/hdr/stack/ric/e2ap.h index 01b8d8d41..1dcea7b03 100644 --- a/srsgnb/hdr/stack/ric/e2ap.h +++ b/srsgnb/hdr/stack/ric/e2ap.h @@ -22,6 +22,7 @@ using namespace asn1::e2ap; class e2ap { public: + e2ap(srslog::basic_logger& logger); e2_ap_pdu_c generate_setup_request(); int process_setup_response(e2setup_resp_s setup_response); int process_setup_failure(); @@ -32,8 +33,9 @@ public: bool has_setup_response() { return setup_response_received; } private: - bool setup_response_received = false; - bool pending_subscription_request = false; + srslog::basic_logger& logger; + bool setup_response_received = false; + bool pending_subscription_request = false; }; #endif /* RIC_E2AP_H */ diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 34d94926f..174850138 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -2,6 +2,8 @@ #include "srsgnb/hdr/stack/ric/e2ap.h" #include "stdint.h" +e2ap::e2ap(srslog::basic_logger& logger) : logger(logger) {} + e2_ap_pdu_c e2ap::generate_setup_request() { e2_ap_pdu_c pdu; diff --git a/srsgnb/src/stack/ric/ric_client.cc b/srsgnb/src/stack/ric/ric_client.cc index 79eb60f9d..e376587c3 100644 --- a/srsgnb/src/stack/ric/ric_client.cc +++ b/srsgnb/src/stack/ric/ric_client.cc @@ -16,7 +16,7 @@ using namespace srsenb; ric_client::ric_client(srslog::basic_logger& logger) : - task_sched(), logger(logger), rx_sockets(), thread("RIC_CLIENT_THREAD") + task_sched(), logger(logger), rx_sockets(), thread("RIC_CLIENT_THREAD"), e2ap_(logger) { } bool ric_client::init() @@ -191,7 +191,7 @@ bool ric_client::handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& { using namespace asn1::e2ap; if (successful_outcome.value.type() == e2_ap_elem_procs_o::successful_outcome_c::types_opts::e2setup_resp) { - logger.info("Received E2AP E2 Setup Successful Outcome"); + logger.info("Received E2AP E2 Setup Response"); handle_e2_setup_response(successful_outcome.value.e2setup_resp()); } else if (successful_outcome.value.type() == e2_ap_elem_procs_o::successful_outcome_c::types_opts::ricsubscription_resp) { @@ -219,7 +219,6 @@ bool ric_client::handle_e2_successful_outcome(asn1::e2ap::successful_outcome_s& bool ric_client::handle_e2_setup_response(e2setup_resp_s setup_response) { - printf("Received E2AP E2 Setup Response \n"); if (e2ap_.process_setup_response(setup_response)) { logger.error("Failed to process E2 Setup Response"); return false; diff --git a/srsgnb/src/stack/ric/test/e2ap_test.cc b/srsgnb/src/stack/ric/test/e2ap_test.cc index 39338bbed..12a49da74 100644 --- a/srsgnb/src/stack/ric/test/e2ap_test.cc +++ b/srsgnb/src/stack/ric/test/e2ap_test.cc @@ -82,7 +82,8 @@ void test_native_e2ap_setup_request() { srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); e2_ap_pdu_c pdu, pdu2; - e2ap e2ap_; + srslog::basic_logger& logger = srslog::fetch_basic_logger("E2AP"); + e2ap e2ap_(logger); pdu = e2ap_.generate_setup_request(); asn1::bit_ref bref(buf->msg, buf->get_tailroom()); @@ -116,7 +117,8 @@ void test_native_e2ap_subscription_response() { srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); e2_ap_pdu_c pdu, pdu2; - e2ap e2ap_; + srslog::basic_logger& logger = srslog::fetch_basic_logger("E2AP"); + e2ap e2ap_(logger); pdu = e2ap_.generate_subscription_response(); asn1::bit_ref bref(buf->msg, buf->get_tailroom());