Change in osmo-ttcn3-hacks[master]: PCU: fix: actually match IMSI in Packet Paging 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/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Jan 1 22:19:49 UTC 2020


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


Change subject: PCU: fix: actually match IMSI in Packet Paging Request
......................................................................

PCU: fix: actually match IMSI in Packet Paging Request

Makes the test cases fail because typeOfIdentity != '001'B.

Change-Id: I0afdd53fd5d2a89e139f65a7aec412a2e12511cc
---
M library/RLCMAC_CSN1_Types.ttcn
M pcu/PCU_Tests_RAW.ttcn
2 files changed, 31 insertions(+), 11 deletions(-)



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

diff --git a/library/RLCMAC_CSN1_Types.ttcn b/library/RLCMAC_CSN1_Types.ttcn
index 321049c..7cb6581 100644
--- a/library/RLCMAC_CSN1_Types.ttcn
+++ b/library/RLCMAC_CSN1_Types.ttcn
@@ -17,6 +17,7 @@
 	import from Osmocom_Types all;
 	import from GSM_Types all;
 	import from MobileL3_GMM_SM_Types all;
+	import from MobileL3_CommonIE_Types all;
 
 	/* TS 44.060 11.2.0.1 */
 	type enumerated RlcmacDlCtrlMsgType {
@@ -203,7 +204,7 @@
 		 * use only 4 bit to encode the length of a mobile identity, whereas the IE
 		 * uses a byte. */
 		uint4_t			len,
-		octetstring		mobile_id
+		MobileIdentityV		mobile_id
 	} with { variant (len) "LENGTHTO(mobile_id)" };
 	type record PageInfoPs {
 		BIT1			presence ('0'B),
diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn
index cd13ff5..e4e26cc 100644
--- a/pcu/PCU_Tests_RAW.ttcn
+++ b/pcu/PCU_Tests_RAW.ttcn
@@ -1247,6 +1247,29 @@
 	f_tx_rlcmac_ul_block(ts_RLCMAC_DL_ACK_NACK(dl_block.data.mac_hdr.hdr_ext.tfi, ack_nack_desc), 0, sched_fn);
 }
 
+private function f_pkt_paging_match_imsi(in PacketPagingReq req, hexstring imsi) {
+	var MobileIdentityLV_Paging mi := req.repeated_pageinfo.cs.mobile_identity;
+	var integer mi_len := lengthof(imsi);
+
+	/* Convert number of digits to the number of octets */
+	mi_len := mi_len / 2 + (mi_len rem 2);
+
+	if (mi.len != mi_len) {
+		setverdict(fail, "Mobile Identity length mismatch: ",
+			   mi.len, " vs ", mi_len);
+		mtc.stop;
+	} else if (mi.mobile_id.typeOfIdentity != '001'B) {
+		setverdict(fail, "Mobile Identity must be of type IMSI ('001'B), ",
+			   "got: ", mi.mobile_id.typeOfIdentity);
+		mtc.stop;
+	} else if (mi.mobile_id.oddEvenInd_identity.imsi.digits != imsi) {
+		setverdict(fail, "Mobile Identity contains unexpected IMSI, ",
+			   "expected ", imsi, " got: ",
+			   mi.mobile_id.oddEvenInd_identity.imsi.digits);
+		mtc.stop;
+	}
+}
+
 /* Test CS paging over the BTS<->PCU socket.
  * When a (class B or C, not A) MS has an active TBF (or is on the PDCH), the MS can not react on CS paging over CCCH.
  * Paging should be send on the PACCH.
@@ -1263,7 +1286,6 @@
 	var OCT4 tlli := '00000001'O;
 	var MobileL3_CommonIE_Types.MobileIdentityLV mi;
 	var octetstring mi_enc_lv;
-	var MobileIdentityLV_Paging mi_res;
 	var hexstring imsi := f_gen_imsi(42);
 
 	/* Initialize NS/BSSGP side */
@@ -1300,12 +1322,9 @@
 	/* Receive it on BTS side towards MS */
 	f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);
 
-	mi_res := dl_block.ctrl.payload.u.paging.repeated_pageinfo.cs.mobile_identity;
-	if (oct2int(substr(mi_enc_lv, 0, 1)) != mi_res.len) {
-		/* TODO: Verify MI contents encoded match */
-		setverdict(fail, "Mobile Identity not matching (imsi=", imsi, ")");
-		mtc.stop;
-	}
+	/* Make sure that Packet Paging Request contains the same IMSI */
+	f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);
+
 	setverdict(pass);
 }
 
@@ -1317,7 +1336,6 @@
 	var RlcmacDlBlock dl_block;
 	var boolean ok;
 	var OCT4 tlli := '00000001'O;
-	var MobileIdentityLV_Paging mi_res;
 	var hexstring imsi := f_gen_imsi(42);
 
 	/* Initialize NS/BSSGP side */
@@ -1349,8 +1367,9 @@
 	/* Receive it on BTS side towards MS */
 	f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);
 
-	/* FIXME: actually match the identity */
-	mi_res := dl_block.ctrl.payload.u.paging.repeated_pageinfo.cs.mobile_identity;
+	/* Make sure that Packet Paging Request contains the same IMSI */
+	f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);
+
 	setverdict(pass);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16695
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: I0afdd53fd5d2a89e139f65a7aec412a2e12511cc
Gerrit-Change-Number: 16695
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200101/539a2e26/attachment.htm>


More information about the gerrit-log mailing list