e2sm: move RIC content generation to SM

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 5e4e13df09
commit 48a7dd546f

@ -13,7 +13,6 @@
#include "e2sm_kpm.h" #include "e2sm_kpm.h"
#include "srsran/asn1/e2ap.h" #include "srsran/asn1/e2ap.h"
#include "srsran/asn1/e2sm_kpm_v2.h"
#include "srsran/interfaces/e2_metrics_interface.h" #include "srsran/interfaces/e2_metrics_interface.h"
#include "srsran/interfaces/enb_metrics_interface.h" #include "srsran/interfaces/enb_metrics_interface.h"
#include "srsran/srsran.h" #include "srsran/srsran.h"
@ -44,16 +43,6 @@ typedef struct {
std::vector<uint32_t> not_admitted_actions; std::vector<uint32_t> not_admitted_actions;
} ric_subscription_reponse_t; } ric_subscription_reponse_t;
typedef struct {
uint32_t ric_requestor_id;
uint32_t ric_instance_id;
uint32_t ra_nfunction_id;
uint32_t ri_caction_id;
ri_cind_type_e indication_type;
srsran::unique_byte_buffer_t ri_cind_hdr;
srsran::unique_byte_buffer_t ri_cind_msg;
} ric_indication_t;
class e2ap class e2ap
{ {
public: public:

@ -34,6 +34,16 @@ struct E2AP_RIC_action {
uint32_t sm_local_ric_action_id; uint32_t sm_local_ric_action_id;
}; };
typedef struct {
uint32_t ric_requestor_id;
uint32_t ric_instance_id;
uint32_t ra_nfunction_id;
uint32_t ri_caction_id;
asn1::e2ap::ri_cind_type_e indication_type;
srsran::unique_byte_buffer_t ri_cind_hdr;
srsran::unique_byte_buffer_t ri_cind_msg;
} ric_indication_t;
class e2sm class e2sm
{ {
public: public:
@ -51,8 +61,9 @@ public:
virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request, virtual bool process_ric_event_trigger_definition(asn1::e2ap::ricsubscription_request_s subscription_request,
RIC_event_trigger_definition& event_def) = 0; RIC_event_trigger_definition& event_def) = 0;
virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action, virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action,
E2AP_RIC_action& action_entry) = 0; E2AP_RIC_action& action_entry) = 0;
virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry) = 0; virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry) = 0;
virtual bool execute_action_fill_ric_indication(E2AP_RIC_action& action_entry, ric_indication_t& ric_indication) = 0;
protected: protected:
uint32_t _generate_local_action_id() { return _registered_action_id_gen++; }; uint32_t _generate_local_action_id() { return _registered_action_id_gen++; };

@ -51,6 +51,8 @@ public:
virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action, virtual bool process_ric_action_definition(asn1::e2ap::ri_caction_to_be_setup_item_s ric_action,
E2AP_RIC_action& action_entry); E2AP_RIC_action& action_entry);
virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry); virtual bool remove_ric_action_definition(E2AP_RIC_action& action_entry);
virtual bool execute_action_fill_ric_indication(E2AP_RIC_action& action_entry, ric_indication_t& ric_indication);
bool generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf); bool generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf);
bool generate_indication_message(E2SM_KPM_RIC_ind_message msg, srsran::unique_byte_buffer_t& buf); bool generate_indication_message(E2SM_KPM_RIC_ind_message msg, srsran::unique_byte_buffer_t& buf);

@ -42,7 +42,6 @@ private:
uint32_t ric_requestor_id; uint32_t ric_requestor_id;
uint32_t ric_instance_id; uint32_t ric_instance_id;
uint16_t ra_nfunction_id; uint16_t ra_nfunction_id;
uint16_t ri_caction_id;
e2sm* sm_ptr = nullptr; e2sm* sm_ptr = nullptr;
uint32_t reporting_period = 0; // ms uint32_t reporting_period = 0; // ms

