diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_common.h b/srsgnb/hdr/stack/ric/e2sm_kpm_common.h index 5968c9459..78e36bee8 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_common.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_common.h @@ -65,6 +65,8 @@ typedef struct { e2sm_kpm_label_enum label; e2sm_kpm_metric_scope_enum scope; meas_record_item_c::types data_type; + uint32_t ue_id; // TODO: do we need to use type ueid_c? or we translate to local RNTI? + uint32_t cell_id; // TODO: do we need to use type cgi_c? or we translate to local cell_id? } E2SM_KPM_meas_def_t; #endif // SRSRAN_E2SM_KPM_COMMON_H diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h index 160dfc84e..50dcdba5e 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h @@ -52,10 +52,10 @@ std::vector e2sm_kpm_custom_metrics() { std::vector metrics; // supported metrics - metrics.push_back({"test", true, INTEGER, "", true, 0, true, 100, NO_LABEL, CELL_LEVEL | UE_LEVEL }); + metrics.push_back({"test", true, INTEGER, "", true, 0, true, 100, NO_LABEL, ENB_LEVEL | CELL_LEVEL | UE_LEVEL }); metrics.push_back({"random_int", true, INTEGER, "", true, 0, true, 100, NO_LABEL, CELL_LEVEL }); - metrics.push_back({"cpu0_load", true, REAL, "", true, 0, true, 100, NO_LABEL, CELL_LEVEL }); - metrics.push_back({"cpu_load", true, REAL, "", true, 0, true, 100, MIN_LABEL|MAX_LABEL|AVG_LABEL, CELL_LEVEL }); + metrics.push_back({"cpu0_load", true, REAL, "", true, 0, true, 100, NO_LABEL, ENB_LEVEL }); + metrics.push_back({"cpu_load", true, REAL, "", true, 0, true, 100, MIN_LABEL|MAX_LABEL|AVG_LABEL, ENB_LEVEL }); // not supported metrics metrics.push_back({"test123", false, REAL, "", true, 0, true, 100, NO_LABEL, CELL_LEVEL | UE_LEVEL }); return metrics; diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_report_service.h b/srsgnb/hdr/stack/ric/e2sm_kpm_report_service.h index 20735202d..6463b77bd 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_report_service.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_report_service.h @@ -51,6 +51,10 @@ public: e2_sm_kpm_ind_hdr_s ric_ind_header_generic; e2_sm_kpm_ind_msg_s ric_ind_message_generic; + uint64_t granul_period = 0; + bool cell_global_id_present = false; + cgi_c cell_global_id; + // hdr format 1 in base class, as all types use it e2_sm_kpm_ind_hdr_format1_s& ric_ind_header; }; diff --git a/srsgnb/src/stack/ric/e2sm_kpm.cc b/srsgnb/src/stack/ric/e2sm_kpm.cc index 7fd53a621..da5873feb 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm.cc @@ -338,9 +338,24 @@ bool e2sm_kpm::_extract_integer_type_meas_value(E2SM_KPM_meas_def_t& meas_value, if (meas_value.name.c_str() == std::string("test")) { switch (meas_value.label) { case NO_LABEL: - value = (int32_t)enb_metrics.sys.cpu_load[0]; - printf("extract last \"test\" value as int, (filled with CPU0_load) value %i \n", value); - return true; + if (meas_value.scope & ENB_LEVEL) { + value = (int32_t)enb_metrics.sys.cpu_load[0]; + printf("extract last \"test\" value as int, (filled with ENB_LEVEL metric: CPU0_load) value %i \n", value); + return true; + } + if (meas_value.scope & CELL_LEVEL) { + uint32_t cell_id = meas_value.cell_id; + value = (int32_t)enb_metrics.stack.mac.cc_info[cell_id].cc_rach_counter; + printf("extract last \"test\" value as int, (filled with CELL_LEVEL metric: cc_rach_counter) value %i \n", + value); + return true; + } + if (meas_value.scope & UE_LEVEL) { + uint32_t ue_id = meas_value.ue_id; + value = (int32_t)enb_metrics.stack.mac.ues[ue_id].ul_rssi; + printf("extract last \"test\" value as int, (filled with UE_LEVEL metric: ul_rssi) value %i \n", value); + return true; + } default: return false; } diff --git a/srsgnb/src/stack/ric/e2sm_kpm_report_service.cc b/srsgnb/src/stack/ric/e2sm_kpm_report_service.cc index 86f99569a..89ed9dfcc 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm_report_service.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm_report_service.cc @@ -92,6 +92,12 @@ e2sm_kpm_report_service_style1::e2sm_kpm_report_service_style1(e2sm_kpm* ric_ind_message(ric_ind_message_generic.ind_msg_formats.set_ind_msg_format1()) { ind_msg_format = e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types_opts::ind_msg_format1; + granul_period = action_def.granul_period; + cell_global_id_present = action_def.cell_global_id_present; + if (cell_global_id_present) { + cell_global_id = action_def.cell_global_id; + } + this->_initialize_ric_ind_hdr(); this->_initialize_ric_ind_msg(); } @@ -320,7 +326,11 @@ bool e2sm_kpm_report_service_style1::collect_meas_data() E2SM_KPM_meas_def_t meas_value; meas_value.name = meas_name; meas_value.label = label; - // meas_values.scope = ...; + meas_value.scope = ENB_LEVEL; + if (cell_global_id_present) { + meas_value.scope = CELL_LEVEL; + meas_value.cell_id = 0; + } meas_value.data_type = data_type; meas_record_item_c item; @@ -380,6 +390,8 @@ bool e2sm_kpm_report_service_style2::process_ric_action_definition(e2sm_kpm* e2_sm_kpm_action_definition_s& action_def_generic) { // TODO: implement + // note: similar to e2sm_kpm_report_service_style1::process_ric_action_definition but in addition + // we need to check whether measurement is supported at UE_LEVEL return false; }