Change in osmo-ttcn3-hacks[master]: fixup pcu/GPRS_Components: do not duplicate existing functions

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
Thu May 28 17:00:33 UTC 2020


fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/18548 )

Change subject: fixup pcu/GPRS_Components: do not duplicate existing functions
......................................................................

fixup pcu/GPRS_Components: do not duplicate existing functions

Both f_ms_rx_imm_ass_ccch() and f_ms_establish_ul_tbf() functions
are actually twin brothers of good old f_pcuif_rx_imm_ass() and
f_establish_tbf() with some minor changes.

The former accepts a GprsMS parameter, that is never used. The
latter simply calls f_ultbf_new_from_rr_imm_ass() in the end.

Let's avoid code duplication:

  - call f_establish_tbf() from f_ms_establish_ul_tbf(),
  - remove f_ms_rx_imm_ass_ccch(), use f_pcuif_rx_imm_ass().

After the removal of f_ms_rx_imm_ass_ccch(), the implementation
of TC_ta_idle_dl_tbf_ass() does not need the GprsMS state, so
let's make it look like it was before.

Change-Id: If6c0b8796500e96525b7b1cadb61ab2fc84b4744
---
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
2 files changed, 14 insertions(+), 72 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 9db13b4..af35f40 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -249,45 +249,6 @@
 	}
 }
 
-function f_ms_rx_imm_ass_ccch(inout GprsMS ms, template PCUIF_Sapi sapi := PCU_IF_SAPI_AGCH, template GsmRrMessage t_imm_ass := ?)
-runs on MS_BTS_IFACE_CT return GsmRrMessage {
-	var PCUIF_Message pcu_msg;
-	var GsmRrMessage rr_imm_ass;
-	var octetstring data;
-	timer T;
-
-	T.start(2.0);
-	alt {
-	[] BTS.receive(tr_PCUIF_DATA_REQ(bts_nr := 0, trx_nr := 0, ts_nr := 0,
-					 sapi := sapi, data := ?)) -> value pcu_msg {
-		/* On PCH the payload is prefixed with paging group (3 octets): skip it.
-		 * TODO: add an additional template parameter, so we can match it. */
-		if (pcu_msg.u.data_req.sapi == PCU_IF_SAPI_PCH) {
-			data := substr(pcu_msg.u.data_req.data, 3, pcu_msg.u.data_req.len - 3);
-		} else {
-			data := pcu_msg.u.data_req.data;
-		}
-
-		rr_imm_ass := dec_GsmRrMessage(data);
-		if (not match(rr_imm_ass, t_imm_ass)) {
-		        /* Not for us? Wait for more. */
-		        repeat;
-		}
-
-		log("Rx Immediate Assignment: ", rr_imm_ass);
-		f_pcuif_tx_data_cnf(pcu_msg);
-		setverdict(pass);
-		return rr_imm_ass;
-		}
-	[] BTS.receive { repeat; }
-	[] T.timeout {
-		setverdict(fail, "Timeout waiting for Immediate Assignment");
-		f_shutdown(__BFILE__, __LINE__);
-		}
-	}
-	return rr_imm_ass; /* make compiler happy */
-}
-
 function f_ms_rx_imm_ass_pacch(inout GprsMS ms, out uint32_t poll_fn, template RlcmacDlBlock t_imm_ass := ?)
 runs on MS_BTS_IFACE_CT return RlcmacDlBlock {
 	var RlcmacDlBlock dl_block;
@@ -318,40 +279,20 @@
 	return dl_block;
 }
 
-function f_ms_establish_ul_tbf(inout GprsMS ms, uint32_t fn := 1337)
+function f_ms_establish_ul_tbf(inout GprsMS ms)
 runs on MS_BTS_IFACE_CT {
 	var GsmRrMessage rr_imm_ass;
-	var uint8_t exp_ra;
 
-	/* Send RACH.ind */
-	log("Sending RACH.ind on fn=", fn, " with RA=", ms.ra, ", TA=", ms.ta);
-	BTS.send(ts_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 0,
-				   ra := ms.ra, is_11bit := ms.ra_is_11bit,
-				   burst_type := ms.burst_type,
-				   fn := fn, arfcn := 871,
-				   qta := ms.ta * 4));
-
-	/* 3GPP TS 44.018, table 9.1.8.1, note 2b: Request Reference shall be set to 127
-	 * when Immediate Assignment is triggered by EGPRS Packet Channel Request. Here
-	 * we assume that 11 bit RA always contains EGPRS Packet Channel Request. */
-	if (ms.ra_is_11bit == 0) {
-		exp_ra := ms.ra;
-	} else {
-		exp_ra := 127;
-	}
-
-	/* Expect Immediate (TBF) Assignment on TS0/AGCH */
-	rr_imm_ass := f_ms_rx_imm_ass_ccch(ms, PCU_IF_SAPI_AGCH,
-	                                   tr_IMM_TBF_ASS(false, exp_ra, fn));
-
+	rr_imm_ass := f_establish_tbf(ms.ra, ms.ra_is_11bit, ms.burst_type, ms.ta);
 	ms.ul_tbf := f_ultbf_new_from_rr_imm_ass(rr_imm_ass);
 }
 
