[PATCH] osmo-ttcn3-hacks[master]: sgsn: Parse Attach Accept (RA, P-TMSI, P-TMSI SIG, ...)

Harald Welte gerrit-no-reply at lists.osmocom.org
Sat Feb 17 09:17:20 UTC 2018


Review at  https://gerrit.osmocom.org/6556

sgsn: Parse Attach Accept (RA, P-TMSI, P-TMSI SIG, ...)

Change-Id: I5778aa98181e0418d4fe11e31619b679f226f043
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 41 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/56/6556/1

diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index adb018b..2698e87 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
@@ -285,11 +284,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();
 
@@ -307,7 +331,9 @@
 	GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));
 	GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));
 
-	BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3(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);
@@ -382,6 +408,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();
 
@@ -400,7 +427,8 @@
 	[] BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_REJECT(?))) {
 		setverdict(pass);
 		}
-	[] BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) {
+	[] BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
+		f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
 		setverdict(fail);
 		}
 	}
@@ -415,6 +443,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();
 
@@ -432,11 +461,12 @@
 	GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));
 	GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));
 
-	BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3(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();
@@ -447,6 +477,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();
 
@@ -460,7 +491,9 @@
 
 	BSSGP.send(ts_GMM_ATTACH_REQ(mi, old_ra, false, false, omit, omit));
 	f_gmm_auth();
-	BSSGP.receive(tr_BD_L3(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)));
+	BSSGP.receive(tr_BD_L3(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);
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5778aa98181e0418d4fe11e31619b679f226f043
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>


More information about the gerrit-log mailing list