generate E2 indication

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 03d3bd4fb0
commit 02d1fc5336

@ -46,7 +46,7 @@ public:
int process_subscription_request(ricsubscription_request_s subscription_request);
e2_ap_pdu_c generate_subscription_response();
int generate_subscription_failure();
int generate_indication();
e2_ap_pdu_c generate_indication();
e2_ap_pdu_c generate_reset_request();
e2_ap_pdu_c generate_reset_response();
int process_reset_request(reset_request_s reset_request);

@ -31,9 +31,9 @@ public:
e2sm_kpm(srslog::basic_logger& logger_);
bool
generate_ran_function_description(int function_id, RANfunction_description desc, srsran::unique_byte_buffer_t& buf);
bool process_ric_action_definition();
bool generate_indication_header();
bool generate_indication_message();
int process_ric_action_definition();
bool generate_indication_header(srsran::unique_byte_buffer_t& buf);
bool generate_indication_message(srsran::unique_byte_buffer_t& buf);
private:
srslog::basic_logger& logger;

@ -129,9 +129,56 @@ int e2ap::process_setup_response(e2setup_resp_s setup_response)
int e2ap::process_subscription_request(ricsubscription_request_s subscription_request)
{
pending_subscription_request = true;
// TODO process subscription request
uint16_t ran_func_id = subscription_request->ra_nfunction_id->value;
if (ran_functions.count(ran_func_id)) {
// TODO handle RIC subscription request
}
// TODO handle RIC subscription request
return 0;
}
e2_ap_pdu_c e2ap::generate_indication()
{
using namespace asn1::e2ap;
e2_ap_pdu_c pdu;
init_msg_s& initmsg = pdu.set_init_msg();
initmsg.load_info_obj(ASN1_E2AP_ID_RI_CIND);
initmsg.crit = asn1::crit_opts::reject;
ri_cind_s& indication = initmsg.value.ri_cind();
indication->ri_crequest_id.crit = asn1::crit_opts::reject;
indication->ri_crequest_id.value.ric_requestor_id = 1021;
indication->ri_crequest_id.value.ric_instance_id = 0;
indication->ra_nfunction_id.crit = asn1::crit_opts::reject;
indication->ra_nfunction_id.value = 147;
indication->ri_caction_id.crit = asn1::crit_opts::reject;
indication->ri_caction_id.value = 0;
indication->ri_cind_type.crit = asn1::crit_opts::reject;
indication->ri_cind_type.value = ri_cind_type_opts::report;
indication->ri_cind_hdr.crit = asn1::crit_opts::reject;
srsran::unique_byte_buffer_t header_buf = srsran::make_byte_buffer();
e2sm_.generate_indication_header(header_buf);
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());
indication->ri_cind_msg.crit = asn1::crit_opts::reject;
srsran::unique_byte_buffer_t msg_buf = srsran::make_byte_buffer();
e2sm_.generate_indication_message(msg_buf);
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());
return pdu;
}
e2_ap_pdu_c e2ap::generate_reset_request()
{
using namespace asn1::e2ap;

@ -67,3 +67,61 @@ bool e2sm_kpm::generate_ran_function_description(int f
buf->N_bytes = bref.distance_bytes();
return true;
}
int e2sm_kpm::process_ric_action_definition()
{
return 0;
}
bool e2sm_kpm::generate_indication_header(srsran::unique_byte_buffer_t& buf)
{
using namespace asn1::e2sm_kpm;
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");
logger.info("Generating E2-SM-KPM Indication Header");
asn1::bit_ref bref(buf->msg, buf->get_tailroom());
if (e2_sm_kpm_ind_hdr.pack(bref) != asn1::SRSASN_SUCCESS) {
printf("IND HEADER: Failed to pack TX E2 PDU\n");
return false;
}
buf->N_bytes = bref.distance_bytes();
return true;
}
bool e2sm_kpm::generate_indication_message(srsran::unique_byte_buffer_t& buf)
{
using namespace asn1::e2sm_kpm;
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;
meas_data_list.resize(1);
meas_data_list[0].meas_record.resize(11);
for (uint32_t i = 0; i < meas_data_list[0].meas_record.size(); i++) {
meas_data_list[0].meas_record[i].set_integer() = i * 1000;
}
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");
asn1::bit_ref bref(buf->msg, buf->get_tailroom());
if (e2_sm_kpm_ind_msg.pack(bref) != asn1::SRSASN_SUCCESS) {
printf("IND MSG: Failed to pack TX E2 PDU\n");
return false;
}
buf->N_bytes = bref.distance_bytes();
return true;
}

@ -111,15 +111,16 @@ bool ric_client::send_e2_msg(e2_msg_type_t msg_type)
e2_ap_pdu_c send_pdu;
switch (msg_type) {
case e2_msg_type_t::E2_SETUP_REQUEST:
send_pdu = e2ap_.generate_setup_request();
send_pdu = e2ap_.generate_setup_request();
message_name = "E2 SETUP REQUEST";
break;
case e2_msg_type_t::E2_SUB_RESPONSE:
send_pdu = e2ap_.generate_subscription_response();
send_pdu = e2ap_.generate_subscription_response();
message_name = "E2 SUBSCRIPTION RESPONSE";
break;
case e2_msg_type_t::E2_INDICATION:
// TODO create E2 INDICATION generation
send_pdu = e2ap_.generate_indication();
message_name = "E2 INDICATION";
break;
case e2_msg_type_t::E2_RESET:
send_pdu = e2ap_.generate_reset_request();
@ -252,12 +253,20 @@ bool ric_client::handle_e2_unsuccessful_outcome(asn1::e2ap::unsuccessful_outcome
bool ric_client::handle_ric_subscription_request(ricsubscription_request_s ric_subscription_request)
{
auto send_sub_resp =
[this]() {
send_e2_msg(E2_SUB_RESPONSE);
};
ric_rece_task_queue.push(send_sub_resp);
// TODO handle RIC subscription request
auto send_sub_resp = [this]() { send_e2_msg(E2_SUB_RESPONSE); };
ric_rece_task_queue.push(send_sub_resp);
logger.info("Received subscription request from RIC ID: %i (instance id %i) to RAN Function ID: %i \n",
ric_subscription_request->ri_crequest_id->ric_requestor_id,
ric_subscription_request->ri_crequest_id->ric_instance_id,
ric_subscription_request->ra_nfunction_id->value);
e2ap_.process_subscription_request(ric_subscription_request);
auto send_ind = [this]() { for(uint16_t i = 0; i < 5; i++) {send_e2_msg(E2_INDICATION);
sleep(1);}};
ric_rece_task_queue.push(send_ind);
return true;
}

Loading…
Cancel
Save