e2sm_kpm: set collet_start_time timestamp correctly

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 81f28a4d45
commit 048b54c4f4

@ -137,6 +137,8 @@ private:
bool _generate_indication_message(E2SM_KPM_RIC_ind_message_t msg, srsran::unique_byte_buffer_t& buf); bool _generate_indication_message(E2SM_KPM_RIC_ind_message_t msg, srsran::unique_byte_buffer_t& buf);
bool _get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& def); bool _get_meas_definition(std::string meas_name, E2SM_KPM_metric_t& def);
uint64_t _get_meas_collection_start_time(uint32_t action_id);
void _save_meas_collection_start_time(uint32_t action_id, uint64_t timestamp);
E2SM_KPM_meas_values_t& _get_collected_meas_values(uint32_t act_id, std::string meas_name, e2sm_kpm_label_enum label); E2SM_KPM_meas_values_t& _get_collected_meas_values(uint32_t act_id, std::string meas_name, e2sm_kpm_label_enum label);
bool _save_last_meas_value(E2SM_KPM_meas_values_t& meas_values); bool _save_last_meas_value(E2SM_KPM_meas_values_t& meas_values);
@ -152,6 +154,7 @@ private:
srslog::basic_logger& logger; srslog::basic_logger& logger;
std::vector<E2SM_KPM_metric_t> supported_meas_types; std::vector<E2SM_KPM_metric_t> supported_meas_types;
std::map<uint32_t, e2_sm_kpm_action_definition_s> registered_actions; std::map<uint32_t, e2_sm_kpm_action_definition_s> registered_actions;
std::map<uint32_t, uint64_t> action_meas_collection_start_timestamp;
std::vector<E2SM_KPM_meas_values_t> collected_meas_data; std::vector<E2SM_KPM_meas_values_t> collected_meas_data;
srsran_random_t random_gen; srsran_random_t random_gen;

@ -96,6 +96,12 @@ void e2sm_kpm::receive_e2_metrics_callback(const enb_metrics_t& m)
// TODO: probably some labels need a special processing (e.g., use bin width that needs to be stored) // TODO: probably some labels need a special processing (e.g., use bin width that needs to be stored)
E2SM_KPM_meas_values_t& meas_values = _get_collected_meas_values(action_id, meas_name, label); E2SM_KPM_meas_values_t& meas_values = _get_collected_meas_values(action_id, meas_name, label);
// extract a needed value from enb metrics and save to the value vector // extract a needed value from enb metrics and save to the value vector
if ((meas_values.integer_values.size() + meas_values.real_values.size()) == 0) {
// save timestamp of the first measurement value for this action
if (_get_meas_collection_start_time(action_id) == 0) {
_save_meas_collection_start_time(action_id, std::time(0));
}
}
_save_last_meas_value(meas_values); _save_last_meas_value(meas_values);
} }
} }
@ -257,6 +263,8 @@ bool e2sm_kpm::process_ric_action_definition(ri_caction_to_be_setup_item_s ric_a
action_entry.sm_local_ric_action_id = _generate_local_action_id(); action_entry.sm_local_ric_action_id = _generate_local_action_id();
registered_actions.insert( registered_actions.insert(
std::pair<uint32_t, e2_sm_kpm_action_definition_s>(action_entry.sm_local_ric_action_id, e2sm_kpm_action_def)); std::pair<uint32_t, e2_sm_kpm_action_definition_s>(action_entry.sm_local_ric_action_id, e2sm_kpm_action_def));
// clear timestamp, i.e., save 0 as timestamp, so we can save the timestamp of the first measurement of this action
_save_meas_collection_start_time(action_entry.sm_local_ric_action_id, 0);
} }
return admit_action; return admit_action;
@ -370,7 +378,7 @@ bool e2sm_kpm::execute_action_fill_ric_indication(E2AP_RIC_action_t& action_entr
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_ind_header.collet_start_time = std::time(0); ric_ind_header.collet_start_time = _get_meas_collection_start_time(action_id);
ric_indication.ri_cind_hdr = srsran::make_byte_buffer(); ric_indication.ri_cind_hdr = srsran::make_byte_buffer();
this->_generate_indication_header(ric_ind_header, ric_indication.ri_cind_hdr); this->_generate_indication_header(ric_ind_header, ric_indication.ri_cind_hdr);
@ -407,6 +415,10 @@ bool e2sm_kpm::execute_action_fill_ric_indication(E2AP_RIC_action_t& action_entr
ric_indication.ri_cind_msg = srsran::make_byte_buffer(); ric_indication.ri_cind_msg = srsran::make_byte_buffer();
this->_generate_indication_message(ric_ind_message, ric_indication.ri_cind_msg); this->_generate_indication_message(ric_ind_message, ric_indication.ri_cind_msg);
// clear timestamp, i.e., save 0 as timestamp, so we can save the timestamp of the first measurement of this action
_save_meas_collection_start_time(action_id, 0);
return true; return true;
} }
@ -633,6 +645,19 @@ e2sm_kpm::_get_collected_meas_values(uint32_t action_id, std::string meas_name,
return *it; return *it;
} }
uint64_t e2sm_kpm::_get_meas_collection_start_time(uint32_t action_id)
{
if (action_meas_collection_start_timestamp.find(action_id) != action_meas_collection_start_timestamp.end()) {
return action_meas_collection_start_timestamp.at(action_id);
}
return std::time(0);
}
void e2sm_kpm::_save_meas_collection_start_time(uint32_t action_id, uint64_t timestamp)
{
action_meas_collection_start_timestamp[action_id] = timestamp;
}
bool e2sm_kpm::_save_last_meas_value(E2SM_KPM_meas_values_t& meas_values) bool e2sm_kpm::_save_last_meas_value(E2SM_KPM_meas_values_t& meas_values)
{ {
meas_values.data_type = meas_values.data_type =

Loading…
Cancel
Save