aboutsummaryrefslogtreecommitdiffstats
path: root/fr
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-02-03 18:08:29 +0100
committerHarald Welte <laforge@osmocom.org>2021-02-03 19:28:05 +0100
commitf1f23bf7853321db7f8dd3da85e945121a4380b5 (patch)
tree15341d0344bb591b7aeb09cd1e387d2e0c92574d /fr
parent02cdc7cf2cde6b1f4499f1dc26a74b1a8e3f7a66 (diff)
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
Diffstat (limited to 'fr')
-rw-r--r--fr/FR_Tests.ttcn56
1 files changed, 36 insertions, 20 deletions
diff --git a/fr/FR_Tests.ttcn b/fr/FR_Tests.ttcn
index 2bac1f8e..7ef5f1f5 100644
--- a/fr/FR_Tests.ttcn
+++ b/fr/FR_Tests.ttcn
@@ -9,8 +9,11 @@ import from BSSGP_Emulation all;
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 @@ type component test_CT {
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 @@ private function f_init_gb(inout GbInstance gb, charstring id, integer offset) r
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 @@ private altstep as_ue_tguard() runs on UE_CT {
}
}
+/* 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 @@ function f_handler_init(void_fn fn, charstring id, UE_Pars pars) runs on UE_CT {
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 @@ function f_ul_ud(charstring id) runs on UE_CT {
}
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 @@ runs on test_CT return UE_CT
}
-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 @@ testcase TC_foo() runs on test_CT {
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 @@ testcase TC_foo() runs on test_CT {
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() );
}
}