<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10769">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">sgsn: implement TC_attach_usim_resync<br><br>Test the UMTS AKA resync procedure with USIMs.<br><br>MS -> SGSN: Attach Request<br>MS <- SGSN: Identity Request IMSI<br>MS -> SGSN: Identity Response IMSI<br>MS <- SGSN: Identity Request IMEI<br>MS -> SGSN: Identity Response IMEI<br>HLR<- SGSN: SAI Request<br>HLR-> SGSN: SAI Response<br>MS <- SGSN: Auth Request<br>MS -> SGSN: Auth Failure (with AUTS)<br>HLR<- SGSN: SAI Request (with AUTS & RAND)<br>HLR-> SGSN: SAI Response (new key material)<br>MS <- SGSN: Auth Request (new key material)<br>MS -> SGSN: Auth Response<br>MS <- SGSN: Attach Accept<br>MS -> SGSN: Attach Complete<br><br>Change-Id: I52a8dc45bb67d4ca9f3efade278d3308bb0da73d<br>---<br>M sgsn/SGSN_Tests.ttcn<br>1 file changed, 131 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn</span><br><span>index 0112483..a2e93c0 100644</span><br><span>--- a/sgsn/SGSN_Tests.ttcn</span><br><span>+++ b/sgsn/SGSN_Tests.ttcn</span><br><span>@@ -2015,6 +2015,136 @@</span><br><span> vc_conn.done;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+private function f_TC_attach_usim_resync(charstring id) runs on BSSGP_ConnHdlr {</span><br><span style="color: hsl(120, 100%, 40%);">+ var BssgpDecoded bd;</span><br><span style="color: hsl(120, 100%, 40%);">+ var RoutingAreaIdentificationV old_ra := f_random_RAI();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ var template PDU_L3_MS_SGSN attach_req := ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, false, omit, omit);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* send Attach Request */</span><br><span style="color: hsl(120, 100%, 40%);">+ /* indicate R99 capability of the MS to enable UMTS AKA in presence of</span><br><span style="color: hsl(120, 100%, 40%);">+ * 3G auth vectors */</span><br><span style="color: hsl(120, 100%, 40%);">+ attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.revisionLevelIndicatior := '1'B;</span><br><span style="color: hsl(120, 100%, 40%);">+ /* The thing is, if the solSACapability is 'omit', then the</span><br><span style="color: hsl(120, 100%, 40%);">+ * revisionLevelIndicatior is at the wrong place! */</span><br><span style="color: hsl(120, 100%, 40%);">+ attach_req.msgs.gprs_mm.attachRequest.msNetworkCapability.msNetworkCapabilityV.solSACapability := '0'B;</span><br><span style="color: hsl(120, 100%, 40%);">+ f_send_l3_gmm_llc(attach_req);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* do the auth */</span><br><span style="color: hsl(120, 100%, 40%);">+ var PDU_L3_MS_SGSN l3_mo;</span><br><span style="color: hsl(120, 100%, 40%);">+ var PDU_L3_SGSN_MS l3_mt;</span><br><span style="color: hsl(120, 100%, 40%);">+ var default di := activate(as_mm_identity());</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ var GSUP_IE auth_tuple;</span><br><span style="color: hsl(120, 100%, 40%);">+ var template AuthenticationParameterAUTNTLV autn;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec := f_gen_auth_vec_3g();</span><br><span style="color: hsl(120, 100%, 40%);">+ autn := {</span><br><span style="color: hsl(120, 100%, 40%);">+ elementIdentifier := '28'O,</span><br><span style="color: hsl(120, 100%, 40%);">+ lengthIndicator := lengthof(g_pars.vec.autn),</span><br><span style="color: hsl(120, 100%, 40%);">+ autnValue := g_pars.vec.autn</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.sres,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.kc,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.ik,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.ck,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.autn,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.res));</span><br><span style="color: hsl(120, 100%, 40%);">+ log("GSUP sends 2G and 3G auth tuples", auth_tuple);</span><br><span style="color: hsl(120, 100%, 40%);">+ GSUP.receive(tr_GSUP_SAI_REQ(g_pars.imsi));</span><br><span style="color: hsl(120, 100%, 40%);">+ GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ var template PDU_L3_SGSN_MS auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand);</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn;</span><br><span style="color: hsl(120, 100%, 40%);">+ BSSGP[0].receive(tr_BD_L3_MT(auth_ciph_req)) -> value bd;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* send the gmm auth failure with resync IE */</span><br><span style="color: hsl(120, 100%, 40%);">+ f_send_l3_gmm_llc(ts_GMM_AUTH_FAIL_UMTS_AKA_RESYNC(g_pars.vec.auts));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* wait for the GSUP resync request */</span><br><span style="color: hsl(120, 100%, 40%);">+ GSUP.receive(tr_GSUP_SAI_REQ_UMTS_AKA_RESYNC(</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.imsi,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.auts,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.rand));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* generate new key material */</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec := f_gen_auth_vec_3g();</span><br><span style="color: hsl(120, 100%, 40%);">+ autn := {</span><br><span style="color: hsl(120, 100%, 40%);">+ elementIdentifier := '28'O,</span><br><span style="color: hsl(120, 100%, 40%);">+ lengthIndicator := lengthof(g_pars.vec.autn),</span><br><span style="color: hsl(120, 100%, 40%);">+ autnValue := g_pars.vec.autn</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%);">+ auth_tuple := valueof(ts_GSUP_IE_AuthTuple2G3G(g_pars.vec.rand,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.sres,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.kc,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.ik,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.ck,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.autn,</span><br><span style="color: hsl(120, 100%, 40%);">+ g_pars.vec.res));</span><br><span style="color: hsl(120, 100%, 40%);">+ /* send new key material */</span><br><span style="color: hsl(120, 100%, 40%);">+ GSUP.send(ts_GSUP_SAI_RES(g_pars.imsi, auth_tuple));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* wait for the new Auth Request */</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_req := tr_GMM_AUTH_REQ(g_pars.vec.rand);</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_req.msgs.gprs_mm.authenticationAndCipheringRequest.authenticationParameterAUTN := autn;</span><br><span style="color: hsl(120, 100%, 40%);">+ BSSGP[0].receive(tr_BD_L3_MT(auth_ciph_req)) -> value bd;</span><br><span style="color: hsl(120, 100%, 40%);">+ l3_mt := bd.l3_mt;</span><br><span style="color: hsl(120, 100%, 40%);">+ var BIT4 ac_ref := l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.acReferenceNumber.valueField;</span><br><span style="color: hsl(120, 100%, 40%);">+ var template PDU_L3_MS_SGSN auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres);</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_resp := ts_GMM_AUTH_RESP_2G(ac_ref, g_pars.vec.sres);</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationParResp := {</span><br><span style="color: hsl(120, 100%, 40%);">+ valueField := substr(g_pars.vec.res, 0, 4)</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+ auth_ciph_resp.msgs.gprs_mm.authenticationAndCipheringResponse.authenticationRespParExt := {</span><br><span style="color: hsl(120, 100%, 40%);">+ elementIdentifier := '21'O,</span><br><span style="color: hsl(120, 100%, 40%);">+ lengthIndicator := lengthof(g_pars.vec.res) - 4,</span><br><span style="color: hsl(120, 100%, 40%);">+ valueField := substr(g_pars.vec.res, 4, lengthof(g_pars.vec.res) - 4)</span><br><span style="color: hsl(120, 100%, 40%);">+ };</span><br><span style="color: hsl(120, 100%, 40%);">+ l3_mo := valueof(auth_ciph_resp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ispresent(l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest) and</span><br><span style="color: hsl(120, 100%, 40%);">+ l3_mt.msgs.gprs_mm.authenticationAndCipheringRequest.imeisvRequest.valueField == '001'B) {</span><br><span style="color: hsl(120, 100%, 40%);">+ l3_mo.msgs.gprs_mm.authenticationAndCipheringResponse.imeisv :=</span><br><span style="color: hsl(120, 100%, 40%);">+ valueof(ts_MI_IMEISV_TLV(g_pars.imei & '0'H));</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ f_send_l3_gmm_llc(l3_mo);</span><br><span style="color: hsl(120, 100%, 40%);">+ deactivate(di);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Expect SGSN to perform LU with HLR */</span><br><span style="color: hsl(120, 100%, 40%);">+ f_gmm_gsup_lu_isd();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {</span><br><span style="color: hsl(120, 100%, 40%);">+ f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ f_send_l3_gmm_llc(ts_GMM_ATTACH_COMPL);</span><br><span style="color: hsl(120, 100%, 40%);">+ setverdict(pass);</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%);">+testcase TC_attach_usim_resync() runs on test_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* MS -> SGSN: Attach Request</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS <- SGSN: Identity Request IMSI</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS -> SGSN: Identity Response IMSI</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS <- SGSN: Identity Request IMEI</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS -> SGSN: Identity Response IMEI</span><br><span style="color: hsl(120, 100%, 40%);">+ * HLR<- SGSN: SAI Request</span><br><span style="color: hsl(120, 100%, 40%);">+ * HLR-> SGSN: SAI Response</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS <- SGSN: Auth Request</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS -> SGSN: Auth Failure (with AUTS)</span><br><span style="color: hsl(120, 100%, 40%);">+ * HLR<- SGSN: SAI Request (with AUTS & RAND)</span><br><span style="color: hsl(120, 100%, 40%);">+ * HLR-> SGSN: SAI Response (new key material)</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS <- SGSN: Auth Request (new key material)</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS -> SGSN: Auth Response</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS <- SGSN: Attach Accept</span><br><span style="color: hsl(120, 100%, 40%);">+ * MS -> SGSN: Attach Complete</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+ var BSSGP_ConnHdlr vc_conn;</span><br><span style="color: hsl(120, 100%, 40%);">+ f_init();</span><br><span style="color: hsl(120, 100%, 40%);">+ f_sleep(1.0);</span><br><span style="color: hsl(120, 100%, 40%);">+ vc_conn := f_start_handler(refers(f_TC_attach_usim_resync), testcasename(), g_gb, 40);</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> control {</span><br><span> execute( TC_attach() );</span><br><span> execute( TC_attach_mnc3() );</span><br><span>@@ -2042,6 +2172,7 @@</span><br><span> execute( TC_attach_rau() );</span><br><span> execute( TC_attach_rau_a_a() );</span><br><span> execute( TC_attach_rau_a_b() );</span><br><span style="color: hsl(120, 100%, 40%);">+ execute( TC_attach_usim_resync() );</span><br><span> execute( TC_detach_unknown_nopoweroff() );</span><br><span> execute( TC_detach_unknown_poweroff() );</span><br><span> execute( TC_detach_nopoweroff() );</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10769">change 10769</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/10769"/><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-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I52a8dc45bb67d4ca9f3efade278d3308bb0da73d </div>
<div style="display:none"> Gerrit-Change-Number: 10769 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: lynxis lazus <lynxis@fe80.eu> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>