Add new field for the PCI in the enb JSON report file.

master
faluco 3 years ago committed by faluco
parent d168536bc4
commit d122d0c69b

@ -13,6 +13,8 @@
#include "srsran/common/enb_events.h" #include "srsran/common/enb_events.h"
#include "srsran/srslog/context.h" #include "srsran/srslog/context.h"
#include "srsran/srslog/log_channel.h" #include "srsran/srslog/log_channel.h"
#include <mutex>
#include <unordered_map>
using namespace srsenb; using namespace srsenb;
@ -82,8 +84,12 @@ DECLARE_METRIC("pci", metric_pci, uint32_t, "");
DECLARE_METRIC("cell_identity", metric_cell_identity, std::string, ""); DECLARE_METRIC("cell_identity", metric_cell_identity, std::string, "");
DECLARE_METRIC("sib9_home_enb_name", metric_sib9_home_enb_name, std::string, ""); DECLARE_METRIC("sib9_home_enb_name", metric_sib9_home_enb_name, std::string, "");
DECLARE_METRIC_SET("event_data", mset_sector_event, metric_pci, metric_cell_identity, metric_sib9_home_enb_name); DECLARE_METRIC_SET("event_data", mset_sector_event, metric_pci, metric_cell_identity, metric_sib9_home_enb_name);
using sector_event_t = srslog:: using sector_event_t = srslog::build_context_type<metric_type_tag,
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_sector_event>; metric_timestamp_tag,
metric_sector_id,
metric_cell_id,
metric_event_name,
mset_sector_event>;
/// Context for a RRC event. /// Context for a RRC event.
DECLARE_METRIC("asn1_type", metric_asn1_type, uint32_t, ""); DECLARE_METRIC("asn1_type", metric_asn1_type, uint32_t, "");
@ -95,21 +101,30 @@ DECLARE_METRIC_SET("event_data",
metric_asn1_message, metric_asn1_message,
metric_asn1_type, metric_asn1_type,
metric_additional); metric_additional);
using rrc_event_t = srslog:: using rrc_event_t = srslog::build_context_type<metric_type_tag,
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_rrc_event>; metric_timestamp_tag,
metric_sector_id,
metric_cell_id,
metric_event_name,
mset_rrc_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:: using s1apctx_event_t = srslog::build_context_type<metric_type_tag,
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_s1apctx_event>; metric_timestamp_tag,
metric_sector_id,
metric_cell_id,
metric_event_name,
mset_s1apctx_event>;
/// Context for the RLF report event. /// Context for the RLF report event.
DECLARE_METRIC_SET("event_data", mset_rlf_report_event, metric_asn1_length, metric_asn1_message, metric_rnti); DECLARE_METRIC_SET("event_data", mset_rlf_report_event, metric_asn1_length, metric_asn1_message, metric_rnti);
using rlf_report_event_t = srslog::build_context_type<metric_type_tag, using rlf_report_event_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag, metric_timestamp_tag,
metric_sector_id, metric_sector_id,
metric_cell_id,
metric_event_name, metric_event_name,
mset_rlf_report_event>; mset_rlf_report_event>;
@ -118,6 +133,7 @@ DECLARE_METRIC_SET("event_data", mset_meas_report_event, metric_asn1_length, met
using meas_report_event_t = srslog::build_context_type<metric_type_tag, using meas_report_event_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag, metric_timestamp_tag,
metric_sector_id, metric_sector_id,
metric_cell_id,
metric_event_name, metric_event_name,
mset_meas_report_event>; mset_meas_report_event>;
@ -131,8 +147,12 @@ DECLARE_METRIC_SET("event_data",
metric_target_pci, metric_target_pci,
metric_target_earfcn, metric_target_earfcn,
metric_new_ue_rnti); metric_new_ue_rnti);
using ho_cmd_t = srslog:: using ho_cmd_t = srslog::build_context_type<metric_type_tag,
build_context_type<metric_type_tag, metric_timestamp_tag, metric_sector_id, metric_event_name, mset_ho_cmd_event>; metric_timestamp_tag,
metric_sector_id,
metric_cell_id,
metric_event_name,
mset_ho_cmd_event>;
/// Context for the connection resume event. /// Context for the connection resume event.
DECLARE_METRIC("resume_rnti", metric_resume_rnti, uint32_t, ""); DECLARE_METRIC("resume_rnti", metric_resume_rnti, uint32_t, "");
@ -140,6 +160,7 @@ DECLARE_METRIC_SET("event_data", mset_conn_resume_event, metric_rnti, metric_res
using conn_resume_t = srslog::build_context_type<metric_type_tag, using conn_resume_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag, metric_timestamp_tag,
metric_sector_id, metric_sector_id,
metric_cell_id,
metric_event_name, metric_event_name,
mset_conn_resume_event>; mset_conn_resume_event>;
@ -149,6 +170,7 @@ DECLARE_METRIC_SET("event_data", mset_rlf_detected_event, metric_rnti, metric_rl
using rlf_detected_t = srslog::build_context_type<metric_type_tag, using rlf_detected_t = srslog::build_context_type<metric_type_tag,
metric_timestamp_tag, metric_timestamp_tag,
metric_sector_id, metric_sector_id,
metric_cell_id,
metric_event_name, metric_event_name,
mset_rlf_detected_event>; mset_rlf_detected_event>;
@ -174,6 +196,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("rrc_log"); ctx.write<metric_event_name>("rrc_log");
ctx.get<mset_rrc_event>().write<metric_rnti>(rnti); 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_length>(asn1.size());
@ -190,6 +213,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_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);
@ -204,6 +228,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_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);
@ -213,11 +238,14 @@ public:
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
{ {
register_pci(cc_idx, pci);
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_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx); ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_cell_id>(pci);
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>(fmt::to_string(cell_id)); ctx.get<mset_sector_event>().write<metric_cell_identity>(fmt::to_string(cell_id));
@ -232,6 +260,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(cc_idx); ctx.write<metric_sector_id>(cc_idx);
ctx.write<metric_cell_id>(get_pci(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>(fmt::to_string(cell_id)); ctx.get<mset_sector_event>().write<metric_cell_identity>(fmt::to_string(cell_id));
@ -251,6 +280,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("measurement_report"); 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_length>(asn1.size());
ctx.get<mset_meas_report_event>().write<metric_asn1_message>(asn1); ctx.get<mset_meas_report_event>().write<metric_asn1_message>(asn1);
@ -270,6 +300,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("rlf_report"); ctx.write<metric_event_name>("rlf_report");
ctx.get<mset_rlf_report_event>().write<metric_asn1_length>(asn1.size()); ctx.get<mset_rlf_report_event>().write<metric_asn1_length>(asn1.size());
ctx.get<mset_rlf_report_event>().write<metric_asn1_message>(asn1); ctx.get<mset_rlf_report_event>().write<metric_asn1_message>(asn1);
@ -284,6 +315,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("rlf_detected"); ctx.write<metric_event_name>("rlf_detected");
ctx.get<mset_rlf_detected_event>().write<metric_rnti>(rnti); ctx.get<mset_rlf_detected_event>().write<metric_rnti>(rnti);
ctx.get<mset_rlf_detected_event>().write<metric_rlf_type>(type); ctx.get<mset_rlf_detected_event>().write<metric_rlf_type>(type);
@ -301,6 +333,7 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("ho_command"); ctx.write<metric_event_name>("ho_command");
ctx.get<mset_ho_cmd_event>().write<metric_rnti>(rnti); ctx.get<mset_ho_cmd_event>().write<metric_rnti>(rnti);
ctx.get<mset_ho_cmd_event>().write<metric_target_pci>(target_pci); ctx.get<mset_ho_cmd_event>().write<metric_target_pci>(target_pci);
@ -316,15 +349,35 @@ public:
ctx.write<metric_type_tag>("event"); ctx.write<metric_type_tag>("event");
ctx.write<metric_timestamp_tag>(get_time_stamp()); ctx.write<metric_timestamp_tag>(get_time_stamp());
ctx.write<metric_sector_id>(enb_cc_idx); ctx.write<metric_sector_id>(enb_cc_idx);
ctx.write<metric_cell_id>(get_pci(enb_cc_idx));
ctx.write<metric_event_name>("connection_resume"); ctx.write<metric_event_name>("connection_resume");
ctx.get<mset_conn_resume_event>().write<metric_rnti>(rnti); ctx.get<mset_conn_resume_event>().write<metric_rnti>(rnti);
ctx.get<mset_conn_resume_event>().write<metric_resume_rnti>(resume_rnti); ctx.get<mset_conn_resume_event>().write<metric_resume_rnti>(resume_rnti);
event_channel(ctx); event_channel(ctx);
} }
private:
/// Associates the corresponding cc_idx with its PCI.
void register_pci(uint32_t cc_idx, uint32_t pci)
{
std::lock_guard<std::mutex> lock(m);
cc_idx_to_pci_map[cc_idx] = pci;
}
/// Returns the PCI value associated to specified cc_idx, otherwise returns an invalid PCI value if not previous
/// association has been set.
uint32_t get_pci(uint32_t cc_idx) const
{
std::lock_guard<std::mutex> lock(m);
auto it = cc_idx_to_pci_map.find(cc_idx);
return (it != cc_idx_to_pci_map.cend()) ? it->second : 999;
}
private: private:
srslog::log_channel& event_channel; srslog::log_channel& event_channel;
event_logger::asn1_output_format asn1_format; event_logger::asn1_output_format asn1_format;
std::unordered_map<uint32_t, uint32_t> cc_idx_to_pci_map;
mutable std::mutex m;
}; };
} // namespace } // namespace

Loading…
Cancel
Save