aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-06-10 21:02:03 +0200
committerpespin <pespin@sysmocom.de>2019-06-13 14:33:23 +0000
commit8ab9a7936bbf4b4c2b2de8bb703acadeb94fa358 (patch)
treebad0f27461cec209c2864fcb87bf0b58f589b5a1
parenta839604956fa5cc773ecbad79975f8574f81a209 (diff)
bscnat: Introduce test TC_ctrl_location
It checks location-state TRAP is forwaded correctly in BSC-NAT from BSC towards locally connected CTRL client, with variable names updated to contain BSC/BTS indexes. It also verifies commands can be applied (SET) in inverse direction. Change-Id: If28aba011a1903788cacbc10c0b62954925d4b1f
-rw-r--r--bsc-nat/BSCNAT_Tests.ttcn27
-rw-r--r--bsc-nat/BSC_MS_ConnectionHandler.ttcn4
-rw-r--r--bsc-nat/BSC_MS_Simulation.ttcn31
-rwxr-xr-xbsc-nat/gen_links.sh2
-rwxr-xr-xbsc-nat/regen_makefile.sh2
5 files changed, 60 insertions, 6 deletions
diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index 81afcfae..9d2fc4be 100644
--- a/bsc-nat/BSCNAT_Tests.ttcn
+++ b/bsc-nat/BSCNAT_Tests.ttcn
@@ -20,6 +20,10 @@ import from RAN_Emulation all;
import from MTP3asp_Types all;
+import from Osmocom_CTRL_Functions all;
+import from Osmocom_CTRL_Types all;
+import from Osmocom_CTRL_Adapter all;
+
import from SCCP_Types all;
import from SCCPasp_Types all;
import from SCCP_Emulation all;
@@ -48,7 +52,7 @@ type record MscState {
SCCP_PAR_Address sccp_addr_own
}
-type component test_CT {
+type component test_CT extends CTRL_Adapter_CT {
var MscState msc[NUM_MSC];
var BscState bsc[NUM_BSC];
@@ -65,6 +69,9 @@ modulepar {
PortNumber mp_msc_port := 5000;
charstring mp_msc_ip := "127.0.0.1";
+ /* port number to which to establish the IPA CTRL connection */
+ integer mp_nat_ctrl_port := 4250;
+ /* port number to which to establish the SCCPLite connection */
PortNumber mp_nat_port := 5000;
charstring mp_nat_ip := "127.0.0.1";
@@ -144,6 +151,7 @@ function f_init(void_fn_bsc_ms fn_bsc_ms, void_fn_bsc fn_bsc, BssmapCreateCallba
f_init_vty("VirtBSCNAT");
f_vty_allow_osmux(use_osmux);
+ f_ipa_ctrl_start(mp_nat_ip, mp_nat_ctrl_port);
for (i := 0; i < NUM_MSC; i := i+1) {
f_init_MscState(msc[i], mp_msc_pc +i, mp_bsc_pc, mp_msc_ssn, mp_bsc_ssn);
@@ -206,9 +214,26 @@ testcase TC_recv_dump_osmux() runs on test_CT {
f_TC_recv_dump(true);
}
+testcase TC_ctrl_location() runs on test_CT {
+ timer T := 30.0;
+
+ f_init(refers(bsc_ms_do_nothing),
+ refers(bsc_ctrl_location),
+ refers(CreateCallback_establish_fully),
+ false);
+
+ f_ctrl_exp_trap(IPA_CTRL, "net.0.bsc.0.bts.0.location-state",
+ "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01",
+ 10.0);
+ f_ctrl_set(IPA_CTRL, "net.0.bsc.0.rf_locked", "1");
+
+ f_wait_finish(T);
+}
+
control {
execute( TC_recv_dump() );
execute( TC_recv_dump_osmux() );
+ execute( TC_ctrl_location() );
}
}
diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
index f7126fdc..f011c39f 100644
--- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn
+++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
@@ -210,4 +210,8 @@ runs on BSC_MS_ConnHdlr {
}
}
+function bsc_ms_do_nothing(charstring id)
+runs on BSC_MS_ConnHdlr {
+}
+
}
diff --git a/bsc-nat/BSC_MS_Simulation.ttcn b/bsc-nat/BSC_MS_Simulation.ttcn
index 7f233181..453f3040 100644
--- a/bsc-nat/BSC_MS_Simulation.ttcn
+++ b/bsc-nat/BSC_MS_Simulation.ttcn
@@ -14,6 +14,9 @@ import from IPL4asp_Types all;
import from IPA_Emulation all;
+import from Osmocom_CTRL_Functions all;
+import from Osmocom_CTRL_Types all;
+
import from SCCP_Types all;
import from SCCPasp_Types all;
import from SCCP_Emulation all;
@@ -33,6 +36,8 @@ type component BSC_CT {
var RAN_Emulation_CT vc_BSSMAP;
/* test port to SCCP emulation */
port SCCPasp_PT SCCP;
+ /* test port to SCCPLite CTRL over IPA emulation */
+ port IPA_CTRL_PT SCCPLITE_IPA_CTRL;
var BSC_MS_TestHdlrParams g_pars;
@@ -71,6 +76,15 @@ function bsc_do_nothing(charstring id)
runs on BSC_CT {
}
+/* Submit a location-state TRAP BSC->BSC-NAT */
+function bsc_ctrl_location(charstring id)
+runs on BSC_CT {
+ log("Starting main of BSC_CT");
+ f_ctrl_trap(SCCPLITE_IPA_CTRL, "bts.0.location-state",
+ "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01");
+ f_ctrl_exp_set(SCCPLITE_IPA_CTRL, "rf_locked", "1", "1");
+}
+
function main(charstring remote_ip, PortNumber remote_port,
charstring local_ip, PortNumber local_port,
MSC_SCCP_MTP3_parameters sccp_pars,
@@ -78,7 +92,7 @@ function main(charstring remote_ip, PortNumber remote_port,
void_fn_bsc_ms fn_bsc_ms, void_fn_bsc fn_bsc, charstring id) runs on BSC_CT
{
var integer i := 0;
- timer T := 1.0;
+ timer T := 2.0;
var IPA_CCM_Parameters ccm_pars := IPA_Emulation.c_IPA_default_ccm_pars;
ccm_pars.name := id;
g_pars := pars;
@@ -98,6 +112,11 @@ function main(charstring remote_ip, PortNumber remote_port,
/* connect BSSMAP dispatcher to IPA_Emulation MGCP */
connect(vc_BSSMAP:MGCP, vc_IPA:IPA_MGCP_PORT);
+ /* connect BSSMAP dispatcher to IPA_Emulation CTRL */
+ connect(vc_BSSMAP:CTRL, vc_IPA:IPA_CTRL_PORT);
+
+ /* connect BSSMAP dispatcher to IPA_Emulation CTRL */
+ connect(self:SCCPLITE_IPA_CTRL, vc_BSSMAP:CTRL_CLIENT);
/* start components */
vc_IPA.start(IPA_Emulation.main_client(remote_ip, remote_port, local_ip, local_port, ccm_pars));
@@ -105,8 +124,14 @@ function main(charstring remote_ip, PortNumber remote_port,
vc_BSSMAP.start(RAN_Emulation.main(BSC_MS_ConnectionHandler.BSC_MS_RanOps, id));
/* Initial delay to wait for IPA connection establishment */
- T.start(2.0);
- T.timeout;
+ T.start;
+ alt {
+ [] SCCPLITE_IPA_CTRL.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) { }
+ [] T.timeout {
+ setverdict(fail, "Timeout CTRL waiting for ASP_IPA_EVENT_UP");
+ mtc.stop;
+ }
+ }
var BSC_MS_ConnHdlrList vc_conns;
for (i := 0; i < mp_num_iterations; i := i+1) {
diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index 01d4c7b6..5da9d4e6 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -52,7 +52,7 @@ FILES="RTP_EncDec.cc RTP_Types.ttcn"
gen_links $DIR $FILES
DIR=../library
-FILES="Misc_Helpers.ttcn 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.ttcnpp L3_Templates.ttcn BSSMAP_Templates.ttcn RAN_Emulation.ttcnpp MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc Osmocom_CTRL_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_CTRL_Functions.ttcn BSSAP_CodecPort.ttcn"
+FILES="Misc_Helpers.ttcn 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.ttcnpp L3_Templates.ttcn BSSMAP_Templates.ttcn RAN_Emulation.ttcnpp MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc Osmocom_CTRL_Types.ttcn Osmocom_VTY_Functions.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn BSSAP_CodecPort.ttcn"
gen_links $DIR $FILES
ignore_pp_results
diff --git a/bsc-nat/regen_makefile.sh b/bsc-nat/regen_makefile.sh
index 0f3cfabe..c9d744e2 100755
--- a/bsc-nat/regen_makefile.sh
+++ b/bsc-nat/regen_makefile.sh
@@ -4,6 +4,6 @@ MAIN=BSCNAT_Tests.ttcn
FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc RTP_EncDec.cc SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc"
-export CPPFLAGS_TTCN3="-DIPA_EMULATION_SCCP -DIPA_EMULATION_MGCP -DRAN_EMULATION_BSSAP -DRAN_EMULATION_MGCP -DUSE_MTP3_DISTRIBUTOR"
+export CPPFLAGS_TTCN3="-DIPA_EMULATION_SCCP -DIPA_EMULATION_MGCP -DIPA_EMULATION_CTRL -DRAN_EMULATION_BSSAP -DRAN_EMULATION_MGCP -DRAN_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR"
../regen-makefile.sh $MAIN $FILES