[MERGED] osmo-ttcn3-hacks[master]: sgsn: Skeleton of a SGSN test fremwork

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 16 19:08:21 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: sgsn: Skeleton of a SGSN test fremwork
......................................................................


sgsn: Skeleton of a SGSN test fremwork

Based on the exsting NS/BSSGP emulation as well as the VTY, GSUP and
CTRL implementations, we are now building a test framework skeleton
for osmo-sgsn.

Change-Id: Icce90f9d8a680c7a523163e2c0bc03d12ff857e2
---
M library/BSSGP_Emulation.ttcn
A sgsn/SGSN_Tests.ttcn
A sgsn/gen_links.sh
A sgsn/regen_makefile.sh
4 files changed, 145 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index 70c9c80..52649ef 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -40,7 +40,8 @@
 		out	PDU_BSSGP;
 	} with { extension "internal" };
 
-	function BssgpStart() runs on BSSGP_CT {
+	function BssgpStart(boolean sgsn_role := false) runs on BSSGP_CT {
+		g_sgsn_role := sgsn_role
 		f_init();
 		f_ScanEvents();
 	}
@@ -189,10 +190,13 @@
 				[] g_T1.timeout {
 					f_sendUnblock();
 				}
-				[] BSCP.receive(f_BnsUdInd(t_BVC_UNBLOCK_ACK(mp_bvci))) {
+				[] BSCP.receive(f_BnsUdInd(t_BVC_UNBLOCK_ACK(mp_bvci), 0)) {
 					g_T1.stop;
 					f_change_state(BVC_S_UNBLOCKED);
 				}
+				[not g_sgsn_role] BSCP.receive(f_BnsUdInd(tr_BVC_RESET_ACK(mp_bvci, omit), 0)) {
+					f_sendUnblock();
+				}
 			}
 		} else if (g_ptp_bvc_state == BVC_S_UNBLOCKED) {
 			alt {
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
new file mode 100644
index 0000000..d535432
--- /dev/null
+++ b/sgsn/SGSN_Tests.ttcn
@@ -0,0 +1,67 @@
+module SGSN_Tests {
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from NS_Types all;
+import from NS_Emulation all;
+import from BSSGP_Types all;
+import from BSSGP_Emulation all;
+
+type component test_CT {
+	var NS_CT vc_NS;
+
+	var BSSGP_CT vc_BSSGP;
+	port BSSGP_PT BSSGP;
+
+	var boolean g_initialized := false;
+};
+
+function f_init() runs on test_CT {
+	if (g_initialized == true) {
+		return;
+	}
+	g_initialized := true;
+
+	vc_NS := NS_CT.create;
+	vc_BSSGP := BSSGP_CT.create;
+	/* connect our BSSGP port to upper end of BSSGP emulation */
+	connect(self:BSSGP, vc_BSSGP:BSSGP_SP);
+	/* connect lower end of BSSGP emulation with NS upper port */
+	connect(vc_BSSGP:BSCP, vc_NS:NS_SP);
+	/* connect lower end of NS emulation to NS codec port (on top of IPL4) */
+	map(vc_NS:NSCP, system:NS_CODEC_PORT);
+
+	vc_NS.start(NSStart());
+	vc_BSSGP.start(BssgpStart(false));
+}
+
+/* TODO:
+   * RAU without Attach
+   * Detach without Attach
+   * SM procedures without attach / RAU
+   * ATTACH / RAU
+   ** with / without authentication
+   ** with / without P-TMSI allocation
+   ** timeout from HLR on SAI
+   ** timeout from HLR on UL
+   ** reject from HLR on SAI
+   ** reject from HLR on UL
+   * re-transmissions of LLC frames
+   * PDP Context activation
+   ** with different GGSN config in SGSN VTY
+   ** with different PDP context type (v4/v6/v46)
+   ** timeout from GGSN
+   ** reject from GGSN
+ */
+
+testcase TC_wait_ns_up() runs on test_CT {
+	f_init();
+	f_sleep(20.0);
+}
+
+
+//control { }
+
+
+
+}
diff --git a/sgsn/gen_links.sh b/sgsn/gen_links.sh
new file mode 100755
index 0000000..4b76196
--- /dev/null
+++ b/sgsn/gen_links.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+BASEDIR=../deps
+
+gen_links() {
+	DIR=$1
+	FILES=$*
+	for f in $FILES; do
+		echo "Linking $f"
+		ln -sf $DIR/$f $f
+	done
+}
+
+#DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
+#FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
+#gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
+FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCConversion.hh TCCInterface.cc TCCInterface_ip.h"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
+FILES="Socket_API_Definitions.ttcn"
+gen_links $DIR $FILES
+
+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
+
+#DIR=$BASEDIR/titan.TestPorts.UNIX_DOMAIN_SOCKETasp/src
+#FILES="UD_PT.cc  UD_PT.hh  UD_PortType.ttcn  UD_Types.ttcn"
+#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 IPA Emulation
+DIR=../MTP3asp_CNL113337/src
+FILES="MTP3asp_PortType.ttcn  MTP3asp_Types.ttcn"
+gen_links $DIR $FILES
+
+# required by MGCP Types, which is required by IPA Emulation
+DIR=$BASEDIR/titan.ProtocolModules.SDP/src
+FILES="SDP_EncDec.cc SDP_Types.ttcn SDP_parse_.tab.c SDP_parse_.tab.h SDP_parse_parser.h SDP_parser.l
+SDP_parser.y lex.SDP_parse_.c"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.NS_v7.3.0/src
+FILES="NS_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=$BASEDIR/titan.ProtocolModules.BSSGP_v13.0.0/src
+FILES="BSSGP_EncDec.cc  BSSGP_Types.ttcn"
+gen_links $DIR $FILES
+
+DIR=../library
+FILES="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 "
+FILES+="BSSGP_Emulation.ttcn Osmocom_Gb_Types.ttcn "
+FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
+FILES+="Osmocom_VTY_Functions.ttcn "
+# IPA_Emulation + dependencies
+FILES+="IPA_Types.ttcn IPA_Emulation.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn
+IPA_CodecPort_CtrlFunctDef.cc Native_Functions.ttcn Native_FunctionDefs.cc GSUP_Types.ttcn MGCP_Types.ttcn RSL_Types.ttcn "
+gen_links $DIR $FILES
diff --git a/sgsn/regen_makefile.sh b/sgsn/regen_makefile.sh
new file mode 100755
index 0000000..6824d94
--- /dev/null
+++ b/sgsn/regen_makefile.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+FILES="*.ttcn BSSGP_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc NS_CodecPort_CtrlFunctDef.cc RLCMAC_EncDec.cc Native_FunctionDefs.cc SDP_EncDec.cc SDP_parse_.tab.c lex.SDP_parse_.c TELNETasp_PT.cc IPA_CodecPort_CtrlFunctDef.cc"
+
+../regen-makefile.sh SGSN_Tests.ttcn $FILES

-- 
To view, visit https://gerrit.osmocom.org/6404
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icce90f9d8a680c7a523163e2c0bc03d12ff857e2
Gerrit-PatchSet: 5
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list