From 9abb8c920b4cdf4409029392001ba18ef7b9d054 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 31 Aug 2023 13:12:28 +0200 Subject: MME_Tests: Add S11/GTPv2 interface The S11 interface is used by the MME to talk to the SGW-C. At the moment we do not simulate the S11 interface in our testcases. This is in particular a problem for TC_s1ap_attach, which needs to answer the Create Session Request, comming from the MME in order to continue. As a first step, lets add evrything that is required to run an S11 interface in the testsuite. Change-Id: I545dd6cef3cef7283f2e04c2406a2703c2fdd01a Related: OS#5760 --- mme/MME_Tests.ttcn | 46 +++++++++++++++++++++++++++++++++++++++++----- mme/gen_links.sh | 10 ++++++++++ mme/regen_makefile.sh | 2 ++ 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/mme/MME_Tests.ttcn b/mme/MME_Tests.ttcn index cc753777..55cb021a 100644 --- a/mme/MME_Tests.ttcn +++ b/mme/MME_Tests.ttcn @@ -44,6 +44,10 @@ import from DNS_Helpers all; import from Osmocom_Types all; import from Osmocom_Gb_Types all; +import from GTPv2_Types all; +import from GTPv2_Templates all; +import from GTPv2_Emulation all; + friend module MME_Tests_SGsAP; /* (maximum) number of emulated eNBs */ @@ -84,6 +88,10 @@ type component MTC_CT { /* Gn interface (GTPv1C) of emulated SGSN (Rel. 7) */ var GTP_Emulation_CT vc_GTP; + /* S11 interface (GTPv2C) of emulated SGW-C */ + var GTPv2_Emulation_CT vc_GTP2; + port GTP2EM_PT TEID0; + var UeParams g_ue_pars[NUM_UE]; } @@ -116,7 +124,7 @@ private function enc_S1AP_Global_ENB_ID(Global_ENB_ID global_enb_id) return octe return substr(encoded, 11, global_enb_id_len); } -type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr, GTP_ConnHdlr { +type component ConnHdlr extends S1AP_ConnHdlr, SGsAP_ConnHdlr, DIAMETER_ConnHdlr, GTP_ConnHdlr, GTP2_ConnHdlr { var ConnHdlrPars g_pars; timer g_Tguard := 30.0; @@ -153,6 +161,12 @@ modulepar { charstring mp_gn_local_ip := "127.0.0.22"; integer mp_gn_local_port := 2123; charstring mp_gn_remote_ip := "127.0.0.2"; + + /* S11 interface (GTPv2C, interface between MME and SGW) */ + charstring mp_s11_local_ip := "127.0.0.3"; + integer mp_s11_local_port := 2123; + charstring mp_s11_remote_ip := "127.0.0.2"; + integer mp_s11_remote_port := 2123; } /* send incoming unit data messages (like reset) to global SGsAP_UNIT port */ @@ -290,7 +304,25 @@ friend function f_init_gtp(charstring id) runs on MTC_CT { vc_GTP.start(GTP_Emulation.main(gtp_cfg)); } -friend template (value) TAI ts_enb_S1AP_TAI(EnbParams enb) := { +friend function f_init_gtpv2_s11(charstring id) runs on MTC_CT { + id := id & "-GTPV2"; + + var Gtp2EmulationCfg cfg := { + gtpc_bind_ip := mp_s11_local_ip, + gtpc_bind_port := mp_s11_local_port, + gtpc_remote_ip := mp_s11_remote_ip, + gtpc_remote_port := mp_s11_remote_port, + sgw_role := true, + use_gtpu_daemon := false + }; + + vc_GTP2 := GTPv2_Emulation_CT.create(id); + map(vc_GTP2:GTP2C, system:GTP2C); + connect(vc_GTP2:TEID0, self:TEID0); + vc_GTP2.start(GTPv2_Emulation.main(cfg)); +} + +friend template (value) S1AP_IEs.TAI ts_enb_S1AP_TAI(EnbParams enb) := { pLMNidentity := enb.global_enb_id.pLMNidentity, tAC := enb.supported_tas[0].tAC, iE_Extensions := omit @@ -339,6 +371,10 @@ runs on MTC_CT return ConnHdlr { connect(vc_conn:GTP, vc_GTP:CLIENT); connect(vc_conn:GTP_PROC, vc_GTP:CLIENT_PROC); } + if (isbound(vc_GTP2)) { + connect(vc_conn:GTP2, vc_GTP2:CLIENT); + connect(vc_conn:GTP2_PROC, vc_GTP2: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/ */ @@ -371,8 +407,8 @@ friend function f_init_handler(ConnHdlrPars pars, float t_guard := 30.0) runs on -friend function f_s1ap_setup(integer idx := 0, template Cause cause := omit) runs on MTC_CT { - var template (present) Cause exp_cause; +friend function f_s1ap_setup(integer idx := 0, template S1AP_IEs.Cause cause := omit) runs on MTC_CT { + var template (present) S1AP_IEs.Cause exp_cause; var boolean exp_fail := false; timer T := 5.0; if (not istemplatekind(cause, "omit")) { @@ -911,7 +947,7 @@ testcase TC_s1ap_reset() runs on MTC_CT { f_init_s1ap(id, 3); f_s1ap_setup(0); - var template (value) Cause reset_cause := {misc := om_intervention}; + var template (value) S1AP_IEs.Cause reset_cause := {misc := om_intervention}; var template (value) ResetType reset_type := {s1_Interface := reset_all}; timer T := 5.0; diff --git a/mme/gen_links.sh b/mme/gen_links.sh index e0a038b1..f10a1612 100755 --- a/mme/gen_links.sh +++ b/mme/gen_links.sh @@ -51,6 +51,14 @@ DIR=$BASEDIR/titan.ProtocolModules.BSSGP_v13.0.0/src FILES="BSSGP_EncDec.cc BSSGP_Types.ttcn" gen_links $DIR $FILES +DIR=$BASEDIR/titan.ProtocolModules.GTPv2_v13.7.0/src +FILES="GTPv2_Types.ttcn" +gen_links $DIR $FILES + +DIR=$BASEDIR/osmo-uecups/ttcn3 +FILES="UECUPS_CodecPort.ttcn UECUPS_CodecPort_CtrlFunct.ttcn UECUPS_CodecPort_CtrlFunctDef.cc UECUPS_Types.ttcn " +gen_links $DIR $FILES + DIR=$BASEDIR/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator/src FILES="DIAMETER_EncDec.cc" gen_links $DIR $FILES @@ -69,6 +77,8 @@ FILES+="S1AP_CodecPort.ttcn S1AP_CodecPort_CtrlFunctDef.cc S1AP_CodecPort_CtrlFu 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+="GTPv2_PrivateExtensions.ttcn GTPv2_Templates.ttcn " +FILES+="GTPv2_CodecPort.ttcn GTPv2_CodecPort_CtrlFunctDef.cc GTPv2_CodecPort_CtrlFunct.ttcn GTPv2_Emulation.ttcn " FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn " gen_links $DIR $FILES diff --git a/mme/regen_makefile.sh b/mme/regen_makefile.sh index df5151ed..e153d353 100755 --- a/mme/regen_makefile.sh +++ b/mme/regen_makefile.sh @@ -12,6 +12,7 @@ FILES=" GTPC_EncDec.cc GTPU_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc + GTPv2_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc LTE_CryptoFunctionDefs.cc @@ -23,6 +24,7 @@ FILES=" TCCEncoding.cc TCCInterface.cc TELNETasp_PT.cc + UECUPS_CodecPort_CtrlFunctDef.cc " -- cgit v1.2.3