Change in osmo-ttcn3-hacks[master]: gbproxy: Refactor f_TC_{suspend, resume}

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
Sat Jan 16 22:00:57 UTC 2021


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

Change subject: gbproxy: Refactor f_TC_{suspend,resume}
......................................................................

gbproxy: Refactor f_TC_{suspend,resume}

Move the entire body inside the loop to a separate function.  This
will be useful when adding pooling support next.

Change-Id: Ia0f9d9128754c2196ab026623f1b6a254a958d2f
---
M gbproxy/GBProxy_Tests.ttcn
1 file changed, 56 insertions(+), 53 deletions(-)

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



diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 9168fa3..6f5b326 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -1066,37 +1066,39 @@
 	f_cleanup();
 }
 
+private function f_suspend_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
+runs on GlobalTest_CT
+{
+	var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;
+	var OCT4 tlli := f_gprs_tlli_random();
+	var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
+	f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
+
+	pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(suffix, 1));
+	f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
+
+	pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
+	f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
+
+	/* These messages are simple passed through so just also test sending NACK */
+	pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+	f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
+}
+
 private function f_TC_suspend() runs on GlobalTest_CT {
 	var integer i;
 
 	/* TODO: Generate RA ID for each ConnHdlr */
-	var RoutingAreaIdentification	ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
 	for (i := 0; i < 10; i := i+1) {
-		var OCT4 tlli := f_gprs_tlli_random();
-		var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
-
-		f_global_pcu2sgsn(pdu_tx, pdu_rx);
-
-		pdu_tx := ts_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1));
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1));
-
-		f_global_sgsn2pcu(pdu_tx, pdu_rx);
-
-		pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
-
-		f_global_pcu2sgsn(pdu_tx, pdu_rx);
-
-		/* These messages are simple passed through so just also test sending NACK */
-		pdu_tx := ts_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
-
-		f_global_sgsn2pcu(pdu_tx, pdu_rx);
+		f_suspend_one(0, 0, 0, i);
 	}
 	setverdict(pass);
 }
@@ -1108,37 +1110,38 @@
 	f_cleanup();
 }
 
+private function f_resume_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
+runs on GlobalTest_CT
+{
+	var RoutingAreaIdentification	ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;
+	var OCT4 tlli := f_gprs_tlli_random();
+	var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
+	f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
+
+	pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id);
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id);
+	f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
+
+	pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
+	f_global_pcu2sgsn(pdu_tx, pdu_rx, pcu_idx, sgsn_idx);
+
+	/* These messages are simple passed through so just also test sending NACK */
+	pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+	/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
+	pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+	f_global_sgsn2pcu(pdu_tx, pdu_rx, sgsn_idx, pcu_idx);
+}
+
 private function f_TC_resume() runs on GlobalTest_CT {
 	var integer i;
 
-	/* TODO: Generate RA ID for each ConnHdlr */
-	var RoutingAreaIdentification	ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
 	for (i := 0; i < 10; i := i+1) {
-		var OCT4 tlli := f_gprs_tlli_random();
-		var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
-
-		f_global_pcu2sgsn(pdu_tx, pdu_rx);
-
-		pdu_tx := ts_BSSGP_RESUME_ACK(tlli, ra_id);
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id);
-
-		f_global_sgsn2pcu(pdu_tx, pdu_rx);
-
-		pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
-
-		f_global_pcu2sgsn(pdu_tx, pdu_rx);
-
-		/* These messages are simple passed through so just also test sending NACK */
-		pdu_tx := ts_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
-		/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
-		pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
-
-		f_global_sgsn2pcu(pdu_tx, pdu_rx);
+		f_resume_one(0, 0, 0, i);
 	}
 	setverdict(pass);
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22229
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: Ia0f9d9128754c2196ab026623f1b6a254a958d2f
Gerrit-Change-Number: 22229
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis at fe80.eu>
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/20210116/943fa42f/attachment.htm>


More information about the gerrit-log mailing list