Include a ASN1 json representation for RRC enb events.

master
faluco 3 years ago committed by faluco
parent 00653bdd46
commit 8a3586dfbf

@ -31,7 +31,8 @@ public:
/// Logs into the underlying log channel any RRC event.
virtual void log_rrc_event(uint32_t enb_cc_idx,
const std::string& asn1,
const std::string& asn1_oct_str,
const std::string& asn1_txt_str,
unsigned type,
unsigned additional_info,
uint16_t rnti) = 0;

@ -23,7 +23,8 @@ class null_event_logger : public event_logger_interface
{
public:
void log_rrc_event(uint32_t enb_cc_idx,
const std::string& asn1,
const std::string& asn1_oct_str,
const std::string& asn1_txt_str,
unsigned type,
unsigned additional_info,
uint16_t rnti) override
@ -58,6 +59,7 @@ DECLARE_METRIC("rnti", metric_rnti, uint16_t, "");
/// ASN1 message metrics.
DECLARE_METRIC("asn1_length", metric_asn1_length, uint32_t, "");
DECLARE_METRIC("asn1_message", metric_asn1_message, std::string, "");
DECLARE_METRIC("asn1_message_txt", metric_asn1_message_txt, std::string, ""); //: TODO:
/// Context for sector start/stop.
DECLARE_METRIC("pci", metric_pci, uint32_t, "");
@ -75,6 +77,7 @@ DECLARE_METRIC_SET("event_data",
metric_rnti,
metric_asn1_length,
metric_asn1_message,
metric_asn1_message_txt,
metric_asn1_type,
metric_additional);
using rrc_event_t = srslog::
@ -107,7 +110,8 @@ public:
explicit logging_event_logger(srslog::log_channel& c) : event_channel(c) {}
void log_rrc_event(uint32_t enb_cc_idx,
const std::string& asn1,
const std::string& asn1_oct_str,
const std::string& asn1_txt_str,
unsigned type,
unsigned additional_info,
uint16_t rnti) override
@ -119,8 +123,9 @@ public:
ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_event_name>("rrc_log");
ctx.get<mset_rrc_event>().write<metric_rnti>(rnti);
ctx.get<mset_rrc_event>().write<metric_asn1_length>(asn1.size());
ctx.get<mset_rrc_event>().write<metric_asn1_message>(asn1);
ctx.get<mset_rrc_event>().write<metric_asn1_length>(asn1_oct_str.size());
ctx.get<mset_rrc_event>().write<metric_asn1_message>(asn1_oct_str);
ctx.get<mset_rrc_event>().write<metric_asn1_message_txt>(asn1_txt_str);
ctx.get<mset_rrc_event>().write<metric_asn1_type>(type);
ctx.get<mset_rrc_event>().write<metric_additional>(additional_info);
event_channel(ctx);

@ -511,7 +511,7 @@ void rrc::ue::rrc_mobility::fill_mobility_reconf_common(asn1::rrc::dl_dcch_msg_s
mob_info.rr_cfg_common.p_max = rrc_enb->cfg.sib1.p_max;
mob_info.rr_cfg_common.ul_cp_len = target_cell.sib2.rr_cfg_common.ul_cp_len;
mob_info.carrier_freq_present = false; // same frequency handover for now
mob_info.carrier_freq_present = false; // same frequency handover for now
asn1::number_to_enum(mob_info.carrier_bw.dl_bw, target_cell.mib.dl_bw.to_number());
if (target_cell.cell_cfg.dl_earfcn != src_dl_earfcn) {
mob_info.carrier_freq_present = true;
@ -700,8 +700,11 @@ void rrc::ue::rrc_mobility::s1_source_ho_st::handle_ho_cmd(wait_ho_cmd& s, const
}
// Log rrc release event.
asn1::json_writer json_writer;
dl_dcch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(rrc_ue->ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reconf),
static_cast<unsigned>(procedure_result_code::none),
rrc_ue->rnti);
@ -836,11 +839,11 @@ void rrc::ue::rrc_mobility::handle_ho_requested(idle_st& s, const ho_req_rx_ev&
if (ho_req.transparent_container->erab_info_list_present) {
const auto& lst = ho_req.transparent_container->erab_info_list;
const auto* it = std::find_if(
lst.begin(),
lst.end(),
[&erab](const asn1::s1ap::protocol_ie_single_container_s<asn1::s1ap::erab_info_list_ies_o>& fwd_erab) {
lst.begin(),
lst.end(),
[&erab](const asn1::s1ap::protocol_ie_single_container_s<asn1::s1ap::erab_info_list_ies_o>& fwd_erab) {
return fwd_erab.value.erab_info_list_item().erab_id == erab.second.id;
});
});
if (it == lst.end()) {
continue;
}
@ -1019,7 +1022,7 @@ void rrc::ue::rrc_mobility::handle_status_transfer(s1_target_ho_st& s, const sta
const auto& drbs = rrc_ue->bearer_list.get_established_drbs();
lte_drb drbid = lte_lcid_to_drb(erab_it->second.lcid);
auto drb_it = std::find_if(
drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return (lte_drb)drb.drb_id == drbid; });
drbs.begin(), drbs.end(), [drbid](const drb_to_add_mod_s& drb) { return (lte_drb)drb.drb_id == drbid; });
if (drb_it == drbs.end()) {
logger.warning("The DRB id=%d does not exist", drbid);
}

@ -412,8 +412,11 @@ std::string rrc::ue::to_string(const activity_timeout_type_t& type)
void rrc::ue::handle_rrc_con_req(rrc_conn_request_s* msg)
{
// Log event.
asn1::json_writer json_writer;
msg->to_json(json_writer);
event_logger::get().log_rrc_event(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),
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_request),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -477,8 +480,11 @@ void rrc::ue::send_connection_setup()
send_dl_ccch(&dl_ccch_msg, &octet_str);
// Log event.
asn1::json_writer json_writer;
dl_ccch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_setup),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -489,8 +495,11 @@ void rrc::ue::send_connection_setup()
void rrc::ue::handle_rrc_con_setup_complete(rrc_conn_setup_complete_s* msg, srsran::unique_byte_buffer_t pdu)
{
// Log event.
asn1::json_writer json_writer;
msg->to_json(json_writer);
event_logger::get().log_rrc_event(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),
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_setup_complete),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -542,8 +551,11 @@ void rrc::ue::send_connection_reject(procedure_result_code cause)
send_dl_ccch(&dl_ccch_msg, &octet_str);
// Log event.
asn1::json_writer json_writer;
dl_ccch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reject),
static_cast<unsigned>(cause),
rnti);
@ -555,8 +567,11 @@ void rrc::ue::send_connection_reject(procedure_result_code cause)
void rrc::ue::handle_rrc_con_reest_req(rrc_conn_reest_request_s* msg)
{
// Log event.
asn1::json_writer json_writer;
msg->to_json(json_writer);
event_logger::get().log_rrc_event(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),
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reest_req),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -689,8 +704,11 @@ void rrc::ue::send_connection_reest(uint8_t ncc)
apply_rr_cfg_ded_diff(current_ue_cfg.rr_cfg, rr_cfg);
// Log event.
asn1::json_writer json_writer;
dl_ccch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reest),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -699,8 +717,11 @@ void rrc::ue::send_connection_reest(uint8_t ncc)
void rrc::ue::handle_rrc_con_reest_complete(rrc_conn_reest_complete_s* msg, srsran::unique_byte_buffer_t pdu)
{
// Log event.
asn1::json_writer json_writer;
msg->to_json(json_writer);
event_logger::get().log_rrc_event(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),
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reest_complete),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -740,8 +761,11 @@ void rrc::ue::send_connection_reest_rej(procedure_result_code cause)
send_dl_ccch(&dl_ccch_msg, &octet_str);
// Log event.
asn1::json_writer json_writer;
dl_ccch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reest_reject),
static_cast<unsigned>(cause),
rnti);
@ -816,8 +840,11 @@ void rrc::ue::send_connection_reconf(srsran::unique_byte_buffer_t pdu,
send_dl_dcch(&dl_dcch_msg, std::move(pdu), &octet_str);
// Log event.
asn1::json_writer json_writer;
dl_dcch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reconf),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -837,8 +864,11 @@ void rrc::ue::handle_rrc_reconf_complete(rrc_conn_recfg_complete_s* msg, srsran:
}
// Log event.
asn1::json_writer json_writer;
msg->to_json(json_writer);
event_logger::get().log_rrc_event(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),
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_reconf_complete),
static_cast<unsigned>(procedure_result_code::none),
rnti);
@ -1019,8 +1049,11 @@ void rrc::ue::send_connection_release()
send_dl_dcch(&dl_dcch_msg, nullptr, &octet_str);
// Log rrc release event.
asn1::json_writer json_writer;
dl_dcch_msg.to_json(json_writer);
event_logger::get().log_rrc_event(ue_cell_list.get_ue_cc_idx(UE_PCELL_CC_IDX)->cell_common->enb_cc_idx,
octet_str,
json_writer.to_string(),
static_cast<unsigned>(rrc_event_type::con_release),
static_cast<unsigned>(con_release_result),
rnti);

Loading…
Cancel
Save