From 96a33b00c9bdfb9d7fad81882ef24f434f0a9763 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 4 Feb 2018 10:36:22 +0100 Subject: 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 --- sgsn/SGSN_Tests.ttcn | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ sgsn/gen_links.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ sgsn/regen_makefile.sh | 5 ++++ 3 files changed, 139 insertions(+) create mode 100644 sgsn/SGSN_Tests.ttcn create mode 100755 sgsn/gen_links.sh create mode 100755 sgsn/regen_makefile.sh (limited to 'sgsn') diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn new file mode 100644 index 00000000..d5354321 --- /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 00000000..4b76196b --- /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 00000000..6824d94c --- /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 -- cgit v1.2.3