Implement second revision of the events and metrics document.

master
faluco 4 years ago committed by faluco
parent 0e828aeb4b
commit a4605883f0

@ -30,16 +30,16 @@ public:
virtual ~event_logger_interface() = default; virtual ~event_logger_interface() = default;
/// Logs into the underlying log channel the RRC connected event. /// Logs into the underlying log channel the RRC connected event.
virtual void log_rrc_connected(unsigned cause) = 0; virtual void log_rrc_connected(uint32_t cc_idx, const std::string& asn1, unsigned error_code, uint16_t rnti) = 0;
/// Logs into the underlying log channel the RRC disconnected event. /// Logs into the underlying log channel the RRC disconnected event.
virtual void log_rrc_disconnect(unsigned reason) = 0; virtual void log_rrc_disconnect(uint32_t cc_idx, unsigned reason, unsigned rrc_cause, uint16_t rnti) = 0;
/// Logs into the underlying log channel the S1 context create event. /// Logs into the underlying log channel the S1 context create event.
virtual void log_s1_ctx_create(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) = 0; virtual void log_s1_ctx_create(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) = 0;
/// Logs into the underlying log channel the S1 context delete event. /// Logs into the underlying log channel the S1 context delete event.
virtual void log_s1_ctx_delete(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) = 0; virtual void log_s1_ctx_delete(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) = 0;
/// Logs into the underlying log channel when a sector has been started. /// Logs into the underlying log channel when a sector has been started.
virtual void log_sector_start(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) = 0; virtual void log_sector_start(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) = 0;
@ -47,6 +47,9 @@ public:
/// Logs into the underlying log channel when a sector has been stopped. /// Logs into the underlying log channel when a sector has been stopped.
virtual void log_sector_stop(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) = 0; virtual void log_sector_stop(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) = 0;
/// Logs into the underlying log channel a measurement report event..
virtual void log_measurement_report(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) = 0;
/// Logs into the underlying log channel a RLF event. /// Logs into the underlying log channel a RLF event.
virtual void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) = 0; virtual void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) = 0;
}; };

