Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Sep 4 17:13:27 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
......................................................................

sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

Testing the corner case of receiving an Attach Request
while not (yet) sent an Attach Accept.

MS -> SGSN: Attach Request IMSI
MS <- SGSN: Identity Request IMSI (optional)
MS -> SGSN: Identity Response IMSI (optional)
MS <- SGSN: Identity Request IMEI
MS -> SGSN: Attach Request (2nd)
MS <- SGSN: Identity Response IMEI
MS <- SGSN: Attach Accept
MS -> SGSN: Attach Complete

Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 73 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 3f479da..0112483 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1943,6 +1943,78 @@
 	vc_conn.done;
 }
 
+private function f_TC_attach_gmm_attach_req_while_gmm_attach(charstring id) runs on BSSGP_ConnHdlr {
+	var integer count_req := 0;
+	var MobileL3_CommonIE_Types.MobileIdentityLV mi;
+	var RoutingAreaIdentificationV rand_rai := f_random_RAI();
+	var BssgpDecoded bd;
+
+	f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit));
+
+	alt {
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
+			setverdict(fail, "Unexpected GMM ATTACH REJECT");
+			mtc.stop;
+		}
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('001'B))) {
+			mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+			f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi));
+			repeat;
+		}
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('010'B))) {
+			/* send out a second GMM_Attach Request.
+			 * If the SGSN follows the rules, this 2nd ATTACH REQ should be ignored, because
+			 * of the same content */
+			f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit));
+			mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
+			f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi));
+		}
+	}
+	f_sleep(1.0);
+
+	/* we've sent already a IMEI answer, we should NOT asked again for IMEI */
+	alt {
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('001'B))) {
+			mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+			f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi));
+			repeat;
+		}
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('010'B))) {
+			setverdict(fail, "Unexpected GMM ID REQ (IMEI).");
+			mtc.stop;
+		}
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
+			setverdict(fail, "Unexpected GMM ATTACH REJECT");
+			mtc.stop;
+		}
+		[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+			f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
+			f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL);
+			setverdict(pass);
+			/* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */
+		}
+	}
+}
+
+testcase TC_attach_gmm_attach_req_while_gmm_attach() runs on test_CT {
+	/* Testing if the SGSN ignore Attach Request with the exact same content */
+	/* MS -> SGSN: Attach Request IMSI
+	 * MS <- SGSN: Identity Request IMSI (optional)
+	 * MS -> SGSN: Identity Response IMSI (optional)
+	 * MS <- SGSN: Identity Request IMEI
+	 * MS -> SGSN: Attach Request (2nd)
+	 * MS <- SGSN: Identity Response IMEI
+	 * MS <- SGSN: Attach Accept
+	 * MS -> SGSN: Attach Complete
+	 */
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all");
+	vc_conn := f_start_handler(refers(f_TC_attach_gmm_attach_req_while_gmm_attach), testcasename(), g_gb, 39);
+	vc_conn.done;
+}
+
 control {
 	execute( TC_attach() );
 	execute( TC_attach_mnc3() );
@@ -1985,6 +2057,7 @@
 	execute( TC_attach_restart_ctr_create() );
 	execute( TC_attach_pdp_act_deact_mt_t3395_expire() );
 	execute( TC_attach_pdp_act_user_error_ind_ggsn() );
+	execute( TC_attach_gmm_attach_req_while_gmm_attach() );
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180904/6aa631f1/attachment.htm>


More information about the gerrit-log mailing list