e2sm_kpm: do not pass enb_metrics to e2sm_kpm_report_service

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent ffe16f363f
commit 01886a2d6d

@ -56,8 +56,13 @@ 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);
bool _extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_value, const enb_metrics_t& enb_metrics);
bool _extract_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value, const enb_metrics_t& enb_metrics);
bool _collect_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_value);
bool _collect_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value);
bool _extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_value,
const enb_metrics_t& enb_metrics,
uint32_t& value);
bool _extract_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value, const enb_metrics_t& enb_metrics, float& value);
srslog::basic_logger& logger;
std::vector<E2SM_KPM_metric_t> supported_meas_types;

@ -33,7 +33,7 @@ public:
virtual bool _initialize_ric_ind_hdr();
virtual bool _initialize_ric_ind_msg() = 0;
virtual bool collect_data(const enb_metrics_t& enb_metrics) = 0;
virtual bool collect_meas_data() = 0;
virtual bool is_ric_ind_ready() = 0;
virtual bool clear_collected_data() = 0;
@ -67,7 +67,7 @@ public:
static bool process_ric_action_definition(e2sm_kpm* e2sm_kpm, e2_sm_kpm_action_definition_s& action_definition);
virtual bool _initialize_ric_ind_msg();
virtual bool collect_data(const enb_metrics_t& enb_metrics);
virtual bool collect_meas_data();
virtual bool is_ric_ind_ready();
virtual bool clear_collected_data();
@ -90,7 +90,7 @@ public:
static bool process_ric_action_definition(e2sm_kpm* e2sm_kpm, e2_sm_kpm_action_definition_s& action_definition);
virtual bool _initialize_ric_ind_msg();
virtual bool collect_data(const enb_metrics_t& enb_metrics);
virtual bool collect_meas_data();
virtual bool is_ric_ind_ready();
virtual bool clear_collected_data();
@ -110,7 +110,7 @@ public:
static bool process_ric_action_definition(e2sm_kpm* e2sm_kpm, e2_sm_kpm_action_definition_s& action_definition);
virtual bool _initialize_ric_ind_msg();
virtual bool collect_data(const enb_metrics_t& enb_metrics);
virtual bool collect_meas_data();
virtual bool is_ric_ind_ready();
virtual bool clear_collected_data();
@ -130,7 +130,7 @@ public:
static bool process_ric_action_definition(e2sm_kpm* e2sm_kpm, e2_sm_kpm_action_definition_s& action_definition);
virtual bool _initialize_ric_ind_msg();
virtual bool collect_data(const enb_metrics_t& enb_metrics);
virtual bool collect_meas_data();
virtual bool is_ric_ind_ready();
virtual bool clear_collected_data();
@ -150,7 +150,7 @@ public:
static bool process_ric_action_definition(e2sm_kpm* e2sm_kpm, e2_sm_kpm_action_definition_s& action_definition);
virtual bool _initialize_ric_ind_msg();
virtual bool collect_data(const enb_metrics_t& enb_metrics);
virtual bool collect_meas_data();
virtual bool is_ric_ind_ready();
virtual bool clear_collected_data();

