Skip to content

Commit 2e716f8

Browse files
committed
sched: check for max ul grants in UL result
1 parent fff0f60 commit 2e716f8

File tree

2 files changed

+45
-10
lines changed

2 files changed

+45
-10
lines changed

tests/unittests/scheduler/test_utils/scheduler_test_suite.cpp

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,20 @@ void srsran::test_pdsch_ue_consistency(const cell_configuration& cell_cfg, span<
282282

283283
void srsran::test_pusch_ue_consistency(const cell_configuration& cell_cfg, span<const ul_sched_info> grants)
284284
{
285+
ASSERT_LE(grants.size(), cell_cfg.expert_cfg.ue.max_puschs_per_slot);
286+
285287
for (const ul_sched_info& grant : grants) {
286288
ASSERT_TRUE(test_helper::is_valid_ul_sched_info(grant));
287289
}
288290
}
289291

292+
void srsran::test_pucch_consistency(const cell_configuration& cell_cfg, span<const pucch_info> pucchs)
293+
{
294+
ASSERT_LE(pucchs.size(), cell_cfg.expert_cfg.ue.max_pucchs_per_slot);
295+
296+
// TODO: Add more checks.
297+
}
298+
290299
/// \brief Tests the validity of the parameters chosen for the PDCCHs using common search spaces. Checks include:
291300
/// - PDSCH time resource chosen (k0 and symbols) fall in DL symbols
292301
/// - UCI delay chosen falls in an UL slot.
@@ -442,8 +451,7 @@ void srsran::test_prach_opportunity_validity(const cell_configuration& cell_cfg,
442451

443452
void srsran::test_ul_resource_grid_collisions(const cell_configuration& cell_cfg, const ul_sched_result& result)
444453
{
445-
cell_slot_resource_grid grid(cell_cfg.ul_cfg_common.freq_info_ul.scs_carrier_list);
446-
454+
cell_slot_resource_grid grid(cell_cfg.ul_cfg_common.freq_info_ul.scs_carrier_list);
447455
std::vector<test_grant_info> ul_grants = get_ul_grants(cell_cfg, result);
448456
for (const test_grant_info& test_grant : ul_grants) {
449457
// We do not check for collisions between PUCCHs or between PUCCHs and PRACHs.
@@ -460,20 +468,34 @@ void srsran::test_ul_resource_grid_collisions(const cell_configuration& cell_cfg
460468
}
461469
}
462470

471+
void srsran::test_ul_consistency(const cell_configuration& cell_cfg, const ul_sched_result& result)
472+
{
473+
// Check that UL grant limits are respected.
474+
ASSERT_LE(result.pucchs.size() + result.puschs.size(), cell_cfg.expert_cfg.ue.max_ul_grants_per_slot);
475+
476+
ASSERT_NO_FATAL_FAILURE(test_prach_opportunity_validity(cell_cfg, result.prachs));
477+
ASSERT_NO_FATAL_FAILURE(test_pusch_ue_consistency(cell_cfg, result.puschs));
478+
ASSERT_NO_FATAL_FAILURE(test_pucch_consistency(cell_cfg, result.pucchs));
479+
ASSERT_NO_FATAL_FAILURE(test_ul_resource_grid_collisions(cell_cfg, result));
480+
}
481+
482+
void srsran::test_dl_consistency(const cell_configuration& cell_cfg, slot_point sl_tx, const dl_sched_result& result)
483+
{
484+
ASSERT_NO_FATAL_FAILURE(test_pdsch_sib_consistency(cell_cfg, result.bc.sibs));
485+
ASSERT_NO_FATAL_FAILURE(test_pdsch_rar_consistency(cell_cfg, result.rar_grants));
486+
ASSERT_NO_FATAL_FAILURE(test_pdsch_ue_consistency(cell_cfg, result.ue_grants));
487+
ASSERT_NO_FATAL_FAILURE(test_pdcch_common_consistency(cell_cfg, sl_tx, result.dl_pdcchs));
488+
ASSERT_NO_FATAL_FAILURE(test_dl_resource_grid_collisions(cell_cfg, result));
489+
}
490+
463491
void srsran::test_scheduler_result_consistency(const cell_configuration& cell_cfg,
464492
slot_point sl_tx,
465493
const sched_result& result)
466494
{
467495
ASSERT_TRUE(result.success);
468496
ASSERT_NO_FATAL_FAILURE(assert_tdd_pattern_consistency(cell_cfg, sl_tx, result));
469-
ASSERT_NO_FATAL_FAILURE(test_pdsch_sib_consistency(cell_cfg, result.dl.bc.sibs));
470-
ASSERT_NO_FATAL_FAILURE(test_prach_opportunity_validity(cell_cfg, result.ul.prachs));
471-
ASSERT_NO_FATAL_FAILURE(test_pdsch_rar_consistency(cell_cfg, result.dl.rar_grants));
472-
ASSERT_NO_FATAL_FAILURE(test_pdsch_ue_consistency(cell_cfg, result.dl.ue_grants));
473-
ASSERT_NO_FATAL_FAILURE(test_pusch_ue_consistency(cell_cfg, result.ul.puschs));
474-
ASSERT_NO_FATAL_FAILURE(test_pdcch_common_consistency(cell_cfg, sl_tx, result.dl.dl_pdcchs));
475-
ASSERT_NO_FATAL_FAILURE(test_dl_resource_grid_collisions(cell_cfg, result.dl));
476-
ASSERT_NO_FATAL_FAILURE(test_ul_resource_grid_collisions(cell_cfg, result.ul));
497+
ASSERT_NO_FATAL_FAILURE(test_dl_consistency(cell_cfg, sl_tx, result.dl));
498+
ASSERT_NO_FATAL_FAILURE(test_ul_consistency(cell_cfg, result.ul));
477499
}
478500

479501
/// \brief Verifies that the cell resource grid PRBs and symbols was filled with the allocated PDSCHs.

tests/unittests/scheduler/test_utils/scheduler_test_suite.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ void test_pdsch_rar_consistency(const cell_configuration& cell_cfg, span<const r
6464
void test_pdsch_ue_consistency(const cell_configuration& cell_cfg, span<const dl_msg_alloc> ue_grants);
6565

6666
/// \brief Verify UE PUSCH content is valid. Current checks:
67+
/// - Number of PUSCHs does not exceed max_puschs_per_slot.
6768
/// - PRBs fall within BWP boundaries.
6869
void test_pusch_ue_consistency(const cell_configuration& cell_cfg, span<const ul_sched_info> ue_grants);
6970

71+
/// \brief Verify UE PUCCH content is valid. Current checks:
72+
/// - Number of PUCCHs does not exceed max_pucchs_per_slot.
73+
void test_pucch_consistency(const cell_configuration& cell_cfg, span<const pucch_info> pucchs);
74+
7075
/// \brief Current checks:
7176
/// - PRACH occasions parameters match RACH-ConfigCommon present in cell_cfg.
7277
/// \param cell_cfg Cell configuration.
@@ -79,6 +84,14 @@ void test_dl_resource_grid_collisions(const cell_configuration& cell_cfg, const
7984
/// \brief Detects collisions in the "RB x symbol" UL resource grid.
8085
void test_ul_resource_grid_collisions(const cell_configuration& cell_cfg, const ul_sched_result& result);
8186

87+
/// \brief Detects inconsistencies in the whole UL scheduling result. This function calls other more specific UL
88+
/// validity checks.
89+
void test_ul_consistency(const cell_configuration& cell_cfg, const ul_sched_result& result);
90+
91+
/// \brief Detects inconsistencies in the whole DL scheduling result. This function calls other more specific DL
92+
/// validity checks.
93+
void test_dl_consistency(const cell_configuration& cell_cfg, slot_point sl_tx, const dl_sched_result& result);
94+
8295
/// \brief Run all consistency checks for the scheduler result.
8396
void test_scheduler_result_consistency(const cell_configuration& cell_cfg,
8497
slot_point sl_tx,

0 commit comments

Comments
 (0)