summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2019-05-29 13:02:42 +0200
committerHarald Welte <laforge@gnumonks.org>2019-06-04 08:38:13 +0000
commite6f071fe577eb277213848dece21311c71f3a3ef (patch)
tree0728658fac46cf2ed8285c865df0e952ff4b6bfe
parentf8034480a00abeffee3bc9f4f5783a72f2efa8cb (diff)
sgsn: Add tests to check GTP retransmit queue
-rw-r--r--sgsn/SGSN_Tests.ttcn119
-rw-r--r--sgsn/expected-results.xml2
2 files changed, 121 insertions, 0 deletions
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 5633183..1f63dfa 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1536,6 +1536,123 @@ testcase TC_attach_pdp_act_deact_mt_t3395_expire() runs on test_CT {
vc_conn.done;
}
+/* ATTACH + PDP CTX ACT dropped + retrans */
+private function f_TC_attach_pdp_act_deact_gtp_retrans(charstring id) runs on BSSGP_ConnHdlr {
+ var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+ var Gtp1cUnitdata g_ud_first, g_ud_second;
+ /* first perform regular attach */
+ f_TC_attach(id);
+
+ /* then activate PDP context on the Gb side */
+ f_send_l3_gmm_llc(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, apars.qos, apars.addr,
+ apars.apn, apars.pco), 0);
+
+ GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud_first {}
+ log("First createPDPContextRequest received, dropping & waiting for retransmission");
+ GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value g_ud_second {
+ if (g_ud_first != g_ud_second) {
+ setverdict(fail, "Retransmitted GTP message createPDPContextRequest is different from original one!");
+ mtc.stop;
+ }
+ f_process_gtp_ctx_act_req(apars, g_ud_second.gtpc);
+ var integer seq_nr := oct2int(g_ud_second.gtpc.opt_part.sequenceNumber);
+ GTP.send(ts_GTPC_CreatePdpResp(g_ud_second.peer, seq_nr,
+ apars.sgsn_tei_c, apars.gtp_resp_cause,
+ apars.ggsn_tei_c, apars.ggsn_tei_u,
+ apars.nsapi,
+ apars.ggsn_ip_c, apars.ggsn_ip_u, apars.chg_id,
+ omit, omit));
+ }
+ BSSGP[0].receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT)) {}
+
+ /* Now the same with Deact */
+ f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, '00'O, false, omit), 0);
+ GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud_first {}
+ log("First deletePDPContextRequest received, dropping & waiting for retransmission");
+ GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, apars.ggsn_tei_c)) -> value g_ud_second {
+ if (g_ud_first != g_ud_second) {
+ setverdict(fail, "Retransmitted GTP message deletePDPContextRequest is different from original one!");
+ mtc.stop;
+ }
+ var integer seq_nr := oct2int(g_ud_second.gtpc.opt_part.sequenceNumber);
+ BSSGP[0].clear;
+ GTP.send(ts_GTPC_DeletePdpResp(g_ud_second.peer, seq_nr, apars.sgsn_tei_c, '7F'O));
+ }
+ alt {
+ [] BSSGP[0].receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid))) {
+ setverdict(pass);
+ }
+ [] as_xid(apars, 0);
+ }
+
+ setverdict(pass);
+}
+testcase TC_attach_pdp_act_deact_gtp_retrans() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans), testcasename(), g_gb, 27);
+ vc_conn.done;
+}
+
+/* Test that SGSN GTP response retransmit queue works fine */
+private function f_TC_attach_pdp_act_deact_gtp_retrans_resp(charstring id) runs on BSSGP_ConnHdlr {
+ var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+ var integer seq_nr := 23;
+ var Gtp1cUnitdata g_ud_first, g_ud_second;
+ var template Gtp1cUnitdata g_delete_req;
+ /* first perform regular attach + PDP context act */
+ f_TC_attach(id);
+ f_pdp_ctx_act(apars);
+
+ /* Now perform an MT DeleteCtxReq and emulate GGSN didn't receive response and sends a duplicated DeleteCtxReq */
+ BSSGP[0].clear;
+ var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
+ g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, apars.nsapi, '1'B);
+ GTP.send(g_delete_req);
+ alt {
+ [] BSSGP[0].receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, true))) {
+ f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), 0);
+ }
+ [] as_xid(apars, 0);
+ }
+ GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) -> value g_ud_first {
+ if (g_ud_first.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue != '80'O) {
+ setverdict(fail, "Received deletePDPContextResponse cause is not 'Request accepted'");
+ mtc.stop;
+ }
+ };
+
+ /* Send duplicate DeleteCtxReq */
+ log("First deletePDPContextResponse received, dropping & retransmitting retransmission of deletePDPContextRequest");
+ GTP.send(g_delete_req);
+ GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, apars.ggsn_tei_c)) -> value g_ud_second {
+ if (g_ud_first != g_ud_second) {
+ setverdict(fail, "Retransmitted GTP message deletePDPContextResponse is different from original one!");
+ mtc.stop;
+ }
+ }
+
+ /* Let's send now a new DeleteCtxReq (increased seq_nr) to make sure it
+ * is handled differently by SGSN (expect "non-existent" cause) */
+ g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr + 1, apars.sgsn_tei_c, apars.nsapi, '1'B);
+ GTP.send(g_delete_req);
+ /* Response with cause "non-existent" must be sent with TEID 0 according to specs */
+ GTP.receive(tr_GTPC_MsgType(?, deletePDPContextResponse, '00000000'O)) -> value g_ud_second {
+ if (g_ud_second.gtpc.gtpc_pdu.deletePDPContextResponse.cause.causevalue != 'C0'O) {
+ setverdict(fail, "Received deletePDPContextResponse cause is not 'Non-existent'");
+ mtc.stop;
+ }
+ }
+
+ setverdict(pass);
+}
+testcase TC_attach_pdp_act_deact_gtp_retrans_resp() runs on test_CT {
+ var BSSGP_ConnHdlr vc_conn;
+ f_init();
+ vc_conn := f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans_resp), testcasename(), g_gb, 28);
+ vc_conn.done;
+}
+
private function f_TC_hlr_location_cancel_request_update(charstring id) runs on BSSGP_ConnHdlr {
/* MS: perform regular attach */
f_TC_attach(id);
@@ -2369,6 +2486,8 @@ control {
execute( TC_attach_restart_ctr_echo() );
execute( TC_attach_restart_ctr_create() );
execute( TC_attach_pdp_act_deact_mt_t3395_expire() );
+ execute( TC_attach_pdp_act_deact_gtp_retrans() );
+ execute( TC_attach_pdp_act_deact_gtp_retrans_resp() );
execute( TC_attach_pdp_act_user_error_ind_ggsn() );
execute( TC_attach_pdp_act_gmm_detach() );
execute( TC_attach_gmm_attach_req_while_gmm_attach() );
diff --git a/sgsn/expected-results.xml b/sgsn/expected-results.xml
index b53a6f3..0b477d1 100644
--- a/sgsn/expected-results.xml
+++ b/sgsn/expected-results.xml
@@ -56,6 +56,8 @@
<testcase classname='SGSN_Tests' name='TC_attach_restart_ctr_echo' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_restart_ctr_create' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_pdp_act_deact_mt_t3395_expire' time='MASKED'/>
+ <testcase classname='SGSN_Tests' name='TC_attach_pdp_act_deact_gtp_retrans' time='MASKED'/>
+ <testcase classname='SGSN_Tests' name='TC_attach_pdp_act_deact_gtp_retrans_resp' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_pdp_act_user_error_ind_ggsn' time='MASKED'/>
<testcase classname='SGSN_Tests' name='TC_attach_gmm_attach_req_while_gmm_attach' time='MASKED'/>
</testsuite>