From e51871a62634f9c17c2cb806698f6eba75be95dd Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Tue, 21 Mar 2023 18:26:33 +0100 Subject: [PATCH] e2ap: change func signature and move logic to the function --- srsgnb/hdr/stack/ric/e2sm.h | 2 +- srsgnb/hdr/stack/ric/e2sm_kpm.h | 2 +- srsgnb/src/stack/ric/e2ap.cc | 8 +------- srsgnb/src/stack/ric/e2sm_kpm.cc | 14 ++++++++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/srsgnb/hdr/stack/ric/e2sm.h b/srsgnb/hdr/stack/ric/e2sm.h index 385f8af26..54df1a31b 100644 --- a/srsgnb/hdr/stack/ric/e2sm.h +++ b/srsgnb/hdr/stack/ric/e2sm.h @@ -57,7 +57,7 @@ public: std::string get_func_description() { return _func_description; }; uint32_t get_revision() { return _revision; }; - virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf) = 0; + virtual bool generate_ran_function_description(RANfunction_description& desc, ra_nfunction_item_s& ran_func) = 0; virtual bool process_ric_event_trigger_definition(ricsubscription_request_s subscription_request, RIC_event_trigger_definition_t& event_def) = 0; virtual bool process_ric_action_definition(ri_caction_to_be_setup_item_s ric_action, diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm.h b/srsgnb/hdr/stack/ric/e2sm_kpm.h index fdf667e1c..42fb87059 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm.h @@ -48,7 +48,7 @@ public: e2sm_kpm(srslog::basic_logger& logger_); ~e2sm_kpm() = default; - virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf); + virtual bool generate_ran_function_description(RANfunction_description& desc, ra_nfunction_item_s& ran_func); virtual bool process_ric_event_trigger_definition(ricsubscription_request_s subscription_request, RIC_event_trigger_definition_t& event_def); virtual bool process_ric_action_definition(ri_caction_to_be_setup_item_s ric_action, E2AP_RIC_action_t& action_entry); diff --git a/srsgnb/src/stack/ric/e2ap.cc b/srsgnb/src/stack/ric/e2ap.cc index 41f6eab83..178789904 100644 --- a/srsgnb/src/stack/ric/e2ap.cc +++ b/srsgnb/src/stack/ric/e2ap.cc @@ -52,13 +52,7 @@ e2_ap_pdu_c e2ap::generate_setup_request() ran_func.ran_function_id = local_ran_function_id; ran_func.ran_function_revision = sm_ptr->get_revision(); ran_func.ran_function_oid.from_string(sm_ptr->get_oid().c_str()); - - auto& ran_func_def = ran_func.ran_function_definition; - srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); - sm_ptr->generate_ran_function_description(x.second, buf); - ran_func_def.resize(buf->N_bytes); - buf->msg[1] = 0x30; // TODO: needed to keep wireshak happy, need better fix - std::copy(buf->msg, buf->msg + buf->N_bytes, ran_func_def.data()); + sm_ptr->generate_ran_function_description(x.second, ran_func); idx++; } diff --git a/srsgnb/src/stack/ric/e2sm_kpm.cc b/srsgnb/src/stack/ric/e2sm_kpm.cc index 172f3adce..f182a89f2 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm.cc @@ -14,7 +14,7 @@ e2sm_kpm::e2sm_kpm(srslog::basic_logger& logger_) : e2sm(short_name, oid, func_d supported_meas_types.push_back("test"); } -bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf) +bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, ra_nfunction_item_s& ran_func) { desc.function_shortname = short_name; desc.function_e2_sm_oid = oid; @@ -78,12 +78,18 @@ bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, report_style_list[4].ric_ind_msg_format_type = 3; */ logger.info("Generating RAN function description"); - asn1::bit_ref bref(buf->msg, buf->get_tailroom()); + srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); + asn1::bit_ref bref(buf->msg, buf->get_tailroom()); if (e2sm_kpm_ra_nfunction_description.pack(bref) != asn1::SRSASN_SUCCESS) { printf("Failed to pack TX E2 PDU\n"); return false; } buf->N_bytes = bref.distance_bytes(); + + ran_func.ran_function_definition.resize(buf->N_bytes); + buf->msg[1] = 0x30; // TODO: needed to keep wireshak happy, need better fix + std::copy(buf->msg, buf->msg + buf->N_bytes, ran_func.ran_function_definition.data()); + return true; } @@ -206,8 +212,8 @@ bool e2sm_kpm::execute_action_fill_ric_indication(E2AP_RIC_action_t& action_entr E2SM_KPM_RIC_ind_header_t ric_ind_header; E2SM_KPM_RIC_ind_message_t ric_ind_message; - uint64_t granul_period; - meas_info_list_l action_meas_info_list; + uint64_t granul_period; + meas_info_list_l action_meas_info_list; ric_indication.indication_type = ri_cind_type_opts::report; e2_sm_kpm_action_definition_s action = registered_actions.at(action_entry.sm_local_ric_action_id);