aboutsummaryrefslogtreecommitdiffstats
path: root/bsc
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-01-17 22:39:54 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-21 19:31:09 +0100
commitffe55fcc83a0a4a5a8381038bda1218e03c32696 (patch)
treea6ed99aba23918c7f9e1392100b6736d4bad21b4 /bsc
parent67089ee9a4550ed42820d6c6cbcb968dedf2bae4 (diff)
bsc test: Abstract out CTRL handling so it can be re-used from MSC test
We create a new Osmocom_CTRL_Adapter module which can be used by test suites using the 'extends' functionality. Change-Id: I3ef6cfaa738900e008155013a05b8ccf3d4b7aeb
Diffstat (limited to 'bsc')
-rw-r--r--bsc/BSC_Tests.ttcn54
-rwxr-xr-xbsc/gen_links.sh2
2 files changed, 4 insertions, 52 deletions
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 880b693b..6b5ce24f 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -34,6 +34,7 @@ import from RSL_Emulation all;
import from Osmocom_CTRL_Functions all;
import from Osmocom_CTRL_Types all;
+import from Osmocom_CTRL_Adapter all;
import from MobileL3_CommonIE_Types all;
import from L3_Templates all;
@@ -46,43 +47,18 @@ const float T3101_MAX := 12.0;
const integer NUM_TCHF_PER_BTS := 5;
-/* BSC specific CTRL helper functions */
-function f_ctrl_get_bts(IPA_CTRL_PT pt, integer bts_nr, charstring suffix) return CtrlValue {
- return f_ctrl_get(pt, "bts." & int2str(bts_nr) & "." & suffix);
-}
-
-template charstring ts_bts(integer bts_nr) := "bts." & int2str(bts_nr) & ".";
-template charstring ts_bts_trx(integer bts_nr, integer trx_nr ) :=
- valueof(ts_bts(bts_nr)) & "trx." & int2str(trx_nr) & ".";
-
-function f_ctrl_get_exp_bts(IPA_CTRL_PT pt, integer bts_nr, CtrlVariable suffix, template CtrlValue exp) {
- f_ctrl_get_exp(pt, valueof(ts_bts(bts_nr)) & suffix, exp);
-}
-
-function f_ctrl_get_exp_trx(IPA_CTRL_PT pt, integer bts_nr, integer trx_nr, CtrlVariable suffix,
- template CtrlValue exp)
-{
- f_ctrl_get_exp(pt, valueof(ts_bts_trx(bts_nr, trx_nr)) & suffix, exp);
-}
-
-
/* per-BTS state which we keep */
type record BTS_State {
/* component reference to the IPA_Client component used for RSL */
IPA_Client rsl
}
-type component test_CT extends BSSAP_Adapter_CT {
+type component test_CT extends BSSAP_Adapter_CT, CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
- /* component reference to the IPA_Client component used for CTRL to BSC */
- var IPA_Client ctrl;
- /* test port for the CTRL interface of the BSC */
- port IPA_CTRL_PT IPA_CTRL;
-
/* are we initialized yet */
var boolean g_initialized := false;
@@ -160,30 +136,6 @@ runs on test_CT {
}
}
-/*! Start the CTRL connection to the specified BSC IP+Port */
-function f_ipa_ctrl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i)
-runs on test_CT {
- timer T := 10.0;
-
- clnt.id := "IPA" & int2str(i) & "-CTRL";
- clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA");
-
- map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
- connect(clnt.vc_IPA:IPA_CTRL_PORT, self:IPA_CTRL);
-
- clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", -1));
-
- /* wait for IPA CTRL link to connect and send UP */
- T.start;
- alt {
- [] IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { }
- [] T.timeout {
- setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
- self.stop;
- }
- }
-}
-
/* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */
function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT {
timer T := secs_max;
@@ -242,7 +194,7 @@ function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs o
} else {
f_bssap_init("VirtMSC", omit);
}
- f_ipa_ctrl_start(ctrl, mp_bsc_ip, mp_bsc_ctrl_port, 0);
+ f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
for (i := 0; i < nr_bts; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 14771a7b..94bea21a 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -76,5 +76,5 @@ FILES="RTP_EncDec.cc RTP_Types.ttcn"
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 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 IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.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 Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.ttcn"
gen_links $DIR $FILES