sgsn: Use Random RAI when performing attach request
Change-Id: Id349c7cd0899d6b87114a3ece8bc2ee625f64116
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 {