Skip to content

Commit ef8a12b

Browse files
committed
sched: add unit test confirming that SRs do not keep UE as zombie while being removed
1 parent af6c45d commit ef8a12b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/unittests/scheduler/scheduler_ue_removal_test.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,55 @@ TEST_F(sched_ue_removal_test, when_ue_is_removed_then_any_pending_uci_does_not_c
169169
// No log warnings should be generated.
170170
ASSERT_EQ(initial_nof_warnings, test_spy.get_warning_counter() + test_spy.get_error_counter());
171171
}
172+
173+
TEST_F(sched_ue_removal_test,
174+
when_ue_is_being_removed_but_keeps_receiving_sr_indications_then_scheduler_ignores_indications)
175+
{
176+
// Create UE.
177+
du_ue_index_t ue_index = (du_ue_index_t)test_rgen::uniform_int<unsigned>(0, MAX_DU_UE_INDEX);
178+
rnti_t rnti = to_rnti(test_rgen::uniform_int<unsigned>(0x4601, MAX_CRNTI));
179+
add_ue(ue_index, rnti);
180+
181+
// Push BSR update for UE.
182+
this->push_bsr(ul_bsr_indication_message{
183+
to_du_cell_index(0), ue_index, rnti, bsr_format::SHORT_BSR, ul_bsr_lcg_report_list{{uint_to_lcg_id(0), 100}}});
184+
185+
// Wait for at least one UL HARQ to be allocated.
186+
const ul_sched_info* alloc = nullptr;
187+
const unsigned TX_TIMEOUT = 10;
188+
for (unsigned i = 0; i != TX_TIMEOUT; ++i) {
189+
this->run_slot();
190+
alloc = find_ue_pusch(rnti, *last_sched_res);
191+
if (alloc != nullptr) {
192+
break;
193+
}
194+
}
195+
ASSERT_NE(alloc, nullptr);
196+
197+
// Schedule UE removal.
198+
rem_ue(ue_index);
199+
200+
// Keep pushing SRs without ACKing HARQ.
201+
const unsigned UE_REM_TIMEOUT = 1000;
202+
for (unsigned count = 0; count != UE_REM_TIMEOUT and not notif.last_ue_index_deleted.has_value(); ++count) {
203+
this->run_slot();
204+
ASSERT_EQ(find_ue_pusch(rnti, *last_sched_res), nullptr) << "UE UL allocated despite being marked for removal";
205+
206+
const pucch_info* pucch = find_ue_pucch(rnti, *last_sched_res);
207+
if (pucch != nullptr and
208+
(pucch->format == pucch_format::FORMAT_1 and pucch->format_1.sr_bits != sr_nof_bits::no_sr)) {
209+
// UCI indication sets SR indication.
210+
uci_indication uci;
211+
uci.cell_index = to_du_cell_index(0);
212+
uci.slot_rx = last_result_slot();
213+
uci_indication::uci_pdu::uci_pucch_f0_or_f1_pdu f0;
214+
f0.sr_detected = true;
215+
f0.ul_sinr = 10;
216+
uci.ucis.push_back(uci_indication::uci_pdu{.ue_index = ue_index, .crnti = rnti, .pdu = f0});
217+
this->sched->handle_uci_indication(uci);
218+
}
219+
}
220+
221+
ASSERT_TRUE(notif.last_ue_index_deleted.has_value()) << "UE has not been deleted";
222+
ASSERT_EQ(notif.last_ue_index_deleted, ue_index);
223+
}

0 commit comments

Comments
 (0)