diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm.h b/srsgnb/hdr/stack/ric/e2sm_kpm.h index 4e6d5d4b3..009f5c754 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm.h @@ -37,6 +37,21 @@ typedef struct { uint64_t granul_period; } E2SM_KPM_RIC_ind_message_t; +enum e2_metric_data_type_t { INTEGER, REAL }; + +typedef struct { + std::string name; + bool supported; + e2_metric_data_type_t data_type; + std::string units; + bool min_val_present; + double min_val; + bool max_val_present; + double max_val; + uint32_t supported_labels; + uint32_t supported_scopes; +} E2SM_KPM_metric_t; + class e2sm_kpm : public e2sm { public: @@ -75,7 +90,7 @@ private: bool _generate_indication_message(E2SM_KPM_RIC_ind_message_t msg, srsran::unique_byte_buffer_t& buf); srslog::basic_logger& logger; - std::vector supported_meas_types; + std::vector supported_meas_types; std::map registered_actions; srsran_random_t random_gen; diff --git a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h index e96afbe66..695ed1f3a 100644 --- a/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h +++ b/srsgnb/hdr/stack/ric/e2sm_kpm_metrics.h @@ -14,6 +14,7 @@ #ifndef SRSRAN_E2SM_KPM_METRICS_H #define SRSRAN_E2SM_KPM_METRICS_H +#include "e2sm_kpm.h" #include "srsran/srsran.h" /* Labels supported for a metric */ @@ -29,21 +30,6 @@ #define UE_LEVEL 0x0004 #define BEARER_LEVEL 0x0008 -enum e2_metric_data_type_t { INTEGER, REAL }; - -struct E2SM_KPM_metric_t { - std::string name; - bool supported; - e2_metric_data_type_t data_type; - std::string units; - bool min_val_present; - double min_val; - bool max_val_present; - double max_val; - uint32_t supported_labels; - uint32_t supported_scopes; -}; - // clang-format off // Measurements defined in 3GPP TS 28.552 std::vector get_e2sm_kpm_28_552_metrics() diff --git a/srsgnb/src/stack/ric/e2sm_kpm.cc b/srsgnb/src/stack/ric/e2sm_kpm.cc index 751931348..a59e4dafc 100644 --- a/srsgnb/src/stack/ric/e2sm_kpm.cc +++ b/srsgnb/src/stack/ric/e2sm_kpm.cc @@ -13,22 +13,22 @@ e2sm_kpm::e2sm_kpm(srslog::basic_logger& logger_) : e2sm(short_name, oid, func_d // add supported metrics for (auto& metric : get_e2sm_kpm_28_552_metrics()) { if (metric.supported) { - supported_meas_types.push_back(metric.name); + supported_meas_types.push_back(metric); } } for (auto& metric : get_e2sm_kpm_34_425_metrics()) { if (metric.supported) { - supported_meas_types.push_back(metric.name); + supported_meas_types.push_back(metric); } } for (auto& metric : e2sm_kpm_oran_metrics()) { if (metric.supported) { - supported_meas_types.push_back(metric.name); + supported_meas_types.push_back(metric); } } for (auto& metric : e2sm_kpm_custom_metrics()) { if (metric.supported) { - supported_meas_types.push_back(metric.name); + supported_meas_types.push_back(metric); } } } @@ -212,7 +212,8 @@ bool e2sm_kpm::_process_ric_action_definition_format1(e2_sm_kpm_action_definitio meas_info_list = action_definition_format1.meas_info_list; for (uint32_t i = 0; i < meas_info_list.size(); i++) { std::string meas_name = meas_info_list[i].meas_type.meas_name().to_string(); - if (std::find(supported_meas_types.begin(), supported_meas_types.end(), meas_name.c_str()) == + auto name_matches = [&meas_name](const E2SM_KPM_metric_t& x) { return x.name == meas_name.c_str(); }; + if (std::find_if(supported_meas_types.begin(), supported_meas_types.end(), name_matches) == supported_meas_types.end()) { printf("Unsupported measurement name: \"%s\" --> do not admit action\n", meas_name.c_str()); return false;