@ -22,25 +22,34 @@ namespace {
class null_event_logger : public event_logger_interface class null_event_logger : public event_logger_interface
{ {
public: public:
void log_rrc_connected(unsigned cause) override {} void log_rrc_connected(uint32_t cc_idx, const std::string& asn1, unsigned error_code, uint16_t rnti) override {}
void log_rrc_disconnect(unsigned reason) override {} void log_rrc_disconnect(uint32_t cc_idx, unsigned reason, unsigned rrc_cause, uint16_t rnti) override {}
void log_s1_ctx_create(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override {} void log_s1_ctx_create(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override {}
void log_s1_ctx_delete(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override {} void log_s1_ctx_delete(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override {}
void log_sector_start(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) override {} void log_sector_start(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) override {}
void log_sector_stop(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) override {} void log_sector_stop(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) override {}
void log_measurement_report(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override {}
void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override {} void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override {}
}; };
} // namespace } // namespace
/// Returns the current time in seconds with ms precision since UNIX epoch.
static double get_time_stamp()
{
auto tp = std::chrono::system_clock::now().time_since_epoch();
return std::chrono::duration_cast<std::chrono::milliseconds>(tp).count() * 1e-3;
}
namespace { namespace {
/// Common metrics to all events. /// Common metrics to all events.
DECLARE_METRIC("type", metric_type_tag, std::string, ""); DECLARE_METRIC("type", metric_type_tag, std::string, "");
DECLARE_METRIC("timestamp", metric_timestamp_tag, double, "");
DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, "");
DECLARE_METRIC("event_name", metric_event_name, std::string, ""); DECLARE_METRIC("event_name", metric_event_name, std::string, "");
DECLARE_METRIC("rnti", metric_rnti, uint16_t, ""); DECLARE_METRIC("rnti", metric_rnti, uint16_t, "");
DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, "");
/// ASN1 message metrics. /// ASN1 message metrics.
DECLARE_METRIC("asn1_length", metric_asn1_length, uint32_t, ""); DECLARE_METRIC("asn1_length", metric_asn1_length, uint32_t, "");
@ -48,24 +57,55 @@ DECLARE_METRIC("asn1_message", metric_asn1_message, std::string, "");
/// Context for sector start/stop. /// Context for sector start/stop.
DECLARE_METRIC("pci", metric_pci, uint32_t, ""); DECLARE_METRIC("pci", metric_pci, uint32_t, "");
DECLARE_METRIC("cell_identity", metric_cell_identity, uint32_t, ""); DECLARE_METRIC("cell_identity", metric_cell_identity, std::string, "");
DECLARE_METRIC_SET("event_data", mset_sector_event, metric_pci, metric_cell_identity, metric_sector_id); //:TODO: sib9_home_enb_name as string
using sector_event_t = srslog::build_context_type<metric_type_tag, metric_event_name, mset_sector_event>; DECLARE_METRIC_SET("event_data", mset_sector_event, metric_pci, metric_cell_identity);
using sector_event_t = srslog::
/// Context for RRC connect/disconnect. build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_sector_event>;
DECLARE_METRIC("cause", metric_cause, uint32_t, "");
DECLARE_METRIC_SET("event_data", mset_rrc_event, metric_cause); /// Context for RRC connect.
using rrc_event_t = srslog::build_context_type<metric_type_tag, metric_event_name, mset_rrc_event>; DECLARE_METRIC("error_code", metric_error_code, uint32_t, "");
DECLARE_METRIC_SET("event_data",
mset_rrc_connect_event,
metric_rnti,
metric_asn1_length,
metric_asn1_message,
metric_error_code);
using rrc_connect_event_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag,
metric_sector_id,
metric_event_name,
mset_rrc_connect_event>;
/// Context for RRC disconnect.
DECLARE_METRIC("reason", metric_reason, uint32_t, "");
DECLARE_METRIC("rrc_cause", metric_rrc_cause, uint32_t, "");
DECLARE_METRIC_SET("event_data", mset_rrc_disconnect_event, metric_reason, metric_rnti, metric_rrc_cause);
using rrc_disconnect_event_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag,
metric_sector_id,
metric_event_name,
mset_rrc_disconnect_event>;
/// Context for S1 context create/delete. /// Context for S1 context create/delete.
DECLARE_METRIC("mme_ue_s1ap_id", metric_ue_mme_id, uint32_t, ""); DECLARE_METRIC("mme_ue_s1ap_id", metric_ue_mme_id, uint32_t, "");
DECLARE_METRIC("enb_ue_s1ap_id", metric_ue_enb_id, uint32_t, ""); DECLARE_METRIC("enb_ue_s1ap_id", metric_ue_enb_id, uint32_t, "");
DECLARE_METRIC_SET("event_data", mset_s1apctx_event, metric_ue_mme_id, metric_ue_enb_id, metric_rnti); DECLARE_METRIC_SET("event_data", mset_s1apctx_event, metric_ue_mme_id, metric_ue_enb_id, metric_rnti);
using s1apctx_event_t = srslog::build_context_type<metric_type_tag, metric_event_name, mset_s1apctx_event>; using s1apctx_event_t = srslog::
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_s1apctx_event>;
/// Context for the RLC event. /// Context for the RLF event.
DECLARE_METRIC_SET("event_data", mset_rlfctx_event, metric_asn1_length, metric_asn1_message, metric_rnti); DECLARE_METRIC_SET("event_data", mset_rlfctx_event, metric_asn1_length, metric_asn1_message, metric_rnti);
using rlfctx_event_t = srslog::build_context_type<metric_type_tag, metric_event_name, mset_rlfctx_event>; using rlfctx_event_t = srslog::
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_rlfctx_event>;
/// Context for measurement report.
DECLARE_METRIC_SET("event_data", mset_meas_report_event, metric_asn1_length, metric_asn1_message, metric_rnti);
using meas_report_event_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag,
metric_sector_id,
metric_event_name,
mset_meas_report_event>;
/// Logs events into the configured log channel. /// Logs events into the configured log channel.
class logging_event_logger : public event_logger_interface class logging_event_logger : public event_logger_interface
@ -73,31 +113,43 @@ class logging_event_logger : public event_logger_interface
public: public:
explicit logging_event_logger(srslog::log_channel& c) : event_channel(c) {} explicit logging_event_logger(srslog::log_channel& c) : event_channel(c) {}
void log_rrc_connected(unsigned cause) override void log_rrc_connected(uint32_t cc_idx, const std::string& asn1, unsigned error_code, uint16_t rnti) override
{ {
rrc_event_t ctx(""); rrc_connect_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("rrc_connect"); ctx.write<metric_event_name>("rrc_connect");
ctx.get<mset_rrc_event>().write<metric_cause>(cause); ctx.get<mset_rrc_connect_event>().write<metric_rnti>(rnti);
ctx.get<mset_rrc_connect_event>().write<metric_asn1_length>(asn1.size());
ctx.get<mset_rrc_connect_event>().write<metric_asn1_message>(asn1);
ctx.get<mset_rrc_connect_event>().write<metric_error_code>(error_code);
event_channel(ctx); event_channel(ctx);
} }
void log_rrc_disconnect(unsigned reason) override void log_rrc_disconnect(uint32_t cc_idx, unsigned reason, unsigned rrc_cause, uint16_t rnti) override
{ {
rrc_event_t ctx(""); rrc_disconnect_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("rrc_disconnect"); ctx.write<metric_event_name>("rrc_disconnect");
ctx.get<mset_rrc_event>().write<metric_cause>(reason); ctx.get<mset_rrc_disconnect_event>().write<metric_reason>(reason);
ctx.get<mset_rrc_disconnect_event>().write<metric_rnti>(rnti);
ctx.get<mset_rrc_disconnect_event>().write<metric_rrc_cause>(rrc_cause);
event_channel(ctx); event_channel(ctx);
} }
void log_s1_ctx_create(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override void log_s1_ctx_create(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override
{ {
s1apctx_event_t ctx(""); s1apctx_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
//:TODO: not available
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("s1_context_create"); ctx.write<metric_event_name>("s1_context_create");
ctx.get<mset_s1apctx_event>().write<metric_ue_mme_id>(mme_id); ctx.get<mset_s1apctx_event>().write<metric_ue_mme_id>(mme_id);
ctx.get<mset_s1apctx_event>().write<metric_ue_enb_id>(enb_id); ctx.get<mset_s1apctx_event>().write<metric_ue_enb_id>(enb_id);
@ -105,11 +157,14 @@ public:
event_channel(ctx); event_channel(ctx);
} }
void log_s1_ctx_delete(uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override void log_s1_ctx_delete(uint32_t cc_idx, uint32_t mme_id, uint32_t enb_id, uint16_t rnti) override
{ {
s1apctx_event_t ctx(""); s1apctx_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
//:TODO: not available
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("s1_context_delete"); ctx.write<metric_event_name>("s1_context_delete");
ctx.get<mset_s1apctx_event>().write<metric_ue_mme_id>(mme_id); ctx.get<mset_s1apctx_event>().write<metric_ue_mme_id>(mme_id);
ctx.get<mset_s1apctx_event>().write<metric_ue_enb_id>(enb_id); ctx.get<mset_s1apctx_event>().write<metric_ue_enb_id>(enb_id);
@ -122,10 +177,11 @@ public:
sector_event_t ctx(""); sector_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("sector_start"); ctx.write<metric_event_name>("sector_start");
ctx.get<mset_sector_event>().write<metric_pci>(pci); ctx.get<mset_sector_event>().write<metric_pci>(pci);
ctx.get<mset_sector_event>().write<metric_cell_identity>(cell_id); ctx.get<mset_sector_event>().write<metric_cell_identity>(fmt::to_string(cell_id));
ctx.get<mset_sector_event>().write<metric_sector_id>(cc_idx);
event_channel(ctx); event_channel(ctx);
} }
@ -134,10 +190,25 @@ public:
sector_event_t ctx(""); sector_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("sector_stop"); ctx.write<metric_event_name>("sector_stop");
ctx.get<mset_sector_event>().write<metric_pci>(pci); ctx.get<mset_sector_event>().write<metric_pci>(pci);
ctx.get<mset_sector_event>().write<metric_cell_identity>(cell_id); ctx.get<mset_sector_event>().write<metric_cell_identity>(fmt::to_string(cell_id));
ctx.get<mset_sector_event>().write<metric_sector_id>(cc_idx); event_channel(ctx);
}
void log_measurement_report(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override
{
meas_report_event_t ctx("");
ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("measurement_report");
ctx.get<mset_meas_report_event>().write<metric_asn1_length>(asn1.size());
ctx.get<mset_meas_report_event>().write<metric_asn1_message>(asn1);
ctx.get<mset_meas_report_event>().write<metric_rnti>(rnti);
event_channel(ctx); event_channel(ctx);
} }
@ -146,6 +217,8 @@ public:
rlfctx_event_t ctx(""); rlfctx_event_t ctx("");
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_event_name>("radio_link_failure"); ctx.write<metric_event_name>("radio_link_failure");
ctx.get<mset_rlfctx_event>().write<metric_asn1_length>(asn1.size()); ctx.get<mset_rlfctx_event>().write<metric_asn1_length>(asn1.size());
ctx.get<mset_rlfctx_event>().write<metric_asn1_message>(asn1); ctx.get<mset_rlfctx_event>().write<metric_asn1_message>(asn1);

@ -36,7 +36,7 @@ public:
rrc_mobility(srsenb::rrc::ue* outer_ue); rrc_mobility(srsenb::rrc::ue* outer_ue);
bool fill_conn_recfg_no_ho_cmd(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_recfg); bool fill_conn_recfg_no_ho_cmd(asn1::rrc::rrc_conn_recfg_r8_ies_s* conn_recfg);
void handle_ue_meas_report(const asn1::rrc::meas_report_s& msg); void handle_ue_meas_report(const asn1::rrc::meas_report_s& msg, srslte::unique_byte_buffer_t pdu);
void handle_ho_preparation_complete(bool is_success, void handle_ho_preparation_complete(bool is_success,
const asn1::s1ap::ho_cmd_s& msg, const asn1::s1ap::ho_cmd_s& msg,
srslte::unique_byte_buffer_t container); srslte::unique_byte_buffer_t container);

@ -58,6 +58,12 @@ public:
void parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu); void parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu);
/// List of results for a connection request.
enum class conn_request_result_t { success, error_mme_not_connected, error_unknown_rnti };
/// Possible causes for the RRC to transition to the idle state.
enum class rrc_idle_transition_cause { release, timeout };
void handle_rrc_con_req(asn1::rrc::rrc_conn_request_s* msg); void handle_rrc_con_req(asn1::rrc::rrc_conn_request_s* msg);
void handle_rrc_con_setup_complete(asn1::rrc::rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu); void handle_rrc_con_setup_complete(asn1::rrc::rrc_conn_setup_complete_s* msg, srslte::unique_byte_buffer_t pdu);
void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_s* msg); void handle_rrc_con_reest_req(asn1::rrc::rrc_conn_reest_request_s* msg);
@ -92,6 +98,8 @@ public:
bool send_dl_dcch(const asn1::rrc::dl_dcch_msg_s* dl_dcch_msg, bool send_dl_dcch(const asn1::rrc::dl_dcch_msg_s* dl_dcch_msg,
srslte::unique_byte_buffer_t pdu = srslte::unique_byte_buffer_t()); srslte::unique_byte_buffer_t pdu = srslte::unique_byte_buffer_t());
void save_ul_message(srslte::unique_byte_buffer_t pdu) { last_ul_msg = std::move(pdu); }
uint16_t rnti = 0; uint16_t rnti = 0;
rrc* parent = nullptr; rrc* parent = nullptr;
@ -138,6 +146,9 @@ private:
bearer_cfg_handler bearer_list; bearer_cfg_handler bearer_list;
security_cfg_handler ue_security_cfg; security_cfg_handler ue_security_cfg;
/// Cached message of the last uplinl message.
srslte::unique_byte_buffer_t last_ul_msg;
// controllers // controllers
mac_controller mac_ctrl; mac_controller mac_ctrl;

@ -53,7 +53,7 @@ DECLARE_METRIC("ul_mcs", metric_ul_mcs, float, "");
DECLARE_METRIC("ul_bitrate", metric_ul_bitrate, float, ""); DECLARE_METRIC("ul_bitrate", metric_ul_bitrate, float, "");
DECLARE_METRIC("ul_bler", metric_ul_bler, float, ""); DECLARE_METRIC("ul_bler", metric_ul_bler, float, "");
DECLARE_METRIC("ul_phr", metric_ul_phr, float, ""); DECLARE_METRIC("ul_phr", metric_ul_phr, float, "");
DECLARE_METRIC("bsr", metric_bsr, int, ""); DECLARE_METRIC("ul_bsr", metric_bsr, uint32_t, "");
DECLARE_METRIC_LIST("bearer_list", mlist_bearers, std::vector<mset_bearer_container>); DECLARE_METRIC_LIST("bearer_list", mlist_bearers, std::vector<mset_bearer_container>);
DECLARE_METRIC_SET("ue_container", DECLARE_METRIC_SET("ue_container",
mset_ue_container, mset_ue_container,
@ -78,10 +78,11 @@ DECLARE_METRIC_SET("sector_container", mset_sector_container, metric_sector_id,
/// Metrics root object. /// Metrics root object.
DECLARE_METRIC("type", metric_type_tag, std::string, ""); DECLARE_METRIC("type", metric_type_tag, std::string, "");
DECLARE_METRIC("timestamp", metric_timestamp_tag, double, "");
DECLARE_METRIC_LIST("sector_list", mlist_sector, std::vector<mset_sector_container>); DECLARE_METRIC_LIST("sector_list", mlist_sector, std::vector<mset_sector_container>);
/// Metrics context. /// Metrics context.
using metric_context_t = srslog::build_context_type<metric_type_tag, mlist_sector>; using metric_context_t = srslog::build_context_type<metric_type_tag, metric_timestamp_tag, mlist_sector>;
} // namespace } // namespace
@ -132,9 +133,17 @@ static void fill_ue_metrics(mset_ue_container& ue, const enb_metrics_t& m, unsig
bearer_container.write<metric_ul_total_bytes>(rlc_bearer[drb.first].num_rx_sdu_bytes); bearer_container.write<metric_ul_total_bytes>(rlc_bearer[drb.first].num_rx_sdu_bytes);
bearer_container.write<metric_ul_latency>(rlc_bearer[drb.first].rx_latency_ms / 1e3); bearer_container.write<metric_ul_latency>(rlc_bearer[drb.first].rx_latency_ms / 1e3);
bearer_container.write<metric_ul_buffered_bytes>(rlc_bearer[drb.first].rx_buffered_bytes); bearer_container.write<metric_ul_buffered_bytes>(rlc_bearer[drb.first].rx_buffered_bytes);
//:TODO: fill in dl_buffered_bytes and dl_latency
} }
} }
/// Returns the current time in seconds with ms precision since UNIX epoch.
static double get_time_stamp()
{
auto tp = std::chrono::system_clock::now().time_since_epoch();
return std::chrono::duration_cast<std::chrono::milliseconds>(tp).count() * 1e-3;
}
/// Returns false if the input index is out of bounds in the metrics struct. /// Returns false if the input index is out of bounds in the metrics struct.
static bool has_valid_metric_ranges(const enb_metrics_t& m, unsigned index) static bool has_valid_metric_ranges(const enb_metrics_t& m, unsigned index)
{ {
@ -164,6 +173,7 @@ void metrics_json::set_metrics(const enb_metrics_t& m, const uint32_t period_use
// Fill root object. // Fill root object.
ctx.write<metric_type_tag>("metrics"); ctx.write<metric_type_tag>("metrics");
ctx.write<metric_timestamp_tag>(get_time_stamp());
auto& sector_list = ctx.get<mlist_sector>(); auto& sector_list = ctx.get<mlist_sector>();
sector_list.resize(m.stack.mac.cc_rach_counter.size()); sector_list.resize(m.stack.mac.cc_rach_counter.size());

@ -572,6 +572,7 @@ void rrc::parse_ul_ccch(uint16_t rnti, srslte::unique_byte_buffer_t pdu)
switch (ul_ccch_msg.msg.c1().type().value) { switch (ul_ccch_msg.msg.c1().type().value) {
case ul_ccch_msg_type_c::c1_c_::types::rrc_conn_request: case ul_ccch_msg_type_c::c1_c_::types::rrc_conn_request:
if (user_it != users.end()) { if (user_it != users.end()) {
user_it->second->save_ul_message(std::move(pdu));
user_it->second->handle_rrc_con_req(&ul_ccch_msg.msg.c1().rrc_conn_request()); user_it->second->handle_rrc_con_req(&ul_ccch_msg.msg.c1().rrc_conn_request());
} else { } else {
logger.error("Received ConnectionSetup for rnti=0x%x without context", rnti); logger.error("Received ConnectionSetup for rnti=0x%x without context", rnti);
@ -579,6 +580,7 @@ void rrc::parse_ul_ccch(uint16_t rnti, srslte::unique_byte_buffer_t pdu)
break; break;
case ul_ccch_msg_type_c::c1_c_::types::rrc_conn_reest_request: case ul_ccch_msg_type_c::c1_c_::types::rrc_conn_reest_request:
if (user_it != users.end()) { if (user_it != users.end()) {
user_it->second->save_ul_message(std::move(pdu));
user_it->second->handle_rrc_con_reest_req(&ul_ccch_msg.msg.c1().rrc_conn_reest_request()); user_it->second->handle_rrc_con_reest_req(&ul_ccch_msg.msg.c1().rrc_conn_reest_request());
} else { } else {
logger.error("Received ConnectionReestablishment for rnti=0x%x without context.", rnti); logger.error("Received ConnectionReestablishment for rnti=0x%x without context.", rnti);

@ -18,6 +18,7 @@
#include "srslte/asn1/rrc_utils.h" #include "srslte/asn1/rrc_utils.h"
#include "srslte/common/bcd_helpers.h" #include "srslte/common/bcd_helpers.h"
#include "srslte/common/common.h" #include "srslte/common/common.h"
#include "srslte/common/enb_events.h"
#include "srslte/common/int_helpers.h" #include "srslte/common/int_helpers.h"
#include "srslte/interfaces/enb_mac_interfaces.h" #include "srslte/interfaces/enb_mac_interfaces.h"
#include "srslte/interfaces/enb_pdcp_interfaces.h" #include "srslte/interfaces/enb_pdcp_interfaces.h"
@ -207,7 +208,7 @@ bool rrc::ue::rrc_mobility::fill_conn_recfg_no_ho_cmd(asn1::rrc::rrc_conn_recfg_
} }
//! Method called whenever the eNB receives a MeasReport from the UE. In normal situations, an HO procedure is started //! Method called whenever the eNB receives a MeasReport from the UE. In normal situations, an HO procedure is started
void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg) void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg, srslte::unique_byte_buffer_t pdu)
{ {
if (not is_in_state<idle_st>()) { if (not is_in_state<idle_st>()) {
Info("Received a MeasReport while UE is performing Handover. Ignoring..."); Info("Received a MeasReport while UE is performing Handover. Ignoring...");
@ -260,6 +261,11 @@ void rrc::ue::rrc_mobility::handle_ue_meas_report(const meas_report_s& msg)
break; break;
} }
} }
event_logger::get().log_measurement_report(
rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(pdu->msg, pdu->N_bytes),
rrc_ue->rnti);
} }
/** /**

@ -108,6 +108,10 @@ void rrc::ue::activity_timer_expired()
if (parent->s1ap->user_exists(rnti)) { if (parent->s1ap->user_exists(rnti)) {
parent->s1ap->user_release(rnti, asn1::s1ap::cause_radio_network_opts::user_inactivity); parent->s1ap->user_release(rnti, asn1::s1ap::cause_radio_network_opts::user_inactivity);
event_logger::get().log_rrc_disconnect(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
static_cast<unsigned>(rrc_idle_transition_cause::timeout),
0,
rnti);
} else { } else {
if (rnti != SRSLTE_MRNTI) { if (rnti != SRSLTE_MRNTI) {
parent->rem_user_thread(rnti); parent->rem_user_thread(rnti);
@ -224,7 +228,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
break; break;
case ul_dcch_msg_type_c::c1_c_::types::meas_report: case ul_dcch_msg_type_c::c1_c_::types::meas_report:
if (mobility_handler != nullptr) { if (mobility_handler != nullptr) {
mobility_handler->handle_ue_meas_report(ul_dcch_msg.msg.c1().meas_report()); mobility_handler->handle_ue_meas_report(ul_dcch_msg.msg.c1().meas_report(), std::move(original_pdu));
} else { } else {
parent->logger.warning("Received MeasReport but no mobility configuration is available"); parent->logger.warning("Received MeasReport but no mobility configuration is available");
} }
@ -251,6 +255,10 @@ void rrc::ue::handle_rrc_con_req(rrc_conn_request_s* msg)
{ {
if (not parent->s1ap->is_mme_connected()) { if (not parent->s1ap->is_mme_connected()) {
parent->logger.error("MME isn't connected. Sending Connection Reject"); parent->logger.error("MME isn't connected. Sending Connection Reject");
event_logger::get().log_rrc_connected(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(last_ul_msg->msg, last_ul_msg->N_bytes),
static_cast<unsigned>(conn_request_result_t::error_mme_not_connected),
rnti);
send_connection_reject(); send_connection_reject();
return; return;
} }
@ -325,7 +333,10 @@ void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srsl
state = RRC_STATE_WAIT_FOR_CON_RECONF_COMPLETE; state = RRC_STATE_WAIT_FOR_CON_RECONF_COMPLETE;
// Log event. // Log event.
event_logger::get().log_rrc_connected(static_cast<unsigned>(s1ap_cause.value)); event_logger::get().log_rrc_connected(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(last_ul_msg->msg, last_ul_msg->N_bytes),
static_cast<unsigned>(conn_request_result_t::success),
rnti);
// 2> if the UE has radio link failure or handover failure information available // 2> if the UE has radio link failure or handover failure information available
if (msg->crit_exts.type().value == c1_or_crit_ext_opts::c1 and if (msg->crit_exts.type().value == c1_or_crit_ext_opts::c1 and
@ -354,6 +365,10 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
{ {
if (not parent->s1ap->is_mme_connected()) { if (not parent->s1ap->is_mme_connected()) {
parent->logger.error("MME isn't connected. Sending Connection Reject"); parent->logger.error("MME isn't connected. Sending Connection Reject");
event_logger::get().log_rrc_connected(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(last_ul_msg->msg, last_ul_msg->N_bytes),
static_cast<unsigned>(conn_request_result_t::error_mme_not_connected),
rnti);
send_connection_reject(); send_connection_reject();
return; return;
} }
@ -415,6 +430,10 @@ void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
set_activity_timeout(UE_INACTIVITY_TIMEOUT); set_activity_timeout(UE_INACTIVITY_TIMEOUT);
} else { } else {
parent->logger.error("Received ConnectionReestablishment for rnti=0x%x without context", old_rnti); parent->logger.error("Received ConnectionReestablishment for rnti=0x%x without context", old_rnti);
event_logger::get().log_rrc_connected(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(last_ul_msg->msg, last_ul_msg->N_bytes),
static_cast<unsigned>(conn_request_result_t::error_unknown_rnti),
rnti);
send_connection_reest_rej(); send_connection_reest_rej();
} }
} else { } else {
@ -485,6 +504,11 @@ void rrc::ue::handle_rrc_con_reest_complete(rrc_conn_reest_complete_s* msg, srsl
state = RRC_STATE_REESTABLISHMENT_COMPLETE; state = RRC_STATE_REESTABLISHMENT_COMPLETE;
event_logger::get().log_rrc_connected(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
asn1::octstring_to_string(last_ul_msg->msg, last_ul_msg->N_bytes),
0,
rnti);
// 2> if the UE has radio link failure or handover failure information available // 2> if the UE has radio link failure or handover failure information available
if (msg->crit_exts.type().value == rrc_conn_reest_complete_s::crit_exts_c_::types_opts::rrc_conn_reest_complete_r8) { if (msg->crit_exts.type().value == rrc_conn_reest_complete_s::crit_exts_c_::types_opts::rrc_conn_reest_complete_r8) {
const auto& complete_r8 = msg->crit_exts.rrc_conn_reest_complete_r8(); const auto& complete_r8 = msg->crit_exts.rrc_conn_reest_complete_r8();
@ -737,7 +761,10 @@ void rrc::ue::send_connection_release()
send_dl_dcch(&dl_dcch_msg); send_dl_dcch(&dl_dcch_msg);
// Log rrc release event. // Log rrc release event.
event_logger::get().log_rrc_disconnect(static_cast<unsigned>(rel_ies.release_cause)); event_logger::get().log_rrc_disconnect(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
static_cast<unsigned>(rrc_idle_transition_cause::release),
static_cast<unsigned>(rel_ies.release_cause),
rnti);
} }
/* /*

@ -1185,7 +1185,8 @@ bool s1ap::ue::send_uectxtreleasecomplete()
container.mme_ue_s1ap_id.value = ctxt.mme_ue_s1ap_id; container.mme_ue_s1ap_id.value = ctxt.mme_ue_s1ap_id;
// Log event. // Log event.
event_logger::get().log_s1_ctx_delete(ctxt.mme_ue_s1ap_id, ctxt.enb_ue_s1ap_id, ctxt.rnti); //:TODO: cc_idx not available
event_logger::get().log_s1_ctx_delete(0, ctxt.mme_ue_s1ap_id, ctxt.enb_ue_s1ap_id, ctxt.rnti);
return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "UEContextReleaseComplete"); return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "UEContextReleaseComplete");
} }
@ -1219,7 +1220,8 @@ bool s1ap::ue::send_initial_ctxt_setup_response(const asn1::s1ap::init_context_s
} }
// Log event. // Log event.
event_logger::get().log_s1_ctx_create(ctxt.mme_ue_s1ap_id, ctxt.enb_ue_s1ap_id, ctxt.rnti); //:TODO: cc_idx not available
event_logger::get().log_s1_ctx_create(0, ctxt.mme_ue_s1ap_id, ctxt.enb_ue_s1ap_id, ctxt.rnti);
return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "InitialContextSetupResponse"); return s1ap_ptr->sctp_send_s1ap_pdu(tx_pdu, ctxt.rnti, "InitialContextSetupResponse");
} }

Loading…
Cancel
Save