pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/37646?usp=email )
Change subject: sgsn: Introduce test TC_pmm_idle_rx_mt_data ......................................................................
sgsn: Introduce test TC_pmm_idle_rx_mt_data
Change-Id: I35d660b8e546f6ce0af8c05d7b5c56833a26fb76 --- M sgsn/BSSGP_ConnHdlr.ttcn M sgsn/SGSN_Tests_Iu.ttcn M sgsn/expected-results.xml 3 files changed, 74 insertions(+), 4 deletions(-)
Approvals: laforge: Looks good to me, but someone else must approve Jenkins Builder: Verified pespin: Looks good to me, approved
diff --git a/sgsn/BSSGP_ConnHdlr.ttcn b/sgsn/BSSGP_ConnHdlr.ttcn index 0eb24e4..140fa99 100644 --- a/sgsn/BSSGP_ConnHdlr.ttcn +++ b/sgsn/BSSGP_ConnHdlr.ttcn @@ -720,6 +720,7 @@ octetstring ggsn_ip_c, /* GGSN IP Control */ octetstring ggsn_ip_u, /* GGSN IP User */ OCT1 ggsn_restart_ctr, /* GGSN Restart Counter */ + boolean direct_tunnel_requested, /* Did SGSN request Direct Tunnel to the GGSN ?*/
OCT4 rnc_tei_u, /* SGSN TEI User */ octetstring rnc_ip_u, /* SGSN IP USer */ @@ -788,6 +789,7 @@ apars.sgsn_ip_u := upd.sgsn_addr_traffic.addressf; apars.sgsn_tei_u := upd.teidDataI.teidDataI; } + apars.direct_tunnel_requested := dti; } altstep as_ggsn_gtp_ctx_upd_req(inout PdpActPars apars, boolean send_recovery := false, @@ -1024,6 +1026,7 @@ ggsn_ip_c := f_inet_addr(ggsn_ip), ggsn_ip_u := f_inet_addr(ggsn_ip), ggsn_restart_ctr := int2oct(2, 1), + direct_tunnel_requested := false,
rnc_tei_u := f_rnd_octstring(4), rnc_ip_u := f_inet_addr(rnc_ip), @@ -1046,9 +1049,18 @@ remPort := GTP1C_PORT }
-function f_gtpu_send(inout PdpActPars apars, octetstring payload) runs on BSSGP_ConnHdlr { - var Gtp1uPeer peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u)); - GTP[GTP_GGSN_IDX].send(ts_GTP1U_GPDU(peer, 0 /*seq*/, apars.sgsn_tei_u, payload)); +/* Send data from GGSN to SGSN/RNC (depending on apars.f_ggsn_gtpu_send) */ +function f_ggsn_gtpu_send(inout PdpActPars apars, octetstring payload) runs on BSSGP_ConnHdlr { + var Gtp1uPeer peer; + var OCT4 rem_teid; + if (apars.direct_tunnel_requested) { + peer := valueof(ts_GtpPeerU(apars.rnc_ip_u)); + rem_teid := apars.rnc_tei_u; + } else { + peer := valueof(ts_GtpPeerU(apars.sgsn_ip_u)); + rem_teid := apars.sgsn_tei_u; + } + GTP[GTP_GGSN_IDX].send(ts_GTP1U_GPDU(peer, 0 /*seq*/, rem_teid, payload)); }
altstep as_xid(PdpActPars apars, integer ran_index := 0) runs on BSSGP_ConnHdlr { @@ -1095,7 +1107,7 @@ runs on BSSGP_ConnHdlr { timer T := 5.0; /* Send PDU via GTP from our simulated GGSN to the SGSN */ - f_gtpu_send(apars, payload); + f_ggsn_gtpu_send(apars, payload); T.start;
alt { diff --git a/sgsn/SGSN_Tests_Iu.ttcn b/sgsn/SGSN_Tests_Iu.ttcn index a6398eb..5010443 100644 --- a/sgsn/SGSN_Tests_Iu.ttcn +++ b/sgsn/SGSN_Tests_Iu.ttcn @@ -12,6 +12,9 @@ import from RANAP_PDU_Descriptions all; import from RANAP_IEs all;
+import from GTPv1U_Templates all; +import from GTP_Emulation all; + import from BSSGP_ConnHdlr all;
private function f_init() runs on test_CT { @@ -215,6 +218,50 @@ f_cleanup(); }
+/* Test UE going to PMM IDLE state after having activated the PDP context. + * SGSN is expected to update the GGSN cancelling the Direct Tunnel feature. */ +private function f_TC_pmm_idle_rx_mt_data(charstring id) runs on BSSGP_ConnHdlr { + var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip, mp_ranap_cfg[0].sctp_addr.local_ip_addr)); + + /* first perform regular attach */ + f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3); + + f_service_request(apars, ran_index := 3); + + f_pdp_ctx_act(apars, ran_index := 3); + + f_iu_release_req(ts_RanapCause_radio_conn_release); + /* Now UE is in PMM IDLE state at the SGSN. + * Expect SGSN to point GTPU at GGSN back to itself: */ + as_ggsn_gtp_ctx_upd_req(apars, exp_dir_tun := false, ran_index := 3); + + /* Now GGSN receives new MT data and forwards it to SGSN: */ + f_gtp_register_teid('00000000'O, GTP_GGSN_IDX); /* Ease debugging in case SGSN sends ErrorInd */ + f_ran_register_imsi(g_pars.imsi, g_pars.p_tmsi); /* Forward Paging below to this component */ + var octetstring payload := f_rnd_octstring(100); + f_ggsn_gtpu_send(apars, payload); + + BSSAP.receive(tr_RANAP_Paging(ps_domain, imsi_hex2oct(g_pars.imsi))); + + /* Ue comes back, answering the paging: + * SGSN recreates the Iu ctx and recovers the Direct Tunnel RNC<->GGSN: */ + f_service_request(apars, pdp_status := '2000'O /*NSAPI=5*/, ran_index := 3); + as_ranap_rab_ass_req(apars); + as_ggsn_gtp_ctx_upd_req(apars, exp_dir_tun := true, ran_index := 3); + + /* Now UE is in PMM ENABLED state, tear it down to clean up: */ + f_pdp_ctx_deact_mo(apars, '00'O, ran_index := 3); + setverdict(pass); +} +testcase TC_pmm_idle_rx_mt_data() runs on test_CT { + var BSSGP_ConnHdlr vc_conn; + f_init(); + f_sleep(1.0); + vc_conn := f_start_handler(refers(f_TC_pmm_idle_rx_mt_data), testcasename(), g_gb, 1007); + vc_conn.done; + f_cleanup(); +} + control { execute( TC_iu_attach() ); execute( TC_iu_attach_encr() ); @@ -222,6 +269,7 @@ execute( TC_geran_attach_iu_rau() ); execute( TC_attach_pdp_act_user() ); execute( TC_attach_pdp_act_pmm_idle() ); + execute( TC_pmm_idle_rx_mt_data() ); }
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml index 7b38e99..3461721 100644 --- a/sgsn/expected-results.xml +++ b/sgsn/expected-results.xml @@ -95,6 +95,7 @@ <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_user' time='MASKED'/> <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_pmm_idle' time='MASKED'/> <testcase classname='SGSN_Tests_Iu' name='TC_attach_pdp_act_pmm_idle_lost_pdp_status' time='MASKED'/> + <testcase classname='SGSN_Tests_Iu' name='TC_pmm_idle_rx_mt_data' time='MASKED'/> <!-- SGSN_Tests_NS (handle_sns == true) testcases start here --> <testcase classname='SGSN_Tests_NS' name='TC_SNS_size' time='MASKED'/> <testcase classname='SGSN_Tests_NS' name='TC_SNS_size_too_big' time='MASKED'/>