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
Mon Feb 18 19:57:11 UTC 2019


Max has uploaded this change for review. ( 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, 61 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/47/12947/1

diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 5a6338f..2536901 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -431,6 +431,58 @@
 	}
 }
 
+static void check_imm_ass(struct gprs_rlcmac_tbf *tbf, bool dl, enum ph_burst_type bt, const uint8_t *exp, uint8_t len)
+{
+	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", plen, dl ? "DL" : "UL",
+	       osmo_hexdump_nospc(immediate_assignment->data, sz));
+
+	memcpy(msgb_put(m, sz), immediate_assignment->data, sz);
+	if (!msgb_eq_data_print(m, exp, len))
+		printf("%s(%s) failed!", __func__, dl ? "DL" : "UL");
+}
+
+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, 0x30, 0x0d, 0x23, 0x6d, 0x7f, 0x03, 0x18, 0x23,
+				 0x00, 0xd0, 0x00, 0x00, 0x00, 0x08, 0x17, 0x47, 0x08, 0x0b, 0x5b, 0x2b, 0x2b, };
+
+	check_imm_ass(tbf, true, GSM_L1_BURST_TYPE_ACCESS_2, res, ARRAY_SIZE(res));
+}
+
+void test_immediate_assign_ul0()
+{
+	static uint8_t res[] = { 0x06, 0x3f, 0x10, 0x0d, 0x23, 0x6d, 0x0d, 0x03, 0x18, 0x23,
+				 0x00, 0xc5, 0xd1, 0x08, 0x0b, 0x5b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(NULL, false, GSM_L1_BURST_TYPE_ACCESS_0, res, ARRAY_SIZE(res));
+}
+
+void test_immediate_assign_ul1()
+{
+	static uint8_t res[] = { 0x06, 0x3f, 0x10, 0x0d, 0x23, 0x6d, 0x7f, 0x03, 0x18, 0x23,
+				 0x00, 0x46, 0x97, 0x40, 0x0b, 0x58, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, 0x2b, };
+
+	check_imm_ass(NULL, false, GSM_L1_BURST_TYPE_ACCESS_1, res, ARRAY_SIZE(res));
+}
+
 void test_immediate_assign_rej()
 {
 	uint8_t plen;
@@ -496,6 +548,9 @@
 	test_rlc_v_b();
 	test_rlc_v_n();
 	test_rlc_dl_ul_basic();
+	test_immediate_assign_dl();
+	test_immediate_assign_ul0();
+	test_immediate_assign_ul1();
 	test_immediate_assign_rej();
 	test_lsb();
 
diff --git a/tests/types/TypesTest.err b/tests/types/TypesTest.err
index e69de29..038598f 100644
--- a/tests/types/TypesTest.err
+++ b/tests/types/TypesTest.err
@@ -0,0 +1,3 @@
+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
diff --git a/tests/types/TypesTest.ok b/tests/types/TypesTest.ok
index 4bdd917..53aa5b1 100644
--- a/tests/types/TypesTest.ok
+++ b/tests/types/TypesTest.ok
@@ -6,6 +6,9 @@
 rbb: 10 00 00 00 00 00 00 01 
 show_rbb: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
 show_rbb: IIRRIIIR
+[11] DL Immediate Assignment: 063f300d236d7f03182300d0000000081747080b5b2b2b
+[11] UL Immediate Assignment: 063f100d236d0d03182300c5d1080b5b2b2b2b2b2b2b2b
+[11] UL Immediate Assignment: 063f100d236d7f031823004697400b582b2b2b2b2b2b2b
 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: newchange
Gerrit-Change-Id: I63f4654b23c7c4f063f6b3254d77157fac798586
Gerrit-Change-Number: 12947
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190218/7af80b87/attachment.htm>


More information about the gerrit-log mailing list