GPRS_Components: generalize both f_pkt_paging_match_{imsi,tmsi}()

Change-Id: Ie0578fa299cdac18e942350b2e879839c9bd9dba
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index dffbc4d..5e61d85 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -1700,30 +1700,6 @@
 	f_shutdown(__BFILE__, __LINE__, final := true);
 }
 
-private function f_pkt_paging_match_imsi(in PacketPagingReq req, hexstring imsi)
-runs on RAW_PCU_Test_CT {
-	var PageInfo info := req.repeated_pageinfo[0].item;
-	var MobileIdentityLV_Paging mi_lv := info.cs.mobile_identity;
-	var MobileIdentityV mi := dec_MobileIdentityV(mi_lv.mobile_id);
-
-	if (mi_lv.len != 8) { /* 8 octets: type of ID (3 bits) + even/odd flag (1 bit) + 15 BCD-encoded digits (60 bits) */
-		setverdict(fail, "Mobile Identity length mismatch: ",
-			   "expected: 8, got: ", mi_lv.len);
-		f_shutdown(__BFILE__, __LINE__);
-	}
-
-	/* Make sure MI contains IMSI before referencing it */
-	if (mi.typeOfIdentity != '001'B) {
-		setverdict(fail, "Mobile Identity must be of type IMSI ('001'B), ",
-			   "got: ", mi.typeOfIdentity);
-		f_shutdown(__BFILE__, __LINE__);
-	} else if (mi.oddEvenInd_identity.imsi.digits != imsi) {
-		setverdict(fail, "Mobile Identity contains unexpected IMSI, ",
-			   "expected: ", imsi, " got: ", mi.oddEvenInd_identity.imsi.digits);
-		f_shutdown(__BFILE__, __LINE__);
-	}
-}
-
 /* 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.
@@ -1766,7 +1742,10 @@
 	f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);
 
 	/* Make sure that Packet Paging Request contains the same IMSI */
-	f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);
+	var PacketPagingReq req := dl_block.ctrl.payload.u.paging;
+	if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) {
+		setverdict(fail, "Failed to match IMSI ", imsi, " in ", req);
+	}
 
 	f_shutdown(__BFILE__, __LINE__, final := true);
 }
@@ -1808,10 +1787,15 @@
 	f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);
 
 	/* Make sure that Packet Paging Request contains the same P-TMSI/IMSI */
+	var PacketPagingReq req := dl_block.ctrl.payload.u.paging;
 	if (use_ptmsi) {
-		f_pkt_paging_match_tmsi(dl_block.ctrl.payload.u.paging, tmsi);
+		if (not f_pkt_paging_match_tmsi(req, tmsi, ps_domain := false)) {
+			setverdict(fail, "Failed to match P-TMSI ", tmsi, " in ", req);
+		}
 	} else {
-		f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);
+		if (not f_pkt_paging_match_imsi(req, imsi, ps_domain := false)) {
+			setverdict(fail, "Failed to match IMSI ", imsi, " in ", req);
+		}
 	}
 
 	f_shutdown(__BFILE__, __LINE__, final := true);