aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tbf/TbfTest.cpp
diff options
context:
space:
mode:
authorAravind Sirsikar <Arvind.Sirsikar@radisys.com>2016-08-25 16:37:30 +0530
committerAravind Sirsikar <Arvind.Sirsikar@radisys.com>2016-08-25 16:37:30 +0530
commit02352b487ac6808b6adb8e8623f0921aad7f02d7 (patch)
tree1d00e728b55868aad7a175f38fe43616dfdf5893 /tests/tbf/TbfTest.cpp
parent50b097003baac3903c9d52a609b091c76ca83e3c (diff)
EGPRS: PUAN encoding: add test case to show wrong urbb_len issue
This patch adds a test case which expects a current bug with EGPRS PUAN encoding when VQ != VR. The test's expectation is corrected along with the bugfix in a subsequent commit Adds test_tbf_puan_urbb_len to describe the following bug: EGPRS PUAN encoding disregards the urbb_len, leading to identical PUAN messages regardless of the urbb_len. Related: OS#1793 Change-Id: I00662a564f64c0c83627401ae8f7bfef0f0a5de8
Diffstat (limited to 'tests/tbf/TbfTest.cpp')
-rw-r--r--tests/tbf/TbfTest.cpp179
1 files changed, 179 insertions, 0 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 5e45506d..8ec1dccb 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -618,6 +618,149 @@ static void send_control_ack(gprs_rlcmac_tbf *tbf)
&ulreq, tbf->poll_fn);
}
+static gprs_rlcmac_ul_tbf *puan_urbb_len_issue(BTS *the_bts,
+ uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
+ uint8_t ms_class, uint8_t egprs_ms_class)
+{
+ GprsMs *ms;
+ uint32_t rach_fn = *fn - 51;
+ uint32_t sba_fn = *fn + 52;
+ uint8_t trx_no = 0;
+ int tfi = 0, i = 0;
+ gprs_rlcmac_ul_tbf *ul_tbf;
+ struct gprs_rlcmac_pdch *pdch;
+ gprs_rlcmac_bts *bts;
+ RlcMacUplink_t ulreq = {0};
+ struct pcu_l1_meas meas;
+ struct gprs_rlc_ul_header_egprs_3 *egprs3 = NULL;
+ GprsCodingScheme cs;
+
+ meas.set_rssi(31);
+ bts = the_bts->bts_data();
+
+ /* needed to set last_rts_fn in the PDCH object */
+ request_dl_rlc_block(bts, trx_no, ts_no, fn);
+
+ /*
+ * simulate RACH, this sends an Immediate
+ * Assignment Uplink on the AGCH
+ */
+ the_bts->rcv_rach(0x73, rach_fn, qta);
+
+ /* get next free TFI */
+ tfi = the_bts->tfi_find_free(GPRS_RLCMAC_UL_TBF, &trx_no, -1);
+
+ /* fake a resource request */
+ ulreq.u.MESSAGE_TYPE = MT_PACKET_RESOURCE_REQUEST;
+ 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;
+ if (egprs_ms_class) {
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ MS_RA_capability_value[0].u.Content.
+ Multislot_capability.Exist_EGPRS_multislot_class = 1;
+ ulreq.u.Packet_Resource_Request.MS_Radio_Access_capability.
+ MS_RA_capability_value[0].u.Content.
+ Multislot_capability.EGPRS_multislot_class = ms_class;
+ }
+
+ send_ul_mac_block(the_bts, trx_no, ts_no, &ulreq, sba_fn);
+
+ /* check the TBF */
+ ul_tbf = the_bts->ul_tbf_by_tfi(tfi, trx_no, ts_no);
+ OSMO_ASSERT(ul_tbf);
+ OSMO_ASSERT(ul_tbf->ta() == qta / 4);
+
+ /* send packet uplink assignment */
+ *fn = sba_fn;
+ request_dl_rlc_block(ul_tbf, fn);
+
+ /* send real acknowledgement */
+ send_control_ack(ul_tbf);
+
+ check_tbf(ul_tbf);
+ /* send fake data */
+ uint8_t data_msg[42] = {
+ 0xf << 2, /* GPRS_RLCMAC_DATA_BLOCK << 6, CV = 15 */
+ tfi << 1,
+ 1, /* BSN:7, E:1 */
+ };
+
+ pdch = &the_bts->bts_data()->trx[trx_no].pdch[ts_no];
+ pdch->rcv_block(&data_msg[0], 23, *fn, &meas);
+
+ ms = the_bts->ms_by_tlli(tlli);
+ OSMO_ASSERT(ms != NULL);
+ OSMO_ASSERT(ms->ta() == qta/4);
+ OSMO_ASSERT(ms->ul_tbf() == ul_tbf);
+
+ /*
+ * TS 44.060, B.8.1
+ * first seg received first, later second seg
+ */
+ cs = GprsCodingScheme::MCS3;
+ egprs3 = (struct gprs_rlc_ul_header_egprs_3 *) data_msg;
+ egprs3->si = 0;
+ egprs3->r = 1;
+ egprs3->cv = 7;
+ egprs3->tfi_hi = tfi & 0x03;
+ egprs3->tfi_lo = (tfi & 0x1c) >> 2;
+ egprs3->bsn1_hi = 1;
+ egprs3->bsn1_lo = 0;
+ egprs3->cps_hi = 1;
+ data_msg[3] = 0xff;
+ egprs3->pi = 0;
+ egprs3->cps_lo = 1;
+ egprs3->rsb = 0;
+ egprs3->spb = 0;
+ egprs3->pi = 0;
+
+ pdch->rcv_block(data_msg, 42, *fn, &meas);
+
+ struct msgb *msg1 = ul_tbf->create_ul_ack(*fn, ts_no);
+
+ OSMO_ASSERT(!strcmp(osmo_hexdump(msg1->data, msg1->data_len),
+ "40 24 01 3f 3e 24 46 68 90 87 b0 06 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b "
+ ));
+
+ egprs3->si = 0;
+ egprs3->r = 1;
+ egprs3->cv = 7;
+ egprs3->tfi_hi = tfi & 0x03;
+ egprs3->tfi_lo = (tfi & 0x1c) >> 2;
+ egprs3->bsn1_hi = 4;
+ egprs3->bsn1_lo = 0;
+ egprs3->cps_hi = 1;
+ data_msg[3] = 0xff;
+ egprs3->pi = 0;
+ egprs3->cps_lo = 1;
+ egprs3->rsb = 0;
+ egprs3->spb = 0;
+
+ pdch->rcv_block(data_msg, 42, *fn, &meas);
+
+ msg1 = ul_tbf->create_ul_ack(*fn, ts_no);
+
+ /* TODO: Need to modify the assert */
+ OSMO_ASSERT(!strcmp(osmo_hexdump(msg1->data, msg1->data_len),
+ "40 24 01 3f 3e 24 46 68 90 87 b0 06 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b "
+ ));
+
+ return ul_tbf;
+}
+
static gprs_rlcmac_ul_tbf *establish_ul_tbf_two_phase_spb(BTS *the_bts,
uint8_t ts_no, uint32_t tlli, uint32_t *fn, uint16_t qta,
uint8_t ms_class, uint8_t egprs_ms_class)
@@ -1631,6 +1774,41 @@ static void test_tbf_ws()
gprs_bssgp_destroy();
}
+static void test_tbf_puan_urbb_len(void)
+{
+ BTS the_bts;
+ int ts_no = 7;
+ uint32_t fn = 2654218;
+ uint16_t qta = 31;
+ uint32_t tlli = 0xf1223344;
+ const char *imsi = "0011223344";
+ uint8_t ms_class = 1;
+ uint8_t egprs_ms_class = 1;
+ gprs_rlcmac_ul_tbf *ul_tbf;
+ GprsMs *ms;
+ uint8_t test_data[256];
+
+ printf("=== start %s ===\n", __func__);
+
+ memset(test_data, 1, sizeof(test_data));
+
+ setup_bts(&the_bts, ts_no, 4);
+ the_bts.bts_data()->initial_mcs_dl = 9;
+ the_bts.bts_data()->egprs_enabled = 1;
+
+ ul_tbf = puan_urbb_len_issue(&the_bts, ts_no, tlli, &fn, qta,
+ ms_class, egprs_ms_class);
+
+ ms = ul_tbf->ms();
+ 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, test_data, sizeof(test_data));
+
+ printf("=== end %s ===\n", __func__);
+}
+
static void test_tbf_egprs_two_phase_spb(void)
{
BTS the_bts;
@@ -2306,6 +2484,7 @@ int main(int argc, char **argv)
test_tbf_egprs_dl();
test_tbf_egprs_retx_dl();
test_tbf_egprs_spb_dl();
+ test_tbf_puan_urbb_len();
if (getenv("TALLOC_REPORT_FULL"))
talloc_report_full(tall_pcu_ctx, stderr);