aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-21 18:00:54 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-08-21 19:02:18 +0200
commit076f5c794d4af02914cd633671176437367b5af8 (patch)
treed18af5497748339a9009ad0ef0bd52362df5c6b7 /tests
parent537b149828be91189f99acc8d9c655b8a75b95ee (diff)
tbf/test: Fix existing tests
This commit fixes several issues: - Set MS class in request - Set IMSI in establish_ul_tbf_two_phase - Fake assigment acknowledgement in establish_ul_tbf_two_phase - Fix TFI bit offset to 1 (was 2) Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests')
-rw-r--r--tests/tbf/TbfTest.cpp63
-rw-r--r--tests/tbf/TbfTest.err62
2 files changed, 114 insertions, 11 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index f3b749f..568b49d 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -205,7 +205,7 @@ static void send_rlc_block(struct gprs_rlcmac_bts *bts,
uint8_t trx_no, uint8_t ts_no, uint16_t arfcn,
uint32_t *fn, uint8_t *block_nr)
{
- gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, 0, *fn, *block_nr);
+ gprs_rlcmac_rcv_rts_block(bts, trx_no, ts_no, arfcn, *fn, *block_nr);
*fn = fn_add_blocks(*fn, 1);
*block_nr += 1;
}
@@ -600,6 +600,17 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
ulreq.u.Packet_Resource_Request.PayloadType = GPRS_RLCMAC_CONTROL_BLOCK;
ulreq.u.Packet_Resource_Request.ID.UnionType = 1; /* != 0 */
ulreq.u.Packet_Resource_Request.ID.u.TLLI = tlli;
+ ulreq.u.Packet_Resource_Request.Exist_MS_Radio_Access_capability = 1;
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ Count_MS_RA_capability_value = 1;
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ MS_RA_capability_value[0].u.Content.Exist_Multislot_capability = 1;
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ MS_RA_capability_value[0].u.Content.Multislot_capability.
+ Exist_GPRS_multislot_class = 1;
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ MS_RA_capability_value[0].u.Content.Multislot_capability.
+ GPRS_multislot_class = ms_class;
encode_gsm_rlcmac_uplink(rlc_block, &ulreq);
num_bytes = bitvec_pack(rlc_block, &buf[0]);
@@ -619,10 +630,18 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
rts_bn = fn2bn(*fn);
send_rlc_block(bts, trx_no, ts_no, 0, fn, &rts_bn);
+ /* TODO: send real acknowledgement */
+ /* Fake acknowledgement */
+ OSMO_ASSERT(ul_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_WAIT_ACK);
+ ul_tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_NONE;
+ ul_tbf->ul_ack_state = GPRS_RLCMAC_UL_ACK_NONE;
+ ul_tbf->set_state(GPRS_RLCMAC_FLOW);
+ check_tbf(ul_tbf);
+
/* send fake data */
uint8_t data_msg[23] = {
- 0x00, /* GPRS_RLCMAC_DATA_BLOCK << 6 */
- uint8_t(0 | (tfi << 2)),
+ 0x00 | 0xf << 2, /* GPRS_RLCMAC_DATA_BLOCK << 6, CV = 15 */
+ uint8_t(0 | (tfi << 1)),
uint8_t(1), /* BSN:7, E:1 */
};
@@ -636,12 +655,45 @@ static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase(BTS *the_bts,
return ul_tbf;
}
+static void send_dl_data(BTS *the_bts, uint32_t tlli, const char *imsi,
+ const uint8_t *data, unsigned data_size)
+{
+ GprsMs *ms, *ms2;
+ gprs_rlcmac_dl_tbf *dl_tbf = NULL;
+
+ ms = the_bts->ms_store().get_ms(tlli, 0, imsi);
+ if (ms)
+ dl_tbf = ms->dl_tbf();
+
+ gprs_rlcmac_dl_tbf::handle(the_bts->bts_data(), tlli, 0, imsi, 0,
+ 1000, data, data_size);
+
+ ms = the_bts->ms_by_imsi(imsi);
+ OSMO_ASSERT(ms != NULL);
+ OSMO_ASSERT(ms->dl_tbf() != NULL);
+ dl_tbf = ms->dl_tbf();
+
+ if (imsi[0] && strcmp(imsi, "000") != 0) {
+ ms2 = the_bts->ms_by_tlli(tlli);
+ OSMO_ASSERT(ms == ms2);
+ }
+
+ if (dl_tbf->state_is(GPRS_RLCMAC_ASSIGN)) {
+ /* The DL TBF is new, fake establishment */
+ dl_tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_NONE;
+ dl_tbf->set_state(GPRS_RLCMAC_FLOW);
+ dl_tbf->m_wait_confirm = 0;
+ check_tbf(dl_tbf);
+ }
+}
+
static void test_tbf_single_phase()
{
BTS the_bts;
int ts_no = 7;
uint32_t fn = 2654167; /* 17,25,9 */
uint32_t tlli = 0xf1223344;
+ const char *imsi = "0011223344";
uint16_t qta = 31;
gprs_rlcmac_ul_tbf *ul_tbf;
GprsMs *ms;
@@ -656,6 +708,8 @@ static void test_tbf_single_phase()
fprintf(stderr, "Got '%s', TA=%d\n", ul_tbf->name(), ul_tbf->ta());
fprintf(stderr, "Got MS: TLLI = 0x%08x, TA = %d\n", ms->tlli(), ms->ta());
+ send_dl_data(&the_bts, tlli, imsi, (const uint8_t *)"TEST", 4);
+
printf("=== end %s ===\n", __func__);
}
@@ -666,6 +720,7 @@ static void test_tbf_two_phase()
uint32_t fn = 2654218;
uint16_t qta = 31;
uint32_t tlli = 0xf1223344;
+ const char *imsi = "0011223344";
uint8_t ms_class = 1;
gprs_rlcmac_ul_tbf *ul_tbf;
GprsMs *ms;
@@ -680,6 +735,8 @@ static void test_tbf_two_phase()
fprintf(stderr, "Got '%s', TA=%d\n", ul_tbf->name(), ul_tbf->ta());
fprintf(stderr, "Got MS: TLLI = 0x%08x, TA = %d\n", ms->tlli(), ms->ta());
+ send_dl_data(&the_bts, tlli, imsi, (const uint8_t *)"TEST", 4);
+
printf("=== end %s ===\n", __func__);
}
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index c34d6a0..58cb4a9 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -1409,6 +1409,30 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) changes state from FLOW to FINISHED
- Scheduling Ack/Nack, because last block has CV==0.
Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FINISHED)', TA=7
Got MS: TLLI = 0xf1223344, TA = 7
+********** TBF starts here **********
+Allocating DL TBF: MS_CLASS=0
+Slot Allocation (Algorithm A) for class 0
+- Skipping TS 0, because not enabled
+- Skipping TS 1, because not enabled
+- Skipping TS 2, because not enabled
+- Skipping TS 3, because not enabled
+- Skipping TS 4, because not enabled
+- Skipping TS 5, because not enabled
+- Skipping TS 6, because not enabled
+- Assign downlink TS=7 TFI=0
+PDCH(TS 7, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001.
+- Setting Control TS 7
+Attaching TBF to MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL)
+Allocated TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80
+Modifying MS object, TLLI: 0xf1223344 confirmed
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) [DOWNLINK] START
+Modifying MS object, TLLI = 0xf1223344, IMSI '' -> '0011223344'
+Send dowlink assignment for TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) on PCH, no TBF exist (IMSI=0011223344)
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) changes state from NULL to ASSIGN
+TX: START TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) Immediate Assignment Downlink (PCH)
+Sending data request: trx=0 ts=0 sapi=3 arfcn=0 fn=0 block=0 data=33 34 34 2d 06 3f 30 0f 00 00 7d 80 00 07 00 df 12 23 34 48 00 23 2b 2b 2b 2b
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) append
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) changes state from ASSIGN to FLOW
Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654218 block=8 data=47 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
MS requests UL TBF on RACH, so we provide one:
MS requests single block allocation
@@ -1420,11 +1444,11 @@ Searching for first unallocated TFI: TRX=0
+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++
------------------------- RX : Uplink Control Block -------------------------
MS requests UL TBF in packet resource request of single block, so we provide one:
-MS does not give us a class.
********** TBF starts here **********
-Allocating UL TBF: MS_CLASS=0
+Allocating UL TBF: MS_CLASS=1
Creating MS object, TLLI = 0x00000000
-Slot Allocation (Algorithm A) for class 0
+Modifying MS object, TLLI = 0x00000000, MS class 0 -> 1
+Slot Allocation (Algorithm A) for class 1
- Skipping TS 0, because not enabled
- Skipping TS 1, because not enabled
- Skipping TS 2, because not enabled
@@ -1447,16 +1471,38 @@ TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN)s start Packet Uplink Assignment (
------------------------- TX : Packet Uplink Assignment -------------------------
Scheduling control message at RTS for TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) (TRX=0, TS=7)
Sending data request: trx=0 ts=7 sapi=5 arfcn=0 fn=2654270 block=8 data=4f 28 5e 24 46 68 8f 1d 00 00 88 00 08 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) changes state from ASSIGN to FLOW
UL DATA TFI=0 received (V(Q)=0 .. V(R)=0)
-TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) restarting timer 3169 while old timer 3169 pending
+TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) restarting timer 3169 while old timer 3169 pending
- BSN 0 storing in window (0..63)
- Raising V(R) to 1
- Taking block 0 out, raising V(Q) to 1
- Assembling frames: (len=23)
-- Frame 1 starts at offset 0
- Data length after length fields: 20
-TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) complete UL frame that fits precisely in last block: len=20
-LLC [PCU -> SGSN] TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN) len=20
-No bctx
-Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=ASSIGN)', TA=7
+- No gaps in received block, last block: BSN=0 CV=15
+Got 'TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW)', TA=7
Got MS: TLLI = 0xf1223344, TA = 7
+********** TBF starts here **********
+Allocating DL TBF: MS_CLASS=0
+Slot Allocation (Algorithm A) for class 0
+- Skipping TS 0, because not enabled
+- Skipping TS 1, because not enabled
+- Skipping TS 2, because not enabled
+- Skipping TS 3, because not enabled
+- Skipping TS 4, because not enabled
+- Skipping TS 5, because not enabled
+- Skipping TS 6, because not enabled
+- Assign downlink TS=7 TFI=0
+PDCH(TS 7, TRX 0): Attaching TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL), 1 TBFs, USFs = 01, TFIs = 00000001.
+- Setting Control TS 7
+Attaching TBF to MS object, TLLI = 0xf1223344, TBF = TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL)
+Allocated TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL): trx = 0, ul_slots = 80, dl_slots = 80
+Modifying MS object, TLLI: 0xf1223344 confirmed
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) [DOWNLINK] START
+Modifying MS object, TLLI = 0xf1223344, IMSI '' -> '0011223344'
+Send dowlink assignment on PACCH, because TBF(TFI=0 TLLI=0xf1223344 DIR=UL STATE=FLOW) exists
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=NULL) changes state from NULL to ASSIGN
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) starting timer 0.
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) append
+TBF(TFI=0 TLLI=0xf1223344 DIR=DL STATE=ASSIGN) changes state from ASSIGN to FLOW