@ -196,6 +196,41 @@ bool e2sm_kpm::remove_ric_action_definition(E2AP_RIC_action& action_entry)
return false; return false;
} }
bool e2sm_kpm::execute_action_fill_ric_indication(E2AP_RIC_action& action_entry, ric_indication_t& ric_indication)
{
using namespace asn1::e2ap;
using namespace asn1::e2sm_kpm;
ric_indication.indication_type = ri_cind_type_opts::report;
E2SM_KPM_RIC_ind_header ric_ind_header;
ric_ind_header.collet_start_time = 0x12345;
ric_indication.ri_cind_hdr = srsran::make_byte_buffer();
this->generate_indication_header(ric_ind_header, ric_indication.ri_cind_hdr);
E2SM_KPM_RIC_ind_message ric_ind_message;
ric_ind_message.ind_msg_format = e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types_opts::ind_msg_format1;
ric_ind_message.meas_data.resize(1);
ric_ind_message.meas_data[0].meas_record.resize(5);
for (uint32_t i = 0; i < ric_ind_message.meas_data[0].meas_record.size(); i++) {
ric_ind_message.meas_data[0].meas_record[i].set_integer() = i * 1000;
}
ric_ind_message.meas_info_list.resize(1);
ric_ind_message.meas_info_list[0].meas_type.set_meas_name().from_string("RRU.PrbTotDl");
ric_ind_message.meas_info_list[0].label_info_list.resize(1);
ric_ind_message.meas_info_list[0].label_info_list[0].meas_label.no_label_present = true;
ric_ind_message.meas_info_list[0].label_info_list[0].meas_label.no_label =
asn1::e2sm_kpm::meas_label_s::no_label_opts::true_value;
// ric_ind_message.granul_period = 12345; // not implemented by flexric and crashes it
ric_indication.ri_cind_msg = srsran::make_byte_buffer();
this->generate_indication_message(ric_ind_message, ric_indication.ri_cind_msg);
return true;
}
bool e2sm_kpm::generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf) bool e2sm_kpm::generate_indication_header(E2SM_KPM_RIC_ind_header hdr, srsran::unique_byte_buffer_t& buf)
{ {
using namespace asn1::e2sm_kpm; using namespace asn1::e2sm_kpm;

@ -130,44 +130,24 @@ void ric_client::ric_subscription::delete_subscription()
void ric_client::ric_subscription::send_ric_indication() void ric_client::ric_subscription::send_ric_indication()
{ {
printf("Sending RIC indication msg to RIC Requestor ID: %i\n", ric_requestor_id); if (sm_ptr == nullptr) {
ric_indication_t ric_indication; parent->logger.error("SM pointer not set in subscription: %i\n", ric_requestor_id);
ric_indication.ric_requestor_id = ric_requestor_id; return;
ric_indication.ric_instance_id = ric_instance_id;
ric_indication.ra_nfunction_id = ra_nfunction_id;
ric_indication.ri_caction_id = ri_caction_id;
ric_indication.indication_type = ri_cind_type_opts::report;
e2sm_kpm* sm_kpm_ptr = dynamic_cast<e2sm_kpm*>(sm_ptr);
E2SM_KPM_RIC_ind_header ric_ind_header;
ric_ind_header.collet_start_time = 0x12345;
ric_indication.ri_cind_hdr = srsran::make_byte_buffer();
sm_kpm_ptr->generate_indication_header(ric_ind_header, ric_indication.ri_cind_hdr);
E2SM_KPM_RIC_ind_message ric_ind_message;
ric_ind_message.ind_msg_format = e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types_opts::ind_msg_format1;
ric_ind_message.meas_data.resize(1);
ric_ind_message.meas_data[0].meas_record.resize(5);
for (uint32_t i = 0; i < ric_ind_message.meas_data[0].meas_record.size(); i++) {
ric_ind_message.meas_data[0].meas_record[i].set_integer() = i * 1000;
} }
ric_ind_message.meas_info_list.resize(1); for (auto& action : admitted_actions) {
ric_ind_message.meas_info_list[0].meas_type.set_meas_name().from_string("RRU.PrbTotDl"); printf("Sending RIC indication msg to RIC Requestor ID: %i\n", ric_requestor_id);
ric_ind_message.meas_info_list[0].label_info_list.resize(1); ric_indication_t ric_indication;
ric_ind_message.meas_info_list[0].label_info_list[0].meas_label.no_label_present = true; ric_indication.ric_requestor_id = ric_requestor_id;
ric_ind_message.meas_info_list[0].label_info_list[0].meas_label.no_label = ric_indication.ric_instance_id = ric_instance_id;
asn1::e2sm_kpm::meas_label_s::no_label_opts::true_value; ric_indication.ra_nfunction_id = ra_nfunction_id;
ric_indication.ri_caction_id = action.ric_action_id;
// ric_ind_message.granul_period = 12345; // not implemented by flexric and crashes it
ric_indication.ri_cind_msg = srsran::make_byte_buffer(); sm_ptr->execute_action_fill_ric_indication(action, ric_indication);
sm_kpm_ptr->generate_indication_message(ric_ind_message, ric_indication.ri_cind_msg);
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_indication(ric_indication); e2_ap_pdu_c send_pdu = parent->e2ap_.generate_indication(ric_indication);
parent->queue_send_e2ap_pdu(send_pdu); parent->queue_send_e2ap_pdu(send_pdu);
}
// reschedule sending RIC indication // reschedule sending RIC indication
reporting_timer.run(); reporting_timer.run();

Loading…
Cancel
Save