diff --git a/srsenb/test/mac/scheduler_ca_test.cc b/srsenb/test/mac/scheduler_ca_test.cc index c85efb7a1..2918157b3 100644 --- a/srsenb/test/mac/scheduler_ca_test.cc +++ b/srsenb/test/mac/scheduler_ca_test.cc @@ -132,16 +132,16 @@ int test_scell_activation(test_scell_activation_params params) TESTASSERT(tester.ue_tester->user_exists(rnti1)); // Event (TTI=prach_tti+msg4_tot_delay): First Tx (Msg4). Goes in SRB0 and contains ConRes - while (not tester.ue_tester->get_user_state(rnti1)->msg3_tic.is_valid() or - tester.ue_tester->get_user_state(rnti1)->msg3_tic.tti_rx() > generator.tti_counter) { + while (not tester.ue_tester->get_user_state(rnti1)->msg3_tti.is_valid() or + tester.ue_tester->get_user_state(rnti1)->msg3_tti.to_uint() > generator.tti_counter) { generator.step_tti(); tester.test_next_ttis(generator.tti_events); } generator.step_tti(); generator.add_dl_data(rnti1, msg4_size); tester.test_next_ttis(generator.tti_events); - while (not tester.ue_tester->get_user_state(rnti1)->msg4_tic.is_valid() or - tester.ue_tester->get_user_state(rnti1)->msg4_tic.tti_rx() > generator.tti_counter) { + while (not tester.ue_tester->get_user_state(rnti1)->msg4_tti.is_valid() or + tester.ue_tester->get_user_state(rnti1)->msg4_tti.to_uint() > generator.tti_counter) { generator.step_tti(); tester.test_next_ttis(generator.tti_events); } diff --git a/srsenb/test/mac/scheduler_test_common.cc b/srsenb/test/mac/scheduler_test_common.cc index cbe783ed1..9edc614ad 100644 --- a/srsenb/test/mac/scheduler_test_common.cc +++ b/srsenb/test/mac/scheduler_test_common.cc @@ -409,6 +409,7 @@ int ue_ctxt_test::test_sched_result(uint32_t enb_cc_idx, cc_result result{enb_cc_idx, &dl_result, &ul_result}; TESTASSERT(test_harqs(result) == SRSLTE_SUCCESS); TESTASSERT(test_ra(result) == SRSLTE_SUCCESS); + TESTASSERT(test_scell_activation(result) == SRSLTE_SUCCESS); TESTASSERT(schedule_acks(result) == SRSLTE_SUCCESS); return SRSLTE_SUCCESS; } @@ -523,6 +524,42 @@ int ue_ctxt_test::test_ra(cc_result result) return SRSLTE_SUCCESS; } +/** + * Tests whether the SCells are correctly activated. Individual tests: + * - no DL and UL allocations in inactive carriers + */ +int ue_ctxt_test::test_scell_activation(cc_result result) +{ + auto cc_it = + std::find_if(user_cfg.supported_cc_list.begin(), + user_cfg.supported_cc_list.end(), + [&result](const sched::ue_cfg_t::cc_cfg_t& cc) { return cc.enb_cc_idx == result.enb_cc_idx; }); + + if (cc_it == user_cfg.supported_cc_list.end() or not cc_it->active) { + // cell not active. Ensure data allocations are not made + for (uint32_t i = 0; i < result.dl_result->nof_data_elems; ++i) { + CONDERROR(result.dl_result->data[i].dci.rnti == rnti, "Allocated user in inactive carrier\n"); + } + for (uint32_t i = 0; i < result.ul_result->nof_dci_elems; ++i) { + CONDERROR(result.ul_result->pusch[i].dci.rnti == rnti, "Allocated user in inactive carrier\n"); + } + } else { + uint32_t ue_cc_idx = std::distance(user_cfg.supported_cc_list.begin(), cc_it); + for (uint32_t i = 0; i < result.dl_result->nof_data_elems; ++i) { + if (result.dl_result->data[i].dci.rnti == rnti) { + CONDERROR(result.dl_result->data[i].dci.ue_cc_idx != ue_cc_idx, "User cell index was incorrectly set\n"); + } + } + for (uint32_t i = 0; i < result.ul_result->nof_dci_elems; ++i) { + if (result.ul_result->pusch[i].dci.rnti == rnti) { + CONDERROR(result.ul_result->pusch[i].dci.ue_cc_idx != ue_cc_idx, "The user cell index was incorrectly set\n"); + } + } + } + + return SRSLTE_SUCCESS; +} + /** * Sanity checks of the DCI values in the scheduling result for a given user. Current checks: * - invalid ue_cc_idx<->enb_cc_idx matching in dl_result @@ -768,55 +805,11 @@ int user_state_sched_tester::test_ctrl_info(uint32_t return SRSLTE_SUCCESS; } -/** - * Tests whether the SCells are correctly activated. Individual tests: - * - no DL and UL allocations in inactive carriers - */ -int user_state_sched_tester::test_scell_activation(uint32_t enb_cc_idx, - const sched_interface::dl_sched_res_t& dl_result, - const sched_interface::ul_sched_res_t& ul_result) -{ - for (auto& iter : users) { - uint16_t rnti = iter.first; - ue_ctxt_test& userinfo = iter.second; - - auto it = std::find_if(userinfo.user_cfg.supported_cc_list.begin(), - userinfo.user_cfg.supported_cc_list.end(), - [enb_cc_idx](const sched::ue_cfg_t::cc_cfg_t& cc) { return cc.enb_cc_idx == enb_cc_idx; }); - - if (it == userinfo.user_cfg.supported_cc_list.end() or not it->active) { - // cell not active. Ensure data allocations are not made - for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) { - CONDERROR(dl_result.data[i].dci.rnti == rnti, "Allocated user in inactive carrier\n"); - } - for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) { - CONDERROR(ul_result.pusch[i].needs_pdcch and ul_result.pusch[i].dci.rnti == rnti, - "Allocated user in inactive carrier\n"); - } - } else { - uint32_t ue_cc_idx = std::distance(userinfo.user_cfg.supported_cc_list.begin(), it); - for (uint32_t i = 0; i < dl_result.nof_data_elems; ++i) { - if (dl_result.data[i].dci.rnti == rnti) { - CONDERROR(dl_result.data[i].dci.ue_cc_idx != ue_cc_idx, "User cell index was incorrectly set\n"); - } - } - for (uint32_t i = 0; i < ul_result.nof_dci_elems; ++i) { - if (ul_result.pusch[i].needs_pdcch and ul_result.pusch[i].dci.rnti == rnti) { - CONDERROR(ul_result.pusch[i].dci.ue_cc_idx != ue_cc_idx, "The user cell index was incorrectly set\n"); - } - } - } - } - - return SRSLTE_SUCCESS; -} - int user_state_sched_tester::test_all(uint32_t enb_cc_idx, const sched_interface::dl_sched_res_t& dl_result, const sched_interface::ul_sched_res_t& ul_result) { TESTASSERT(test_ctrl_info(enb_cc_idx, dl_result, ul_result) == SRSLTE_SUCCESS); - TESTASSERT(test_scell_activation(enb_cc_idx, dl_result, ul_result) == SRSLTE_SUCCESS); for (auto& u : users) { TESTASSERT(u.second.test_sched_result(enb_cc_idx, dl_result, ul_result) == SRSLTE_SUCCESS); @@ -825,6 +818,10 @@ int user_state_sched_tester::test_all(uint32_t enb return SRSLTE_SUCCESS; } +/*********************** + * Sim Stats Storage + **********************/ + void sched_result_stats::process_results(const tti_params_t& tti_params, const std::vector& dl_result, const std::vector& ul_result) diff --git a/srsenb/test/mac/scheduler_test_common.h b/srsenb/test/mac/scheduler_test_common.h index 67290a644..3c3f78b98 100644 --- a/srsenb/test/mac/scheduler_test_common.h +++ b/srsenb/test/mac/scheduler_test_common.h @@ -147,6 +147,8 @@ private: //! Test the timing of RAR, Msg3, Msg4 int test_ra(cc_result result); int test_harqs(cc_result result); + //! Test correct activation of SCells + int test_scell_activation(cc_result result); int schedule_acks(cc_result result); const std::vector& cell_params; @@ -185,11 +187,6 @@ public: const sched_interface::dl_sched_res_t& dl_result, const sched_interface::ul_sched_res_t& ul_result); - /* Test correct activation of SCells */ - int test_scell_activation(uint32_t enb_cc_idx, - const sched_interface::dl_sched_res_t& dl_result, - const sched_interface::ul_sched_res_t& ul_result); - int test_all(uint32_t enb_cc_idx, const sched_interface::dl_sched_res_t& dl_result, const sched_interface::ul_sched_res_t& ul_result);