diff options
Diffstat (limited to 'tests/tbf')
-rw-r--r-- | tests/tbf/TbfTest.cpp | 70 | ||||
-rw-r--r-- | tests/tbf/TbfTest.err | 60 | ||||
-rw-r--r-- | tests/tbf/TbfTest.ok | 2 |
3 files changed, 132 insertions, 0 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index c7393f4a..5bc492ec 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -427,6 +427,75 @@ static void test_tbf_exhaustion() gprs_bssgp_destroy(); } +static void test_tbf_dl_llc_loss() +{ + BTS the_bts; + gprs_rlcmac_bts *bts; + uint8_t ts_no = 4; + uint8_t ms_class = 45; + int rc = 0; + uint32_t tlli = 0xc0123456; + const char *imsi = "001001000123456"; + unsigned delay_csec = 1000; + GprsMs *ms; + + uint8_t buf[19]; + + printf("=== start %s ===\n", __func__); + + bts = the_bts.bts_data(); + setup_bts(&the_bts, ts_no); + bts->ms_idle_sec = 10; /* keep the MS object */ + + gprs_bssgp_create_and_connect(bts, 33001, 0, 33001, + 1234, 1234, 1234, 1, 1, 0, 0, 0); + + /* Handle LLC frame 1 */ + memset(buf, 1, sizeof(buf)); + rc = gprs_rlcmac_dl_tbf::handle(bts, tlli, 0, imsi, ms_class, + delay_csec, buf, sizeof(buf)); + OSMO_ASSERT(rc >= 0); + + ms = the_bts.ms_store().get_ms(0, 0, imsi); + OSMO_ASSERT(ms != NULL); + OSMO_ASSERT(ms->dl_tbf() != NULL); + + /* Handle LLC frame 2 */ + memset(buf, 2, sizeof(buf)); + rc = gprs_rlcmac_dl_tbf::handle(bts, tlli, 0, imsi, ms_class, + delay_csec, buf, sizeof(buf)); + OSMO_ASSERT(rc >= 0); + + /* TBF establishment fails (timeout) */ + tbf_free(ms->dl_tbf()); + + /* Handle LLC frame 3 */ + memset(buf, 3, sizeof(buf)); + rc = gprs_rlcmac_dl_tbf::handle(bts, tlli, 0, imsi, ms_class, + delay_csec, buf, sizeof(buf)); + OSMO_ASSERT(rc >= 0); + + OSMO_ASSERT(ms->dl_tbf() != NULL); + + /* Get first BSN */ + struct msgb *msg; + int fn = 0; + uint8_t expected_data = 1; + + while (ms->dl_tbf()->have_data()) { + msg = ms->dl_tbf()->create_dl_acked_block(fn += 4, 7); + fprintf(stderr, "MSG = %s\n", msgb_hexdump(msg)); + OSMO_ASSERT(msgb_length(msg) == 23); + /* OSMO_ASSERT(msgb_data(msg)[10] == expected_data); */ + expected_data += 1; + } + /* OSMO_ASSERT(expected_data-1 == 3); */ + + printf("=== end %s ===\n", __func__); + + gprs_bssgp_destroy(); +} + static void test_tbf_single_phase() { BTS the_bts; @@ -605,6 +674,7 @@ int main(int argc, char **argv) test_tbf_delayed_release(); test_tbf_imsi(); test_tbf_exhaustion(); + test_tbf_dl_llc_loss(); test_tbf_single_phase(); test_tbf_two_phase(); diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err index 65387241..fe1b6adf 100644 --- a/tests/tbf/TbfTest.err +++ b/tests/tbf/TbfTest.err @@ -1108,6 +1108,66 @@ Searching for first unallocated TFI: TRX=0 first TS=4 No TFI available. No PDCH resource BSSGP (BVCI=1234) Tx LLC-DISCARDED TLLI=0xc0000020, FRAMES=1, OCTETS=256 +Searching for first unallocated TFI: TRX=0 first TS=4 + Found TFI=0. +********** TBF starts here ********** +Allocating DL TBF: TFI=0 TRX=0 MS_CLASS=45 +Slot Allocation (Algorithm A) for class 45 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Assign downlink TS=4 +- Setting Control TS 4 +Creating MS object, TLLI = 0x00000000 +The MS object cannot fully confirm an unexpected TLLI: 0xc0123456, partly confirmed +Modifying MS object, TLLI = 0xc0123456, MS class 0 -> 45 +Attaching TBF to MS object, TLLI = 0xc0123456, TBF = TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) [DOWNLINK] START +Modifying MS object, TLLI = 0xc0123456, IMSI '' -> '001001000123456' +Send dowlink assignment for TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) on PCH, no TBF exist (IMSI=001001000123456) +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) changes state from NULL to ASSIGN +TX: START TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Immediate Assignment Downlink (PCH) +Sending data request: trx=0 ts=0 sapi=3 arfcn=0 fn=0 block=0 data=34 35 36 2d 06 3f 30 0c 00 00 7d 80 00 00 00 dc 01 23 45 68 00 23 2b 2b 2b 2b +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) append +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) free +Detaching TBF from MS object, TLLI = 0xc0123456, TBF = TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) +********** TBF ends here ********** +Searching for first unallocated TFI: TRX=0 first TS=4 + Found TFI=0. +********** TBF starts here ********** +Allocating DL TBF: TFI=0 TRX=0 MS_CLASS=45 +Slot Allocation (Algorithm A) for class 45 +- Skipping TS 0, because not enabled +- Skipping TS 1, because not enabled +- Skipping TS 2, because not enabled +- Skipping TS 3, because not enabled +- Assign downlink TS=4 +- Setting Control TS 4 +Attaching TBF to MS object, TLLI = 0xc0123456, TBF = TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) [DOWNLINK] START +Send dowlink assignment for TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) on PCH, no TBF exist (IMSI=001001000123456) +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=NULL) changes state from NULL to ASSIGN +TX: START TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) Immediate Assignment Downlink (PCH) +Sending data request: trx=0 ts=0 sapi=3 arfcn=0 fn=0 block=0 data=34 35 36 2d 06 3f 30 0c 00 00 7d 80 00 00 00 dc 01 23 45 68 00 23 2b 2b 2b 2b +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) downlink (V(A)==0 .. V(S)==0) +- Sending new block at BSN 0, CS=1 +-- Chunk with length 19 is less than remaining space (20): add length header to to delimit LLC frame +Complete DL frame for TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN)len=19 +- Dequeue next LLC for TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) (len=19) +-- No space left, so we are done. +data block: 07 00 00 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 +MSG = 07 00 00 4d 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) downlink (V(A)==0 .. V(S)==1) +- Sending new block at BSN 1, CS=1 +-- Chunk with length 19 is less than remaining space (20): add length header to to delimit LLC frame +Complete DL frame for TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN)len=19 +-- Final block, so we done. +TBF(TFI=0 TLLI=0xc0123456 DIR=DL STATE=ASSIGN) changes state from ASSIGN to FINISHED +data block: 07 01 02 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 +- Scheduling Ack/Nack polling, because is was requested explicitly (e.g. first final block sent). +Polling cannot be sheduled in this TS 7, waiting for TS 4 +MSG = 07 01 02 4d 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 Searching for first unallocated TFI: TRX=0 first TS=7 Found TFI=0. MS requests UL TBF on RACH, so we provide one: diff --git a/tests/tbf/TbfTest.ok b/tests/tbf/TbfTest.ok index 831a3dd3..8c2c0e77 100644 --- a/tests/tbf/TbfTest.ok +++ b/tests/tbf/TbfTest.ok @@ -4,6 +4,8 @@ === end test_tbf_imsi === === start test_tbf_exhaustion === === end test_tbf_exhaustion === +=== start test_tbf_dl_llc_loss === +=== end test_tbf_dl_llc_loss === === start test_tbf_single_phase === === end test_tbf_single_phase === === start test_tbf_two_phase === |