<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19718">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">msc: add TC_attached_imsi_lu_unknown_tmsi()<br><br>The test currently fails with osmo-msc master. It uncovers the evil twin aspect<br>of osmo-msc's VLR, for an attached IMSI re-attaching with an unknown TMSI.<br><br>Related: OS#4721<br>Change-Id: Ia53733fc5bc414b0e3d3897f25b549f5183c862d<br>---<br>M msc/MSC_Tests.ttcn<br>1 file changed, 89 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn</span><br><span>index a801db9..43c6287 100644</span><br><span>--- a/msc/MSC_Tests.ttcn</span><br><span>+++ b/msc/MSC_Tests.ttcn</span><br><span>@@ -962,6 +962,94 @@</span><br><span>   vc_conn.done;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Test LU by unknown TMSI, while the IMSI is already attached: osmo-msc should switch to the attached vlr_subscr. */</span><br><span style="color: hsl(120, 100%, 40%);">+private function f_tc_attached_imsi_lu_unknown_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {</span><br><span style="color: hsl(120, 100%, 40%);">+       f_init_handler(pars);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       var PDU_ML3_MS_NW l3_lu := f_build_lu_tmsi('56111111'O);</span><br><span style="color: hsl(120, 100%, 40%);">+      var PDU_DTAP_MT dtap_mt;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* tell GSUP dispatcher to send this IMSI to us */</span><br><span style="color: hsl(120, 100%, 40%);">+    f_create_gsup_expect(hex2str(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */</span><br><span style="color: hsl(120, 100%, 40%);">+   f_cl3_or_initial_ue(l3_lu);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Send Early Classmark, just for the fun of it */</span><br><span style="color: hsl(120, 100%, 40%);">+    BSSAP.send(ts_BSSMAP_ClassmarkUpd(g_pars.cm2, g_pars.cm3));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Wait for + respond to ID REQ (IMSI) */</span><br><span style="color: hsl(120, 100%, 40%);">+     BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req(CM_ID_TYPE_IMSI)));</span><br><span style="color: hsl(120, 100%, 40%);">+  BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi)));</span><br><span style="color: hsl(120, 100%, 40%);">+    f_expect_common_id();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Expect MSC to do UpdateLocation to HLR; respond to it */</span><br><span style="color: hsl(120, 100%, 40%);">+   GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+    GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn));</span><br><span style="color: hsl(120, 100%, 40%);">+       GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+   GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     alt {</span><br><span style="color: hsl(120, 100%, 40%);">+ [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl));</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+     [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          setverdict(fail, "Expected LU ACK, but received REJ");</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 style="color: hsl(120, 100%, 40%);">+   /* Wait for MM-Information (if enabled) */</span><br><span style="color: hsl(120, 100%, 40%);">+    f_expect_mm_info();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* wait for normal teardown */</span><br><span style="color: hsl(120, 100%, 40%);">+        f_expect_clear();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Now the same IMSI is still attached in the VLR, and a LU with an unknown TMSI reveals the same IMSI only</span><br><span style="color: hsl(120, 100%, 40%);">+    * later during ID Response.  osmo-msc first creates a new vlr_subscr for the unknown TMSI, and as soon as the</span><br><span style="color: hsl(120, 100%, 40%);">+         * IMSI becomes known, must notice that this IMSI is still regarded as attached, and must not create evil twins.</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%);">+ /* (since the TMSI Reallocation happened, we could do this with exactly the same TMSI as above, but for test</span><br><span style="color: hsl(120, 100%, 40%);">+   * readability just use a different one.) */</span><br><span style="color: hsl(120, 100%, 40%);">+  l3_lu := f_build_lu_tmsi('56222222'O);</span><br><span style="color: hsl(120, 100%, 40%);">+        f_cl3_or_initial_ue(l3_lu);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Wait for + respond to ID REQ (IMSI) */</span><br><span style="color: hsl(120, 100%, 40%);">+     BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_MM_ID_Req(CM_ID_TYPE_IMSI)));</span><br><span style="color: hsl(120, 100%, 40%);">+  BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_MM_ID_Rsp_IMSI(g_pars.imsi)));</span><br><span style="color: hsl(120, 100%, 40%);">+    f_expect_common_id();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Expect MSC to do UpdateLocation to HLR; respond to it */</span><br><span style="color: hsl(120, 100%, 40%);">+   GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+    GSUP.send(ts_GSUP_ISD_REQ(g_pars.imsi, g_pars.msisdn));</span><br><span style="color: hsl(120, 100%, 40%);">+       GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+   GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     alt {</span><br><span style="color: hsl(120, 100%, 40%);">+ [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Acc)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_TmsiRealloc_Cmpl));</span><br><span style="color: hsl(120, 100%, 40%);">+               }</span><br><span style="color: hsl(120, 100%, 40%);">+     [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          setverdict(fail, "Expected LU ACK, but received REJ");</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 style="color: hsl(120, 100%, 40%);">+   /* Wait for MM-Information (if enabled) */</span><br><span style="color: hsl(120, 100%, 40%);">+    f_expect_mm_info();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* wait for normal teardown */</span><br><span style="color: hsl(120, 100%, 40%);">+        f_expect_clear();</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+testcase TC_attached_imsi_lu_unknown_tmsi() runs on MTC_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+    var BSC_ConnHdlr vc_conn;</span><br><span style="color: hsl(120, 100%, 40%);">+     f_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   vc_conn := f_start_handler(refers(f_tc_attached_imsi_lu_unknown_tmsi), 56);</span><br><span style="color: hsl(120, 100%, 40%);">+   vc_conn.done;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> friend function f_imsi_detach_by_imsi() runs on BSC_ConnHdlr {</span><br><span>         var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));</span><br><span> </span><br><span>@@ -6079,6 +6167,7 @@</span><br><span>  execute( TC_lu_disconnect() );</span><br><span>       execute( TC_lu_by_imei() );</span><br><span>  execute( TC_lu_by_tmsi_noauth_unknown() );</span><br><span style="color: hsl(120, 100%, 40%);">+    execute( TC_attached_imsi_lu_unknown_tmsi() );</span><br><span>       execute( TC_imsi_detach_by_imsi() );</span><br><span>         execute( TC_imsi_detach_by_tmsi() );</span><br><span>         execute( TC_imsi_detach_by_imei() );</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19718">change 19718</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/+/19718"/><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: Ia53733fc5bc414b0e3d3897f25b549f5183c862d </div>
<div style="display:none"> Gerrit-Change-Number: 19718 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>