Change in osmo-ttcn3-hacks[master]: pcu: Introduce test TC_t3141

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

laforge gerrit-no-reply at lists.osmocom.org
Tue May 18 19:04:10 UTC 2021


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

Change subject: pcu: Introduce test TC_t3141
......................................................................

pcu: Introduce test TC_t3141

Change-Id: I5f30e93de4a109d60577394da4e00a15ab23d1d6
Related: OS#1940
---
M pcu/GPRS_Components.ttcn
M pcu/PCU_Tests.ttcn
2 files changed, 116 insertions(+), 0 deletions(-)

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



diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index d3ace4d..5cf9104 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -241,6 +241,17 @@
 	return 51 * ((st.t3 - st.t2) mod 26) + st.t3 + 51 * 26 * st.t1;
 }
 
+function fn2bn(GsmFrameNumber fn) return uint32_t {
+	return (fn mod 52) / 4;
+}
+function f_next_pdch_block(GsmFrameNumber fn) return GsmFrameNumber
+{
+	var uint32_t bn := fn2bn(fn) + 1;
+	fn := fn - (fn mod 52);
+	fn := fn + bn * 4 + bn / 3;
+	return fn mod GsmMaxFrameNumber;
+}
+
 function f_ultbf_new_from_rr_imm_ass(in GsmRrMessage rr_imm_ass)
 runs on MS_BTS_IFACE_CT return UlTbf {
 	var UlTbf ul_tbf := valueof(t_UlTbf_def);
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 4df5515..3d374d0 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -1270,6 +1270,110 @@
 	f_dl_data_exp_cs(f_rlcmac_block_int2cs_mcs(g_mcs_max_dl, true), bssgp_ms_racap_egprs_def);
 }
 
+/* Verify PCU drops TBF after some time of inactivity. */
+testcase TC_t3141() runs on RAW_PCU_Test_CT {
+	var PCUIF_info_ind info_ind;
+	var template (value) TsTrxBtsNum nr;
+	var BTS_PDTCH_Block data_msg;
+	var GprsMS ms;
+	var uint3_t rx_usf;
+	timer T_3141 := 1.0;
+	var boolean ul_tbf_usf_req := false;
+
+	/* 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 */
+
+	info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS));
+	/* Only use 1 PDCH to simplify test: */
+	f_PCUIF_PDCHMask_set(info_ind, '00000001'B, 0);
+	f_PCUIF_PDCHMask_set(info_ind, '00000000'B, (1 .. 7));
+	/* Initialize the PCU interface abstraction */
+	f_init_raw(testcasename(), info_ind);
+
+	f_vty_config2(PCUVTY, {"pcu"}, "timer T3141 1");
+
+	/* Establish BSSGP connection to the PCU */
+	f_bssgp_establish();
+	f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli);
+
+	/* Establish a one-phase access Uplink TBF */
+	f_ms_establish_ul_tbf(ms);
+
+	T_3141.start;
+
+	/* Now we wait for PCU to transmit our USF */
+	nr := ts_TsTrxBtsNum;
+	BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+				  sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+				  arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)),
+				  block_nr := nr.blk_nr));
+
+	alt {
+	[] BTS.receive(tr_PCUIF_DATA_PDTCH(nr.bts_nr,
+					   tr_PCUIF_DATA(nr.trx_nr, nr.ts_nr, sapi := PCU_IF_SAPI_PDTCH),
+					   ?)) -> value data_msg {
+		if (ms.ul_tbf.usf[valueof(nr.ts_nr)] == USF_UNUSED) {
+			setverdict(fail, "Unexpected ts_nr ", valueof(nr.ts_nr), " without USF allocated");
+			f_shutdown(__BFILE__, __LINE__);
+		}
+
+		rx_usf := f_rlcmac_dl_block_get_usf(data_msg.dl_block);
+		if (rx_usf == ms.ul_tbf.usf[valueof(nr.ts_nr)]) {
+			/* PCU requests our USF, transmit WITHOUT tlli to avoid contention resolution success */
+			ul_tbf_usf_req := true;
+			f_ms_tx_ul_data_block(ms, f_rnd_octstring(10), cv := 15, with_tlli := false, fn := f_next_pdch_block(data_msg.raw.fn))
+		} else if (rx_usf == USF_UNUSED) {
+			if (data_msg.raw.fn >= ms.ul_tbf.start_time_fn) {
+				if (ul_tbf_usf_req) {
+					/* TBF was dropped by T3141, success */
+					setverdict(pass);
+					break;
+				} else {
+					log("PCU never requested USF, unexpected");
+					f_shutdown(__BFILE__, __LINE__);
+				}
+			} /* else: Keep waiting for TBF to be active by network */
+		} else {
+			log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]);
+			f_shutdown(__BFILE__, __LINE__);
+		}
+
+		/* Make sure we don't receive a Ul ACK/NACK with TLLI set: */
+		if (match(data_msg.dl_block,
+			  tr_RLCMAC_UL_ACK_NACK_GPRS(ms.ul_tbf.tfi,
+				  		     tr_UlAckNackGprs(tlli := ?,
+								      acknack_desc := ?,
+								      rel99 := *))))
+		{
+			log("Received UL ACK/NACK with TLLI set");
+			f_shutdown(__BFILE__, __LINE__);
+		}
+
+		nr := ts_TsTrxBtsNum;
+		BTS.send(ts_PCUIF_RTS_REQ(nr.bts_nr, nr.trx_nr, nr.ts_nr,
+					  sapi := PCU_IF_SAPI_PDTCH, fn := 0,
+					  arfcn := f_trxnr2arfcn(valueof(nr.trx_nr)),
+					  block_nr := nr.blk_nr));
+		repeat;
+	}
+	[] T_3141.timeout {
+		log("T_3141 expired but TBF is still active, unexpected");
+		f_shutdown(__BFILE__, __LINE__);
+		}
+	[] BTS.receive {
+		/* We should never receive non-dummy messages, aka UL ACK/NACK,
+		 * because we never sent the TLLI to the PCU */
+		setverdict(fail, "Unexpected BTS message");
+		f_shutdown(__BFILE__, __LINE__);
+	}
+	}
+
+	f_shutdown(__BFILE__, __LINE__, final := true);
+}
+
 /* Validate what happens when RACH to get UL TBF and then PCU receives no UL
  * data. It should end up in N3101 reaching N3101_MAX and finally triggering
  * T3169. See OS#5033 */
@@ -5758,6 +5862,7 @@
 	execute( TC_mcs_max_ul() );
 	execute( TC_mcs_initial_dl() );
 	execute( TC_mcs_max_dl() );
+	execute( TC_t3141() );
 	execute( TC_n3101_max_t3169() );
 	execute( TC_n3103_max_t3169() );
 	execute( TC_x2031_t3191() );

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24208
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: I5f30e93de4a109d60577394da4e00a15ab23d1d6
Gerrit-Change-Number: 24208
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210518/467c574d/attachment.htm>


More information about the gerrit-log mailing list