e2ap: parametrize ric indication

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 701f26e34b
commit 9f36e4b12c

@ -44,6 +44,16 @@ 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;
RIC_indication_header indication_header;
RIC_indication_message indication_message;
} ric_indication_t;
class e2ap class e2ap
{ {
public: public:
@ -56,7 +66,7 @@ public:
int generate_subscription_failure(); int generate_subscription_failure();
e2_ap_pdu_c e2_ap_pdu_c
generate_subscription_delete_response(uint32_t ric_requestor_id, uint32_t ric_instance_id, uint32_t ra_nfunction_id); generate_subscription_delete_response(uint32_t ric_requestor_id, uint32_t ric_instance_id, uint32_t ra_nfunction_id);
e2_ap_pdu_c generate_indication(); e2_ap_pdu_c generate_indication(ric_indication_t& ric_indication);
e2_ap_pdu_c generate_reset_request(); e2_ap_pdu_c generate_reset_request();
e2_ap_pdu_c generate_reset_response(); e2_ap_pdu_c generate_reset_response();
int process_reset_request(reset_request_s reset_request); int process_reset_request(reset_request_s reset_request);

@ -23,6 +23,20 @@ struct RANfunction_description {
std::string function_shortname; std::string function_shortname;
std::string function_e2_sm_oid; std::string function_e2_sm_oid;
int function_instance; int function_instance;
struct RIC_indication_header {
uint32_t collet_start_time;
std::string file_formatversion;
std::string sender_name;
std::string sender_type;
std::string vendor_name;
};
struct RIC_indication_message {
asn1::e2sm_kpm::e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types ind_msg_format;
asn1::e2sm_kpm::meas_data_l meas_data;
asn1::e2sm_kpm::meas_info_list_l meas_info_list;
uint64_t granul_period = 0;
}; };
class e2sm_kpm class e2sm_kpm
@ -32,8 +46,8 @@ public:
bool bool
generate_ran_function_description(int function_id, RANfunction_description desc, srsran::unique_byte_buffer_t& buf); generate_ran_function_description(int function_id, RANfunction_description desc, srsran::unique_byte_buffer_t& buf);
int process_ric_action_definition(); int process_ric_action_definition();
bool generate_indication_header(srsran::unique_byte_buffer_t& buf); bool generate_indication_header(RIC_indication_header hdr, srsran::unique_byte_buffer_t& buf);
bool generate_indication_message(srsran::unique_byte_buffer_t& buf); bool generate_indication_message(RIC_indication_message msg, srsran::unique_byte_buffer_t& buf);
private: private:
srslog::basic_logger& logger; srslog::basic_logger& logger;

@ -42,6 +42,7 @@ 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;
uint32_t reporting_period; // ms uint32_t reporting_period; // ms
srsran::unique_timer reporting_timer; // for RIC indication reporting srsran::unique_timer reporting_timer; // for RIC indication reporting

@ -166,7 +166,7 @@ int e2ap::process_subscription_request(ricsubscription_request_s subscription_re
return 0; return 0;
} }
e2_ap_pdu_c e2ap::generate_indication() e2_ap_pdu_c e2ap::generate_indication(ric_indication_t& ric_indication)
{ {
using namespace asn1::e2ap; using namespace asn1::e2ap;
e2_ap_pdu_c pdu; e2_ap_pdu_c pdu;
@ -176,29 +176,28 @@ e2_ap_pdu_c e2ap::generate_indication()
initmsg.crit = asn1::crit_opts::reject; initmsg.crit = asn1::crit_opts::reject;
ri_cind_s& indication = initmsg.value.ri_cind(); ri_cind_s& indication = initmsg.value.ri_cind();
indication->ri_crequest_id.crit = asn1::crit_opts::reject; indication->ri_crequest_id.crit = asn1::crit_opts::reject;
indication->ri_crequest_id.value.ric_requestor_id = 1021; indication->ri_crequest_id.value.ric_requestor_id = ric_indication.ric_requestor_id;
indication->ri_crequest_id.value.ric_instance_id = 0; indication->ri_crequest_id.value.ric_instance_id = ric_indication.ric_instance_id;
indication->ra_nfunction_id.crit = asn1::crit_opts::reject; indication->ra_nfunction_id.crit = asn1::crit_opts::reject;
indication->ra_nfunction_id.value = 147; indication->ra_nfunction_id.value = ric_indication.ra_nfunction_id;
indication->ri_caction_id.crit = asn1::crit_opts::reject; indication->ri_caction_id.crit = asn1::crit_opts::reject;
indication->ri_caction_id.value = 0; indication->ri_caction_id.value = ric_indication.ri_caction_id;
indication->ri_cind_type.crit = asn1::crit_opts::reject; indication->ri_cind_type.crit = asn1::crit_opts::reject;
indication->ri_cind_type.value = ri_cind_type_opts::report; indication->ri_cind_type.value = ric_indication.indication_type;
indication->ri_cind_hdr.crit = asn1::crit_opts::reject; indication->ri_cind_hdr.crit = asn1::crit_opts::reject;
srsran::unique_byte_buffer_t header_buf = srsran::make_byte_buffer(); srsran::unique_byte_buffer_t header_buf = srsran::make_byte_buffer();
e2sm_.generate_indication_header(header_buf); e2sm_.generate_indication_header(ric_indication.indication_header, header_buf);
indication->ri_cind_hdr->resize(header_buf->N_bytes); indication->ri_cind_hdr->resize(header_buf->N_bytes);
std::copy(header_buf->msg, header_buf->msg + header_buf->N_bytes, indication->ri_cind_hdr->data()); std::copy(header_buf->msg, header_buf->msg + header_buf->N_bytes, indication->ri_cind_hdr->data());
indication->ri_cind_msg.crit = asn1::crit_opts::reject; indication->ri_cind_msg.crit = asn1::crit_opts::reject;
srsran::unique_byte_buffer_t msg_buf = srsran::make_byte_buffer(); srsran::unique_byte_buffer_t msg_buf = srsran::make_byte_buffer();
e2sm_.generate_indication_message(msg_buf); e2sm_.generate_indication_message(ric_indication.indication_message, msg_buf);
indication->ri_cind_msg->resize(msg_buf->N_bytes); indication->ri_cind_msg->resize(msg_buf->N_bytes);
std::copy(msg_buf->msg, msg_buf->msg + msg_buf->N_bytes, indication->ri_cind_msg->data()); std::copy(msg_buf->msg, msg_buf->msg + msg_buf->N_bytes, indication->ri_cind_msg->data());

@ -73,13 +73,16 @@ int e2sm_kpm::process_ric_action_definition()
return 0; return 0;
} }
bool e2sm_kpm::generate_indication_header(srsran::unique_byte_buffer_t& buf) bool e2sm_kpm::generate_indication_header(RIC_indication_header hdr, srsran::unique_byte_buffer_t& buf)
{ {
using namespace asn1::e2sm_kpm; using namespace asn1::e2sm_kpm;
e2_sm_kpm_ind_hdr_s e2_sm_kpm_ind_hdr; e2_sm_kpm_ind_hdr_s e2_sm_kpm_ind_hdr;
e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().collet_start_time.from_string("43f51164"); e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().collet_start_time.from_number(hdr.collet_start_time);
e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().file_formatversion.from_string(hdr.file_formatversion);
e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().sender_name.from_string(hdr.sender_name);
e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().sender_type.from_string(hdr.sender_type);
e2_sm_kpm_ind_hdr.ind_hdr_formats.ind_hdr_format1().vendor_name.from_string(hdr.vendor_name);
logger.info("Generating E2-SM-KPM Indication Header");
asn1::bit_ref bref(buf->msg, buf->get_tailroom()); asn1::bit_ref bref(buf->msg, buf->get_tailroom());
if (e2_sm_kpm_ind_hdr.pack(bref) != asn1::SRSASN_SUCCESS) { if (e2_sm_kpm_ind_hdr.pack(bref) != asn1::SRSASN_SUCCESS) {
printf("IND HEADER: Failed to pack TX E2 PDU\n"); printf("IND HEADER: Failed to pack TX E2 PDU\n");
@ -90,31 +93,31 @@ bool e2sm_kpm::generate_indication_header(srsran::unique_byte_buffer_t& buf)
return true; return true;
} }
bool e2sm_kpm::generate_indication_message(srsran::unique_byte_buffer_t& buf) bool e2sm_kpm::generate_indication_message(RIC_indication_message msg, srsran::unique_byte_buffer_t& buf)
{ {
using namespace asn1::e2sm_kpm; using namespace asn1::e2sm_kpm;
e2_sm_kpm_ind_msg_s e2_sm_kpm_ind_msg; e2_sm_kpm_ind_msg_s e2_sm_kpm_ind_msg;
e2_sm_kpm_ind_msg.ind_msg_formats.set_ind_msg_format1();
auto& meas_data_list = e2_sm_kpm_ind_msg.ind_msg_formats.ind_msg_format1().meas_data; switch (msg.ind_msg_format) {
meas_data_list.resize(1); case asn1::e2sm_kpm::e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types::ind_msg_format1:
meas_data_list[0].meas_record.resize(11); e2_sm_kpm_ind_msg.ind_msg_formats.set_ind_msg_format1();
for (uint32_t i = 0; i < meas_data_list[0].meas_record.size(); i++) { e2_sm_kpm_ind_msg.ind_msg_formats.ind_msg_format1().meas_data = msg.meas_data;
meas_data_list[0].meas_record[i].set_integer() = i * 1000; e2_sm_kpm_ind_msg.ind_msg_formats.ind_msg_format1().meas_info_list = msg.meas_info_list;
break;
case asn1::e2sm_kpm::e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types::ind_msg_format2:
e2_sm_kpm_ind_msg.ind_msg_formats.set_ind_msg_format2();
// TODO: support format2
break;
case asn1::e2sm_kpm::e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types::ind_msg_format3:
e2_sm_kpm_ind_msg.ind_msg_formats.set_ind_msg_format3();
// TODO: support format3
break;
case asn1::e2sm_kpm::e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types::nulltype:
break;
default:
log_invalid_choice_id(msg.ind_msg_format, "e2_sm_kpm_ind_msg_s::ind_msg_formats_c_");
} }
auto& meas_info_list = e2_sm_kpm_ind_msg.ind_msg_formats.ind_msg_format1().meas_info_list;
meas_info_list.resize(2);
meas_info_list[0].meas_type.set_meas_name().from_string("PrbDlUsage");
meas_info_list[0].label_info_list.resize(1);
meas_info_list[0].label_info_list[0].meas_label.no_label_present = true;
meas_info_list[0].label_info_list[0].meas_label.no_label = asn1::e2sm_kpm::meas_label_s::no_label_opts::true_value;
meas_info_list[1].meas_type.set_meas_id() = 1;
meas_info_list[1].label_info_list.resize(1);
meas_info_list[1].label_info_list[0].meas_label.no_label_present = true;
meas_info_list[1].label_info_list[0].meas_label.no_label = asn1::e2sm_kpm::meas_label_s::no_label_opts::true_value;
logger.info("Generating E2-SM-KPM Indication Message"); logger.info("Generating E2-SM-KPM Indication Message");
asn1::bit_ref bref(buf->msg, buf->get_tailroom()); asn1::bit_ref bref(buf->msg, buf->get_tailroom());
if (e2_sm_kpm_ind_msg.pack(bref) != asn1::SRSASN_SUCCESS) { if (e2_sm_kpm_ind_msg.pack(bref) != asn1::SRSASN_SUCCESS) {

@ -65,7 +65,32 @@ void ric_client::ric_subscription::stop_ric_indication_reporting()
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); printf("Sending RIC indication msg to RIC Requestor ID: %i\n", ric_requestor_id);
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_indication(); ric_indication_t ric_indication;
ric_indication.ric_requestor_id = ric_requestor_id;
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;
ric_indication.indication_header.collet_start_time = 0x12345;
ric_indication.indication_message.ind_msg_format =
e2_sm_kpm_ind_msg_s::ind_msg_formats_c_::types_opts::ind_msg_format1;
ric_indication.indication_message.meas_data.resize(1);
ric_indication.indication_message.meas_data[0].meas_record.resize(5);
for (uint32_t i = 0; i < ric_indication.indication_message.meas_data[0].meas_record.size(); i++) {
ric_indication.indication_message.meas_data[0].meas_record[i].set_integer() = i * 1000;
}
ric_indication.indication_message.meas_info_list.resize(1);
ric_indication.indication_message.meas_info_list[0].meas_type.set_meas_name().from_string("RRU.PrbTotDl");
ric_indication.indication_message.meas_info_list[0].label_info_list.resize(1);
ric_indication.indication_message.meas_info_list[0].label_info_list[0].meas_label.no_label_present = true;
ric_indication.indication_message.meas_info_list[0].label_info_list[0].meas_label.no_label =
asn1::e2sm_kpm::meas_label_s::no_label_opts::true_value;
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

Loading…
Cancel
Save