-function f_ms_exp_dl_tbf_ass_ccch(inout GprsMS ms, template PCUIF_Sapi sapi := PCU_IF_SAPI_AGCH, template GsmRrMessage t_imm_ass := tr_IMM_TBF_ASS(true, ?, ?))
+function f_ms_exp_dl_tbf_ass_ccch(inout GprsMS ms, template PCUIF_Sapi sapi := PCU_IF_SAPI_AGCH,
+				  template GsmRrMessage t_imm_ass := tr_IMM_TBF_ASS(true, ?, ?))
 runs on MS_BTS_IFACE_CT {
 	var GsmRrMessage rr_imm_ass;
 
-	rr_imm_ass := f_ms_rx_imm_ass_ccch(ms, sapi, t_imm_ass);
+	rr_imm_ass := f_pcuif_rx_imm_ass(sapi, t_imm_ass);
 	ms.dl_tbf := f_dltbf_new_from_rr_imm_ass(rr_imm_ass, tr_PacketDlAssign(ms.tlli));
 }
 
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index ff5da82..8b9a471 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -266,7 +266,7 @@
 	for (var TimingAdvance ta := 0; ta < 64; ta := ta + 16) {
 		/* Establish an Uplink TBF (send RACH.ind with current TA) */
 		ms.ta := ta;
-		f_ms_establish_ul_tbf(ms, fn := 1337 + ta);
+		f_ms_establish_ul_tbf(ms);
 
 		/* Make sure Timing Advance IE matches out expectations */
 		if (ms.ul_tbf.rr_imm_ass.payload.imm_ass.timing_advance != ta) {
@@ -285,29 +285,30 @@
  * IUT that causes it to send an unreasonable Timing Advance value > 0 despite
  * no active TBF exists at the moment of establishment (idle mode). */
 testcase TC_ta_idle_dl_tbf_ass() runs on RAW_PCU_Test_CT {
-	var GprsMS ms;
+	var OCT4 tlli := f_rnd_octstring(4);
+	var GsmRrMessage rr_imm_ass;
 
 	/* Initialize NS/BSSGP side */
 	f_init_bssgp();
-	/* Initialize GPRS MS side */
-	f_init_gprs_ms();
-	ms := g_ms[0]; /* We only use first MS in this test */
 
 	/* Initialize the PCU interface abstraction */
 	f_init_raw(testcasename());
 
 	/* Establish BSSGP connection to the PCU */
 	f_bssgp_establish();
-	f_bssgp_client_llgmm_assign('FFFFFFFF'O, ms.tlli);
+	f_bssgp_client_llgmm_assign('FFFFFFFF'O, tlli);
 
 	/* SGSN sends some DL data, PCU will initiate Packet Downlink
 	 * Assignment on CCCH (PCH). We don't care about the payload. */
-	BSSGP[0].send(ts_BSSGP_DL_UD(ms.tlli, f_rnd_octstring(10)));
+	BSSGP[0].send(ts_BSSGP_DL_UD(tlli, f_rnd_octstring(10)));
+	rr_imm_ass := f_pcuif_rx_imm_ass(PCU_IF_SAPI_PCH, tr_IMM_TBF_ASS(dl := true));
 
 	/* Make sure that Timing Advance is 0 (the actual value is not known yet).
 	 * As per 3GPP S 44.018, section 3.5.3.1.2, the network *shall* initiate
 	 * the procedures defined in 3GPP TS 44.060 or use the polling mechanism. */
-	f_ms_rx_imm_ass_ccch(ms,  PCU_IF_SAPI_PCH, tr_IMM_TBF_ASS(ta := 0));
+	if (rr_imm_ass.payload.imm_ass.timing_advance != 0) {
+		setverdict(fail, "Timing Advance value doesn't match");
+	}
 
 	f_shutdown(__BFILE__, __LINE__, final := true);
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/18548
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: If6c0b8796500e96525b7b1cadb61ab2fc84b4744
Gerrit-Change-Number: 18548
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
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/20200528/0737842f/attachment.htm>


More information about the gerrit-log mailing list