Change in ...osmo-ttcn3-hacks[master]: WIP: PCU_Tests_RAW.ttcn: introduce test case for TBF Timing Advance

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sat Sep 14 19:16:29 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15526


Change subject: WIP: PCU_Tests_RAW.ttcn: introduce test case for TBF Timing Advance
......................................................................

WIP: PCU_Tests_RAW.ttcn: introduce test case for TBF Timing Advance

Change-Id: Ia78d93e43a3c41b0b30e70df20a2da31077fd05f
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 93 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/26/15526/1

diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index 1312a2f..fedb604 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -7,6 +7,7 @@
    those NS and BSSGP implementations on the BSS (PCU) side. */
 
 /* (C) 2018-2019 Harald Welte <laforge at gnumonks.org>
+ * (C) 2019 Vadim Yanitskiy <axilirator at gmail.com>
  * All rights reserved.
  *
  * Released under the terms of GNU General Public License, Version 2 or
@@ -20,6 +21,9 @@
 import from GSM_Types all;
 import from GSM_RR_Types all;
 
+import from RLCMAC_CSN1_Types all;
+import from RLCMAC_Types all;
+
 import from NS_Types all;
 import from BSSGP_Types all;
 import from Osmocom_Gb_Types all;
@@ -535,7 +539,7 @@
 	 * at some point the PCU will fail to allocate a new TBF. */
 	for (var integer ta := 0; ta < 64; ta := ta + 16) {
 		/* Send an Access Burst (8-bit) on TS0.
-		 * FIXME: properly encode RA (see 3GPP TS 04.08, table 9.9),
+		 * FIXME: properly encode RA (see 3GPP TS 04.08, table 9.9 and TS 24.060, table 11.2.5.2),
 		 * TODO: ask the BTS component to give us the current TDMA fn */
 		log("Sending RACH.ind with TA=", ta);
 		BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, ra := oct2int('3A'O), is_11bit := 0,
@@ -574,6 +578,93 @@
 	}
 }
 
+testcase TC_ta_tbf_tuwat() runs on RAW_PCU_Test_CT {
+	var PacketUlAssign ul_tbf_ass;
+	var PCUIF_Message pcu_msg;
+	var GsmRrMessage rr_msg;
+	timer T := 2.0;
+
+	/* Initialize the PCU interface abstraction */
+	f_init_raw(testcasename());
+
+	/* Ask for an UL TBF by sending an Access Burst (8-bit) on TS0.
+	 * TODO: ask the BTS component to give us the current TDMA fn */
+	BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, ra := oct2int('3A'O), is_11bit := 0,
+				   burst_type := BURST_TYPE_0,
+				   fn := 1337, arfcn := 871));
+
+	/* Expect Immediate (TBF) Assignment on TS0/AGCH */
+	T.start;
+	alt {
+	[] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 0,
+					 sapi := PCU_IF_SAPI_AGCH, data := ?)) -> value pcu_msg {
+		/* FIXME: we cannot use decmatch here because the data comes with padding */
+		rr_msg := dec_GsmRrMessage(pcu_msg.u.data_req.data);
+		log("Rx DATA.req from OsmoPCU: ", rr_msg);
+		T.stop;
+
+		/* Make sure the received data is an UL TBF Assignment */
+		if (match(rr_msg, tr_IMM_TBF_ASS(dl := false, ra := oct2int('3A'O),
+						 rest := tr_IaRestOctets_ULAss(?)))) {
+			ul_tbf_ass := rr_msg.payload.imm_ass.rest_octets.hh.pa.uldl.ass.ul;
+			log("Rx Immediate Assignment (UL TBF): ", ul_tbf_ass);
+			setverdict(pass);
+		} else {
+			setverdict(fail, "Failed to match Immediate (TBF) Assignment");
+			mtc.stop;
+		}
+		}
+	[] BTS.receive { repeat; }
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for Immediate Assignment");
+		mtc.stop;
+		}
+	}
+
+	/* TODO: check if we got single or dynamic assignment */
+	var octetstring pkt_res_req_enc;
+
+	var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
+		tfi := ul_tbf_ass.dynamic.tfi_assignment,
+		cv := 15, /* 15 UL blocks to be sent (to be overridden in loop) */
+		bsn := 0, /* TODO: what should be here? */
+		blocks := { /* To be generated in loop */ }
+	);
+
+	/* HACK: patch missing TLLI */
+	ul_data.data.tlli := '00000001'O;
+
+	for (var integer i := 0; i < 16; i := i + 1) {
+		/* Prepare a new UL block (CV, payload) */
+		ul_data.data.mac_hdr.countdown := (15 - i);
+		ul_data.data.blocks := { valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(23))) };
+
+		/* Encode the payload of DATA.ind */
+		pkt_res_req_enc := enc_RlcmacUlBlock(valueof(ul_data));
+		pkt_res_req_enc := f_pad_oct(pkt_res_req_enc, 34, '00'O); /* CS-2 */
+
+		/* TODO: derive block number from the current TDMA frame number */
+		BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+					   block_nr := i, sapi := PCU_IF_SAPI_PDTCH,
+					   data := pkt_res_req_enc,
+					   fn := 1337 + i * 4,
+					   arfcn := 871));
+		/* TODO: implement block start notifications from the BTS component */
+		f_sleep(4.615 * 4.0 / 1000.0); /* ... wait ~4 frames for now */
+
+		/* Send RTS.req, expect UL ACK from the PCU */
+		BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+					  sapi := PCU_IF_SAPI_PDTCH,
+					  fn := 1337 + i * 4, arfcn := 871,
+					  block_nr := i));
+		BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+					      block_nr := i, fn := 1337 + i * 4,
+					      sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg;
+
+		/* TODO: Packet Uplink ACK / NACK may contain optional Timing Advance field */
+	}
+}
+
 
 control {
 	execute( TC_ns_reset() );
@@ -587,6 +678,7 @@
 
 	execute( TC_pcuif_suspend() );
 	execute( TC_ta_init_prach() );
+	execute( TC_ta_tbf_tuwat() );
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15526
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia78d93e43a3c41b0b30e70df20a2da31077fd05f
Gerrit-Change-Number: 15526
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190914/631b872e/attachment.htm>


More information about the gerrit-log mailing list