[PATCH] osmo-ttcn3-hacks[master]: sgsn: Add TC_rau_unknown

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
Sun Feb 18 09:28:08 UTC 2018


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/6555

to look at the new patch set (#2).

sgsn: Add TC_rau_unknown

Change-Id: If33fc690cedcc362c3cd5d7c1951440ecba328c2
---
M library/L3_Templates.ttcn
M sgsn/SGSN_Tests.ttcn
2 files changed, 95 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/55/6555/2

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 396a361..b37ee25 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -1471,6 +1471,7 @@
 				mSNetworkCapability := omit,
 				pdpContextStatus := omit, /* TODO */
 				pC_LCSCapability := omit,
+				mBMS_ContextStatus := omit,
 				uENetworkCapability := omit,
 				additionalMobileIdentity := omit,
 				oldRoutingAreaIdentification2 := omit,
@@ -1492,6 +1493,28 @@
 	}
 }
 
+template PDU_L3_SGSN_MS tr_GMM_RAU_REJECT(template OCT1 cause := ?) := {
+	discriminator := '1000'B,
+	tiOrSkip := {
+		skipIndicator := '0000'B
+	},
+	msgs := {
+		gprs_mm := {
+			routingAreaUpdateReject := {
+				messageType := '00001011'B,
+				gmmCause := {
+					causeValue := cause
+				},
+				forceToStandby := ?,
+				spare := '0000'B,
+				t3302 := *,
+				t3346 := *
+			}
+		}
+	}
+}
+
+
 template (value) PDU_L3_MS_SGSN ts_GMM_RAU_COMPL := {
 	discriminator := '0000'B, /* overwritten */
 	tiOrSkip := {
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index be1af57..7e1c48e 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -66,6 +66,7 @@
 	hexstring msisdn,
 	/* P-TMSI allocated to the simulated MS */
 	OCT4 p_tmsi optional,
+	OCT3 p_tmsi_sig optional,
 	/* TLLI of the simulated MS */
 	OCT4 tlli,
 	RoutingAreaIdentificationV ra optional,
@@ -165,6 +166,7 @@
 		imsi := f_gen_imsi(imsi_suffix),
 		msisdn := f_gen_msisdn(imsi_suffix),
 		p_tmsi := omit,
+		p_tmsi_sig := omit,
 		tlli := f_gprs_tlli_random(),
 		ra := omit,
 		bssgp_cell_id := gb.cfg.cell_id,
@@ -211,14 +213,11 @@
 }
 
 /* TODO:
-   * RAU without Attach
    * Detach without Attach
    * SM procedures without attach / RAU
    * ATTACH / RAU
    ** with / without authentication
    ** with / without P-TMSI allocation
-   ** timeout from HLR on SAI
-   ** timeout from HLR on UL
    ** reject from HLR on SAI
    ** reject from HLR on UL
    * re-transmissions of LLC frames
@@ -278,11 +277,36 @@
 	deactivate(di);
 }
 
+function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr {
+	/* mandatory IE */
+	g_pars.ra := aa.routingAreaIdentification;
+	if (ispresent(aa.allocatedPTMSI)) {
+		if (not g_pars.net.expect_ptmsi) {
+			setverdict(fail, "unexpected P-TMSI allocation");
+			self.stop;
+		}
+		g_pars.p_tmsi := aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets;
+		/* update TLLI? */
+	}
+	if (ispresent(aa.msIdentity)) {
+		setverdict(fail, "unexpected TMSI allocation in non-combined attach");
+		self.stop;
+	}
+	/* P-TMSI.sig */
+	if (ispresent(aa.ptmsiSignature)) {
+		g_pars.p_tmsi_sig := aa.ptmsiSignature.valueField;
+	}
+	/* updateTimer */
+	// aa.readyTimer
+	/* T3302, T3319, T3323, T3312_ext, T3324 */
+}
+
 function f_random_RAI(HEX0_3n mcc := '262'H, HEX0_3n mnc := '42'H) return RoutingAreaIdentificationV {
 	return f_RAI(mcc, mnc, f_rnd_octstring(2), f_rnd_octstring(1));
 }
 
 private function f_TC_attach(charstring id) runs on BSSGP_ConnHdlr {
+	var BssgpDecoded bd;
 	var MobileIdentityLV mi;
 	var RoutingAreaIdentificationV old_ra := f_random_RAI();
 
@@ -300,7 +324,10 @@
 	GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));
 	GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));
 
