Report the RLF event to the JSON event file in the enb.

This commit is contained in:
faluco 2021-02-02 18:09:23 +01:00 committed by faluco
parent a827350f7c
commit 96c07a69c0
4 changed files with 37 additions and 11 deletions

View File

@ -41,11 +41,14 @@ public:
/// 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;
/// Logs into the underlying log channel the 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;
/// Logs into the underlying log channel the 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;
/// 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;
};
/// Singleton class to provide global access to the event_logger_interface interface.

View File

@ -28,6 +28,7 @@ public:
void log_s1_ctx_delete(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_stop(uint32_t cc_idx, uint32_t pci, uint32_t cell_id) override {}
void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override {}
};
} // namespace
@ -38,10 +39,16 @@ namespace {
DECLARE_METRIC("type", metric_type_tag, std::string, "");
DECLARE_METRIC("event_name", metric_event_name, std::string, "");
DECLARE_METRIC("rnti", metric_rnti, uint16_t, "");
DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, "");
/// ASN1 message metrics.
DECLARE_METRIC("asn1_length", metric_asn1_length, uint32_t, "");
DECLARE_METRIC("asn1_message", metric_asn1_message, std::string, "");
/// Context for sector start/stop.
DECLARE_METRIC("pci", metric_pci, uint32_t, "");
DECLARE_METRIC("cell_identity", metric_cell_identity, uint32_t, "");
DECLARE_METRIC("sector_id", metric_sector_id, uint32_t, "");
DECLARE_METRIC_SET("event_data", mset_sector_event, metric_pci, metric_cell_identity, metric_sector_id);
using sector_event_t = srslog::build_context_type<metric_type_tag, metric_event_name, mset_sector_event>;
@ -53,10 +60,13 @@ using rrc_event_t = srslog::build_context_type<metric_type_tag, metric_event_nam
/// Context for S1 context create/delete.
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("rnti", metric_rnti, uint16_t, "");
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>;
/// Context for the RLC event.
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>;
/// Logs events into the configured log channel.
class logging_event_logger : public event_logger_interface
{
@ -131,6 +141,18 @@ public:
event_channel(ctx);
}
void log_rlf(uint32_t cc_idx, const std::string& asn1, uint16_t rnti) override
{
rlfctx_event_t ctx("");
ctx.write<metric_type_tag>("event");
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_message>(asn1);
ctx.get<mset_rlfctx_event>().write<metric_rnti>(rnti);
event_channel(ctx);
}
private:
srslog::log_channel& event_channel;
};

View File

@ -66,7 +66,7 @@ public:
bool handle_ue_cap_info(asn1::rrc::ue_cap_info_s* msg);
void handle_ue_init_ctxt_setup_req(const asn1::s1ap::init_context_setup_request_s& msg);
bool handle_ue_ctxt_mod_req(const asn1::s1ap::ue_context_mod_request_s& msg);
void handle_ue_info_resp(const asn1::rrc::ue_info_resp_r9_s& msg);
void handle_ue_info_resp(const asn1::rrc::ue_info_resp_r9_s& msg, srslte::unique_byte_buffer_t pdu);
void set_bitrates(const asn1::s1ap::ue_aggregate_maximum_bitrate_s& rates);

View File

@ -167,8 +167,8 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
parent->log_rrc_message(
srsenb::to_string((rb_id_t)lcid), Rx, pdu.get(), ul_dcch_msg, ul_dcch_msg.msg.c1().type().to_string());
// reuse PDU
pdu->clear(); // TODO: name collision with byte_buffer reset
srslte::unique_byte_buffer_t original_pdu = std::move(pdu);
pdu = srslte::allocate_unique_buffer(*pool);
transaction_id = 0;
@ -228,7 +228,7 @@ void rrc::ue::parse_ul_dcch(uint32_t lcid, srslte::unique_byte_buffer_t pdu)
}
break;
case ul_dcch_msg_type_c::c1_c_::types::ue_info_resp_r9:
handle_ue_info_resp(ul_dcch_msg.msg.c1().ue_info_resp_r9());
handle_ue_info_resp(ul_dcch_msg.msg.c1().ue_info_resp_r9(), std::move(original_pdu));
break;
default:
parent->logger.error("Msg: %s not supported", ul_dcch_msg.msg.c1().type().to_string().c_str());
@ -607,11 +607,12 @@ void rrc::ue::send_ue_info_req()
send_dl_dcch(&msg);
}
void rrc::ue::handle_ue_info_resp(const asn1::rrc::ue_info_resp_r9_s& msg)
void rrc::ue::handle_ue_info_resp(const asn1::rrc::ue_info_resp_r9_s& msg, srslte::unique_byte_buffer_t pdu)
{
auto& resp_r9 = msg.crit_exts.c1().ue_info_resp_r9();
if (resp_r9.rlf_report_r9_present) {
// TODO: Handle RLF-Report
std::string msg_str = asn1::octstring_to_string(pdu->msg, pdu->N_bytes);
event_logger::get().log_rlf(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx, msg_str, rnti);
}
if (resp_r9.rach_report_r9_present) {
// TODO: Handle RACH-Report