Change in osmo-ttcn3-hacks[master]: msc: Verify CommonID contains LastUsedEutranPLMNId when in CSFB

pespin gerrit-no-reply at lists.osmocom.org
Wed Apr 28 18:43:47 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23969 )


Change subject: msc: Verify CommonID contains LastUsedEutranPLMNId when in CSFB
......................................................................

msc: Verify CommonID contains LastUsedEutranPLMNId when in CSFB

Validate in test that MSC sends Last Used E-UTRAN PLLMN Id IE when call
is started by SGs (CSFB).

Related: SYS#5337
Change-Id: I161529fd9c8cacb7d17ea18660998df06bb0b575
---
M library/BSSMAP_Templates.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 61 insertions(+), 10 deletions(-)



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

diff --git a/library/BSSMAP_Templates.ttcn b/library/BSSMAP_Templates.ttcn
index 2b99a5b..c60498e 100644
--- a/library/BSSMAP_Templates.ttcn
+++ b/library/BSSMAP_Templates.ttcn
@@ -1163,7 +1163,10 @@
 	elementIdentifier := '95'O,
 	mcc_mnc := mcc_mnc
 }
-
+template BSSAMAP_IE_LastUsedEUTRANPLMNId tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc) := {
+	elementIdentifier := '95'O,
+	mcc_mnc := mcc_mnc
+}
 function f_ts_BSSMAP_LastUsedEUTRANPLMNId(template (omit) OCT3 mcc_mnc)
 			return template (omit) BSSAMAP_IE_LastUsedEUTRANPLMNId {
 	if (not istemplatekind(mcc_mnc, "omit")) {
@@ -1172,6 +1175,18 @@
 		return omit;
 	}
 }
+function f_tr_BSSMAP_LastUsedEUTRANPLMNId(template OCT3 mcc_mnc)
+			return template BSSAMAP_IE_LastUsedEUTRANPLMNId {
+	if (istemplatekind(mcc_mnc, "*")) {
+		return *;
+	} else if (istemplatekind(mcc_mnc, "?")) {
+		return ?;
+	} else if (not istemplatekind(mcc_mnc, "omit")) {
+		return ts_BSSMAP_LastUsedEUTRANPLMNId(valueof(mcc_mnc));
+	} else {
+		return omit;
+	}
+}
 
 template BSSMAP_FIELD_CellIdentificationList ts_BSSMAP_CIL_noCell := {
 	cIl_noCell := ''O
@@ -1227,7 +1242,7 @@
 }
 
 
-private function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
+function f_enc_mcc_mnc(GsmMcc mcc, GsmMnc mnc) return OCT3 {
 	if (lengthof(mnc) == 2) {
 		return hex2oct(mcc[1] & mcc[0] & 'F'H & mcc[2] & mnc[1] & mnc[0]);
 	} else {
@@ -1235,6 +1250,15 @@
 	}
 }
 
+function f_dec_mcc_mnc(in OCT3 mcc_mnc, out GsmMcc mcc, out GsmMnc mnc) {
+	var hexstring hs := oct2hex(mcc_mnc);
+	mcc := hs[1] & hs[0] & hs[3];
+	mnc := hs[5] & hs[4];
+	if (hs[2] == 'F'H) {
+		mnc := mnc & hs[2];
+	}
+}
+
 template (value) BSSMAP_FIELD_CellIdentification_CGI ts_BSSMAP_CI_CGI(GsmMcc mcc, GsmMnc mnc, GsmLac lac, GsmCellId ci) := {
 	mcc_mnc := f_enc_mcc_mnc(mcc, mnc),
 	lac := int2oct(lac, 2),
@@ -1737,14 +1761,17 @@
 	}
 }
 
-template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits)
+template PDU_BSSAP tr_BSSMAP_CommonId(template hexstring imsi_digits,
+				      template BSSAMAP_IE_LastUsedEUTRANPLMNId lastUsedEUTRANPLMNId := *)
 modifies tr_BSSAP_BSSMAP := {
 	pdu := {
 		bssmap := {
 			commonID := {
 				messageType := '2F'O,
 				iMSI := tr_BSSMAP_Imsi(imsi_digits),
-				sNAAccessInformation := *
+				sNAAccessInformation := *,
+				selectedPLMNId := *,
+				lastUsedEUTRANPLMNId := lastUsedEUTRANPLMNId
 			}
 		}
 	}
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 30adb03..8ca8264 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -106,7 +106,8 @@
 	boolean ran_is_geran,
 	boolean use_osmux,
 	boolean use_ipv6,
-	boolean verify_cell_id
+	boolean verify_cell_id,
+	OCT3 common_id_last_eutran_plmn optional
 };
 
 /* get a one-octet bitmaks of supported algorithms based on Classmark information */
