rrc_nr: add log_rrc_message helper to UE object to print RNTI

master
Andre Puschmann 3 years ago
parent c913db5ade
commit 79c443fd60

@ -101,6 +101,21 @@ public:
int set_aggregate_max_bitrate(uint16_t rnti, const asn1::ngap_nr::ue_aggregate_maximum_bit_rate_s& rates);
int allocate_lcid(uint16_t rnti);
// logging
typedef enum { Rx = 0, Tx } direction_t;
template <class T>
void log_rrc_message(const std::string& source,
const direction_t dir,
const asn1::dyn_octstring& oct,
const T& msg,
const std::string& msg_type);
template <class T>
void log_rrc_message(const std::string& source,
const direction_t dir,
const srsran::byte_buffer_t& pdu,
const T& msg,
const std::string& msg_type);
class ue
{
public:
@ -186,6 +201,10 @@ public:
int add_drb();
// logging helpers
template <class T, class M>
void log_rrc_message(const direction_t dir, const M& pdu, const T& msg, const std::string& msg_type);
// state
rrc_nr_state_t state = rrc_nr_state_t::RRC_IDLE;
uint8_t transaction_id = 0;
@ -241,22 +260,6 @@ private:
// Helper to create PDU from RRC message
template <class T>
srsran::unique_byte_buffer_t pack_into_pdu(const T& msg);
// logging
typedef enum { Rx = 0, Tx } direction_t;
template <class T>
void log_rrc_message(const std::string& source,
const direction_t dir,
const asn1::dyn_octstring& oct,
const T& msg,
const std::string& msg_type);
template <class T>
void log_rrc_message(const std::string& source,
const direction_t dir,
const srsran::byte_buffer_t& pdu,
const T& msg,
const std::string& msg_type);
};
} // namespace srsenb

@ -694,9 +694,7 @@ void rrc_nr::ue::send_dl_ccch(dl_ccch_msg_s* dl_ccch_msg)
parent->logger.error("Failed to send DL-CCCH");
return;
}
fmt::memory_buffer strbuf;
fmt::format_to(strbuf, "rnti=0x{:x}", rnti);
parent->log_rrc_message(fmt::to_string(strbuf), Tx, *pdu.get(), *dl_ccch_msg, "DL-CCCH");
log_rrc_message(Tx, *pdu.get(), *dl_ccch_msg, "DL-CCCH");
parent->rlc->write_sdu(rnti, (uint32_t)srsran::nr_srb::srb0, std::move(pdu));
}
@ -1247,10 +1245,7 @@ int rrc_nr::ue::pack_secondary_cell_group_cfg(asn1::dyn_octstring& packed_second
}
packed_secondary_cell_config.resize(bref_pack.distance_bytes());
fmt::memory_buffer strbuf;
fmt::format_to(strbuf, "rnti=0x{:x}", rnti);
parent->log_rrc_message(
fmt::to_string(strbuf), Tx, packed_secondary_cell_config, cell_group_cfg_pack, "nr-SecondaryCellGroupConfig-r15");
log_rrc_message(Tx, packed_secondary_cell_config, cell_group_cfg_pack, "nr-SecondaryCellGroupConfig-r15");
return SRSRAN_SUCCESS;
}
@ -1307,10 +1302,7 @@ int rrc_nr::ue::pack_nr_radio_bearer_config(asn1::dyn_octstring& packed_nr_beare
// resize to packed length
packed_nr_bearer_config.resize(bref_pack.distance_bytes());
fmt::memory_buffer strbuf;
fmt::format_to(strbuf, "rnti=0x{:x}", rnti);
parent->log_rrc_message(
fmt::to_string(strbuf), Tx, packed_nr_bearer_config, radio_bearer_cfg_pack, "nr-RadioBearerConfig1-r15");
log_rrc_message(Tx, packed_nr_bearer_config, radio_bearer_cfg_pack, "nr-RadioBearerConfig1-r15");
return SRSRAN_SUCCESS;
}
@ -1478,4 +1470,12 @@ void rrc_nr::ue::deactivate_bearers()
parent->mac->ue_cfg(rnti, uecfg);
}
template <class T, class M>
void rrc_nr::ue::log_rrc_message(const direction_t dir, const M& pdu, const T& msg, const std::string& msg_type)
{
fmt::memory_buffer strbuf;
fmt::format_to(strbuf, "rnti=0x{:x}", rnti);
parent->log_rrc_message(fmt::to_string(strbuf), Tx, pdu, msg, msg_type);
}
} // namespace srsenb

Loading…
Cancel
Save