GPRS_Components: generalize both f_pkt_paging_match_{imsi,tmsi}()
Change-Id: Ie0578fa299cdac18e942350b2e879839c9bd9dba
This commit is contained in:
parent
7942580e23
commit
3e5f07436a
|
@ -934,8 +934,10 @@ runs on MS_BTS_IFACE_CT return uint32_t {
|
|||
return f_rrbp_ack_fn(dl_fn, rrbp);
|
||||
}
|
||||
|
||||
function f_pkt_paging_match_tmsi(in PacketPagingReq req, template GsmTmsi tmsi)
|
||||
runs on MS_BTS_IFACE_CT {
|
||||
/* Return true if a given Packet Paging Request contains the given IMSI, false otherwise */
|
||||
function f_pkt_paging_match_imsi(in PacketPagingReq req, template hexstring imsi,
|
||||
boolean cs_domain := true, boolean ps_domain := true)
|
||||
runs on MS_BTS_IFACE_CT return boolean {
|
||||
if (not ispresent(req.repeated_pageinfo)) {
|
||||
setverdict(fail, "Packet Paging Request without MIs?!?");
|
||||
f_shutdown(__BFILE__, __LINE__);
|
||||
|
@ -943,18 +945,57 @@ runs on MS_BTS_IFACE_CT {
|
|||
|
||||
for (var integer i := 0; i < lengthof(req.repeated_pageinfo); i := i + 1) {
|
||||
var PageInfo info := req.repeated_pageinfo[i].item;
|
||||
if (not ischosen(info.cs))
|
||||
{ continue; }
|
||||
var MobileIdentityLV_Paging mi_lv;
|
||||
|
||||
if (match(info.cs.tmsi, tmsi)) {
|
||||
setverdict(pass);
|
||||
return;
|
||||
if (ischosen(info.cs)) { /* CS domain */
|
||||
if (not ispresent(info.cs.mobile_identity))
|
||||
{ continue; }
|
||||
if (not cs_domain)
|
||||
{ continue; }
|
||||
mi_lv := info.cs.mobile_identity;
|
||||
} else { /* PS domain */
|
||||
if (not ispresent(info.ps.mobile_identity))
|
||||
{ continue; }
|
||||
if (not ps_domain)
|
||||
{ continue; }
|
||||
mi_lv := info.ps.mobile_identity;
|
||||
}
|
||||
|
||||
/* Make sure MI contains IMSI before referencing it */
|
||||
if (match(mi_lv.mobile_id, decmatch tr_MI_IMSI(imsi))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
setverdict(fail, "Mobile Identity (TMSI/P-TMSI) ", tmsi,
|
||||
" is not present in ", req.repeated_pageinfo);
|
||||
f_shutdown(__BFILE__, __LINE__);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return true if a given Packet Paging Request contains the given P-TMSI, false otherwise */
|
||||
function f_pkt_paging_match_tmsi(in PacketPagingReq req, template GsmTmsi tmsi,
|
||||
boolean cs_domain := true, boolean ps_domain := true)
|
||||
runs on MS_BTS_IFACE_CT return boolean {
|
||||
if (not ispresent(req.repeated_pageinfo)) {
|
||||
setverdict(fail, "Packet Paging Request without MIs?!?");
|
||||
f_shutdown(__BFILE__, __LINE__);
|
||||
}
|
||||
|
||||
for (var integer i := 0; i < lengthof(req.repeated_pageinfo); i := i + 1) {
|
||||
var PageInfo info := req.repeated_pageinfo[i].item;
|
||||
|
||||
if (cs_domain and ischosen(info.cs)) {
|
||||
if (not ispresent(info.cs.tmsi))
|
||||
{ continue; }
|
||||
if (match(info.cs.tmsi, tmsi))
|
||||
{ return true; }
|
||||
} else if (ps_domain) {
|
||||
if (not ispresent(info.ps.ptmsi))
|
||||
{ continue; }
|
||||
if (match(info.ps.ptmsi, tmsi))
|
||||
{ return true; }
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1700,30 +1700,6 @@ testcase TC_ul_tbf_reestablish_with_pkt_resource_req() runs on RAW_PCU_Test_CT {
|
|||
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 @@ testcase TC_paging_cs_from_bts() runs on RAW_PCU_Test_CT {
|
|||
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 @@ runs on RAW_PCU_Test_CT {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue