MME_Tests: add Gn interface

To test the planned Gn connectivity support in open5gs MME the testsuite
also requires support for such an interface. This patch adds the
connection handler, provided by GTP_Emulation.ttcn to the connection
handler in MME_Tests.ttcn, along with a simple GTP ECHO REQUEST
testcase.

Related: OS#5760
Change-Id: I38b668df15b3dd10542b4aa8790b9ea33c1f9635
This commit is contained in:
Philipp Maier 2023-07-12 14:04:14 +02:00 committed by laforge
parent 5c1b5f2c04
commit 74d776a2b1
3 changed files with 86 additions and 4 deletions

View File

@ -11,7 +11,8 @@
module MME_Tests {
import from General_Types all;
import from Native_Functions all;
import from IPL4asp_Types all;
import from S1AP_Types all;
import from S1AP_Templates all;
import from S1AP_Emulation all;
@ -29,6 +30,11 @@ import from SGsAP_Types all;
import from SGsAP_Templates all;
import from SGsAP_Emulation all;
import from GTP_Emulation all;
import from GTP_Templates all;
import from GTP_CodecPort all;
import from GTPC_Types all;
import from LTE_CryptoFunctions all;
import from L3_Templates all;
@ -72,12 +78,17 @@ type component MTC_CT {
port SGsAP_PT SGsAP_UNIT;
port SGsAPEM_PROC_PT SGsAP_PROC;
/* Gn interface (GTPv1C) of emulated SGSN (Rel. 7) */
var GTP_Emulation_CT vc_GTP;
var UeParams g_ue_pars[NUM_UE];
}
type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr {
type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr, GTP_ConnHdlr {
var ConnHdlrPars g_pars;
timer g_Tguard := 30.0;
var GtpPeer g_gn_iface_peer := { connId := 1, remName := mp_gn_remote_ip, remPort := mp_gn_local_port };
}
type record ConnHdlrPars {
@ -105,6 +116,11 @@ modulepar {
integer mp_sgs_local_port := 29118;
charstring mp_vlr_name := "vlr.example.net";
charstring mp_mme_name := "mmec01.mmegi0001.mme.epc.mnc070.mcc901.3gppnetwork.org";
/* Gn interface (GTPv1C) */
charstring mp_gn_local_ip := "127.0.0.22";
integer mp_gn_local_port := 2123;
charstring mp_gn_remote_ip := "127.0.0.2";
}
/* send incoming unit data messages (like reset) to global SGsAP_UNIT port */
@ -227,6 +243,21 @@ friend function f_init_diameter(charstring id) runs on MTC_CT {
f_diameter_wait_capability(DIAMETER_UNIT);
}
friend function f_init_gtp(charstring id) runs on MTC_CT {
id := id & "-GTP";
var GtpEmulationCfg gtp_cfg := {
gtpc_bind_ip := mp_gn_local_ip,
gtpc_bind_port := mp_gn_local_port,
gtpu_bind_ip := omit,
gtpu_bind_port := omit,
sgsn_role := true
};
vc_GTP := GTP_Emulation_CT.create(id);
vc_GTP.start(GTP_Emulation.main(gtp_cfg));
}
friend template (value) TAI ts_enb_S1AP_TAI(EnbParams enb) := {
pLMNidentity := enb.global_enb_id.pLMNidentity,
tAC := enb.supported_tas[0].tAC,
@ -272,6 +303,10 @@ runs on MTC_CT return ConnHdlr {
connect(vc_conn:DIAMETER, vc_DIAMETER:DIAMETER_CLIENT);
connect(vc_conn:DIAMETER_PROC, vc_DIAMETER:DIAMETER_PROC);
}
if (isbound(vc_GTP)) {
connect(vc_conn:GTP, vc_GTP:CLIENT);
connect(vc_conn:GTP_PROC, vc_GTP:CLIENT_PROC);
}
/* We cannot use vc_conn.start(f_init_handler(fn, id, pars)); as we cannot have
* a stand-alone 'derefers()' call, see https://www.eclipse.org/forums/index.php/t/1091364/ */
@ -561,11 +596,45 @@ testcase TC_s1ap_attach() runs on MTC_CT {
vc_conn.done;
}
private function f_TC_gn_echo_request(ConnHdlrPars pars) runs on ConnHdlr {
timer T := 5.0;
f_init_handler(pars);
f_gtp_register_teid('00000000'O);
GTP.send(ts_GTPC_PING(g_gn_iface_peer, 1));
T.start;
alt {
[] GTP.receive(tr_GTPC_PONG(?)) {
setverdict(pass);
}
[] GTP.receive {
setverdict(fail, "unexpected GTPC message from MME");
}
[] T.timeout {
setverdict(fail, "no GTPC ECHO RESPONSE from MME");
}
}
}
testcase TC_gn_echo_request() runs on MTC_CT {
var charstring id := testcasename();
f_init_diameter(id);
f_init_s1ap(id, 4);
f_s1ap_setup(0);
f_init_gtp(id);
var ConnHdlrPars pars := f_init_pars(ue_idx := 0);
var ConnHdlr vc_conn;
vc_conn := f_start_handler_with_pars(refers(f_TC_gn_echo_request), pars);
vc_conn.done;
}
control {
execute( TC_s1ap_setup_wrong_plmn() );
execute( TC_s1ap_setup_wrong_tac() );
execute( TC_s1ap_setup() );
execute( TC_s1ap_attach() );
execute( TC_gn_echo_request() );
}

View File

@ -40,7 +40,15 @@ FILES="GTPv2_Types.ttcn"
gen_links $DIR $FILES
DIR=$BASEDIR/titan.ProtocolModules.GTP_v13.5.0/src
FILES="GTPC_EncDec.cc GTPC_Types.ttcn GTPU_EncDec.cc GTPU_Types.ttcn"
FILES="GTPC_EncDec.cc GTPC_Types.ttcn GTPU_EncDec.cc GTPU_Types.ttcn"
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=$BASEDIR/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator/src
@ -54,12 +62,14 @@ FILES+="S1AP_EncDec.cc S1AP_Types.ttcn S1AP_Templates.ttcn "
gen_links $DIR $FILES
DIR=../library
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc "
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
FILES+="SGsAP_Templates.ttcn SGsAP_CodecPort.ttcn SGsAP_CodecPort_CtrlFunct.ttcn SGsAP_CodecPort_CtrlFunctDef.cc SGsAP_Emulation.ttcn DNS_Helpers.ttcn "
FILES+="L3_Templates.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn "
FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFunct.ttcn S1AP_Emulation.ttcn "
FILES+="NAS_Templates.ttcn GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn "
FILES+="DIAMETER_Types.ttcn DIAMETER_CodecPort.ttcn DIAMETER_CodecPort_CtrlFunct.ttcn DIAMETER_CodecPort_CtrlFunctDef.cc DIAMETER_Emulation.ttcn DIAMETER_Templates.ttcn "
FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc GTP_Emulation.ttcn GTP_Templates.ttcn Osmocom_Gb_Types.ttcn "
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
gen_links $DIR $FILES
ignore_pp_results

View File

@ -6,10 +6,12 @@ FILES="
*.asn
*.c
*.ttcn
BSSGP_EncDec.cc
DIAMETER_CodecPort_CtrlFunctDef.cc
DIAMETER_EncDec.cc
GTPC_EncDec.cc
GTPU_EncDec.cc
GTP_CodecPort_CtrlFunctDef.cc
IPL4asp_PT.cc
IPL4asp_discovery.cc
LTE_CryptoFunctionDefs.cc
@ -23,6 +25,7 @@ FILES="
TELNETasp_PT.cc
"
export CPPFLAGS_TTCN3="
"