ttcn3: use RNTI values in RACH provided by tester

this patch extends the SS to use the C-RNTI and Temp CRNTI values
provided by the tester for RAR and Msg3.
This commit is contained in:
Andre Puschmann 2020-09-22 09:37:42 +02:00
parent e14cb4b405
commit a36f9bddc2
4 changed files with 73 additions and 24 deletions

View File

@ -58,6 +58,7 @@ public:
srslte_cell_t phy_cell = {};
float initial_power = -90.0;
float attenuation = 0.0;
uint16_t temp_crnti = 0;
uint16_t crnti = 0;
};
virtual void set_cell_config(const ttcn3_helpers::timing_info_t timing, const cell_config_t cell) = 0;

View File

@ -175,29 +175,25 @@ private:
const Value& att = document["Request"]["Cell"]["AddOrReconfigure"]["Basic"]["InitialCellPower"]["Attenuation"];
float att_value = 0;
cell.attenuation = 0;
if (att.HasMember("Value")) {
att_value = att["Value"].GetInt();
cell.attenuation = att["Value"].GetInt();
} else if (att.HasMember("Off")) {
// is there other values than Off=True?
assert(att["Off"].GetBool() == true);
if (att["Off"].GetBool() == true) {
// use high attenuation value (-145dB RX power as per TS 36.508 Sec 6.2.2.1-1 is a non-suitable Off cell)
att_value = 90.0;
cell.attenuation = 90.0;
}
}
// Extract CRNTI
if (document["Request"]["Cell"]["AddOrReconfigure"].HasMember("Active")) {
const Value& crnti_string = document["Request"]["Cell"]["AddOrReconfigure"]["Active"]["C_RNTI"];
assert(crnti_string.IsString());
cell.crnti = std::bitset<16>(crnti_string.GetString()).to_ulong();
}
// parse and handle reconfig of active cells
handle_active_cell_reconfig_section(document, cell);
// Now configure cell
syssim->set_cell_config(ttcn3_helpers::get_timing_info(document), cell);
log->info("Configuring attenuation of %s to %.2f dB\n", cell_name.GetString(), att_value);
syssim->set_cell_attenuation(ttcn3_helpers::get_timing_info(document), cell_name.GetString(), att_value);
log->info("Configuring attenuation of %s to %.2f dB\n", cell_name.GetString(), cell.attenuation);
syssim->set_cell_attenuation(ttcn3_helpers::get_timing_info(document), cell_name.GetString(), cell.attenuation);
}
// Pull out SIBs and send to syssim
@ -233,18 +229,13 @@ private:
// Create response for template car_CellConfig_CNF(CellId_Type p_CellId)
std::string cell_id = document["Common"]["CellId"].GetString();
// Fill relevant content
ss_sys_interface::cell_config_t cell;
cell.name = cell_id;
// Extract CRNTI
if (document["Request"]["Cell"]["AddOrReconfigure"].HasMember("Active")) {
if (document["Request"]["Cell"]["AddOrReconfigure"]["Active"].HasMember("C_RNTI")) {
const Value& crnti_string = document["Request"]["Cell"]["AddOrReconfigure"]["Active"]["C_RNTI"];
assert(crnti_string.IsString());
cell.crnti = std::bitset<16>(crnti_string.GetString()).to_ulong();
}
}
handle_active_cell_reconfig_section(document, cell);
// Now configure cell
syssim->set_cell_config(ttcn3_helpers::get_timing_info(document), cell);
if (ttcn3_helpers::requires_confirm(document)) {
@ -257,6 +248,59 @@ private:
}
}
// This function just pulls out the reconfiguration section but doesn't send response to SS
void handle_active_cell_reconfig_section(Document& document, ss_sys_interface::cell_config_t& cell)
{
if (document["Request"]["Cell"]["AddOrReconfigure"].HasMember("Active")) {
// Extract CRNTI
if (document["Request"]["Cell"]["AddOrReconfigure"]["Active"].HasMember("C_RNTI")) {
const Value& crnti_string = document["Request"]["Cell"]["AddOrReconfigure"]["Active"]["C_RNTI"];
assert(crnti_string.IsString());
cell.crnti = std::bitset<16>(crnti_string.GetString()).to_ulong();
}
// Extra Cont Resolution scheme
if (document["Request"]["Cell"]["AddOrReconfigure"]["Active"].HasMember("RachProcedureConfig")) {
if (document["Request"]["Cell"]["AddOrReconfigure"]["Active"]["RachProcedureConfig"].HasMember(
"RachProcedureList")) {
const Value& rach_proc_list =
document["Request"]["Cell"]["AddOrReconfigure"]["Active"]["RachProcedureConfig"]["RachProcedureList"];
assert(rach_proc_list.IsArray());
for (Value::ConstValueIterator itr = rach_proc_list.Begin(); itr != rach_proc_list.End(); ++itr) {
if (itr->HasMember("ContentionResolutionCtrl")) {
const Value& cont_res_type = (*itr)["ContentionResolutionCtrl"];
if (cont_res_type.HasMember("CRNTI_Based")) {
// TODO: handle CRNTI based contention resolution
} else if (cont_res_type.HasMember("TCRNTI_Based")) {
// TODO: handle TCRNTI based contention resolution
}
}
if (itr->HasMember("RAResponse")) {
if ((*itr)["RAResponse"].HasMember("Ctrl")) {
if ((*itr)["RAResponse"]["Ctrl"].HasMember("Rar")) {
if ((*itr)["RAResponse"]["Ctrl"]["Rar"].HasMember("List")) {
const Value& rar_list_list = (*itr)["RAResponse"]["Ctrl"]["Rar"]["List"];
assert(rar_list_list.IsArray());
for (Value::ConstValueIterator rar_itr = rar_list_list.Begin(); rar_itr != rar_list_list.End();
++rar_itr) {
if (rar_itr->HasMember("TempC_RNTI")) {
if ((*rar_itr)["TempC_RNTI"].HasMember("SameAsC_RNTI")) {
const Value& temp_crnti = (*rar_itr)["TempC_RNTI"]["SameAsC_RNTI"];
assert(temp_crnti.IsBool() && temp_crnti.GetBool() == true);
cell.temp_crnti = cell.crnti;
}
}
}
}
}
}
}
}
}
}
}
}
void handle_request_cell(Document& document, const uint8_t* payload, const uint16_t len)
{
// get Cmd and make sure it has MMI
@ -373,7 +417,7 @@ private:
const Value& config = (*itr)["Config"];
if (config.HasMember("AddOrReconfigure")) {
const Value& aor = config["AddOrReconfigure"];
const Value& aor = config["AddOrReconfigure"];
if (aor.HasMember("LogicalChannelId")) {
uint32_t lcid = aor["LogicalChannelId"].GetInt();
if (lcid > 0) {

View File

@ -238,6 +238,7 @@ void lte_ttcn3_phy::set_timeadv(uint32_t ta_cmd)
void lte_ttcn3_phy::set_rar_grant(uint8_t grant_payload[SRSLTE_RAR_GRANT_LEN], uint16_t rnti)
{
// Empty, SYSSIM knows when to provide UL grant for Msg3
log.debug("%s not implemented.\n", __FUNCTION__);
}
// Called from the SYSSIM to configure the current TTI

View File

@ -270,7 +270,7 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
} else if (SRSLTE_RNTI_ISUSER(dl_rnti)) {
// check if this is for contention resolution after PRACH/RAR
if (dl_rnti == cells[pcell_idx]->config.crnti) {
log->debug("Searching for C-RNTI=%d\n", dl_rnti);
log->debug("Searching for C-RNTI=0x%x\n", dl_rnti);
if (rar_tti != -1) {
msg3_tti = (rar_tti + 3) % 10240;
@ -287,7 +287,7 @@ void ttcn3_syssim::new_tti_indication(uint64_t res)
}
if (dl_rnti != SRSLTE_INVALID_RNTI) {
log->debug("Searching for RNTI=%d\n", dl_rnti);
log->debug("Searching for RNTI=0x%x\n", dl_rnti);
// look for DL data to be send in each bearer and provide grant accordingly
for (int lcid = 0; lcid < SRSLTE_N_RADIO_BEARERS; lcid++) {
@ -581,7 +581,7 @@ void ttcn3_syssim::send_rar(uint32_t preamble_index)
if (rar_pdu.new_subh()) {
rar_pdu.get()->set_rapid(preamble_index);
rar_pdu.get()->set_ta_cmd(0);
rar_pdu.get()->set_temp_crnti(cells[pcell_idx]->config.crnti);
rar_pdu.get()->set_temp_crnti(cells[pcell_idx]->config.temp_crnti);
rar_pdu.get()->set_sched_grant(grant_buffer);
}
rar_pdu.write_packet(rar_buffer.msg);
@ -788,11 +788,14 @@ void ttcn3_syssim::set_cell_config_impl(const cell_config_t config)
} else {
// cell is already there
log->info("Cell already there, reconfigure\n");
// We only support C-RNTI reconfiguration
// We only support (Temp-)CRNTI reconfiguration
syssim_cell_t* ss_cell = get_cell(config.name);
if (config.crnti > 0) {
ss_cell->config.crnti = config.crnti;
}
if (config.temp_crnti > 0) {
ss_cell->config.temp_crnti = config.temp_crnti;
}
}
update_cell_map();