bscnat: Refactor MSC side code to allow different actions per test

Each test can now plug in different acctions to be done by the emulated
MSC, by passing a BssmapCreateCallback RAN_Emaulation callback to
f_init(). Old hardcoded behaviour (main()) is renamed and used in
laready existing tests.

New infrastructure provides a generic BssmapCreateCallback taking care
of required boilerplate, so new tests/users only need to define a new
callback calling that generic one with a function pointer where all test
logic is implemented.

Change-Id: Ic429420d0d95b6aacb6e5c44031b49c942ed544d
diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index fda065a..47d894b 100644
--- a/bsc-nat/BSCNAT_Tests.ttcn
+++ b/bsc-nat/BSCNAT_Tests.ttcn
@@ -16,6 +16,7 @@
 import from IPL4asp_Types all;
 
 import from IPA_Emulation all;
+import from RAN_Emulation all;
 
 import from MTP3asp_Types all;
 
@@ -24,6 +25,7 @@
 import from SCCP_Emulation all;
 
 import from MSC_Simulation all;
+import from MSC_ConnectionHandler all;
 import from BSC_MS_Simulation all;
 import from BSC_MS_ConnectionHandler all;
 
@@ -136,7 +138,7 @@
 	f_vty_transceive(BSCNATVTY, "enable");
 }
 
-function f_init(void_fn_bsc_ms fn_bsc_ms, boolean use_osmux) runs on test_CT {
+function f_init(void_fn_bsc_ms fn_bsc_ms, BssmapCreateCallback cb_msc, boolean use_osmux) runs on test_CT {
 	var integer i;
 	var charstring id;
 
@@ -147,7 +149,9 @@
 		f_init_MscState(msc[i], mp_msc_pc +i, mp_bsc_pc, mp_msc_ssn, mp_bsc_ssn);
 		id := "MSC" & int2str(i);
 		msc[i].MSC := MSC_CT.create(id);
-		msc[i].MSC.start(MSC_Simulation.main(mp_msc_ip, mp_msc_port + i, msc[i].sccp_pars, msc[i].sccp_addr_own, id));
+		msc[i].MSC.start(MSC_Simulation.main(mp_msc_ip, mp_msc_port + i,
+						     msc[i].sccp_pars, msc[i].sccp_addr_own,
+						     cb_msc, id));
 	}
 
 	/* Wait for bsc_nat to attach to MSC. Before that all BSC connections will be dropped */
@@ -186,7 +190,9 @@
 function f_TC_recv_dump(boolean use_osmux := false) runs on test_CT {
 	timer T := 30.0;
 
-	f_init(refers(bsc_ms_establish_fully), use_osmux);
+	f_init(refers(bsc_ms_establish_fully),
+	       refers(CreateCallback_establish_fully),
+	       use_osmux);
 
 	f_wait_finish(T);
 }