Change in osmo-ttcn3-hacks[master]: FR/FRNET: Introduce simplistic simulation of UEs

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
Thu Nov 12 20:52:54 UTC 2020


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


Change subject: FR/FRNET: Introduce simplistic simulation of UEs
......................................................................

FR/FRNET: Introduce simplistic simulation of UEs

Let's start a number of per-UE/TLLI component on each BVC, and generate
some uplink traffic with random-payload 512-byte LLC frames.  The
FRNET(SGSN) side simply ignores all of those by means of a
CreateCallback.

Change-Id: I1b25b4a650d831bb07e9623b76e6c3dcdd71ac88
---
M fr-net/FRNET_Tests.ttcn
M fr/FR_Tests.ttcn
2 files changed, 81 insertions(+), 1 deletion(-)



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

diff --git a/fr-net/FRNET_Tests.ttcn b/fr-net/FRNET_Tests.ttcn
index 87b9bd7..94b32dc 100644
--- a/fr-net/FRNET_Tests.ttcn
+++ b/fr-net/FRNET_Tests.ttcn
@@ -43,6 +43,11 @@
 	var GbInstances g_gb;
 };
 
+
+private function CreateCallback(BssgpBvci bvci, BssgpCellId cell_id, OCT4 tlli, BssgpDecoded dec) runs on BSSGP_BVC_CT {
+	/* simply ignore any inbound traffic for now */
+}
+
 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");
@@ -66,7 +71,7 @@
 			cell_id := base + 600 + idx
 		},
 		depth := BSSGP_DECODE_DEPTH_LLC,
-		create_cb := refers(BSSGP_Emulation.DefaultCreateCallback)
+		create_cb := refers(CreateCallback)
 	};
 	return bvc;
 }
diff --git a/fr/FR_Tests.ttcn b/fr/FR_Tests.ttcn
index 9f9b70e..f3652a3 100644
--- a/fr/FR_Tests.ttcn
+++ b/fr/FR_Tests.ttcn
@@ -6,9 +6,11 @@
 
 import from NS_Emulation all;
 import from BSSGP_Emulation all;
+import from LLC_Templates all;
 
 modulepar {
 	integer mp_num_bvc := 10;
+	integer mp_num_ue_in_bvc := 10;
 	NSConfigurations mp_nsconfig := {
 		{
 			nsei := 123,
@@ -42,6 +44,7 @@
 
 type component test_CT {
 	var GbInstances g_gb;
+	port BSSGP_CT_PROC_PT BSSGP_PROC[16];
 };
 
 private function f_init_gb(inout GbInstance gb, charstring id, integer offset) runs on test_CT {
@@ -50,6 +53,7 @@
 	gb.vc_BSSGP := BSSGP_CT.create(id_idx & "-BSSGPemu");
 	connect(gb.vc_BSSGP:BSCP, gb.vc_NS:NS_SP);
 	gb.vc_NS.start(NSStart(mp_nsconfig[offset], id_idx));
+	connect(self:BSSGP_PROC[offset], gb.vc_BSSGP:PROC);
 	gb.vc_BSSGP.start(BssgpStart(gb.cfg, testcasename()));
 }
 
@@ -72,6 +76,65 @@
 	return bvc;
 }
 
+/***********************************************************************
+ * UE simulation component
+ ***********************************************************************/
+
+type component UE_CT extends BSSGP_Client_CT {
+	var UE_Pars g_pars;
+	timer g_Tguard;
+	var LLC_Entities llc;
+}
+
+type record UE_Pars {
+	hexstring imsi,
+	OCT4 tlli
+};
+
+type function void_fn(charstring id) runs on UE_CT;
+
+function f_handler_init(void_fn fn, charstring id, UE_Pars pars) runs on UE_CT {
+	g_pars := pars;
+	llc := f_llc_create(false);
+	f_bssgp_client_register(g_pars.imsi, g_pars.tlli);
+
+	fn.apply(id);
+	f_bssgp_client_unregister(g_pars.imsi);
+}
+
+function f_ul_ud(charstring id) runs on UE_CT {
+
+	log("Waiting for BVC-UNBLOCK");
+	alt {
+	[] BSSGP[0].receive(BssgpStatusIndication:{*,?,BVC_S_UNBLOCKED}) { }
+	[] BSSGP[0].receive { repeat; }
+	}
+
+	log ("Entering main loop");
+	while (true) {
+		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);
+	}
+}
+
+function f_start_ue(void_fn fn, charstring id, GbInstance gb, integer imsi_suffix, BSSGP_BVC_CT bvc_comp, float t_guard := 30.0)
+runs on test_CT
+{
+	var UE_CT ue_comp;
+	var UE_Pars ue_pars := {
+		imsi := f_gen_imsi(imsi_suffix),
+		tlli := f_gprs_tlli_random()
+	};
+
+	ue_comp := UE_CT.create(id);
+	connect(ue_comp:BSSGP[0], bvc_comp:BSSGP_SP);
+	connect(ue_comp:BSSGP_SIG[0], bvc_comp:BSSGP_SP_SIG);
+	connect(ue_comp:BSSGP_PROC[0], bvc_comp:BSSGP_PROC);
+	ue_comp.start(f_handler_init(fn, id, ue_pars));
+}
+
 
 testcase TC_foo() runs on test_CT {
 
@@ -85,8 +148,20 @@
 		for (var integer j := 0; j < mp_num_bvc; j := j+1) {
 			g_gb[i].cfg.bvc := g_gb[i].cfg.bvc & { f_gen_bvc(i * 1000, j) };
 		}
+		log("Initializing Gb interface ", i, ": NSEI=", g_gb[i].cfg.nsei);
 		f_init_gb(g_gb[i], "gb", i);
 	}
+	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) {
+				var charstring id := "gb" & int2str(i) & "-bvc" & int2str(g_gb[i].cfg.bvc[j].bvci) & "-UEsim" & int2str(k);
+				f_start_ue(refers(f_ul_ud), id, g_gb[i], i*10000+j*100+k, bvc_comp);
+				/* a bit of staggering to ensure the timers above don't run all at the same time */
+				f_sleep(0.05);
+			}
+		}
+	}
 	while (true) {
 		f_sleep(100.0);
 	}

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21133
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: I1b25b4a650d831bb07e9623b76e6c3dcdd71ac88
Gerrit-Change-Number: 21133
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/20201112/ffe93090/attachment.htm>


More information about the gerrit-log mailing list