Change in osmo-pcu[master]: Add encoding tests for Immediate Assignment

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Feb 20 23:30:08 UTC 2019


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/12947 )

Change subject: Add encoding tests for Immediate Assignment
......................................................................

Add encoding tests for Immediate Assignment

Change-Id: I63f4654b23c7c4f063f6b3254d77157fac798586
---
M tests/types/TypesTest.cpp
M tests/types/TypesTest.err
M tests/types/TypesTest.ok
3 files changed, 152 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, but someone else must approve



diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 90d3981..9c24ffe 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -431,6 +431,134 @@
 	}
 }
 
+static void check_imm_ass(struct gprs_rlcmac_tbf *tbf, bool dl, enum ph_burst_type bt, const uint8_t *exp, uint8_t len,
+			  const char *kind)
+{
+	uint8_t alpha = 7, gamma = 8, ta = 35, ts = 5, tsc = 1, usf = 1, sz = sizeof(DUMMY_VEC) / 2, plen;
+	bitvec *immediate_assignment = bitvec_alloc(sz, tall_pcu_ctx);
+	struct msgb *m = msgb_alloc(80, "test");
+	bool poll = true;
+	uint16_t ra = 13, arfcn = 877;
+	uint32_t ref_fn = 24, fn = 11;
+	int8_t ta_idx = 0;
+
+	bitvec_unhex(immediate_assignment, DUMMY_VEC);
+	plen = Encoding::write_immediate_assignment(tbf, immediate_assignment, dl,
+						    ra, ref_fn, ta, arfcn, ts, tsc, usf,
+						    poll, fn, alpha, gamma, ta_idx, bt);
+	printf("[%u] %s Immediate Assignment <%s>:\n\t%s\n", plen, dl ? "DL" : "UL", kind,
+	       osmo_hexdump(immediate_assignment->data, sz));
+
+	memcpy(msgb_put(m, sz), immediate_assignment->data, sz);
+	if (!msgb_eq_data_print(m, exp, len))
+		printf("%s(%s, %s) failed!\n", __func__, dl ? "DL" : "UL", kind);
+
+	msgb_free(m);
+}
+
+void test_immediate_assign_dl()
+{
+	BTS the_bts;
+	the_bts.bts_data()->alloc_algorithm = alloc_algorithm_a;
+	the_bts.bts_data()->trx[0].pdch[2].enable();
+	the_bts.bts_data()->trx[0].pdch[3].enable();
+
+	struct gprs_rlcmac_tbf *tbf = tbf_alloc_dl_tbf(the_bts.bts_data(), NULL, 0, 1, 1, false);
+	static uint8_t res[] = { 0x06,
+				 0x3f, /* Immediate Assignment Message Type */
+				 0x30, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */
+				 0x0d, 0x23, 0x6d, /* §10.5.2.25a Packet Channel Description */
+				 /* ETSI TS 44.018 §10.5.2.30 Request Reference */
+				 0x7f, /* RA */
+				 0x03, 0x18, /* T1'-T3 */
+				 0x23, /* TA */
+				 0x00, /* 0-length §10.5.2.21 Mobile Allocation */
+				 /* ETSI TS 44.018 §10.5.2.16 IA Rest Octets */
+				 0xd0, 0x00, 0x00, 0x00, 0x08, 0x17, 0x47, 0x08, 0x0b, 0x5b, 0x2b, 0x2b, };
+
+	check_imm_ass(tbf, true, GSM_L1_BURST_TYPE_ACCESS_2, res, sizeof(res), "ia_rest_downlink");
+}
+
+void test_immediate_assign_ul0m()
+{
+	BTS the_bts;
+	the_bts.bts_data()->alloc_algorithm = alloc_algorithm_a;
+	the_bts.bts_data()->trx[0].pdch[4].enable();
+	the_bts.bts_data()->trx[0].pdch[5].enable();
+
+	struct gprs_rlcmac_tbf *tbf = tbf_alloc_ul_tbf(the_bts.bts_data(), NULL, 0, 1, 1, false);
+	static uint8_t res[] = { 0x06,
+				 0x3f, /* Immediate Assignment Message Type */
+				 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */
+				 0x0d, 0x23, 0x6d, /* §10.5.2.25a Packet Channel Description */
+				 /* ETSI TS 44.018 §10.5.2.30 Request Reference */
+				 0x0d, /* RA */
+				 0x03, 0x18, /* T1'-T3 */
+				 0x23, /* TA */
+				 0x00, /* 0-length §10.5.2.21 Mobile Allocation */
+				 /* ETSI TS 44.018 §10.5.2.16 IA Rest Octets */
+				 0xc8, 0x02, 0x7b, 0xa0, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(tbf, false, GSM_L1_BURST_TYPE_ACCESS_0, res, sizeof(res), "ia_rest_uplink(MBA)");
+}
+
+void test_immediate_assign_ul0s()
+{
+	static uint8_t res[] = { 0x06,
+				 0x3f, /* Immediate Assignment Message Type */
+				 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */
+				 0x0d, 0x23, 0x6d, /* §10.5.2.25a Packet Channel Description */
+				 /* ETSI TS 44.018 §10.5.2.30 Request Reference */
+				 0x0d, /* RA */
+				 0x03, 0x18, /* T1'-T3 */
+				 0x23, /* TA */
+				 0x00, /* 0-length §10.5.2.21 Mobile Allocation */
+				 /* ETSI TS 44.018 §10.5.2.16 IA Rest Octets */
+				 0xc5, 0xd1, 0x08, 0x0b, 0x5b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(NULL, false, GSM_L1_BURST_TYPE_ACCESS_0, res, sizeof(res), "ia_rest_uplink(SBA)");
+}
+
+void test_immediate_assign_ul1s()
+{
+	BTS the_bts;
+	the_bts.bts_data()->alloc_algorithm = alloc_algorithm_a;
+	the_bts.bts_data()->trx[0].pdch[1].enable();
+	the_bts.bts_data()->trx[0].pdch[2].enable();
+
+	struct gprs_rlcmac_tbf *tbf = tbf_alloc_ul_tbf(the_bts.bts_data(), NULL, 0, 1, 1, false);
+	static uint8_t res[] = { 0x06,
+				 0x3f, /* Immediate Assignment Message Type */
+				 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */
+				 0x0d, 0x23, 0x6d, /* §10.5.2.25a Packet Channel Description */
+				 /* ETSI TS 44.018 §10.5.2.30 Request Reference */
+				 0x7f, /* RA */
+				 0x03, 0x18, /* T1'-T3 */
+				 0x23, /* TA */
+				 0x00, /* 0-length §10.5.2.21 Mobile Allocation */
+				 /* ETSI TS 44.018 §10.5.2.16 IA Rest Octets */
+				 0x46, 0xa0, 0x09, 0xe0, 0x17, 0x40, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(tbf, false, GSM_L1_BURST_TYPE_ACCESS_1, res, sizeof(res), "ia_rest_egprs_uplink(SBA)");
+}
+
+void test_immediate_assign_ul1m()
+{
+	static uint8_t res[] = { 0x06,
+				 0x3f, /* Immediate Assignment Message Type */
+				 0x10, /* §10.5.2.26 Page Mode and §10.5.2.25b Dedicated mode/TBF */
+				 0x0d, 0x23, 0x6d, /* §10.5.2.25a Packet Channel Description */
+				 /* ETSI TS 44.018 §10.5.2.30 Request Reference */
+				 0x7f, /* RA */
+				 0x03, 0x18, /* T1'-T3 */
+				 0x23, /* TA */
+				 0x00, /* 0-length §10.5.2.21 Mobile Allocation */
+				 /* ETSI TS 44.018 §10.5.2.16 IA Rest Octets */
+				 0x46, 0x97, 0x40, 0x0b, 0x58, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(NULL, false, GSM_L1_BURST_TYPE_ACCESS_1, res, sizeof(res), "ia_rest_egprs_uplink(MBA)");
+}
+
 void test_immediate_assign_rej()
 {
 	uint8_t plen;
@@ -496,6 +624,11 @@
 	test_rlc_v_b();
 	test_rlc_v_n();
 	test_rlc_dl_ul_basic();
+	test_immediate_assign_dl();
+	test_immediate_assign_ul0m();
+	test_immediate_assign_ul0s();
+	test_immediate_assign_ul1m();
+	test_immediate_assign_ul1s();
 	test_immediate_assign_rej();
 	test_lsb();
 
diff --git a/tests/types/TypesTest.err b/tests/types/TypesTest.err
index e69de29..3abc61c 100644
--- a/tests/types/TypesTest.err
+++ b/tests/types/TypesTest.err
@@ -0,0 +1,9 @@
+Allocating DL TBF: MS_CLASS=1/1
+TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) Setting Control TS 2
+TBF(TFI=0 TLLI=0x00000000 DIR=DL STATE=NULL) Allocated: trx = 0, ul_slots = 04, dl_slots = 04
+Allocating UL TBF: MS_CLASS=1/1
+TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) Setting Control TS 4
+TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) Allocated: trx = 0, ul_slots = 10, dl_slots = 00
+Allocating UL TBF: MS_CLASS=1/1
+TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) Setting Control TS 1
+TBF(TFI=0 TLLI=0x00000000 DIR=UL STATE=NULL) Allocated: trx = 0, ul_slots = 02, dl_slots = 00
diff --git a/tests/types/TypesTest.ok b/tests/types/TypesTest.ok
index 4bdd917..d4cc255 100644
--- a/tests/types/TypesTest.ok
+++ b/tests/types/TypesTest.ok
@@ -6,6 +6,16 @@
 rbb: 10 00 00 00 00 00 00 01 
 show_rbb: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
 show_rbb: IIRRIIIR
+[11] DL Immediate Assignment <ia_rest_downlink>:
+	06 3f 30 0d 23 6d 7f 03 18 23 00 d0 00 00 00 08 17 47 08 0b 5b 2b 2b 
+[11] UL Immediate Assignment <ia_rest_uplink(MBA)>:
+	06 3f 10 0d 23 6d 0d 03 18 23 00 c8 02 7b a0 2b 2b 2b 2b 2b 2b 2b 2b 
+[11] UL Immediate Assignment <ia_rest_uplink(SBA)>:
+	06 3f 10 0d 23 6d 0d 03 18 23 00 c5 d1 08 0b 5b 2b 2b 2b 2b 2b 2b 2b 
+[11] UL Immediate Assignment <ia_rest_egprs_uplink(MBA)>:
+	06 3f 10 0d 23 6d 7f 03 18 23 00 46 97 40 0b 58 2b 2b 2b 2b 2b 2b 2b 
+[11] UL Immediate Assignment <ia_rest_egprs_uplink(SBA)>:
+	06 3f 10 0d 23 6d 7f 03 18 23 00 46 a0 09 e0 17 40 2b 2b 2b 2b 2b 2b 
 assignment reject: 06 3a 10 7f 06 36 14 7f 06 36 14 7f 06 36 14 7f 06 36 14 c0 2b 2b 
 assignment reject: 06 3a 10 70 06 36 14 70 06 36 14 70 06 36 14 70 06 36 14 0b 2b 2b 
 Testing LBS utility...

-- 
To view, visit https://gerrit.osmocom.org/12947
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I63f4654b23c7c4f063f6b3254d77157fac798586
Gerrit-Change-Number: 12947
Gerrit-PatchSet: 5
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190220/a8a57d45/attachment.htm>


More information about the gerrit-log mailing list