@ -298,12 +298,35 @@ void e2sm_kpm::receive_e2_metrics_callback(const enb_metrics_t& m)
for (auto& it : registered_actions_data) {
e2sm_kpm_report_service* report_service = it.second;
report_service->collect_data(m);
report_service->collect_meas_data();
}
}
bool e2sm_kpm::_collect_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_value)
{
// here we implement logic of measurement data collection, currently we only read from enb_metrics
uint32_t value;
if (_extract_integer_type_meas_value(meas_value, last_enb_metrics, value)) {
meas_value.integer_value = value;
return true;
}
return false;
}
bool e2sm_kpm::_collect_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value)
{
// here we implement logic of measurement data collection, currently we only read from enb_metrics
float value;
if (_extract_real_type_meas_value(meas_value, last_enb_metrics, value)) {
meas_value.real_value = value;
return true;
}
return false;
}
bool e2sm_kpm::_extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_value,
const enb_metrics_t& enb_metrics)
const enb_metrics_t& enb_metrics,
uint32_t& value)
{
// TODO: maybe add ID to metric types in e2sm_kpm_metrics definitions, so we do not have to compare strings?
// TODO: make string comparison case insensitive
@ -312,8 +335,8 @@ bool e2sm_kpm::_extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_valu
if (meas_value.name.c_str() == std::string("test")) {
switch (meas_value.label) {
case NO_LABEL:
meas_value.integer_value = (int32_t)enb_metrics.sys.cpu_load[0];
printf("extract last \"test\" value as int, (filled with CPU0_load) value %i \n", meas_value.integer_value);
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;
default:
return false;
@ -324,8 +347,8 @@ bool e2sm_kpm::_extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_valu
if (meas_value.name.c_str() == std::string("random_int")) {
switch (meas_value.label) {
case NO_LABEL:
meas_value.integer_value = srsran_random_uniform_int_dist(random_gen, 0, 100);
printf("extract last \"random_int\" value as int, random value %i \n", meas_value.integer_value);
value = srsran_random_uniform_int_dist(random_gen, 0, 100);
printf("extract last \"random_int\" value as int, random value %i \n", value);
return true;
default:
return false;
@ -335,14 +358,16 @@ bool e2sm_kpm::_extract_integer_type_meas_value(E2SM_KPM_meas_value_t& meas_valu
return false;
}
bool e2sm_kpm::_extract_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value, const enb_metrics_t& enb_metrics)
bool e2sm_kpm::_extract_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value,
const enb_metrics_t& enb_metrics,
float& value)
{
// all real type measurements
// cpu0_load: no_label
if (meas_value.name.c_str() == std::string("cpu0_load")) {
switch (meas_value.label) {
case NO_LABEL:
meas_value.real_value = enb_metrics.sys.cpu_load[0];
value = enb_metrics.sys.cpu_load[0];
return true;
default:
return false;
@ -354,15 +379,14 @@ bool e2sm_kpm::_extract_real_type_meas_value(E2SM_KPM_meas_value_t& meas_value,
uint32_t size;
switch (meas_value.label) {
case MIN_LABEL:
meas_value.real_value = *std::min_element(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end());
value = *std::min_element(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end());
return true;
case MAX_LABEL:
meas_value.real_value = *std::max_element(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end());
value = *std::max_element(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end());
return true;
case AVG_LABEL:
size = enb_metrics.sys.cpu_load.size();
meas_value.real_value =
std::accumulate(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end(), 0.0 / size);
value = std::accumulate(enb_metrics.sys.cpu_load.begin(), enb_metrics.sys.cpu_load.end(), 0.0 / size);
return true;
default:
return false;

@ -310,7 +310,7 @@ meas_data_item_s& e2sm_kpm_report_service_style1::_get_meas_data_item(std::strin
return ric_ind_message.meas_data[0];
}
bool e2sm_kpm_report_service_style1::collect_data(const enb_metrics_t& enb_metrics)
bool e2sm_kpm_report_service_style1::collect_meas_data()
{
meas_info_list_l& meas_info_list = ric_ind_message.meas_info_list;
for (uint32_t i = 0; i < meas_info_list.size(); i++) {
@ -342,13 +342,13 @@ bool e2sm_kpm_report_service_style1::collect_data(const enb_metrics_t& enb_metri
meas_value.data_type = data_type;
if (meas_value.data_type == meas_record_item_c::types::options::integer) {
if (not parent->_extract_integer_type_meas_value(meas_value, enb_metrics)) {
if (not parent->_collect_integer_type_meas_value(meas_value)) {
parent->logger.info("Cannot extract value \"%s\" label: %i", meas_name.c_str(), label);
return false;
}
} else {
// data_type == meas_record_item_c::types::options::real;
if (not parent->_extract_real_type_meas_value(meas_value, enb_metrics)) {
if (not parent->_collect_real_type_meas_value(meas_value)) {
parent->logger.info("Cannot extract value \"%s\" label %i", meas_name.c_str(), label);
return false;
}
@ -400,7 +400,7 @@ bool e2sm_kpm_report_service_style2::process_ric_action_definition(e2sm_kpm*
return false;
}
bool e2sm_kpm_report_service_style2::collect_data(const enb_metrics_t& enb_metrics)
bool e2sm_kpm_report_service_style2::collect_meas_data()
{
// TODO: implement
return false;
@ -443,7 +443,7 @@ bool e2sm_kpm_report_service_style3::process_ric_action_definition(e2sm_kpm*
return false;
}
bool e2sm_kpm_report_service_style3::collect_data(const enb_metrics_t& enb_metrics)
bool e2sm_kpm_report_service_style3::collect_meas_data()
{
// TODO: implement
return false;
@ -486,7 +486,7 @@ bool e2sm_kpm_report_service_style4::process_ric_action_definition(e2sm_kpm*
return false;
}
bool e2sm_kpm_report_service_style4::collect_data(const enb_metrics_t& enb_metrics)
bool e2sm_kpm_report_service_style4::collect_meas_data()
{
// TODO: implement
return false;
@ -529,7 +529,7 @@ bool e2sm_kpm_report_service_style5::process_ric_action_definition(e2sm_kpm*
return false;
}
bool e2sm_kpm_report_service_style5::collect_data(const enb_metrics_t& enb_metrics)
bool e2sm_kpm_report_service_style5::collect_meas_data()
{
// TODO: implement
return false;

Loading…
Cancel
Save