nr,gnb,rrc: extend RRC setup test to verify if UE-specific SearchSpaces and CORESETs are added at RRC setup complete and not before

master
Francisco 3 years ago committed by Francisco Paisana
parent 0a8a576263
commit 27d223de2a

@ -69,11 +69,18 @@ public:
} }
uint16_t reserve_rnti(uint32_t enb_cc_idx, const sched_nr_ue_cfg_t& uecfg) override { return 0x4601; } uint16_t reserve_rnti(uint32_t enb_cc_idx, const sched_nr_ue_cfg_t& uecfg) override { return 0x4601; }
int ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg) override { return SRSRAN_SUCCESS; } int ue_cfg(uint16_t rnti, const sched_nr_interface::ue_cfg_t& ue_cfg) override
{
last_ue_cfg_rnti = rnti;
last_ue_cfg = ue_cfg;
return SRSRAN_SUCCESS;
}
int remove_ue(uint16_t rnti) override { return SRSRAN_SUCCESS; } int remove_ue(uint16_t rnti) override { return SRSRAN_SUCCESS; }
std::vector<srsenb::sched_nr_interface::cell_cfg_t> nr_cells; std::vector<srsenb::sched_nr_interface::cell_cfg_t> nr_cells;
uint16_t last_ue_cfg_rnti = SRSRAN_INVALID_RNTI;
sched_nr_interface::ue_cfg_t last_ue_cfg{};
}; };
class phy_nr_dummy : public phy_interface_stack_nr class phy_nr_dummy : public phy_interface_stack_nr

@ -96,7 +96,7 @@ private:
int update_rlc_bearers(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff); int update_rlc_bearers(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff);
/// Update MAC based on ASN1 message /// Update MAC based on ASN1 message
int update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff); int update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff, bool is_config_complete);
int pack_rrc_reconfiguration(asn1::dyn_octstring& packed_rrc_reconfig); int pack_rrc_reconfiguration(asn1::dyn_octstring& packed_rrc_reconfig);
int pack_secondary_cell_group_cfg(asn1::dyn_octstring& packed_secondary_cell_config); int pack_secondary_cell_group_cfg(asn1::dyn_octstring& packed_secondary_cell_config);
@ -161,7 +161,7 @@ private:
srsran::unique_timer activity_timer; /// for basic DL/UL activity timeout srsran::unique_timer activity_timer; /// for basic DL/UL activity timeout
// RRC configs for UEs // RRC configs for UEs
asn1::rrc_nr::cell_group_cfg_s cell_group_cfg; asn1::rrc_nr::cell_group_cfg_s cell_group_cfg, next_cell_group_cfg;
asn1::rrc_nr::radio_bearer_cfg_s radio_bearer_cfg, next_radio_bearer_cfg; asn1::rrc_nr::radio_bearer_cfg_s radio_bearer_cfg, next_radio_bearer_cfg;
std::vector<srsran::unique_byte_buffer_t> nas_pdu_queue; std::vector<srsran::unique_byte_buffer_t> nas_pdu_queue;

