e2sm_kpm: do not admit action if at least one label not supported or if more than 1 label per metric requested

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 7560948a7d
commit ffe16f363f

@ -49,6 +49,8 @@ enum e2sm_kpm_label_enum {
UNKNOWN_LABEL = 0x8000 UNKNOWN_LABEL = 0x8000
}; };
std::string e2sm_kpm_label_2_str(e2sm_kpm_label_enum label);
/* Scopes supported for a metric */ /* Scopes supported for a metric */
enum e2sm_kpm_metric_scope_enum { enum e2sm_kpm_metric_scope_enum {
ENB_LEVEL = 0x0001, ENB_LEVEL = 0x0001,

@ -1,4 +1,4 @@
set(SOURCES ric_client.cc ric_subscription.cc e2ap.cc e2sm_kpm.cc e2sm_kpm_report_service.cc) set(SOURCES ric_client.cc ric_subscription.cc e2ap.cc e2sm_kpm_common.cc e2sm_kpm.cc e2sm_kpm_report_service.cc)
add_library(srsgnb_ric STATIC ${SOURCES}) add_library(srsgnb_ric STATIC ${SOURCES})
target_link_libraries(srsgnb_ric srsran_asn1 ric_e2) target_link_libraries(srsgnb_ric srsran_asn1 ric_e2)

@ -238,7 +238,7 @@ bool e2sm_kpm::generate_ric_indication_content(E2AP_RIC_action_t& action_entry,
return false; return false;
} }
ric_indication.indication_type = ri_cind_type_opts::report; ric_indication.indication_type = ri_cind_type_opts::report;
// header is the same for all RIC service styles, i.e., type 1 // header is the same for all RIC service styles, i.e., type 1
ric_indication.ri_cind_hdr = srsran::make_byte_buffer(); ric_indication.ri_cind_hdr = srsran::make_byte_buffer();

@ -0,0 +1,32 @@
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2022 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*
*/
#include "srsgnb/hdr/stack/ric/e2sm_kpm_common.h"
std::string e2sm_kpm_label_2_str(e2sm_kpm_label_enum label)
{
switch (label) {
case NO_LABEL:
return "NO_LABEL";
case MIN_LABEL:
return "MIN_LABEL";
case MAX_LABEL:
return "MAX_LABEL";
case AVG_LABEL:
return "AVG_LABEL";
case SUM_LABEL:
return "SUM_LABEL";
default:
return "UNKNOWN_LABEL";
}
}

@ -192,6 +192,7 @@ bool e2sm_kpm_report_service_style1::process_ric_action_definition(e2sm_kpm*
} }
} }
std::map<std::string, e2sm_kpm_label_enum> admitted_metrics;
meas_info_list = action_definition.meas_info_list; meas_info_list = action_definition.meas_info_list;
for (uint32_t i = 0; i < meas_info_list.size(); i++) { 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(); std::string meas_name = meas_info_list[i].meas_type.meas_name().to_string();
@ -201,30 +202,61 @@ bool e2sm_kpm_report_service_style1::process_ric_action_definition(e2sm_kpm*
return false; return false;
} }
printf("Admitted action: measurement name: \"%s\" with the following labels: \n", meas_name.c_str()); uint32_t nof_labels = 0;
// TODO: add all labels defined in e2sm_kpm doc, if at least one label not supported do not admit action? // TODO: add all labels defined in e2sm_kpm doc, make this part generic and put to base class
for (uint32_t l = 0; l < meas_info_list[i].label_info_list.size(); l++) { for (uint32_t l = 0; l < meas_info_list[i].label_info_list.size(); l++) {
if (meas_info_list[i].label_info_list[l].meas_label.no_label_present) { if (meas_info_list[i].label_info_list[l].meas_label.no_label_present) {
if (metric_definition.supported_labels & NO_LABEL) { if (metric_definition.supported_labels & NO_LABEL) {
printf("--- Label %i: NO LABEL\n", i); nof_labels++;
admitted_metrics[meas_name] = NO_LABEL;
} else {
printf("Unsupported label: NO_LABEL for metric \"%s\" --> do not admit action\n", meas_name.c_str());
return false;
} }
} }
if (meas_info_list[i].label_info_list[l].meas_label.min_present) { if (meas_info_list[i].label_info_list[l].meas_label.min_present) {
if (metric_definition.supported_labels & MIN_LABEL) { if (metric_definition.supported_labels & MIN_LABEL) {
printf("--- Label %i: MIN\n", i); nof_labels++;
admitted_metrics[meas_name] = MIN_LABEL;
} else {
printf("Unsupported label: MIN_LABEL for metric \"%s\" --> do not admit action\n", meas_name.c_str());
return false;
} }
} }
if (meas_info_list[i].label_info_list[l].meas_label.max_present) { if (meas_info_list[i].label_info_list[l].meas_label.max_present) {
if (metric_definition.supported_labels & MAX_LABEL) { if (metric_definition.supported_labels & MAX_LABEL) {
printf("--- Label %i: MAX\n", i); nof_labels++;
admitted_metrics[meas_name] = MAX_LABEL;
} else {
printf("Unsupported label: MAX_LABEL for metric \"%s\" --> do not admit action\n", meas_name.c_str());
return false;
} }
} }
if (meas_info_list[i].label_info_list[l].meas_label.avg_present) { if (meas_info_list[i].label_info_list[l].meas_label.avg_present) {
if (metric_definition.supported_labels & AVG_LABEL) { if (metric_definition.supported_labels & AVG_LABEL) {
printf("--- Label %i: AVG\n", i); nof_labels++;
admitted_metrics[meas_name] = AVG_LABEL;
} else {
printf("Unsupported label: AVG_LABEL for metric \"%s\" --> do not admit action\n", meas_name.c_str());
return false;
} }
} }
} }
// Note: currently we use labels as choice (i.e., only one can be present) as documentation is not clear about it
if (nof_labels > 1) {
printf("Only one label per metric can be present, meas: \"%s\" has %i labels --> do not admit action\n",
meas_name.c_str(),
nof_labels);
return false;
}
}
printf("Admitted action with the following metrics and labels: \n");
for (const auto& it : admitted_metrics) {
std::string meas_name = it.first;
std::string label_str = e2sm_kpm_label_2_str(it.second);
printf("--- Metric: \"%s\" with label: %s\n", meas_name.c_str(), label_str.c_str());
} }
return true; return true;

Loading…
Cancel
Save