<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16695">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">PCU: fix: actually match IMSI in Packet Paging Request<br><br>Makes the test cases fail because typeOfIdentity != '001'B.<br><br>Change-Id: I0afdd53fd5d2a89e139f65a7aec412a2e12511cc<br>---<br>M library/RLCMAC_CSN1_Types.ttcn<br>M pcu/PCU_Tests_RAW.ttcn<br>2 files changed, 31 insertions(+), 11 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/95/16695/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/RLCMAC_CSN1_Types.ttcn b/library/RLCMAC_CSN1_Types.ttcn</span><br><span>index 321049c..7cb6581 100644</span><br><span>--- a/library/RLCMAC_CSN1_Types.ttcn</span><br><span>+++ b/library/RLCMAC_CSN1_Types.ttcn</span><br><span>@@ -17,6 +17,7 @@</span><br><span>       import from Osmocom_Types all;</span><br><span>       import from GSM_Types all;</span><br><span>   import from MobileL3_GMM_SM_Types all;</span><br><span style="color: hsl(120, 100%, 40%);">+        import from MobileL3_CommonIE_Types all;</span><br><span> </span><br><span>         /* TS 44.060 11.2.0.1 */</span><br><span>     type enumerated RlcmacDlCtrlMsgType {</span><br><span>@@ -203,7 +204,7 @@</span><br><span>           * use only 4 bit to encode the length of a mobile identity, whereas the IE</span><br><span>           * uses a byte. */</span><br><span>           uint4_t                 len,</span><br><span style="color: hsl(0, 100%, 40%);">-            octetstring             mobile_id</span><br><span style="color: hsl(120, 100%, 40%);">+             MobileIdentityV         mobile_id</span><br><span>    } with { variant (len) "LENGTHTO(mobile_id)" };</span><br><span>    type record PageInfoPs {</span><br><span>             BIT1                    presence ('0'B),</span><br><span>diff --git a/pcu/PCU_Tests_RAW.ttcn b/pcu/PCU_Tests_RAW.ttcn</span><br><span>index cd13ff5..e4e26cc 100644</span><br><span>--- a/pcu/PCU_Tests_RAW.ttcn</span><br><span>+++ b/pcu/PCU_Tests_RAW.ttcn</span><br><span>@@ -1247,6 +1247,29 @@</span><br><span>       f_tx_rlcmac_ul_block(ts_RLCMAC_DL_ACK_NACK(dl_block.data.mac_hdr.hdr_ext.tfi, ack_nack_desc), 0, sched_fn);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+private function f_pkt_paging_match_imsi(in PacketPagingReq req, hexstring imsi) {</span><br><span style="color: hsl(120, 100%, 40%);">+      var MobileIdentityLV_Paging mi := req.repeated_pageinfo.cs.mobile_identity;</span><br><span style="color: hsl(120, 100%, 40%);">+   var integer mi_len := lengthof(imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Convert number of digits to the number of octets */</span><br><span style="color: hsl(120, 100%, 40%);">+        mi_len := mi_len / 2 + (mi_len rem 2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      if (mi.len != mi_len) {</span><br><span style="color: hsl(120, 100%, 40%);">+               setverdict(fail, "Mobile Identity length mismatch: ",</span><br><span style="color: hsl(120, 100%, 40%);">+                          mi.len, " vs ", mi_len);</span><br><span style="color: hsl(120, 100%, 40%);">+         mtc.stop;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (mi.mobile_id.typeOfIdentity != '001'B) {</span><br><span style="color: hsl(120, 100%, 40%);">+           setverdict(fail, "Mobile Identity must be of type IMSI ('001'B), ",</span><br><span style="color: hsl(120, 100%, 40%);">+                    "got: ", mi.mobile_id.typeOfIdentity);</span><br><span style="color: hsl(120, 100%, 40%);">+           mtc.stop;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (mi.mobile_id.oddEvenInd_identity.imsi.digits != imsi) {</span><br><span style="color: hsl(120, 100%, 40%);">+            setverdict(fail, "Mobile Identity contains unexpected IMSI, ",</span><br><span style="color: hsl(120, 100%, 40%);">+                         "expected ", imsi, " got: ",</span><br><span style="color: hsl(120, 100%, 40%);">+                      mi.mobile_id.oddEvenInd_identity.imsi.digits);</span><br><span style="color: hsl(120, 100%, 40%);">+             mtc.stop;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Test CS paging over the BTS<->PCU socket.</span><br><span>  * 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.</span><br><span>  * Paging should be send on the PACCH.</span><br><span>@@ -1263,7 +1286,6 @@</span><br><span>     var OCT4 tlli := '00000001'O;</span><br><span>        var MobileL3_CommonIE_Types.MobileIdentityLV mi;</span><br><span>     var octetstring mi_enc_lv;</span><br><span style="color: hsl(0, 100%, 40%);">-      var MobileIdentityLV_Paging mi_res;</span><br><span>  var hexstring imsi := f_gen_imsi(42);</span><br><span> </span><br><span>    /* Initialize NS/BSSGP side */</span><br><span>@@ -1300,12 +1322,9 @@</span><br><span>      /* Receive it on BTS side towards MS */</span><br><span>      f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     mi_res := dl_block.ctrl.payload.u.paging.repeated_pageinfo.cs.mobile_identity;</span><br><span style="color: hsl(0, 100%, 40%);">-  if (oct2int(substr(mi_enc_lv, 0, 1)) != mi_res.len) {</span><br><span style="color: hsl(0, 100%, 40%);">-           /* TODO: Verify MI contents encoded match */</span><br><span style="color: hsl(0, 100%, 40%);">-            setverdict(fail, "Mobile Identity not matching (imsi=", imsi, ")");</span><br><span style="color: hsl(0, 100%, 40%);">-         mtc.stop;</span><br><span style="color: hsl(0, 100%, 40%);">-       }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Make sure that Packet Paging Request contains the same IMSI */</span><br><span style="color: hsl(120, 100%, 40%);">+     f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     setverdict(pass);</span><br><span> }</span><br><span> </span><br><span>@@ -1317,7 +1336,6 @@</span><br><span>   var RlcmacDlBlock dl_block;</span><br><span>  var boolean ok;</span><br><span>      var OCT4 tlli := '00000001'O;</span><br><span style="color: hsl(0, 100%, 40%);">-   var MobileIdentityLV_Paging mi_res;</span><br><span>  var hexstring imsi := f_gen_imsi(42);</span><br><span> </span><br><span>    /* Initialize NS/BSSGP side */</span><br><span>@@ -1349,8 +1367,9 @@</span><br><span>       /* Receive it on BTS side towards MS */</span><br><span>      f_rx_rlcmac_dl_block_exp_pkt_pag_req(dl_block);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     /* FIXME: actually match the identity */</span><br><span style="color: hsl(0, 100%, 40%);">-        mi_res := dl_block.ctrl.payload.u.paging.repeated_pageinfo.cs.mobile_identity;</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Make sure that Packet Paging Request contains the same IMSI */</span><br><span style="color: hsl(120, 100%, 40%);">+     f_pkt_paging_match_imsi(dl_block.ctrl.payload.u.paging, imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>     setverdict(pass);</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16695">change 16695</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/16695"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0afdd53fd5d2a89e139f65a7aec412a2e12511cc </div>
<div style="display:none"> Gerrit-Change-Number: 16695 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>