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

pespin gerrit-no-reply at lists.osmocom.org
Thu Mar 4 12:55:05 UTC 2021


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


Change subject: pcu: Introduce test TC_n3101_max_t3169
......................................................................

pcu: Introduce test TC_n3101_max_t3169

This test currently fails to pass in master osmo-pcu (and latest) due to
T3169 not being implemented exactly as per specs (due to limitations in
detecting lost UL blocks with assigned USF).

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



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

diff --git a/pcu/GPRS_Components.ttcn b/pcu/GPRS_Components.ttcn
index 5266743..57cd837 100644
--- a/pcu/GPRS_Components.ttcn
+++ b/pcu/GPRS_Components.ttcn
@@ -701,6 +701,20 @@
 	return 0; /* make compiler happy */
 }
 
+function f_rlcmac_dl_block_get_usf(RlcmacDlBlock dl_block)
+runs on MS_BTS_IFACE_CT return uint3_t {
+	if (ischosen(dl_block.data)) {
+		return dl_block.data.mac_hdr.mac_hdr.usf;
+	} else if (ischosen(dl_block.data_egprs)) {
+		return dl_block.data_egprs.mac_hdr.usf;
+	} else { /* Ctrl block */
+		return dl_block.ctrl.mac_hdr.usf;
+	}
+	setverdict(fail, "DlBlock doesn't contain a USF:", dl_block);
+	f_shutdown(__BFILE__, __LINE__);
+	return 0; /* make compiler happy */
+}
+
 /* Get the Chan coding command from a dl block containing PACCH UL Assignment */
 function f_rlcmac_dl_block_get_assigned_ul_cs_mcs(RlcmacDlBlock dl_block)
 runs on MS_BTS_IFACE_CT return CodingScheme {
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index c60e49e..e0fe36f 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -1313,6 +1313,112 @@
 	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 */
+testcase TC_n3101_max_t3169() 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;
+	const integer N3101_MAX := 9; /* N3101 shall be reat than 8 */
+	var integer n3101 := 0;
+	timer T_3169 := 1.0;
+
+	/* 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 */
+	info_ind := valueof(ts_PCUIF_INFO_default(c_PCUIF_Flags_noMCS));
+	info_ind.n3101 := N3101_MAX; /* N3101 shall be reat than 8 */
+	info_ind.t3169 := 1;
+	f_init_raw(testcasename(), info_ind);
+
+	/* Establish BSSGP connection to the PCU */
+	f_bssgp_establish();
+	f_bssgp_client_llgmm_assign(TLLI_UNUSED, ms.tlli);
+
+	/* Establish UL TBF */
+	f_ms_establish_ul_tbf(ms);
+
+	/* 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)]) {
+			log("PCU requests our USF ", rx_usf, ", n3101=", n3101);
+			n3101 := n3101 + 1;
+			//"if (n3101 > N3101_MAX) {" -> start timer T3169
+			if (n3101 > N3101_MAX) {
+				setverdict(fail, "Reached ", n3101, " > ", N3101_MAX, " (N3101_MAX) and PCU still sends us USFs");
+				f_shutdown(__BFILE__, __LINE__);
+			}
+		} else if (rx_usf == USF_UNUSED and n3101 == N3101_MAX) {
+			/* If we already received USFs for us and we don't receive them anymore, that means the TBF entered T3169 */
+			log("PCU stopped requesting USF ", ms.ul_tbf.usf[valueof(nr.ts_nr)]);
+			if (not T_3169.running) {
+				log("T3169 started");
+				T_3169.start;
+			}
+		} else if(rx_usf == USF_UNUSED and n3101 > 0) {
+			setverdict(fail, "PCU stopped requesting USFs too early: ", n3101, " < ", N3101_MAX, " (N3101_MAX)");
+			f_shutdown(__BFILE__, __LINE__);
+		} else {
+			log("PCU requests ", rx_usf, ", we have ", ms.ul_tbf.usf[valueof(nr.ts_nr)]);
+		}
+		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_3169.timeout {
+		log("T_3169 expired");
+		/* Done in alt */
+		}
+	[] BTS.receive {
+		setverdict(fail, "Unexpected BTS message");
+		f_shutdown(__BFILE__, __LINE__);
+	}
+	}
+
+	/* Now that T3169 has expired, establishing a Ul TBF should provide same
+	/* USFs as per previous TBF since they were freed at expiration time: */
+	var uint3_t old_usf[8] := ms.ul_tbf.usf;
+	var uint5_t old_tfi := ms.ul_tbf.tfi;
+	f_ms_establish_ul_tbf(ms);
+	if (old_tfi != ms.ul_tbf.tfi) {
+		setverdict(fail, "Unexpected TFI change: ", ms.ul_tbf.tfi, " vs exp ", old_tfi);
+		f_shutdown(__BFILE__, __LINE__);
+	}
+	for (var integer i := 0; i < 8; i := i +1) {
+		if (ms.ul_tbf.usf[i] != old_usf[i]) {
+			setverdict(fail, "Unexpected USF change: ", ms.ul_tbf.usf[i], " vs exp ", old_usf[i]);
+			f_shutdown(__BFILE__, __LINE__);
+		}
+	}
+
+	f_shutdown(__BFILE__, __LINE__, final := true);
+}
+
 /* Verify that a Downlink TBF is kept available until T3191 fires, at which
  * point the TBF is no longer available. In order to get to start of T3191, we
  * have to wait for x2031 since that marks the IDLE TBF time, that is, the delay
@@ -5530,6 +5636,7 @@
 	execute( TC_mcs_initial_dl() );
 	execute( TC_mcs_max_dl() );
 	execute( TC_t3169() );
+	execute( TC_n3101_max_t3169() );
 	execute( TC_x2031_t3191() );
 	execute( TC_zero_x2031_t3191() );
 	execute( TC_t3193() );

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23232
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: I56177850f084cdaf4fcac63ebdcdff9cef4e7a5d
Gerrit-Change-Number: 23232
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210304/d73e4770/attachment.htm>


More information about the gerrit-log mailing list