-	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
+	}
+	/* FIXME: Extract P-TMSI, if any. Only send Complete if necessary */
 	BSSGP.send(ts_GMM_ATTACH_COMPL);
 	setverdict(pass);
 }
@@ -374,6 +401,7 @@
 
 /* HLR never responds to UL REQ, expect ATTACH REJECT */
 private function f_TC_attach_gsup_lu_timeout(charstring id) runs on BSSGP_ConnHdlr {
+	var BssgpDecoded bd;
 	var MobileIdentityLV mi;
 	var RoutingAreaIdentificationV old_ra := f_random_RAI();
 
@@ -392,7 +420,8 @@
 	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
 		setverdict(pass);
 		}
-	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) {
+	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
 		setverdict(fail);
 		}
 	}
@@ -407,6 +436,7 @@
 
 /* Attempt of combined GPRS + IMSI attach: network should ACK only GPRS attach  */
 private function f_TC_attach_combined(charstring id) runs on BSSGP_ConnHdlr {
+	var BssgpDecoded bd;
 	var MobileIdentityLV mi;
 	var RoutingAreaIdentificationV old_ra := f_random_RAI();
 
@@ -424,11 +454,12 @@
 	GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));
 	GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));
 
-	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
+	}
 	BSSGP.send(ts_GMM_ATTACH_COMPL);
 	setverdict(pass);
 }
-
 testcase TC_attach_combined() runs on test_CT {
 	var BSSGP_ConnHdlr vc_conn;
 	f_init();
@@ -439,6 +470,7 @@
 
 /* Attempt of GPRS ATTACH in 'accept all' mode */
 private function f_TC_attach_accept_all(charstring id) runs on BSSGP_ConnHdlr {
+	var BssgpDecoded bd;
 	var MobileIdentityLV mi;
 	var RoutingAreaIdentificationV old_ra := f_random_RAI();
 
@@ -452,7 +484,9 @@
 
 	BSSGP.send(ts_GMM_ATTACH_REQ(mi, old_ra, false, false, omit, omit));
 	f_gmm_auth();
-	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
+	}
 	BSSGP.send(ts_GMM_ATTACH_COMPL);
 	setverdict(pass);
 }
@@ -505,6 +539,35 @@
 	vc_conn.done;
 }
 
+/* Routing Area Update from Unknown TLLI -> REJECT */
+private function f_TC_rau_unknown(charstring id) runs on BSSGP_ConnHdlr {
+	var MobileIdentityLV mi;
+	var RoutingAreaIdentificationV old_ra := f_random_RAI();
+
+	if (ispresent(g_pars.p_tmsi)) {
+		mi := valueof(ts_MI_TMSI_LV(g_pars.p_tmsi));
+	} else {
+		mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+	}
+
+	BSSGP.send(ts_GMM_RAU_REQ(mi, GPRS_UPD_T_RA, old_ra, false, omit, omit));
+	alt {
+	[] BSSGP.receive(tr_BD_L3_MT(tr_GMM_RAU_REJECT('0a'O))) {
+		setverdict(pass);
+		}
+	/* FIXME: Expect XID RESET? */
+	[] BSSGP.receive { repeat; }
+	}
+}
+testcase TC_rau_unknown() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	vc_conn := f_start_handler(refers(f_TC_rau_unknown), testcasename(), g_gb[0], 9);
+	vc_conn.done;
+}
+
+
 
 
 control {
@@ -515,6 +578,7 @@
 	execute( TC_attach_combined() );
 	execute( TC_attach_accept_all() );
 	execute( TC_attach_closed() );
+	execute( TC_rau_unknown() );
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/6555
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If33fc690cedcc362c3cd5d7c1951440ecba328c2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list