[MERGED] osmo-ttcn3-hacks[master]: sgsn: Use Random RAI when performing attach request

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:54:35 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: sgsn: Use Random RAI when performing attach request
......................................................................


sgsn: Use Random RAI when performing attach request

Change-Id: Id349c7cd0899d6b87114a3ece8bc2ee625f64116
---
M library/General_Types.ttcn
M library/L3_Common.ttcn
M sgsn/SGSN_Tests.ttcn
3 files changed, 24 insertions(+), 7 deletions(-)

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



diff --git a/library/General_Types.ttcn b/library/General_Types.ttcn
index aab0609..b404fe1 100644
--- a/library/General_Types.ttcn
+++ b/library/General_Types.ttcn
@@ -163,6 +163,7 @@
   type hexstring HEX24n length(24) with { variant "" };
 
   //hexstring with length interval
+  type hexstring HEX0_3n length(0..3) with { variant "" };
   type hexstring HEX0_18n length(0..18) with { variant "" };
   type hexstring HEX1_20n length(1..20) with { variant "" };
   type hexstring HEX1_34n length(1..34) with { variant "" };
diff --git a/library/L3_Common.ttcn b/library/L3_Common.ttcn
index a7c2eb2..19e52eb 100644
--- a/library/L3_Common.ttcn
+++ b/library/L3_Common.ttcn
@@ -2,6 +2,7 @@
 
 import from Osmocom_Types all;
 import from General_Types all;
+import from MobileL3_GMM_SM_Types all;
 
 type record AuthVector {
 	OCT16 rand,
@@ -66,6 +67,22 @@
 	return tlli or4b 'c0000000'O;
 }
 
+function f_RAI(HEX0_3n mcc, HEX0_3n mnc, OCT2 lac, OCT1 rac) return RoutingAreaIdentificationV {
+	if (lengthof(mnc) == 2) {
+		mnc := mnc & 'F'H;
+	}
+	var RoutingAreaIdentificationV ret := {
+		mccDigit1 := mcc[0],
+		mccDigit2 := mcc[1],
+		mccDigit3 := mcc[2],
+		mncDigit3 := mnc[2],
+		mncDigit1 := mnc[0],
+		mncDigit2 := mnc[1],
+		lac := lac,
+		rac := rac
+	}
+	return ret;
+}
 
 
 }
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index cf354a7..bb97a68 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -247,9 +247,13 @@
 	deactivate(di);
 }
 
+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 MobileIdentityLV mi;
-	var RoutingAreaIdentificationV old_ra := { '2'H, '6'H, '2'H, 'F'H, '4'H, '2'H, '2342'O, '00'O };
+	var RoutingAreaIdentificationV old_ra := f_random_RAI();
 
 	if (ispresent(g_pars.p_tmsi)) {
 		mi := valueof(ts_MI_TMSI_LV(g_pars.p_tmsi));
@@ -267,12 +271,7 @@
 
 	BSSGP.receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT(?, ?, ?)));
 	BSSGP.send(ts_GMM_ATTACH_COMPL);
-/*
-	alt {
-	[] as_mm_identity();
-	}
-*/
-	f_sleep(5.0);
+	setverdict(pass);
 }
 
 testcase TC_attach() runs on test_CT {

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

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



More information about the gerrit-log mailing list