BSC_Tests: Prepare for tests based on {RSL,BSSMAP}_Emulation
The existing tests were implemented directly on top of the BSSMAP
and RSL CodecPorts. If we loop in the RSL_Emulation and
BSSMAP_Emulation components, we can properly multiplex/demultiplex
multiple MS (radio channels) on both the RSL and the MSC (SCCP
connection) side.
In order to have a single component that handles both the RSL and the
BSSAP side of a given channel/subscriber/call, we introduce the concept
of BSSMAP "Expects", where the test csse can register the L3 INFO that
it sends in the RLL ESTablish INDication on the RSL side, so the BSSMAP
handler cna route the BSC-originated SCCP connection with that L3 INFO
back to the same component. This is a bit inspired "in spirit" of the
"expect" mechanism of netfilter connection tracking.
Change-Id: I71f777cd4f290422fa68897952b6505875e35f0e
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 42de6be..c824415 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -12,6 +12,7 @@
import from IPA_Emulation all;
import from IPA_Types all;
import from RSL_Types all;
+import from RSL_Emulation all;
import from Osmocom_CTRL_Functions all;
import from Osmocom_CTRL_Types all;
@@ -75,10 +76,13 @@
type record IPA_Client {
IPA_Emulation_CT vc_IPA,
IPA_CCM_Parameters ccm_pars,
- charstring id
+ charstring id,
+
+ RSL_Emulation_CT vc_RSL optional
}
-function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i)
+function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i,
+ boolean handler_mode := false)
runs on test_CT {
timer T := 10.0;
@@ -87,11 +91,22 @@
clnt.ccm_pars := c_IPA_default_ccm_pars;
clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0";
+ if (handler_mode) {
+ clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL");
+ }
map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
- connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]);
+ if (handler_mode) {
+ connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT);
+ } else {
+ connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]);
+ }
clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars));
+ if (handler_mode) {
+ clnt.vc_RSL.start(RSL_Emulation.main());
+ return;
+ }
/* wait for IPA RSL link to connect and send ID ACK */
T.start;
@@ -170,7 +185,7 @@
}
}
-function f_init() runs on test_CT {
+function f_init(boolean handler_mode := false) runs on test_CT {
var integer i;
if (g_initialized) {
@@ -180,14 +195,14 @@
/* Call a function of our 'parent component' BSSAP_Adapter_CT to start the
* MSC-side BSSAP emulation */
- f_bssap_init("VirtMSC");
+ f_bssap_init("VirtMSC", handler_mode);
f_ipa_ctrl_start(ctrl, mp_bsc_ip, mp_bsc_ctrl_port, 0);
for (i := 0; i < NUM_BTS; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
f_wait_oml(i, "degraded", 5.0);
/* start RSL connection */
- f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i);
+ f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i, handler_mode);
/* wait until BSC tells us "connected" */
f_wait_oml(i, "connected", 5.0);
}
diff --git a/bsc/BSSAP_Adapter.ttcn b/bsc/BSSAP_Adapter.ttcn
index 60c7103..f1ff5b6 100644
--- a/bsc/BSSAP_Adapter.ttcn
+++ b/bsc/BSSAP_Adapter.ttcn
@@ -22,6 +22,9 @@
import from BSSAP_CodecPort all;
import from BSSMAP_Templates all;
+import from BSSMAP_Emulation all;
+
+import from MSC_ConnectionHandler all;
type component BSSAP_Adapter_CT {
/* component references */
@@ -33,6 +36,9 @@
var octetstring g_sio;
var MSC_SCCP_MTP3_parameters g_sccp_pars;
var SCCP_PAR_Address g_sccp_addr_own, g_sccp_addr_peer;
+
+ /* handler mode */
+ var BSSMAP_Emulation_CT vc_BSSMAP;
}
modulepar {
@@ -79,24 +85,33 @@
}
-function f_bssap_init(charstring id) runs on BSSAP_Adapter_CT
+function f_bssap_init(charstring id, boolean handler_mode := false) runs on BSSAP_Adapter_CT
{
init_pars();
/* create components */
vc_M3UA := M3UA_CT.create(id & "-M3UA");
vc_SCCP := SCCP_CT.create(id & "-SCCP");
+ if (handler_mode) {
+ vc_BSSMAP := BSSMAP_Emulation_CT.create(id & "-BSSMAP");
+ }
map(vc_M3UA:SCTP_PORT, system:sctp);
/* connect MTP3 service provider (M3UA) to lower side of SCCP */
connect(vc_M3UA:MTP3_SP_PORT, vc_SCCP:MTP3_SCCP_PORT);
-
- /* connect BSSNAP dispatcher to upper side of SCCP */
- connect(self:BSSAP, vc_SCCP:SCCP_SP_PORT);
+ if (handler_mode) {
+ connect(vc_BSSMAP:BSSAP, vc_SCCP:SCCP_SP_PORT);
+ } else {
+ /* connect BSSNAP dispatcher to upper side of SCCP */
+ connect(self:BSSAP, vc_SCCP:SCCP_SP_PORT);
+ }
vc_M3UA.start(f_M3UA_Emulation(mp_sctp_addr));
vc_SCCP.start(SCCPStart(g_sccp_pars));
+ if (handler_mode) {
+ vc_BSSMAP.start(BSSMAP_Emulation.main(MSC_BssmapOps, ""));
+ }
}
private altstep as_reset_ack() runs on BSSAP_Adapter_CT {
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index e46bee1..5d8555a 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -76,5 +76,5 @@
gen_links $DIR $FILES
DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn BSSAP_CodecPort.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn"
+FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc BSSAP_CodecPort.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn"
gen_links $DIR $FILES
diff --git a/bsc/regen_makefile.sh b/bsc/regen_makefile.sh
index 8b8fa43..d937482 100755
--- a/bsc/regen_makefile.sh
+++ b/bsc/regen_makefile.sh
@@ -2,6 +2,6 @@
MAIN=BSC_Tests.ttcn
-FILES="*.ttcn IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc *.c"
+FILES="*.ttcn IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc *.c"
../regen-makefile.sh $MAIN $FILES