Change in osmo-ttcn3-hacks[master]: fr: Generalize and document functions

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 Feb 3 17:22:30 UTC 2021


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


Change subject: fr: Generalize and document functions
......................................................................

fr: Generalize and document functions

This prepares a lot of the FR_Tests functionality to be re-used in more
test cases.

Change-Id: I95b759ad85d9d1cba1533122672e7ff5628bc014
---
M fr/FR_Tests.ttcn
1 file changed, 36 insertions(+), 20 deletions(-)



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

diff --git a/fr/FR_Tests.ttcn b/fr/FR_Tests.ttcn
index 2bac1f8..7ef5f1f 100644
--- a/fr/FR_Tests.ttcn
+++ b/fr/FR_Tests.ttcn
@@ -9,8 +9,11 @@
 import from LLC_Templates all;
 
 modulepar {
+	/* number of BVCs to bring up in one Gb instance */
 	integer mp_num_bvc := 10;
+	/* number of UEs to start in each PTP BVC */
 	integer mp_num_ue_in_bvc := 10;
+	/* NS configurations; one per NSE; each with any number of NSVC */
 	NSConfigurations mp_nsconfig := {
 		{
 			nsei := 123,
@@ -47,6 +50,7 @@
 	port BSSGP_CT_PROC_PT BSSGP_PROC[16];
 };
 
+/* initialize one Gb interface */
 private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
 	var charstring id_idx := id & int2str(offset);
 	gb.vc_NS := NS_CT.create(id_idx & "-NSemu");
@@ -57,7 +61,8 @@
 	gb.vc_BSSGP.start(BssgpStart(gb.cfg, testcasename()));
 }
 
-function f_gen_bvc(integer base, integer idx) return BssgpBvcConfig {
+/* generate a BVC dynamically, using distinct number ranges for BVCI, CID, LAC, ... */
+private function f_gen_bvc(integer base, integer idx) return BssgpBvcConfig {
 	var BssgpBvcConfig bvc := {
 		bvci := base + 100 + idx,
 		cell_id := {
@@ -102,6 +107,7 @@
 	}
 }
 
+/* first function executed in UE_CT; creates LLC context, registers with BSSGP, starts Tguard */
 function f_handler_init(void_fn fn, charstring id, UE_Pars pars) runs on UE_CT {
 	g_pars := pars;
 	llc := f_llc_create(false);
@@ -109,12 +115,6 @@
 	g_Tguard.start(g_pars.tguard);
 	activate(as_ue_tguard());
 
-	fn.apply(id);
-	f_bssgp_client_unregister(g_pars.imsi);
-}
-
-function f_ul_ud(charstring id) runs on UE_CT {
-
 	log(id, " Waiting for BVC-UNBLOCK");
 	timer T := 15.0;
 	T.start;
@@ -128,17 +128,12 @@
 	}
 
 	log (id, " Entering main loop");
-	for (var integer num_pkts := 0; num_pkts < 50; num_pkts := num_pkts + 1) {
-		var integer ran_index := 0;
-		//BSSGP[ran_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[ran_index], llc_enc));
-		BSSGP[ran_index].send(ts_LLC_UI(f_rnd_octstring(512), '0000'B, '1'B, 0))
-		f_sleep(0.5);
-		/* 512 bytes + 32 bytes HDR every 0.5s (1088/s) means about 8704/s per UE */
-		/* at 100 UE that ends up about 870 kBps */
-	}
+	fn.apply(id);
 	log (id, "Leaving main loop");
+	f_bssgp_client_unregister(g_pars.imsi);
 }
 
+/* start a single UE component; connect it to BSSGP */
 function f_start_ue(void_fn fn, charstring id, GbInstance gb, integer imsi_suffix, BSSGP_BVC_CT bvc_comp, float t_guard := 40.0)
 runs on test_CT return UE_CT
 {
@@ -159,7 +154,9 @@
 }
 
 
-testcase TC_foo() runs on test_CT {
+/* main test case body function; start Gb instances, start UE_CTs on top; wait for termination */
+private function f_tc_body(void_fn ue_fn, integer ue_per_bvc := mp_num_ue_in_bvc,
+			   float delay_between_ue := 0.005, float ue_tguard := 40.0) runs on test_CT {
 	var ro_ue ues := {};
 
 	for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
@@ -179,13 +176,14 @@
 	for (var integer i := 0; i < lengthof(mp_nsconfig); i := i+1) {
 		for (var integer j := 0; j < mp_num_bvc; j := j+1) {
 			var BSSGP_BVC_CT bvc_comp := f_bssgp_get_bvci_ct(g_gb[i].cfg.bvc[j].bvci, BSSGP_PROC[i]);
-			for (var integer k := 0; k < mp_num_ue_in_bvc; k := k+1) {
+			for (var integer k := 0; k < ue_per_bvc; k := k+1) {
 				var charstring id := "gb" & int2str(i) & "-bvc" & int2str(g_gb[i].cfg.bvc[j].bvci) & "-UEsim" & int2str(k);
 				var UE_CT ue;
-				ue := f_start_ue(refers(f_ul_ud), id, g_gb[i], i*10000+j*100+k, bvc_comp);
+				ue := f_start_ue(ue_fn, id, g_gb[i], i*10000+j*100+k, bvc_comp,
+ue_tguard);
 				ues := ues & { ue };
 				/* a bit of staggering to ensure the timers above don't run all at the same time */
-				f_sleep(0.005);
+				f_sleep(delay_between_ue);
 				/* FIXME: as the BSSGP emulation is already running, we must not
 				 * take too long to start the UE components.  If we do, the
 				 * BVC_S_UNBLOCKED notification will arrive before the components
@@ -201,8 +199,26 @@
 	setverdict(pass);
 }
 
+private function f_ul_ud(charstring id) runs on UE_CT
+{
+	for (var integer num_pkts := 0; num_pkts < 50; num_pkts := num_pkts + 1) {
+		var integer ran_index := 0;
+		//BSSGP[ran_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[ran_index], llc_enc));
+		BSSGP[ran_index].send(ts_LLC_UI(f_rnd_octstring(512), '0000'B, '1'B, 0))
+		f_sleep(0.5);
+		/* 512 bytes + 32 bytes HDR every 0.5s (1088/s) means about 8704/s per UE */
+		/* at 100 UE that ends up about 870 kBps */
+	}
+}
+/* Generate uplink-unitdata traffic */
+testcase TC_ul_ud() runs on test_CT
+{
+	f_tc_body(refers(f_ul_ud));
+}
+
+
 control {
-	execute( TC_foo() );
+	execute( TC_ul_ud() );
 }
 
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22664
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: I95b759ad85d9d1cba1533122672e7ff5628bc014
Gerrit-Change-Number: 22664
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210203/2fe50829/attachment.htm>


More information about the gerrit-log mailing list