Change in ...osmo-ttcn3-hacks[master]: pcu: Introduce some function helpers

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

pespin gerrit-no-reply at lists.osmocom.org
Mon Oct 7 12:26:11 UTC 2019


pespin has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664 )

Change subject: pcu: Introduce some function helpers
......................................................................

pcu: Introduce some function helpers

Change-Id: I8608fac4375153d5020df5d05026513a7fe931d6
---
M pcu/PCU_Tests_RAW.ttcn
1 file changed, 49 insertions(+), 18 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved



diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index b5aec76..4d20027 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -552,6 +552,53 @@
 	return false;
 }
 
+/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+private function f_pcuif_tx_data_ind(octetstring data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+
+	BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, block_nr := 0,
+				   sapi := PCU_IF_SAPI_PDTCH, data := data,
+				   fn := 0, arfcn := 871, lqual_cb := lqual_cb));
+	BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+}
+
+/* Enqueue RTS.req, expect DATA.req with UL ACK from the PCU */
+private function f_pcuif_rx_data_req(out PCUIF_Message pcu_msg)
+runs on RAW_PCU_Test_CT {
+	BTS.send(ts_PCUIF_RTS_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+				  sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+				  arfcn := 871, block_nr := 0));
+	BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
+				      sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg;
+}
+
+private function f_tx_rlcmac_ul_block(template (value) RlcmacUlBlock ul_data, int16_t lqual_cb := 0)
+runs on RAW_PCU_Test_CT {
+	var octetstring data;
+	/* Encode the payload of DATA.ind */
+	data := enc_RlcmacUlBlock(valueof(ul_data));
+	data := f_pad_oct(data, 23, '00'O); /* CS-1 */
+
+	/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
+	f_pcuif_tx_data_ind(data, lqual_cb);
+}
+
+private function f_rx_rlcmac_dl_block(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+	var PCUIF_Message pcu_msg;
+	f_pcuif_rx_data_req(pcu_msg);
+	dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
+}
+
+private function f_rx_rlcmac_dl_block_exp_ack_nack(out RlcmacDlBlock dl_block)
+runs on RAW_PCU_Test_CT {
+	f_rx_rlcmac_dl_block(dl_block);
+	if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
+		setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
+		mtc.stop;
+	}
+}
+
 testcase TC_pcuif_suspend() runs on RAW_PCU_Test_CT {
 	var octetstring ra_id := enc_RoutingAreaIdentification(mp_gb_cfg.cell_id.ra_id);
 	var GprsTlli tlli := 'FFFFFFFF'O;
@@ -851,31 +898,15 @@
 		ul_data.data.mac_hdr.countdown := (15 - i);
 		ul_data.data.blocks := { valueof(t_RLCMAC_LLCBLOCK(f_rnd_octstring(10))) };
 
-		/* Encode the payload of DATA.ind */
-		data := enc_RlcmacUlBlock(valueof(ul_data));
-		data := f_pad_oct(data, 23, '00'O); /* CS-1 */
-
 		/* Link quality in dB and our CS1-4 expectations */
 		var integer lqual := i * 2;
 
 		/* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
 		log("Sending DATA.ind with link quality (dB): ", lqual);
-		BTS.send(ts_PCUIF_DATA_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, block_nr := 0,
-					   sapi := PCU_IF_SAPI_PDTCH, data := data,
-					   fn := 0, arfcn := 871, lqual_cb := lqual * 10));
-		BTS.receive(tr_RAW_PCU_EV(TDMA_EV_PDTCH_BLOCK_SENT));
+		f_tx_rlcmac_ul_block(ul_data, lqual * 10);
 
 		/* Enqueue RTS.req, expect DATA.req with 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 := 0,
-					  arfcn := 871, block_nr := 0));
-		BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 7,
-					      sapi := PCU_IF_SAPI_PDTCH)) -> value pcu_msg;
-		dl_block := dec_RlcmacDlBlock(pcu_msg.u.data_req.data);
-		if (not match(dl_block, tr_RLCMAC_ACK_NACK(ul_tfi := ?, tlli := ?))) {
-			setverdict(fail, "Failed to match Packet Uplink ACK / NACK");
-			mtc.stop;
-		}
+		f_rx_rlcmac_dl_block_exp_ack_nack(dl_block);
 
 		log("Rx Packet Uplink ACK / NACK with Channel Coding Command: ",
 		    dl_block.ctrl.payload.u.ul_ack_nack.gprs.ch_coding_cmd);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/15664
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: I8608fac4375153d5020df5d05026513a7fe931d6
Gerrit-Change-Number: 15664
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191007/935810ef/attachment.htm>


More information about the gerrit-log mailing list