bscnat: Refactor BSC_MS side code to allow different actions per test
Each test can now plug in different actions to be done by the emulated
BSC_MS, by passing a function to f_init(). Old hardcoded behaviour (main())
is renamed and used in already existing tests.
Change-Id: Ic82ca333267535c5859e6439deacbf3b1d1fe391
diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index 6b0c757..fda065a 100644
--- a/bsc-nat/BSCNAT_Tests.ttcn
+++ b/bsc-nat/BSCNAT_Tests.ttcn
@@ -25,6 +25,7 @@
import from MSC_Simulation all;
import from BSC_MS_Simulation all;
+import from BSC_MS_ConnectionHandler all;
import from Osmocom_VTY_Functions all;
import from TELNETasp_PortType all;
@@ -135,7 +136,7 @@
f_vty_transceive(BSCNATVTY, "enable");
}
-function f_init(boolean use_osmux) runs on test_CT {
+function f_init(void_fn_bsc_ms fn_bsc_ms, boolean use_osmux) runs on test_CT {
var integer i;
var charstring id;
@@ -156,9 +157,12 @@
f_init_BscState(bsc[i], mp_bsc_pc +i, mp_msc_pc, mp_bsc_ssn, mp_msc_ssn);
id := "BSC" & int2str(i);
bsc[i].BSC := BSC_CT.create(id);
+ var BSC_MS_TestHdlrParams pars;
+ pars.sccp_addr_own := bsc[i].sccp_addr_own;
+ pars.sccp_addr_remote := bsc[i].sccp_addr_peer;
+ pars.use_osmux := use_osmux;
bsc[i].BSC.start(BSC_MS_Simulation.main(mp_nat_ip, mp_nat_port, mp_bsc_ip, mp_bsc_port+i,
- bsc[i].sccp_pars, bsc[i].sccp_addr_own,
- bsc[i].sccp_addr_peer, use_osmux, id));
+ bsc[i].sccp_pars, pars, fn_bsc_ms, id));
}
}
@@ -182,7 +186,7 @@
function f_TC_recv_dump(boolean use_osmux := false) runs on test_CT {
timer T := 30.0;
- f_init(use_osmux);
+ f_init(refers(bsc_ms_establish_fully), use_osmux);
f_wait_finish(T);
}