sgsn: Integrate RANAP
Integrate RANAP support to SGSN_Tests.ttcn.
Related: OS#2857
Change-Id: Ib62fc4c6007f6f4c47db7ca096a8d629bc72bb22
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index e349719..a7cc57f 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -19,6 +19,7 @@
import from BSSGP_Types all;
import from BSSGP_Emulation all;
import from Osmocom_Gb_Types all;
+import from SCCPasp_Types all;
import from MobileL3_CommonIE_Types all;
import from MobileL3_GMM_SM_Types all;
@@ -30,6 +31,12 @@
import from GSUP_Types all;
import from IPA_Emulation all;
+import from RAN_Adapter all;
+import from RAN_Emulation all;
+import from RANAP_Templates all;
+import from RANAP_PDU_Descriptions all;
+import from RANAP_IEs all;
+
import from GTP_Emulation all;
import from GTP_Templates all;
import from GTP_CodecPort all;
@@ -87,6 +94,20 @@
handle_sns := false
}
};
+
+ RAN_Configurations mp_ranap_cfg := {
+ {
+ transport := RANAP_TRANSPORT_IuCS,
+ sccp_service_type := "mtp3_itu",
+ sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" },
+ own_pc := 195,
+ own_ssn := 142,
+ peer_pc := 188, /* 0.23.4 */
+ peer_ssn := 142,
+ sio := '83'O,
+ rctx := 2
+ }
+ }
};
type record GbInstance {
@@ -100,8 +121,12 @@
type record length(NUM_GB) of NSConfiguration NSConfigurations;
type record length(NUM_GB) of BssgpCellId BssgpCellIds;
+const integer NUM_RNC := 1;
+type record of RAN_Configuration RAN_Configurations;
+
type component test_CT {
var GbInstances g_gb;
+ var RAN_Adapter g_ranap[NUM_RNC];
var GSUP_Emulation_CT vc_GSUP;
var IPA_Emulation_CT vc_GSUP_IPA;
@@ -116,7 +141,7 @@
var boolean g_use_echo := false;
};
-type component BSSGP_ConnHdlr extends BSSGP_Client_CT, GSUP_ConnHdlr, GTP_ConnHdlr {
+type component BSSGP_ConnHdlr extends BSSGP_Client_CT, GSUP_ConnHdlr, GTP_ConnHdlr, RAN_ConnHdlr {
var BSSGP_ConnHdlrPars g_pars;
timer g_Tguard;
var LLC_Entities llc;
@@ -145,7 +170,10 @@
BssgpCellIds bssgp_cell_id,
AuthVector vec optional,
SGSN_ConnHdlrNetworkPars net,
- float t_guard
+ float t_guard,
+ /* only in IuPS / RANAP case */
+ SCCP_PAR_Address sccp_addr_local,
+ SCCP_PAR_Address sccp_addr_peer
};
private function f_cellid_to_RAI(in BssgpCellId cell_id) return RoutingAreaIdentificationV {
@@ -240,6 +268,8 @@
/* mcc_mnc is 24.008 10.5.5.15 encoded. 262 42 */
function f_init(BcdMccMnc mcc_mnc := '262F42'H) runs on test_CT {
+ var integer i;
+
if (g_initialized == true) {
return;
}
@@ -288,11 +318,44 @@
f_init_gb(g_gb[0], "SGSN_Test-Gb0", 0);
f_init_gb(g_gb[1], "SGSN_Test-Gb1", 1);
f_init_gb(g_gb[2], "SGSN_Test-Gb2", 2);
+
+ for (i := 0; i < NUM_RNC; i := i+1) {
+ f_ran_adapter_init(g_ranap[i], mp_ranap_cfg[i], "SGSN_Test_" & int2str(i), RNC_RanOps);
+ f_ran_adapter_start(g_ranap[i]);
+ }
f_init_gsup("SGSN_Test");
f_init_gtp("SGSN_Test");
f_vty_enable_echo_interval(g_use_echo);
}
+private function RncUnitdataCallback(RANAP_PDU ranap)
+runs on RAN_Emulation_CT return template RANAP_PDU {
+ var template RANAP_PDU resp := omit;
+
+ log ("RANAP_RncUnitDataCallback");
+ /* answer all RESET with RESET ACK */
+ if (match(ranap, tr_RANAP_Reset)) {
+ log("RANAP_RncUnitdataCallback: Responding to RESET with RESET-ACK");
+ var CN_DomainIndicator dom;
+ dom := ranap.initiatingMessage.value_.Reset.protocolIEs[1].value_.cN_DomainIndicator;
+ resp := ts_RANAP_ResetAck(dom);
+ }
+ return resp;
+}
+
+const RanOps RNC_RanOps := {
+ ranap_create_cb := refers(RAN_Emulation.RanapExpectedCreateCallback),
+ ranap_unitdata_cb := refers(RncUnitdataCallback),
+ ps_domain := true,
+ decode_dtap := true,
+ role_ms := true,
+ protocol := RAN_PROTOCOL_RANAP,
+ transport := RANAP_TRANSPORT_IuCS,
+ use_osmux := false,
+ sccp_addr_local := omit,
+ sccp_addr_peer := omit
+};
+
type function void_fn(charstring id) runs on BSSGP_ConnHdlr;
/* helper function to create, connect and start a BSSGP_ConnHdlr component */
@@ -317,7 +380,9 @@
bssgp_cell_id := { gb[0].cfg.cell_id, gb[1].cfg.cell_id, gb[2].cfg.cell_id },
vec := omit,
net := net_pars,
- t_guard := t_guard
+ t_guard := t_guard,
+ sccp_addr_local := g_ranap[0].sccp_addr_own,
+ sccp_addr_peer := g_ranap[0].sccp_addr_peer
};
vc_conn := BSSGP_ConnHdlr.create(id);
@@ -328,6 +393,10 @@
connect(vc_conn:BSSGP[2], gb[2].vc_BSSGP:BSSGP_SP);
connect(vc_conn:BSSGP_PROC[2], gb[2].vc_BSSGP:BSSGP_PROC);
+ /* FIXME: support multiple RNCs */
+ connect(vc_conn:BSSAP, g_ranap[0].vc_RAN:CLIENT);
+ connect(vc_conn:BSSAP_PROC, g_ranap[0].vc_RAN:PROC);
+
connect(vc_conn:GSUP, vc_GSUP:GSUP_CLIENT);
connect(vc_conn:GSUP_PROC, vc_GSUP:GSUP_PROC);
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
index fe09726..3552bc2 100755
--- a/sgsn/gen_links.sh
+++ b/sgsn/gen_links.sh
@@ -53,6 +53,35 @@
FILES="GTPC_EncDec.cc GTPC_Types.ttcn GTPU_EncDec.cc GTPU_Types.ttcn"
gen_links $DIR $FILES
+# required by M3UA_Emulation
+DIR=$BASEDIR/titan.ProtocolModules.M3UA/src
+FILES="M3UA_Types.ttcn"
+gen_links $DIR $FILES
+
+# required by M3UA_Emulation
+DIR=$BASEDIR/titan.TestPorts.SCTPasp/src
+FILES="SCTPasp_PT.cc SCTPasp_PT.hh SCTPasp_PortType.ttcn SCTPasp_Types.ttcn"
+gen_links $DIR $FILES
+
+# required by M3UA Emulation
+DIR=$BASEDIR/titan.TestPorts.MTP3asp/src
+FILES="MTP3asp_PortType.ttcn MTP3asp_Types.ttcn"
+gen_links $DIR $FILES
+
+# required by SCCP Emulation
+DIR=$BASEDIR/titan.ProtocolEmulations.M3UA/src
+FILES="M3UA_Emulation.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolEmulations.SCCP/src
+FILES="SCCP_Emulation.ttcn SCCP_EncDec.cc SCCP_Mapping.ttcnpp SCCP_Types.ttcn SCCPasp_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=../library/ranap
+FILES="RANAP_CommonDataTypes.asn RANAP_Constants.asn RANAP_Containers.asn RANAP_IEs.asn RANAP_PDU_Contents.asn RANAP_PDU_Descriptions.asn "
+FILES+="RANAP_Types.ttcn RANAP_Templates.ttcn RANAP_CodecPort.ttcn RANAP_EncDec.cc "
+gen_links $DIR $FILES
+
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
@@ -60,6 +89,7 @@
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
FILES+="Osmocom_VTY_Functions.ttcn "
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
+FILES+="RAN_Emulation.ttcnpp RAN_Adapter.ttcnpp SCCP_Templates.ttcn "
# IPA_Emulation + dependencies
FILES+="IPA_Types.ttcn IPA_Emulation.ttcnpp IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc GSUP_Types.ttcn GSUP_Emulation.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn
diff --git a/sgsn/regen_makefile.sh b/sgsn/regen_makefile.sh
index 0cf2e64..a239a3b 100755
--- a/sgsn/regen_makefile.sh
+++ b/sgsn/regen_makefile.sh
@@ -1,7 +1,9 @@
#!/bin/sh
-FILES="*.ttcn *.ttcnpp BSSGP_EncDec.cc LLC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc TELNETasp_PT.cc IPA_CodecPort_CtrlFunctDef.cc GTPU_EncDec.cc GTPC_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc"
+FILES="*.ttcn *.ttcnpp *.asn BSSGP_EncDec.cc LLC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc TELNETasp_PT.cc IPA_CodecPort_CtrlFunctDef.cc GTPU_EncDec.cc GTPC_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc SCCP_EncDec.cc SCTPasp_PT.cc RANAP_EncDec.cc "
-export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -DIPA_EMULATION_CTRL"
+export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -DIPA_EMULATION_CTRL -DUSE_MTP3_DISTRIBUTOR -DRAN_EMULATION_RANAP"
../regen-makefile.sh SGSN_Tests.ttcn $FILES
+
+sed -i -e 's/^LINUX_LIBS = -lxml2/LINUX_LIBS = -lxml2 -lfftranscode/' Makefile