Implement override_lcid() function in ttcn3_sys_interface

Fixes: TC_7_1_1_1 (#6)
master
Daniel Willmann 5 years ago committed by Andre Puschmann
parent 3633859d09
commit 1314b8f653

@ -68,8 +68,9 @@ public:
const ttcn3_helpers::pdcp_count_map_t bearers) = 0;
virtual void release_as_security(const ttcn3_helpers::timing_info_t timing) = 0;
virtual ttcn3_helpers::pdcp_count_map_t get_pdcp_count() = 0;
virtual uint32_t get_tti() = 0;
virtual ttcn3_helpers::pdcp_count_map_t get_pdcp_count() = 0;
virtual uint32_t get_tti() = 0;
virtual void set_forced_lcid(int lcid) = 0;
};
class ss_srb_interface

@ -286,7 +286,21 @@ private:
if (id.HasMember("Srb")) {
const Value& config = (*itr)["Config"];
if (config.HasMember("AddOrReconfigure")) {
uint32_t lcid = id["Srb"].GetInt();
uint32_t lcid = id["Srb"].GetInt();
const Value& aor = config["AddOrReconfigure"];
if (aor.HasMember("Mac") && aor["Mac"].HasMember("TestMode") && aor["Mac"]["TestMode"].HasMember("Info") &&
aor["Mac"]["TestMode"]["Info"].HasMember("DiffLogChId")) {
uint32_t force_lcid = 0;
const Value& dlcid = aor["Mac"]["TestMode"]["Info"]["DiffLogChId"];
assert(dlcid.HasMember("LogChId"));
force_lcid = dlcid["LogChId"].GetInt();
log->info("TestMode: lcid overridden: %d\n", force_lcid);
syssim->set_forced_lcid(force_lcid);
} else {
// Unset override function to use different lcid
log->info("TestMode: lcid reset\n");
syssim->set_forced_lcid(-1);
}
if (lcid > 0) {
pdcp_config_t pdcp_cfg = {.bearer_id = static_cast<uint8_t>(lcid),
.rb_type = PDCP_RB_IS_SRB,

@ -139,6 +139,8 @@ public:
return SRSLTE_SUCCESS;
}
void set_forced_lcid(int lcid) { force_lcid = lcid; }
int add_port_handler()
{
// UT port
@ -313,6 +315,8 @@ public:
msg3_tti = -1;
}
bool has_single_sdu = false;
// allocate SDUs
while (buf_state > 0) { // there is pending SDU to allocate
if (mac_msg_dl.new_subh()) {
@ -324,13 +328,27 @@ public:
// update buffer state
buf_state = rlc.get_buffer_state(lcid);
if (mac_msg_dl.nof_subh() == 1) {
has_single_sdu = true;
} else {
has_single_sdu = false;
}
}
}
// Assemble entire MAC PDU
uint8_t* mac_pdu_ptr = mac_msg_dl.write_packet(&log);
if (mac_pdu_ptr != nullptr) {
if (force_lcid != -1 && lcid == 0) {
if (has_single_sdu) {
log.info("Patched lcid in mac header to: %d\n", force_lcid);
mac_pdu_ptr[0] = (mac_pdu_ptr[0] & 0xe0) | (force_lcid & 0x1f);
} else if (mac_msg_dl.nof_subh() > 1) {
log.warning(
"Not patching lcid to %d in mac header (nof_subh == %d)\n", force_lcid, mac_msg_dl.nof_subh());
}
}
log.info_hex(mac_pdu_ptr, mac_msg_dl.get_pdu_len(), "DL MAC PDU (%d B):\n", mac_msg_dl.get_pdu_len());
// Prepare MAC grant for CCCH
@ -1188,6 +1206,7 @@ private:
uint32_t prach_preamble_index = 0;
uint16_t dl_rnti = 0;
uint16_t crnti = TTCN3_CRNTI;
int force_lcid = -1;
srslte::timer_handler timers;
bool last_dl_ndi[2 * FDD_HARQ_DELAY_MS] = {};
bool last_ul_ndi[2 * FDD_HARQ_DELAY_MS] = {};

Loading…
Cancel
Save