@@ -524,7 +525,8 @@
 function f_expect_common_id() runs on BSC_ConnHdlr
 {
 	if (g_pars.ran_is_geran) {
-		BSSAP.receive(tr_BSSMAP_CommonId(g_pars.imsi));
+		BSSAP.receive(tr_BSSMAP_CommonId(g_pars.imsi,
+						 f_tr_BSSMAP_LastUsedEUTRANPLMNId(g_pars.common_id_last_eutran_plmn)));
 	} else {
 		BSSAP.receive(tr_RANAP_CommonId(imsi_hex2oct(g_pars.imsi)));
 	}
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 8325625..7aae440 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -16,6 +16,7 @@
 
 import from General_Types all;
 import from Osmocom_Types all;
+import from GSM_Types all;
 
 import from M3UA_Types all;
 import from M3UA_Emulation all;
@@ -400,7 +401,8 @@
 		ran_is_geran := ran_is_geran,
 		use_osmux := use_osmux,
 		use_ipv6 := false,
-		verify_cell_id := verify_cell_id
+		verify_cell_id := verify_cell_id,
+		common_id_last_eutran_plmn := omit
 	};
 	if (not ran_is_geran) {
 		pars.use_umts_aka := true;
@@ -4536,13 +4538,19 @@
 	var PDU_SGsAP lua;
 	var PDU_SGsAP mm_info;
 	var octetstring mm_info_dtap;
+	var GsmMcc mcc;
+	var GsmMnc mnc;
+	var template (omit) TrackingAreaIdentityValue tai := omit;
 
 	/* tell GSUP dispatcher to send this IMSI to us */
 	f_create_gsup_expect(hex2str(g_pars.imsi));
-
+	if (g_pars.common_id_last_eutran_plmn != omit) {
+		f_dec_mcc_mnc(g_pars.common_id_last_eutran_plmn, mcc, mnc);
+		tai := ts_SGsAP_TAI(mcc, mnc, 555);
+	}
 	lur := valueof(ts_SGsAP_LU_REQ(g_pars.imsi, mme_name, IMSI_attach,
 					ts_SGsAP_LAI('901'H, '70'H, 2342),
-					ts_SGsAP_TAI('901'H, '70'H, 555)));
+					tai));
 	/* Old LAI, if MS sends it */
 	/* TMSI status, if MS has no valid TMSI */
 	/* IMEISV, if it supports "automatic device detection" */
@@ -4602,6 +4610,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11811, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu), pars);
 	vc_conn.done;
 }
@@ -4641,7 +4650,6 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11812, true);
-
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_lu_imsi_reject), pars);
 	vc_conn.done;
 }
@@ -4729,6 +4737,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11814, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_expl_imsi_det_eps), pars);
 	vc_conn.done;
 }
@@ -4753,6 +4762,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11814, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_impl_imsi_det_eps), pars);
 	vc_conn.done;
 }
@@ -4780,6 +4790,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11815, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_expl_imsi_det_noneps), pars);
 	vc_conn.done;
 }
@@ -4807,6 +4818,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11815, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_impl_imsi_det_noneps), pars);
 	vc_conn.done;
 }
@@ -4858,6 +4870,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11816, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_rej), pars);
 	vc_conn.done;
 }
@@ -4907,6 +4920,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11817, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_subscr_rej), pars);
 	vc_conn.done;
 }
@@ -4951,6 +4965,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11818, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_ue_unr), pars);
 	vc_conn.done;
 }
@@ -5010,6 +5025,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11819, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_and_nothing), pars);
 	vc_conn.done;
 }
@@ -5068,6 +5084,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11820, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_paging_and_lu), pars);
 	vc_conn.done;
 }
@@ -5276,6 +5293,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11823, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms), pars);
 	vc_conn.done;
 }
@@ -5306,6 +5324,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11824, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mo_sms), pars);
 	vc_conn.done;
 }
@@ -5369,6 +5388,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11825, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms_and_nothing), pars);
 	vc_conn.done;
 }
@@ -5429,6 +5449,7 @@
 	var BSC_ConnHdlr vc_conn;
 	f_init(1, true);
 	pars := f_init_pars(11826, true);
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 	vc_conn := f_start_handler_with_pars(refers(f_tc_sgsap_mt_sms_and_reject), pars);
 	vc_conn.done;
 }
@@ -5445,6 +5466,7 @@
 	if (bssmap_lu) {
 		f_perform_lu();
 	}
+	pars.common_id_last_eutran_plmn := f_enc_mcc_mnc('901'H, '70'H);
 
 	f_sgs_perform_lu();
 	f_sleep(1.0);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23969
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I161529fd9c8cacb7d17ea18660998df06bb0b575
Gerrit-Change-Number: 23969
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210428/8e897494/attachment-0001.htm>


More information about the gerrit-log mailing list