[PATCH] osmo-ttcn3-hacks[master]: sgsn: Implement TLLI assignment/modification/unassignment

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
Sat Feb 17 09:17:23 UTC 2018


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

sgsn: Implement TLLI assignment/modification/unassignment

It's important that we implement the proper TLLI handling whenever our
P-TMSI changes.

Change-Id: I5b95b9e49f0a1db9659714c4d01f340fd44fafe8
---
M library/BSSGP_Emulation.ttcn
M sgsn/SGSN_Tests.ttcn
2 files changed, 46 insertions(+), 4 deletions(-)


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

diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index ff63708..2354709 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -63,9 +63,10 @@
 
 signature BSSGP_register_client(hexstring imsi, OCT4 tlli, BssgpCellId cell_id);
 signature BSSGP_unregister_client(hexstring imsi);
+signature BSSGP_llgmm_assign(OCT4 tlli_old, OCT4 tlli);
 
 type port BSSGP_PROC_PT procedure {
-	inout BSSGP_register_client, BSSGP_unregister_client;
+	inout BSSGP_register_client, BSSGP_unregister_client, BSSGP_llgmm_assign;
 } with { extension "internal" };
 
 
@@ -303,6 +304,25 @@
 	self.stop;
 }
 
+/* TS 44.064 7.2.1.1 LLGMM-ASSIGN */
+private function f_tbl_client_llgmm_assign(OCT4 tlli_old, OCT4 tlli_new, BSSGP_Client_CT vc_conn)
+runs on BSSGP_CT {
+	var integer i := f_tbl_idx_by_comp(vc_conn);
+
+	if (tlli_old == 'FFFFFFFF'O and tlli_new != 'FFFFFFFF'O) {
+		/* TLLI assignment */
+		ClientTable[i].tlli := tlli_new;
+		ClientTable[i].tlli_old := omit;
+	} else if (tlli_old != 'FFFFFFFF'O and tlli_new != 'FFFFFFFF'O) {
+		/* TLLI change: both active */
+		ClientTable[i].tlli := tlli_new;
+		ClientTable[i].tlli_old := tlli_old;
+	} else if (tlli_old != 'FFFFFFFF'O and tlli_new == 'FFFFFFFF'O) {
+		/* TLLI unassignment: old shall be unassigned; new stays */
+		ClientTable[i].tlli_old := omit;
+	}
+}
+
 private function f_tbl_comp_by_imsi(hexstring imsi) runs on BSSGP_CT return BSSGP_Client_CT {
 	var integer i;
 	for (i := 0; i < sizeof(ClientTable); i := i+1) {
@@ -357,7 +377,7 @@
 	var NsStatusIndication nsi;
 	var ASP_Event evt;
 	var hexstring imsi;
-	var OCT4 tlli;
+	var OCT4 tlli, tlli_old;
 	var BssgpCellId cell_id;
 
 	/* Respond to BLOCK for wrong NSVCI */
@@ -421,6 +441,11 @@
 		f_tbl_client_del(imsi, vc_conn);
 		BSSGP_PROC.reply(BSSGP_unregister_client:{imsi});
 		}
+	[] BSSGP_PROC.getcall(BSSGP_llgmm_assign:{?,?}) -> param(tlli_old, tlli) sender vc_conn {
+		f_tbl_client_llgmm_assign(tlli_old, tlli, vc_conn);
+		BSSGP_PROC.reply(BSSGP_llgmm_assign:{tlli_old, tlli});
+		}
+
 }
 
 altstep as_blocked() runs on BSSGP_CT {
@@ -620,6 +645,14 @@
 	}
 }
 
+/* TS 44.064 7.2.1.1 LLGMM-ASSIGN */
+function f_bssgp_client_llgmm_assign(OCT4 tlli_old, OCT4 tlli_new, BSSGP_PROC_PT PT := BSSGP_PROC)
+runs on BSSGP_Client_CT {
+	PT.call(BSSGP_llgmm_assign:{tlli_old, tlli_new}) {
+		[] PT.getreply(BSSGP_llgmm_assign:{tlli_old, tlli_new}) {};
+	}
+}
+
 
 
 
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 2cf6e28..df14a4c 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -69,6 +69,7 @@
 	OCT3 p_tmsi_sig optional,
 	/* TLLI of the simulated MS */
 	OCT4 tlli,
+	OCT4 tlli_old optional,
 	RoutingAreaIdentificationV ra optional,
 	BssgpCellId bssgp_cell_id,
 	AuthVector vec optional,
@@ -168,6 +169,7 @@
 		p_tmsi := omit,
 		p_tmsi_sig := omit,
 		tlli := f_gprs_tlli_random(),
+		tlli_old := omit,
 		ra := omit,
 		bssgp_cell_id := gb.cfg.cell_id,
 		vec := omit,
@@ -285,6 +287,14 @@
 	deactivate(di);
 }
 
+function f_upd_ptmsi_and_tlli(OCT4 p_tmsi) runs on BSSGP_ConnHdlr {
+	g_pars.p_tmsi := p_tmsi;
+	/* update TLLI */
+	g_pars.tlli_old := g_pars.tlli;
+	g_pars.tlli := g_pars.p_tmsi or4b 'c0000000'O;
+	f_bssgp_client_llgmm_assign(g_pars.tlli_old, g_pars.tlli);
+}
+
 function f_process_attach_accept(PDU_GMM_AttachAccept aa) runs on BSSGP_ConnHdlr {
 	/* mandatory IE */
 	g_pars.ra := aa.routingAreaIdentification;
@@ -293,8 +303,7 @@
 			setverdict(fail, "unexpected P-TMSI allocation");
 			self.stop;
 		}
-		g_pars.p_tmsi := aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets;
-		/* update TLLI? */
+		f_upd_ptmsi_and_tlli(aa.allocatedPTMSI.mobileIdentityLV.mobileIdentityV.oddEvenInd_identity.tmsi_ptmsi.octets);
 	}
 	if (ispresent(aa.msIdentity)) {
 		setverdict(fail, "unexpected TMSI allocation in non-combined attach");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5b95b9e49f0a1db9659714c4d01f340fd44fafe8
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