[PATCH] osmo-ttcn3-hacks[master]: sgsn: Use random TLLI when performing ATTACH

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


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

sgsn: Use random TLLI when performing ATTACH

Change-Id: If104add9a6d029b674e46e01af71f2e336aa35f0
---
M library/L3_Common.ttcn
M sgsn/SGSN_Tests.ttcn
2 files changed, 40 insertions(+), 1 deletion(-)


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

diff --git a/library/L3_Common.ttcn b/library/L3_Common.ttcn
index 69ab51d..a7c2eb2 100644
--- a/library/L3_Common.ttcn
+++ b/library/L3_Common.ttcn
@@ -27,6 +27,45 @@
 	return vec;
 }
 
+/* 3GPP TS 23.003 2.6 */
+type enumerated TlliType {
+	TLLI_LOCAL,
+	TLLI_FOREIGN,
+	TLLI_RANDOM,
+	TLLI_AUXILIARY,
+	TLLI_RESERVED,
+	TLLI_G_RNTI,
+	TLLI_RAND_G_RNTI
+}
+
+/* 3GPP TS 23.003 2.6 */
+function f_gprs_tlli_type(OCT4 tlli) return TlliType {
+	var bitstring tllib := oct2bit(tlli);
+	if (substr(tllib, 0, 2) == '11'B) {
+		return TLLI_LOCAL;
+	} else if (substr(tllib, 0, 2) == '10'B) {
+		return TLLI_FOREIGN;
+	} else if (substr(tllib, 0, 5) == '01111'B) {
+		return TLLI_RANDOM;
+	} else if (substr(tllib, 0, 4) == '0110'B) {
+		return TLLI_RESERVED;
+	} else if (substr(tllib, 0, 3) == '010'B) {
+		return TLLI_RESERVED;
+	} else if (substr(tllib, 0, 4) == '0000'B) {
+		return TLLI_G_RNTI;
+	} else if (substr(tllib, 0, 4) == '0001'B) {
+		return TLLI_RAND_G_RNTI;
+	} else {
+		setverdict(fail, "Unknonw TLLI Type ", tllib);
+		self.stop;
+	}
+}
+
+function f_gprs_tlli_random() return OCT4 {
+	var OCT4 tlli := f_rnd_octstring(4);
+	return tlli or4b 'c0000000'O;
+}
+
 
 
 }
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 236c0fb..97b7f09 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -149,7 +149,7 @@
 		imsi := f_gen_imsi(imsi_suffix),
 		msisdn := f_gen_msisdn(imsi_suffix),
 		p_tmsi := omit,
-		tlli := 'FFFFFFFF'O,
+		tlli := f_gprs_tlli_random(),
 		ra := omit,
 		bssgp_cell_id := gb.cfg.cell_id,
 		vec := omit,

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

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