Change in osmo-ttcn3-hacks[master]: sgsn: Integrate RANAP

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Apr 23 15:50:25 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13754


Change subject: sgsn: Integrate RANAP
......................................................................

sgsn: Integrate RANAP

Integrate RANAP support to SGSN_Tests.ttcn.

Related: OS#2857
Change-Id: Ib62fc4c6007f6f4c47db7ca096a8d629bc72bb22
---
M library/ranap/RANAP_CodecPort.ttcn
M sgsn/SGSN_Tests.ttcn
M sgsn/gen_links.sh
M sgsn/regen_makefile.sh
4 files changed, 91 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/54/13754/1

diff --git a/library/ranap/RANAP_CodecPort.ttcn b/library/ranap/RANAP_CodecPort.ttcn
index d9cd40e..07e1b00 100644
--- a/library/ranap/RANAP_CodecPort.ttcn
+++ b/library/ranap/RANAP_CodecPort.ttcn
@@ -17,6 +17,7 @@
 import from SCCPasp_Types all;
 import from SCCP_Types all;
 
+import from RANAP_PDU_Descriptions all;
 import from RANAP_Types all;
 
 type record RANAP_N_CONNECT_req
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 74cdece..0dff040 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -19,6 +19,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;
@@ -76,6 +82,19 @@
 			handle_sns := false
 		}
 	};
+
+	RAN_Configurations mp_ranap_cfg := {
+		{
+			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 := 185,
+			peer_ssn := 142,
+			sio := '83'O,
+			rctx := 2
+		}
+	}
 };
 
 type record GbInstance {
@@ -88,8 +107,12 @@
 type record length(3) of NSConfiguration NSConfigurations;
 type record length(3) 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;
@@ -228,6 +251,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;
 	}
@@ -276,11 +301,42 @@
 	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,
+	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 */
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 a85f79c..a65d27d 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"
+export CPPFLAGS_TTCN3="-DIPA_EMULATION_GSUP -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

-- 
To view, visit https://gerrit.osmocom.org/13754
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib62fc4c6007f6f4c47db7ca096a8d629bc72bb22
Gerrit-Change-Number: 13754
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190423/a159d885/attachment.htm>


More information about the gerrit-log mailing list