[PATCH] 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
Sat Feb 17 09:17:15 UTC 2018


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

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(-)


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

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 97b7f09..47ec847 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -254,9 +254,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));
@@ -274,12 +278,7 @@
 
 	BSSGP.receive(tr_BD_L3(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: newchange
Gerrit-Change-Id: Id349c7cd0899d6b87114a3ece8bc2ee625f64116
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