From 6090033a3838dd2ce0774a1fba26da30eafdcf5f Mon Sep 17 00:00:00 2001 From: Piotr Gawlowicz Date: Fri, 31 Mar 2023 17:36:34 +0200 Subject: [PATCH] e2sm_kpm: report supported metrics in setup_request msg --- srsgnb/hdr/stack/ric/e2sm_kpm.h | 1 + srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h | 6 +-- srsgnb/src/stack/ric/e2sm_kpm.cc | 57 ++++++++++++++++++++----- 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm.h b/srsgnb/hdr/stack/ric/e2sm_kpm.h index f36ceba83..0a535fa1d 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm.h @@ -56,6 +56,7 @@ private: bool _generate_indication_header(e2_sm_kpm_ind_hdr_s& hdr, srsran::unique_byte_buffer_t& buf); bool _generate_indication_message(e2_sm_kpm_ind_msg_s& msg, srsran::unique_byte_buffer_t& buf); bool _get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& def); + std::vector _get_supported_meas(uint32_t level_mask); bool _collect_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item); bool _collect_real_type_meas_value(E2SM_KPM_meas_def_t& meas_value, meas_record_item_c& item); diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h index 50dcdba5e..9bf016b21 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h @@ -23,9 +23,9 @@ std::vector get_e2sm_kpm_28_552_metrics() { // TODO: add all metrics from 3GPP TS 28.552 std::vector metrics; - // supported metrics - metrics.push_back({"RRU.PrbTotDl", true, REAL, "%", true, 0, true, 100, NO_LABEL | AVG_LABEL, CELL_LEVEL | UE_LEVEL }); - metrics.push_back({"RRU.PrbTotUl", true, REAL, "%", true, 0, true, 100, NO_LABEL | AVG_LABEL, CELL_LEVEL | UE_LEVEL }); + // not supported metrics + metrics.push_back({"RRU.PrbTotDl", false, REAL, "%", true, 0, true, 100, NO_LABEL | AVG_LABEL, CELL_LEVEL | UE_LEVEL }); + metrics.push_back({"RRU.PrbTotUl", false, REAL, "%", true, 0, true, 100, NO_LABEL | AVG_LABEL, CELL_LEVEL | UE_LEVEL }); // not supported metrics metrics.push_back({"RRU.RachPreambleDedMean", false, REAL, "-", false, 0, false, 100, NO_LABEL, CELL_LEVEL | UE_LEVEL }); return metrics; diff --git a/srsgnb/src/stack/ric/e2sm_kpm.cc b/srsgnb/src/stack/ric/e2sm_kpm.cc index 2ae84f57d..adfd19860 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm.cc @@ -72,45 +72,65 @@ bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, event_trigger_style_list[0].ric_event_trigger_format_type = 1; // uses RIC Event Trigger Definition Format 1 // O-RAN.WG3.E2SM-KPM-R003-v03.00, 7.4.1 REPORT Service Style Type - /* TODO: seems that flexric does not like this part and crashes auto& report_style_list = e2sm_kpm_ra_nfunction_description.ric_report_style_list; - report_style_list.resize(5); + report_style_list.resize(1); report_style_list[0].ric_report_style_type = 1; report_style_list[0].ric_report_style_name.from_string("E2 Node Measurement"); report_style_list[0].ric_action_format_type = 1; report_style_list[0].ric_ind_hdr_format_type = 1; report_style_list[0].ric_ind_msg_format_type = 1; - // A measurement ID can be used for subscription instead of a measurement type if an identifier of a certain - // measurement type was exposed by an E2 Node via the RAN Function Definition IE. - // measurement name to ID mapping (local to the E2 node), here only an example: - report_style_list[0].meas_info_action_list.resize(1); - report_style_list[0].meas_info_action_list[0].meas_name.from_string("RRU.PrbTotDl"); - report_style_list[0].meas_info_action_list[0].meas_id = 123; + std::vector supported_enb_meas = _get_supported_meas(ENB_LEVEL | CELL_LEVEL); + for (const auto& metric : supported_enb_meas) { + meas_info_action_item_s meas_info_item; + meas_info_item.meas_name.from_string(metric.c_str()); + report_style_list[0].meas_info_action_list.push_back(meas_info_item); + break; // TODO: add only one as flexric does not like long setup_request msg and crashes + } + + /* TODO: seems that flexric does not like long setup_request msg and crashes, note: wireshark decodes it correctly + // see: nearRT-RIC: flexric/src/ric/msg_handler_ric.c:88: + // generate_setup_response: Assertion `req->ran_func_item[i].def.len < 127' failed report_style_list[1].ric_report_style_type = 2; report_style_list[1].ric_report_style_name.from_string("E2 Node Measurement for a single UE"); - report_style_list[1].ric_action_format_type = 2; // includes UE ID + report_style_list[1].ric_action_format_type = 2; report_style_list[1].ric_ind_hdr_format_type = 1; report_style_list[1].ric_ind_msg_format_type = 1; + // TODO: add all supported UE LEVEL metrics + report_style_list[1].meas_info_action_list.resize(1); + report_style_list[1].meas_info_action_list[0].meas_name.from_string("RRU.PrbTotDl"); + // A measurement ID can be used for subscription instead of a measurement type if an identifier of a certain + // measurement type was exposed by an E2 Node via the RAN Function Definition IE. + // measurement name to ID mapping (local to the E2 node), here only an example: + // report_style_list[1].meas_info_action_list[0].meas_id = 123; report_style_list[2].ric_report_style_type = 3; report_style_list[2].ric_report_style_name.from_string("Condition-based, UE-level E2 Node Measurement"); report_style_list[2].ric_action_format_type = 3; report_style_list[2].ric_ind_hdr_format_type = 1; report_style_list[2].ric_ind_msg_format_type = 2; + // TODO: add all supported UE LEVEL metrics + report_style_list[2].meas_info_action_list.resize(1); + report_style_list[2].meas_info_action_list[0].meas_name.from_string("RRU.PrbTotDl"); report_style_list[3].ric_report_style_type = 4; report_style_list[3].ric_report_style_name.from_string("Common Condition-based, UE-level Measurement"); report_style_list[3].ric_action_format_type = 4; report_style_list[3].ric_ind_hdr_format_type = 1; report_style_list[3].ric_ind_msg_format_type = 3; + // TODO: add all supported UE LEVEL metrics + report_style_list[3].meas_info_action_list.resize(1); + report_style_list[3].meas_info_action_list[0].meas_name.from_string("RRU.PrbTotDl"); report_style_list[4].ric_report_style_type = 5; report_style_list[4].ric_report_style_name.from_string("E2 Node Measurement for multiple UEs"); report_style_list[4].ric_action_format_type = 5; report_style_list[4].ric_ind_hdr_format_type = 1; report_style_list[4].ric_ind_msg_format_type = 3; + // TODO: add all supported UE LEVEL metrics + report_style_list[4].meas_info_action_list.resize(1); + report_style_list[4].meas_info_action_list[0].meas_name.from_string("RRU.PrbTotDl"); */ logger.info("Generating RAN function description"); srsran::unique_byte_buffer_t buf = srsran::make_byte_buffer(); @@ -122,7 +142,6 @@ bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc, 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; @@ -293,6 +312,24 @@ bool e2sm_kpm::_get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& de return true; } +std::vector e2sm_kpm::_get_supported_meas(uint32_t level_mask) +{ + std::vector supported_meas; + for (auto& metric : supported_meas_types) { + if ((level_mask & ENB_LEVEL) and (metric.supported_scopes & ENB_LEVEL)) { + supported_meas.push_back(metric.name); + } else if ((level_mask & CELL_LEVEL) and (metric.supported_scopes & CELL_LEVEL)) { + supported_meas.push_back(metric.name); + } else if ((level_mask & UE_LEVEL) and (metric.supported_scopes & UE_LEVEL)) { + supported_meas.push_back(metric.name); + } else if ((level_mask & BEARER_LEVEL) and (metric.supported_scopes & BEARER_LEVEL)) { + supported_meas.push_back(metric.name); + } + } + + return supported_meas; +} + void e2sm_kpm::receive_e2_metrics_callback(const enb_metrics_t& m) { last_enb_metrics = m;