Change in osmo-ttcn3-hacks[master]: gbproxy: Port TC_{suspend, resume} to new GLOBAL port

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
Wed Nov 25 16:22:57 UTC 2020


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

Change subject: gbproxy: Port TC_{suspend,resume} to new GLOBAL port
......................................................................

gbproxy: Port TC_{suspend,resume} to new GLOBAL port

With the previous commit, we change the processing of the SUSPEND/RESUME
related PDUs and handle them now via a new per-NSE "GLOBAL" port.

Change-Id: I805372f3024a0ec2491a24422e02c0bc6dc669d2
---
M gbproxy/GBProxy_Tests.ttcn
1 file changed, 96 insertions(+), 38 deletions(-)

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



diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn
index 4f0f8b6..0bafaa0 100644
--- a/gbproxy/GBProxy_Tests.ttcn
+++ b/gbproxy/GBProxy_Tests.ttcn
@@ -605,6 +605,72 @@
 	}
 }
 
+/***********************************************************************
+ * GlobaLTest_CT: Using the per-NSE GLOBAL ports on PCU + SGSN side
+ ***********************************************************************/
+
+type component GlobalTest_CT extends test_CT {
+	port BSSGP_PT G_PCU[NUM_PCU];
+	port BSSGP_PT G_SGSN[NUM_SGSN];
+};
+
+private function f_global_init() runs on GlobalTest_CT {
+	var integer i;
+	for (i := 0; i < lengthof(g_sgsn); i := i+1) {
+		connect(self:G_SGSN[i], g_sgsn[i].vc_BSSGP:GLOBAL);
+	}
+	for (i := 0; i < lengthof(g_pcu); i := i+1) {
+		connect(self:G_PCU[i], g_pcu[i].vc_BSSGP:GLOBAL);
+	}
+}
+
+/* Send 'tx' on PTP-BVCI from PCU; expect 'rx' on SGSN */
+friend function f_global_pcu2sgsn(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
+				  integer pcu_idx := 0, integer sgsn_idx := 0) runs on GlobalTest_CT {
+	var PDU_BSSGP rx;
+	timer T := 1.0;
+
+	G_PCU[pcu_idx].send(tx);
+	T.start;
+	alt {
+	[] G_SGSN[sgsn_idx].receive(exp_rx) {
+		setverdict(pass);
+		}
+	[] G_SGSN[sgsn_idx].receive(PDU_BSSGP:?) -> value rx {
+		setverdict(fail, "Unexpected BSSGP on SGSN side: ", rx);
+		mtc.stop;
+		}
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for BSSGP on SGSN side: ", rx);
+		mtc.stop;
+		}
+	}
+}
+
+/* Send 'tx' on PTP-BVCI from SGSN; expect 'rx' on PCU */
+friend function f_global_sgsn2pcu(template (value) PDU_BSSGP tx, template (present) PDU_BSSGP exp_rx,
+				  integer sgsn_idx := 0, integer pcu_idx := 0) runs on GlobalTest_CT {
+	var PDU_BSSGP rx;
+	timer T := 1.0;
+
+	G_SGSN[sgsn_idx].send(tx);
+	T.start;
+	alt {
+	[] G_PCU[pcu_idx].receive(exp_rx) {
+		setverdict(pass);
+		}
+	[] G_PCU[pcu_idx].receive(PDU_BSSGP:?) -> value rx {
+		setverdict(fail, "Unexpected BSSGP on PCU side: ", rx);
+		mtc.stop;
+		}
+	[] T.timeout {
+		setverdict(fail, "Timeout waiting for BSSGP on PCU side: ", rx);
+		mtc.stop;
+		}
+	}
+}
+
+
 /* TODO:
    * Detach without Attach
    * SM procedures without attach / RAU
@@ -812,83 +878,75 @@
 	f_cleanup();
 }
 
-private function f_TC_suspend(charstring id) runs on BSSGP_ConnHdlr {
+private function f_TC_suspend() runs on GlobalTest_CT {
 	var integer i;
 
 	/* TODO: Generate RA ID for each ConnHdlr */
