e2sm_kpm: decode report_period

master
Piotr Gawlowicz 2 years ago committed by Justin Tallon
parent 87d624b333
commit 45cbf49c1a

@ -11,6 +11,7 @@
* *
*/ */
#include "e2sm.h" #include "e2sm.h"
#include "srsran/asn1/e2ap.h"
#include "srsran/asn1/e2sm.h" #include "srsran/asn1/e2sm.h"
#include "srsran/asn1/e2sm_kpm_v2.h" #include "srsran/asn1/e2sm_kpm_v2.h"
#include "srsran/srsran.h" #include "srsran/srsran.h"
@ -18,6 +19,10 @@
#ifndef RIC_E2SM_KPM_H #ifndef RIC_E2SM_KPM_H
#define RIC_E2SM_KPM_H #define RIC_E2SM_KPM_H
struct E2SM_KPM_RIC_event_definition {
uint64_t report_period;
};
struct E2SM_KPM_RIC_ind_header { struct E2SM_KPM_RIC_ind_header {
uint32_t collet_start_time; uint32_t collet_start_time;
std::string file_formatversion; std::string file_formatversion;
@ -45,7 +50,8 @@ public:
~e2sm_kpm() = default; ~e2sm_kpm() = default;
virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf); virtual bool generate_ran_function_description(RANfunction_description& desc, srsran::unique_byte_buffer_t& buf);
int process_ric_action_definition(); bool process_subscription_request(asn1::e2ap::ricsubscription_request_s subscription_request,
E2SM_KPM_RIC_event_definition& event_def);
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);

@ -44,7 +44,7 @@ private:
uint16_t ra_nfunction_id; uint16_t ra_nfunction_id;
uint16_t ri_caction_id; uint16_t ri_caction_id;
uint32_t reporting_period; // ms uint32_t reporting_period = 0; // ms
srsran::unique_timer reporting_timer; // for RIC indication reporting srsran::unique_timer reporting_timer; // for RIC indication reporting
}; };

@ -83,9 +83,20 @@ bool e2sm_kpm::generate_ran_function_description(RANfunction_description& desc,
return true; return true;
} }
int e2sm_kpm::process_ric_action_definition() bool e2sm_kpm::process_subscription_request(asn1::e2ap::ricsubscription_request_s subscription_request,
E2SM_KPM_RIC_event_definition& event_def)
{ {
return 0; using namespace asn1::e2sm_kpm;
e2_sm_kpm_event_trigger_definition_s trigger_def;
asn1::cbit_ref bref(subscription_request->ricsubscription_details->ric_event_trigger_definition.data(),
subscription_request->ricsubscription_details->ric_event_trigger_definition.size());
if (trigger_def.unpack(bref) != asn1::SRSASN_SUCCESS) {
return false;
}
event_def.report_period = trigger_def.event_definition_formats.event_definition_format1().report_period;
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)

@ -22,11 +22,20 @@ ric_client::ric_subscription::ric_subscription(ric_client* ric_cli
ric_instance_id(ric_subscription_request->ri_crequest_id->ric_instance_id), ric_instance_id(ric_subscription_request->ri_crequest_id->ric_instance_id),
ra_nfunction_id(ric_subscription_request->ra_nfunction_id->value) ra_nfunction_id(ric_subscription_request->ra_nfunction_id->value)
{ {
reporting_period = 1000;
reporting_timer = parent->task_sched.get_unique_timer(); reporting_timer = parent->task_sched.get_unique_timer();
// TODO: process request to know what to report
parent->e2ap_.process_subscription_request(ric_subscription_request); parent->e2ap_.process_subscription_request(ric_subscription_request);
RANfunction_description ran_func_desc;
if (!parent->e2ap_.get_func_desc(ra_nfunction_id, ran_func_desc)) {
return;
}
E2SM_KPM_RIC_event_definition event_def;
e2sm_kpm* sm_kpm_ptr = dynamic_cast<e2sm_kpm*>(ran_func_desc.sm_ptr);
if (sm_kpm_ptr->process_subscription_request(ric_subscription_request, event_def)) {
reporting_period = event_def.report_period;
}
} }
void ric_client::ric_subscription::start_ric_indication_reporting() void ric_client::ric_subscription::start_ric_indication_reporting()
@ -43,10 +52,12 @@ void ric_client::ric_subscription::start_ric_indication_reporting()
e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(ric_subscription_reponse); e2_ap_pdu_c send_pdu = parent->e2ap_.generate_subscription_response(ric_subscription_reponse);
parent->queue_send_e2ap_pdu(send_pdu); parent->queue_send_e2ap_pdu(send_pdu);
if (reporting_period) {
printf("Start sending RIC indication msgs every %i ms\n", reporting_period); printf("Start sending RIC indication msgs every %i ms\n", reporting_period);
parent->logger.debug("Start sending RIC indication msgs every %i ms", reporting_period); parent->logger.debug("Start sending RIC indication msgs every %i ms", reporting_period);
reporting_timer.set(reporting_period, [this](uint32_t tid) { send_ric_indication(); }); reporting_timer.set(reporting_period, [this](uint32_t tid) { send_ric_indication(); });
reporting_timer.run(); reporting_timer.run();
}
} }
void ric_client::ric_subscription::stop_ric_indication_reporting() void ric_client::ric_subscription::stop_ric_indication_reporting()

Loading…
Cancel
Save