aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-05-22 15:18:42 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2019-05-27 20:05:25 +0200
commitf3c12228fb1995633aad14620f9ba6d8275e3502 (patch)
tree80b3db3117de083f0aa2a431a4ddcb05d3a4f4d5
parent34b5a95d09aff3ead090cde984200019a43751ec (diff)
bsc-nat: Introduce Osmux test
-rw-r--r--bsc-nat/BSCNAT_Tests.default12
-rw-r--r--bsc-nat/BSCNAT_Tests.ttcn44
-rw-r--r--bsc-nat/BSC_MS_ConnectionHandler.ttcn20
-rw-r--r--bsc-nat/BSC_MS_Simulation.ttcn7
-rwxr-xr-xbsc-nat/gen_links.sh7
-rwxr-xr-xbsc-nat/regen_makefile.sh2
6 files changed, 80 insertions, 12 deletions
diff --git a/bsc-nat/BSCNAT_Tests.default b/bsc-nat/BSCNAT_Tests.default
index 37c10487..3374bcf5 100644
--- a/bsc-nat/BSCNAT_Tests.default
+++ b/bsc-nat/BSCNAT_Tests.default
@@ -4,8 +4,19 @@ mtc.FileMask := ERROR | WARNING | PARALLEL | VERDICTOP;
[TESTPORT_PARAMETERS]
#*.*.udpReuseAddress := "yes";
+*.BSCNATVTY.CTRL_MODE := "client"
+*.BSCNATVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.BSCNATVTY.CTRL_PORTNUM := "4244"
+*.BSCNATVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.BSCNATVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.BSCNATVTY.CTRL_READMODE := "buffered"
+*.BSCNATVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.BSCNATVTY.CTRL_DETECT_CONNECTION_ESTABLISHMENT_RESULT := "yes"
+*.BSCNATVTY.PROMPT1 := "OsmoBSCNAT> "
+
[MODULE_PARAMETERS]
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSCNAT";
mp_bsc_port := 49999;
mp_bsc_ip := "127.0.0.1";
mp_msc_port := 5100;
@@ -22,4 +33,3 @@ mp_mgw_ip := "127.0.0.1";
mp_mgw_udp_port := 2427;
[EXECUTE]
-
diff --git a/bsc-nat/BSCNAT_Tests.ttcn b/bsc-nat/BSCNAT_Tests.ttcn
index b9b031f3..2fab4a37 100644
--- a/bsc-nat/BSCNAT_Tests.ttcn
+++ b/bsc-nat/BSCNAT_Tests.ttcn
@@ -26,6 +26,9 @@ import from SCCP_Emulation all;
import from MSC_Simulation all;
import from BSC_MS_Simulation all;
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
const integer NUM_MSC := 1;
const integer NUM_BSC := 1;
@@ -46,6 +49,8 @@ type component test_CT {
var MscState msc[NUM_MSC];
var BscState bsc[NUM_BSC];
+ port TELNETasp_PT BSCNATVTY;
+
var boolean g_initialized := false;
var octetstring g_sio := '83'O;
}
@@ -112,10 +117,31 @@ runs on test_CT {
msc_st.sccp_addr_own := valueof(ts_SccpAddr_PC_SSN(opc, local_ssn));
}
-function f_init() runs on test_CT {
+function f_vty_allow_osmux(boolean allow) runs on test_CT {
+ if (allow) {
+ f_vty_config(BSCNATVTY, "mgcp", "osmux on");
+ } else {
+ f_vty_config(BSCNATVTY, "mgcp", "osmux off");
+ }
+}
+
+function f_init_vty(charstring id := "foo") runs on test_CT {
+ if (BSCNATVTY.checkstate("Mapped")) {
+ /* skip initialization if already executed once */
+ return;
+ }
+ map(self:BSCNATVTY, system:BSCNATVTY);
+ f_vty_set_prompts(BSCNATVTY);
+ f_vty_transceive(BSCNATVTY, "enable");
+}
+
+function f_init(boolean use_osmux) runs on test_CT {
var integer i;
var charstring id;
+ f_init_vty("VirtBSCNAT");
+ f_vty_allow_osmux(use_osmux);
+
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);
id := "MSC" & int2str(i);
@@ -125,22 +151,23 @@ function f_init() runs on test_CT {
/* Wait for bsc_nat to attach to MSC. Before that all BSC connections will be dropped */
f_sleep(5.0);
+
for (i := 0; i < NUM_BSC; i := i+1) {
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);
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, id));
+ bsc[i].sccp_addr_peer, use_osmux, id));
}
}
-testcase TC_recv_dump() runs on test_CT {
+function f_TC_recv_dump(boolean use_osmux := false) runs on test_CT {
var integer i;
timer T := 30.0;
- f_init();
+ f_init(use_osmux);
alt {
/* wait for BSC to stop. The idea is that the BSC components terminate first */
@@ -155,8 +182,17 @@ testcase TC_recv_dump() runs on test_CT {
}
}
+testcase TC_recv_dump() runs on test_CT {
+ f_TC_recv_dump();
+}
+
+testcase TC_recv_dump_osmux() runs on test_CT {
+ f_TC_recv_dump(true);
+}
+
control {
execute( TC_recv_dump() );
+ execute( TC_recv_dump_osmux() );
}
}
diff --git a/bsc-nat/BSC_MS_ConnectionHandler.ttcn b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
index 7777f039..f9f4db0e 100644
--- a/bsc-nat/BSC_MS_ConnectionHandler.ttcn
+++ b/bsc-nat/BSC_MS_ConnectionHandler.ttcn
@@ -63,6 +63,7 @@ const RanOps BSC_MS_RanOps := {
decode_dtap := false,
role_ms := true,
protocol := RAN_PROTOCOL_BSSAP,
+ /* Always false. We don't want to enable Osmux signalling in SCCPLite messages: */
use_osmux := false,
sccp_addr_local := omit,
sccp_addr_peer := omit
@@ -89,11 +90,12 @@ type enumerated BSC_State {
}
/* main function processing various incoming events */
-function main(SCCP_PAR_Address sccp_addr_own, SCCP_PAR_Address sccp_addr_remote)
+function main(SCCP_PAR_Address sccp_addr_own, SCCP_PAR_Address sccp_addr_remote, boolean use_osmux)
runs on BSC_MS_ConnHdlr {
var PDU_BSSAP bssap;
var MgcpCommand mgcp_cmd;
- var MgcpResponse mgcp_resp;
+ var template MgcpResponse mgcp_resp;
+ var MgcpOsmuxCID osmux_cid;
log("Starting main of BSC_MS_ConnHdlr");
@@ -127,7 +129,19 @@ runs on BSC_MS_ConnHdlr {
valueof(ts_SDP_ptime(20)) }));
/* respond with CRCX_ACK */
g_state := BSC_STATE_WAIT_MDCX;
- BSSAP.send(ts_CRCX_ACK(mgcp_cmd.line.trans_id, g_mgcp_conn_id, g_sdp));
+
+ if (use_osmux != f_MgcpCmd_contains_par(mgcp_cmd, "X-OSMUX")) {
+ setverdict(fail, log2str("Received Osmux CID presence doesn't match presence expectancy (", use_osmux, ")"));
+ self.stop;
+ }
+
+ if (use_osmux) {
+ osmux_cid := f_MgcpCmd_extract_osmux_cid(mgcp_cmd);
+ mgcp_resp := ts_CRCX_ACK_osmux(mgcp_cmd.line.trans_id, g_mgcp_conn_id, osmux_cid, g_sdp);
+ } else {
+ mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, g_mgcp_conn_id, g_sdp);
+ }
+ BSSAP.send(valueof(mgcp_resp));
}
/* MDCX -> OK */
diff --git a/bsc-nat/BSC_MS_Simulation.ttcn b/bsc-nat/BSC_MS_Simulation.ttcn
index ed6e92dc..d4e37a46 100644
--- a/bsc-nat/BSC_MS_Simulation.ttcn
+++ b/bsc-nat/BSC_MS_Simulation.ttcn
@@ -33,6 +33,7 @@ type component BSC_CT {
var SCCP_PAR_Address g_sccp_addr_own;
var SCCP_PAR_Address g_sccp_addr_remote;
+ var boolean g_use_osmux;
var charstring g_bsc_num_str;
}
@@ -45,7 +46,8 @@ function main(charstring remote_ip, PortNumber remote_port,
charstring local_ip, PortNumber local_port,
MSC_SCCP_MTP3_parameters sccp_pars,
SCCP_PAR_Address sccp_addr_own,
- SCCP_PAR_Address sccp_addr_remote, charstring id) runs on BSC_CT
+ SCCP_PAR_Address sccp_addr_remote,
+ boolean use_osmux, charstring id) runs on BSC_CT
{
var integer i := 0;
timer T := 1.0;
@@ -54,6 +56,7 @@ function main(charstring remote_ip, PortNumber remote_port,
g_sccp_addr_own := sccp_addr_own;
g_sccp_addr_remote := sccp_addr_remote;
+ g_use_osmux := use_osmux;
/* create components for IPA/SCCP/BSS[M]AP stack */
vc_IPA := IPA_Emulation_CT.create(id & "-IPA");
@@ -98,7 +101,7 @@ function f_start_BSC_MS(charstring id) runs on BSC_CT {
/* connect client BSSAP port to BSSAP dispatcher */
connect(vc_conn:BSSAP, vc_BSSMAP:CLIENT);
/* start component */
- vc_conn.start(BSC_MS_ConnectionHandler.main(g_sccp_addr_own, g_sccp_addr_remote));
+ vc_conn.start(BSC_MS_ConnectionHandler.main(g_sccp_addr_own, g_sccp_addr_remote, g_use_osmux));
/* blocking wait until component terminates. If you want to start MSs in parallel,
* you have to remove this statement here */
vc_conn.done;
diff --git a/bsc-nat/gen_links.sh b/bsc-nat/gen_links.sh
index 7b7f9283..01d4c7b6 100755
--- a/bsc-nat/gen_links.sh
+++ b/bsc-nat/gen_links.sh
@@ -20,6 +20,11 @@ DIR=$BASEDIR/titan.TestPorts.IPL4asp/src
FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh"
gen_links $DIR $FILES
+# for Osmocom_VTY
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc TELNETasp_PT.hh TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
# required by SCCP Emulation
DIR=$BASEDIR/titan.TestPorts.MTP3asp/src
FILES="MTP3asp_PortType.ttcn MTP3asp_Types.ttcn"
@@ -47,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_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 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 f49df7e2..0f3cfabe 100755
--- a/bsc-nat/regen_makefile.sh
+++ b/bsc-nat/regen_makefile.sh
@@ -2,7 +2,7 @@
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"
+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"