Change in osmo-ttcn3-hacks[master]: PCU: refactor f_imm_ass_verify_{ul, dl}_tbf_ass(): call f_shutdown()

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 7 04:43:45 UTC 2020


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

Change subject: PCU: refactor f_imm_ass_verify_{ul,dl}_tbf_ass(): call f_shutdown()
......................................................................

PCU: refactor f_imm_ass_verify_{ul,dl}_tbf_ass(): call f_shutdown()

This allows us to reduce code duplication.

Change-Id: Ib74285177a5d8e3c4a27df1321e7eab3462318bc
Signed-off-by: Vadim Yanitskiy <axilirator at gmail.com>
---
M pcu/PCU_Tests.ttcn
1 file changed, 38 insertions(+), 75 deletions(-)

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



diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index ac2aaf3..0c61595 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -382,7 +382,7 @@
 }
 
 private function f_imm_ass_verify_ul_tbf_ass(in GsmRrMessage rr_imm_ass, out PacketUlAssign ul_tbf_ass)
-runs on RAW_PCU_Test_CT return boolean {
+runs on RAW_PCU_Test_CT {
 
 	/* Make sure we received an UL TBF Assignment */
 	if (match(rr_imm_ass, tr_IMM_TBF_ASS(dl := false, rest := tr_IaRestOctets_ULAss(?)))) {
@@ -391,20 +391,18 @@
 		setverdict(pass);
 	} else {
 		setverdict(fail, "Failed to match UL TBF Assignment");
-		return false;
+		f_shutdown(__BFILE__, __LINE__);
 	}
 
 	/* Make sure we have got a TBF with Dynamic Block Allocation */
 	if (ul_tbf_ass.dynamic == omit) {
 		setverdict(fail, "Single Block Allocation is not handled by ", testcasename());
-		return false;
+		f_shutdown(__BFILE__, __LINE__);
 	}
-
-	return true;
 }
 
 private function f_imm_ass_verify_dl_tbf_ass(in GsmRrMessage rr_imm_ass, out PacketDlAssign dl_tbf_ass)
-runs on RAW_PCU_Test_CT return boolean {
+runs on RAW_PCU_Test_CT {
 
 	/* Make sure we received a DL TBF Assignment */
 	if (match(rr_imm_ass, tr_IMM_TBF_ASS(dl := true, rest := tr_IaRestOctets_DLAss(?)))) {
@@ -413,10 +411,8 @@
 		setverdict(pass);
 	} else {
 		setverdict(fail, "Failed to match DL TBF Assignment");
-		return false;
+		f_shutdown(__BFILE__, __LINE__);
 	}
-
-	return true;
 }
 
 /* Enqueue DATA.ind (both TDMA frame and block numbers to be patched) */
@@ -1051,11 +1047,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
 		tfi := ul_tbf_ass.dynamic.tfi_assignment,
@@ -1140,11 +1133,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
 		tfi := ul_tbf_ass.dynamic.tfi_assignment,
@@ -1222,11 +1212,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	var template (value) RlcmacUlBlock ul_data := t_RLCMAC_UL_DATA(
 		tfi := ul_tbf_ass.dynamic.tfi_assignment,
@@ -1292,11 +1279,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	/* Send one UL block and make sure it is ACKED fine */
 	f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
@@ -1340,11 +1324,10 @@
 	/* SGSN sends some DL data, PCU will page on CCCH (PCH) */
 	BSSGP[0].send(ts_BSSGP_DL_UD(tlli, data));
 	f_pcuif_rx_pch_imm_tbf_ass(rr_imm_ass);
-	ok := f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not a Downlink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+
+	/* Make sure we've got a Downlink TBF assignment */
+	f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
+
 	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
 	f_sleep(X2002);
 	f_rx_rlcmac_dl_block_exp_data(dl_block, sched_fn, data, 0);
@@ -1401,11 +1384,9 @@
 		setverdict(fail, "Failed to establish TBF");
 		f_shutdown(__BFILE__, __LINE__);
 	}
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	if (not istemplatekind(ms_racap, "omit")) {
 		/* Send PACKET RESOURCE REQUEST to upgrade to EGPRS
@@ -1432,11 +1413,8 @@
 	BSSGP[0].send(ts_BSSGP_DL_UD(tlli, data));
 	f_pcuif_rx_pch_imm_tbf_ass(rr_imm_ass);
 
-	ok := f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not a Downlink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got a Downlink TBF assignment */
+	f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
 
 	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
 	f_sleep(X2002);
@@ -1498,11 +1476,8 @@
 	BSSGP[0].send(ts_BSSGP_DL_UD(tlli, data, ms_racap));
 	f_pcuif_rx_pch_imm_tbf_ass(rr_imm_ass);
 
-	ok := f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not a Downlink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got a Downlink TBF assignment */
+	f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
 
 	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
 	f_sleep(X2002);
@@ -1518,11 +1493,9 @@
 		setverdict(fail, "Failed to establish TBF");
 		f_shutdown(__BFILE__, __LINE__);
 	}
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	/* Send one UL block and make sure it is ACKED fine */
 	f_tx_rlcmac_ul_n_blocks(ul_tbf_ass, 1);
@@ -1579,11 +1552,9 @@
 	/* SGSN sends some DL data, PCU will page on CCCH (PCH) */
 	BSSGP[0].send(ts_BSSGP_DL_UD(tlli, data));
 	f_pcuif_rx_pch_imm_tbf_ass(rr_imm_ass);
-	ok := f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not a Downlink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+
+	/* Make sure we've got a Downlink TBF assignment */
+	f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
 
 	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
 	f_sleep(X2002);
@@ -1593,11 +1564,10 @@
 	 * or GPRS DL, or DL ACK was lost for some reason). As a result, PCU
 	 * should retrigger IMM ASS + GPRS DL procedure after poll timeout. */
 	f_pcuif_rx_pch_imm_tbf_ass(rr_imm_ass);
-	ok := f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
-	if (not ok) {
-	 	setverdict(fail, "Immediate Assignment not a Downlink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+
+	/* Make sure we've got a Downlink TBF assignment */
+	f_imm_ass_verify_dl_tbf_ass(rr_imm_ass, dl_tbf_ass);
+
 	/* Wait timer X2002 and DL block is available after CCCH IMM ASS: */
 	f_sleep(X2002);
 	f_rx_rlcmac_dl_block_exp_data(dl_block, sched_fn, data, 0);
@@ -1677,12 +1647,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
-
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	/* build mobile Identity */
 	mi := valueof(ts_MI_IMSI_LV(imsi));
@@ -1729,11 +1695,8 @@
 		f_shutdown(__BFILE__, __LINE__);
 	}
 
-	ok := f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
-	if (not ok) {
-		setverdict(fail, "Immediate Assignment not an Uplink TBF");
-		f_shutdown(__BFILE__, __LINE__);
-	}
+	/* Make sure we've got an Uplink TBF assignment */
+	f_imm_ass_verify_ul_tbf_ass(rr_imm_ass, ul_tbf_ass);
 
 	/* Send paging request with or without TMSI */
 	if (use_ptmsi) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/18083
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: Ib74285177a5d8e3c4a27df1321e7eab3462318bc
Gerrit-Change-Number: 18083
Gerrit-PatchSet: 4
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
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/20200507/69bb507c/attachment.htm>


More information about the gerrit-log mailing list