-	var RoutingAreaIdentification	ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id;
+	var RoutingAreaIdentification	ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
 	for (i := 0; i < 10; i := i+1) {
-
-		var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(g_pars.tlli, 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(g_pars.tlli, ra_id);
+		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
 
-		f_pcu2sgsn(pdu_tx, pdu_rx);
+		f_global_pcu2sgsn(pdu_tx, pdu_rx);
 
-		pdu_tx := ts_BSSGP_SUSPEND_ACK(g_pars.tlli, ra_id, int2oct(i, 1));
+		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(g_pars.tlli, ra_id, int2oct(i, 1));
+		pdu_rx := tr_BSSGP_SUSPEND_ACK(tlli, ra_id, int2oct(i, 1));
 
-		f_sgsn2pcu(pdu_tx, pdu_rx);
+		f_global_sgsn2pcu(pdu_tx, pdu_rx);
 
 		/* These messages are simple passed through so just also test sending NACK */
-		pdu_tx := ts_BSSGP_SUSPEND_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+		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(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+		pdu_rx := tr_BSSGP_SUSPEND_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
 
-		f_sgsn2pcu(pdu_tx, pdu_rx);
+		f_global_sgsn2pcu(pdu_tx, pdu_rx);
 	}
 	setverdict(pass);
 }
-testcase TC_suspend() runs on test_CT
+testcase TC_suspend() runs on GlobalTest_CT
 {
-	var BSSGP_ConnHdlr vc_conn;
 	f_init();
-
-	vc_conn := f_start_handler(refers(f_TC_suspend), testcasename(), g_pcu, g_sgsn, 6);
-	vc_conn.done;
-	/* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
-
+	f_global_init();
+	f_TC_suspend();
 	f_cleanup();
 }
 
-private function f_TC_resume(charstring id) runs on BSSGP_ConnHdlr {
+private function f_TC_resume() runs on GlobalTest_CT {
 	var integer i;
 
 	/* TODO: Generate RA ID for each ConnHdlr */
-	var RoutingAreaIdentification	ra_id := g_pars.pcu[0].cfg.bvc[0].cell_id.ra_id;
+	var RoutingAreaIdentification	ra_id := g_pcu[0].cfg.bvc[0].cell_id.ra_id;
 	for (i := 0; i < 10; i := i+1) {
-
-		var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(g_pars.tlli, ra_id, int2oct(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(g_pars.tlli, ra_id, int2oct(i, 1));
+		var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(i, 1));
 
-		f_pcu2sgsn(pdu_tx, pdu_rx);
+		f_global_pcu2sgsn(pdu_tx, pdu_rx);
 
-		pdu_tx := ts_BSSGP_RESUME_ACK(g_pars.tlli, ra_id);
+		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(g_pars.tlli, ra_id);
+		pdu_rx := tr_BSSGP_RESUME_ACK(tlli, ra_id);
 
-		f_sgsn2pcu(pdu_tx, pdu_rx);
+		f_global_sgsn2pcu(pdu_tx, pdu_rx);
 
 		/* These messages are simple passed through so just also test sending NACK */
-		pdu_tx := ts_BSSGP_RESUME_NACK(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+		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(g_pars.tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
+		pdu_rx := tr_BSSGP_RESUME_NACK(tlli, ra_id, BSSGP_CAUSE_UNKNOWN_MS);
 
-		f_sgsn2pcu(pdu_tx, pdu_rx);
+		f_global_sgsn2pcu(pdu_tx, pdu_rx);
 	}
 	setverdict(pass);
 }
-testcase TC_resume() runs on test_CT
+testcase TC_resume() runs on GlobalTest_CT
 {
-	var BSSGP_ConnHdlr vc_conn;
 	f_init();
-
-	vc_conn := f_start_handler(refers(f_TC_resume), testcasename(), g_pcu, g_sgsn, 6);
-	vc_conn.done;
-	/* TODO: start multiple handlers (UEs) on various cells on same and other NSEs */
-
+	f_global_init();
+	f_TC_resume();
 	f_cleanup();
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21325
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: I805372f3024a0ec2491a24422e02c0bc6dc669d2
Gerrit-Change-Number: 21325
Gerrit-PatchSet: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: daniel <dwillmann at sysmocom.de>
Gerrit-CC: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201125/2cafaaf7/attachment.htm>


More information about the gerrit-log mailing list