@ -29,8 +29,13 @@ Every function in UE class is called from a mutex environment thus does not
rrc_nr::ue::ue(rrc_nr* parent_, uint16_t rnti_, const sched_nr_ue_cfg_t& uecfg_, bool start_msg3_timer) : rrc_nr::ue::ue(rrc_nr* parent_, uint16_t rnti_, const sched_nr_ue_cfg_t& uecfg_, bool start_msg3_timer) :
parent(parent_), logger(parent_->logger), rnti(rnti_), uecfg(uecfg_) parent(parent_), logger(parent_->logger), rnti(rnti_), uecfg(uecfg_)
{ {
// Derive UE cfg from rrc_cfg_nr_t if (not parent->cfg.is_standalone) {
// Add the final PDCCH config in case of NSA
uecfg.phy_cfg.pdcch = parent->cfg.cell_list[0].phy_cell.pdcch; uecfg.phy_cfg.pdcch = parent->cfg.cell_list[0].phy_cell.pdcch;
} else {
cell_group_cfg = *parent->cell_ctxt->master_cell_group;
next_cell_group_cfg = cell_group_cfg;
}
// Set timer for MSG3_RX_TIMEOUT or UE_INACTIVITY_TIMEOUT // Set timer for MSG3_RX_TIMEOUT or UE_INACTIVITY_TIMEOUT
activity_timer = parent->task_sched.get_unique_timer(); activity_timer = parent->task_sched.get_unique_timer();
@ -929,11 +934,10 @@ void rrc_nr::ue::send_rrc_setup()
compute_diff_radio_bearer_cfg(parent->cfg, radio_bearer_cfg, next_radio_bearer_cfg, setup_ies.radio_bearer_cfg); compute_diff_radio_bearer_cfg(parent->cfg, radio_bearer_cfg, next_radio_bearer_cfg, setup_ies.radio_bearer_cfg);
// - Setup masterCellGroup // - Setup masterCellGroup
asn1::rrc_nr::cell_group_cfg_s master_cell_group = *parent->cell_ctxt->master_cell_group;
// - Derive master cell group config bearers // - Derive master cell group config bearers
fill_cellgroup_with_radio_bearer_cfg(parent->cfg, setup_ies.radio_bearer_cfg, master_cell_group); fill_cellgroup_with_radio_bearer_cfg(parent->cfg, setup_ies.radio_bearer_cfg, next_cell_group_cfg);
// - Pack masterCellGroup into container // - Pack masterCellGroup into container
srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(master_cell_group, __FUNCTION__); srsran::unique_byte_buffer_t pdu = parent->pack_into_pdu(next_cell_group_cfg, __FUNCTION__);
if (pdu == nullptr) { if (pdu == nullptr) {
send_rrc_reject(max_wait_time_secs); send_rrc_reject(max_wait_time_secs);
return; return;
@ -942,18 +946,18 @@ void rrc_nr::ue::send_rrc_setup()
memcpy(setup_ies.master_cell_group.data(), pdu->data(), pdu->N_bytes); memcpy(setup_ies.master_cell_group.data(), pdu->data(), pdu->N_bytes);
if (logger.debug.enabled()) { if (logger.debug.enabled()) {
asn1::json_writer js; asn1::json_writer js;
master_cell_group.to_json(js); next_cell_group_cfg.to_json(js);
logger.debug("Containerized MasterCellGroup: %s", js.to_string().c_str()); logger.debug("Containerized MasterCellGroup: %s", js.to_string().c_str());
} }
// add PDCP bearers // add PDCP bearers
update_pdcp_bearers(setup_ies.radio_bearer_cfg, master_cell_group); update_pdcp_bearers(setup_ies.radio_bearer_cfg, next_cell_group_cfg);
// add RLC bearers // add RLC bearers
update_rlc_bearers(master_cell_group); update_rlc_bearers(next_cell_group_cfg);
// add MAC bearers // add MAC bearers
update_mac(master_cell_group); update_mac(next_cell_group_cfg, false);
// Send RRC Setup message to UE // Send RRC Setup message to UE
if (send_dl_ccch(msg) != SRSRAN_SUCCESS) { if (send_dl_ccch(msg) != SRSRAN_SUCCESS) {
@ -964,8 +968,11 @@ void rrc_nr::ue::send_rrc_setup()
/// TS 38.331, RRCSetupComplete /// TS 38.331, RRCSetupComplete
void rrc_nr::ue::handle_rrc_setup_complete(const asn1::rrc_nr::rrc_setup_complete_s& msg) void rrc_nr::ue::handle_rrc_setup_complete(const asn1::rrc_nr::rrc_setup_complete_s& msg)
{ {
update_mac(next_cell_group_cfg, true);
// Update current radio bearer cfg // Update current radio bearer cfg
radio_bearer_cfg = next_radio_bearer_cfg; radio_bearer_cfg = next_radio_bearer_cfg;
cell_group_cfg = next_cell_group_cfg;
// Create UE context in NGAP // Create UE context in NGAP
using ngap_cause_t = asn1::ngap_nr::rrcestablishment_cause_opts::options; using ngap_cause_t = asn1::ngap_nr::rrcestablishment_cause_opts::options;
@ -996,8 +1003,6 @@ void rrc_nr::ue::handle_security_mode_complete(const asn1::rrc_nr::security_mode
// TODO: handle SecurityModeComplete // TODO: handle SecurityModeComplete
// Note: Skip UE capabilities // Note: Skip UE capabilities
send_rrc_reconfiguration();
} }
/// TS 38.331, RRCReconfiguration /// TS 38.331, RRCReconfiguration
@ -1047,7 +1052,7 @@ void rrc_nr::ue::send_rrc_reconfiguration()
update_rlc_bearers(master_cell_group); update_rlc_bearers(master_cell_group);
// add MAC bearers // add MAC bearers
update_mac(master_cell_group); update_mac(master_cell_group, false);
} }
if (send_dl_dcch(srsran::nr_srb::srb1, dl_dcch_msg) != SRSRAN_SUCCESS) { if (send_dl_dcch(srsran::nr_srb::srb1, dl_dcch_msg) != SRSRAN_SUCCESS) {
@ -1058,6 +1063,7 @@ void rrc_nr::ue::send_rrc_reconfiguration()
void rrc_nr::ue::handle_rrc_reconfiguration_complete(const asn1::rrc_nr::rrc_recfg_complete_s& msg) void rrc_nr::ue::handle_rrc_reconfiguration_complete(const asn1::rrc_nr::rrc_recfg_complete_s& msg)
{ {
radio_bearer_cfg = next_radio_bearer_cfg; radio_bearer_cfg = next_radio_bearer_cfg;
cell_group_cfg = next_cell_group_cfg;
} }
void rrc_nr::ue::send_rrc_release() void rrc_nr::ue::send_rrc_release()
@ -1204,8 +1210,9 @@ int rrc_nr::ue::update_rlc_bearers(const asn1::rrc_nr::cell_group_cfg_s& cell_gr
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;
} }
int rrc_nr::ue::update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff) int rrc_nr::ue::update_mac(const cell_group_cfg_s& cell_group_diff, bool is_config_complete)
{ {
if (not is_config_complete) {
// Release bearers // Release bearers
for (uint8_t lcid : cell_group_diff.rlc_bearer_to_release_list) { for (uint8_t lcid : cell_group_diff.rlc_bearer_to_release_list) {
uecfg.ue_bearers[lcid].direction = mac_lc_ch_cfg_t::IDLE; uecfg.ue_bearers[lcid].direction = mac_lc_ch_cfg_t::IDLE;
@ -1215,12 +1222,26 @@ int rrc_nr::ue::update_mac(const asn1::rrc_nr::cell_group_cfg_s& cell_group_diff
uecfg.ue_bearers[bearer.lc_ch_id].direction = mac_lc_ch_cfg_t::BOTH; uecfg.ue_bearers[bearer.lc_ch_id].direction = mac_lc_ch_cfg_t::BOTH;
if (bearer.mac_lc_ch_cfg.ul_specific_params_present) { if (bearer.mac_lc_ch_cfg.ul_specific_params_present) {
uecfg.ue_bearers[bearer.lc_ch_id].priority = bearer.mac_lc_ch_cfg.ul_specific_params.prio; uecfg.ue_bearers[bearer.lc_ch_id].priority = bearer.mac_lc_ch_cfg.ul_specific_params.prio;
uecfg.ue_bearers[bearer.lc_ch_id].pbr = bearer.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate.to_number(); uecfg.ue_bearers[bearer.lc_ch_id].pbr =
bearer.mac_lc_ch_cfg.ul_specific_params.prioritised_bit_rate.to_number();
uecfg.ue_bearers[bearer.lc_ch_id].bsd = bearer.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur.to_number(); uecfg.ue_bearers[bearer.lc_ch_id].bsd = bearer.mac_lc_ch_cfg.ul_specific_params.bucket_size_dur.to_number();
uecfg.ue_bearers[bearer.lc_ch_id].group = bearer.mac_lc_ch_cfg.ul_specific_params.lc_ch_group; uecfg.ue_bearers[bearer.lc_ch_id].group = bearer.mac_lc_ch_cfg.ul_specific_params.lc_ch_group;
// TODO: remaining fields // TODO: remaining fields
} }
} }
} else {
auto& pdcch = cell_group_diff.sp_cell_cfg.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup();
for (auto& ss : pdcch.search_spaces_to_add_mod_list) {
uecfg.phy_cfg.pdcch.search_space_present[ss.search_space_id] = true;
uecfg.phy_cfg.pdcch.search_space[ss.search_space_id] =
parent->cfg.cell_list[0].phy_cell.pdcch.search_space[ss.search_space_id];
}
for (auto& cs : pdcch.ctrl_res_set_to_add_mod_list) {
uecfg.phy_cfg.pdcch.coreset_present[cs.ctrl_res_set_id] = true;
uecfg.phy_cfg.pdcch.coreset[cs.ctrl_res_set_id] =
parent->cfg.cell_list[0].phy_cell.pdcch.coreset[cs.ctrl_res_set_id];
}
}
parent->mac->ue_cfg(rnti, uecfg); parent->mac->ue_cfg(rnti, uecfg);
return SRSRAN_SUCCESS; return SRSRAN_SUCCESS;

@ -162,9 +162,11 @@ void test_rrc_sa_connection()
SRSRAN_SUCCESS); SRSRAN_SUCCESS);
sched_nr_ue_cfg_t uecfg = get_default_ue_cfg(1); sched_nr_ue_cfg_t uecfg = get_default_ue_cfg(1);
uecfg.phy_cfg.pdcch = rrc_cfg_nr.cell_list[0].phy_cell.pdcch;
uecfg.phy_cfg.pdcch.search_space_present[2] = false;
TESTASSERT_SUCCESS(rrc_obj.add_user(0x4601, uecfg)); TESTASSERT_SUCCESS(rrc_obj.add_user(0x4601, uecfg));
test_rrc_nr_connection_establishment(task_sched, rrc_obj, rlc_obj, 0x4601); test_rrc_nr_connection_establishment(task_sched, rrc_obj, rlc_obj, mac_obj, 0x4601);
test_rrc_nr_security_mode_cmd(task_sched, rrc_obj, pdcp_obj, 0x4601); test_rrc_nr_security_mode_cmd(task_sched, rrc_obj, pdcp_obj, 0x4601);
} }

@ -20,6 +20,7 @@ namespace srsenb {
void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
rrc_nr& rrc_obj, rrc_nr& rrc_obj,
rlc_nr_rrc_tester& rlc, rlc_nr_rrc_tester& rlc,
mac_nr_dummy& mac,
uint16_t rnti) uint16_t rnti)
{ {
srsran::unique_byte_buffer_t pdu; srsran::unique_byte_buffer_t pdu;
@ -64,6 +65,26 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
const srb_to_add_mod_s& srb1 = setup_ies.radio_bearer_cfg.srb_to_add_mod_list[0]; const srb_to_add_mod_s& srb1 = setup_ies.radio_bearer_cfg.srb_to_add_mod_list[0];
TESTASSERT_EQ(srsran::srb_to_lcid(srsran::nr_srb::srb1), srb1.srb_id); TESTASSERT_EQ(srsran::srb_to_lcid(srsran::nr_srb::srb1), srb1.srb_id);
// Test UE context in MAC
TESTASSERT_EQ(rnti, mac.last_ue_cfg_rnti);
// Only LCID=0 and LCID=2 are active
TESTASSERT_EQ(mac_lc_ch_cfg_t::BOTH, mac.last_ue_cfg.ue_bearers[0].direction);
TESTASSERT_EQ(mac_lc_ch_cfg_t::BOTH, mac.last_ue_cfg.ue_bearers[1].direction);
for (uint32_t lcid = 2; lcid < mac.last_ue_cfg.ue_bearers.size(); ++lcid) {
TESTASSERT_EQ(mac_lc_ch_cfg_t::IDLE, mac.last_ue_cfg.ue_bearers[lcid].direction);
}
bool found_common_ul_dci_format = false;
for (uint32_t ss_id = 0; ss_id < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE; ++ss_id) {
if (mac.last_ue_cfg.phy_cfg.pdcch.search_space_present[ss_id]) {
const srsran_search_space_t& ss = mac.last_ue_cfg.phy_cfg.pdcch.search_space[ss_id];
// Ensure MAC ue_cfg does not have yet any UE-specific SS
TESTASSERT_NEQ(srsran_search_space_type_ue, ss.type);
for (uint32_t f = 0; f < ss.nof_formats; ++f) {
found_common_ul_dci_format |= ss.formats[f] == srsran_dci_format_nr_0_0;
}
}
}
TESTASSERT(found_common_ul_dci_format);
// Step 3 - RRCSetupComplete (UE -> gNB) - Configure the msg and send it to RRC // Step 3 - RRCSetupComplete (UE -> gNB) - Configure the msg and send it to RRC
ul_dcch_msg_s ul_dcch_msg; ul_dcch_msg_s ul_dcch_msg;
@ -85,6 +106,18 @@ void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
pdu->N_bytes = bref.distance_bytes(); pdu->N_bytes = bref.distance_bytes();
} }
rrc_obj.write_pdu(rnti, 1, std::move(pdu)); rrc_obj.write_pdu(rnti, 1, std::move(pdu));
// Test new UE context in MAC
bool ss_ue_found = false;
for (uint32_t ss_id = 0; ss_id < SRSRAN_UE_DL_NR_MAX_NOF_SEARCH_SPACE; ++ss_id) {
if (mac.last_ue_cfg.phy_cfg.pdcch.search_space_present[ss_id]) {
const srsran_search_space_t& ss = mac.last_ue_cfg.phy_cfg.pdcch.search_space[ss_id];
if (ss.type == srsran_search_space_type_ue) {
ss_ue_found = true;
}
}
}
TESTASSERT(ss_ue_found); /// Ensure UE-specific SearchSpace was added
} }
void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched, void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,

@ -63,6 +63,7 @@ public:
void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched, void test_rrc_nr_connection_establishment(srsran::task_scheduler& task_sched,
rrc_nr& rrc_obj, rrc_nr& rrc_obj,
rlc_nr_rrc_tester& rlc, rlc_nr_rrc_tester& rlc,
mac_nr_dummy& mac,
uint16_t rnti); uint16_t rnti);
void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched, void test_rrc_nr_security_mode_cmd(srsran::task_scheduler& task_sched,

Loading…
Cancel
Save