lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39255?usp=email )


Change subject: SGSN: add TC_attach_gmm_attach_req_while_gmm_attach_retransmit
......................................................................

SGSN: add TC_attach_gmm_attach_req_while_gmm_attach_retransmit

Extend the TC_attach_gmm_attach_req_while_gmm_attach
by "loosing" an ID Req message.

Change-Id: I8d208c0a98675238dba439ab3e75758293928588
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 89 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/55/39255/1

diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index f8b9213..71b55c7 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -2073,10 +2073,11 @@
         * MS <- SGSN: Identity Request IMSI
         * MS -> SGSN: Identity Response IMSI
         * MS -> SGSN: Attach Request (2nd)
-        * SGS -> HLR: SAI Request
-        * SGS <- HLR: SAI Response
-        * MS <- SGSN: Identity Request IMEI
-        * MS -> SGSN: Identity Response IMEI
+        * SGSN -> HLR: SAI Request
+        * SGSN <- HLR: SAI Response
+        * MS <- SGSN: Auth Req
+        * MS <- SGSN: Auth Resp
+        * SGSN <-> HLR: ULA/ISD
         * MS <- SGSN: Attach Accept
         * MS -> SGSN: Attach Complete
         */
@@ -2088,6 +2089,89 @@
        f_cleanup();
 }

+/* The main difference to f_TC_attach_gmm_attach_req_while_gmm_attach is the 
*lost* of the first ID Req */
+private function 
f_TC_attach_gmm_attach_req_while_gmm_attach_retransmit(charstring id) runs on 
BSSGP_ConnHdlr {
+       var integer count_req := 0;
+       var MobileL3_CommonIE_Types.MobileIdentityLV mi;
+       var RoutingAreaIdentificationV rand_rai := f_random_RAI();
+       var PDU_L3_SGSN_MS l3_mt;
+
+       g_pars.vec := f_gen_auth_vec_3g();
+       g_pars.p_tmsi := f_random_ptmsi(suffix := '01'O);
+
+       f_send_l3(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, 
omit));
+
+       alt {
+               [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) {
+                       setverdict(fail, "Unexpected GMM ATTACH REJECT");
+                       mtc.stop;
+               }
+               [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) {
+                       mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+                       f_send_l3(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, 
true, false, omit, omit));
+               }
+       }
+
+       alt {
+               [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) {
+                       setverdict(fail, "Unexpected GMM ATTACH REJECT");
+                       mtc.stop;
+               }
+               [] BSSGP[0].receive(tr_GMM_ID_REQ('001'B)) {
+                       mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+                       f_send_l3(ts_GMM_ID_RESP(mi));
+                       repeat;
+               }
+               [] BSSGP[0].receive(tr_GMM_ID_REQ('010'B)) {
+                       /* send out a second GMM_Attach Request.
+                        * If the SGSN follows the rules, this 2nd ATTACH REQ 
should be ignored, because
+                        * of the same content */
+                       mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
+                       repeat;
+               }
+               [] as_gmm_auth(umts_aka_challenge := true, expect_sai := true) 
{};
+       }
+       f_sleep(1.0);
+
+       /* we've sent already a IMEI answer, we should NOT asked again for IMEI 
*/
+       alt {
+               [] as_gmm_gsup_lu_isd() { repeat; };
+               [] BSSGP[0].receive(tr_GMM_ATTACH_REJECT(?)) {
+                       setverdict(fail, "Unexpected GMM ATTACH REJECT");
+                       mtc.stop;
+               }
+               [] BSSGP[0].receive(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?)) -> 
value l3_mt {
+                       
f_process_attach_accept(l3_mt.msgs.gprs_mm.attachAccept);
+                       f_send_l3(ts_GMM_ATTACH_COMPL);
+                       setverdict(pass);
+                       /* FIXME: Extract P-TMSI, if any. Only send Complete if 
necessary */
+               }
+       }
+}
+
+testcase TC_attach_gmm_attach_req_while_gmm_attach_retransmit() runs on 
test_CT {
+       /* Testing if the SGSN ignore Attach Request with the exact same 
content */
+       /* MS -> SGSN: Attach Request TMSI
+        * MS <- SGSN: Identity Request IMSI
+        * MS -> SGSN: Attach Request (2nd)
+        * MS <- SGSN: Identity Request IMSI (retrans)
+        * SGSN -> HLR: SAI Request
+        * SGSN <- HLR: SAI Response
+        * MS <- SGSN: Auth Req
+        * MS <- SGSN: Auth Resp
+        * SGSN <-> HLR: ULA/ISD
+        * MS <- SGSN: Attach Accept
+        * MS -> SGSN: Attach Complete
+        */
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       f_sleep(1.0);
+       vc_conn := 
f_start_handler(refers(f_TC_attach_gmm_attach_req_while_gmm_attach_retransmit), 
testcasename(), g_gb, 39);
+       vc_conn.done;
+       f_cleanup();
+}
+
+
 private function f_TC_attach_usim_resync(charstring id) runs on BSSGP_ConnHdlr 
{
        var RoutingAreaIdentificationV old_ra := f_random_RAI();

@@ -3375,6 +3459,7 @@
        execute( TC_attach_pdp_act_user_error_ind_ggsn() );
        execute( TC_attach_pdp_act_gmm_detach() );
        execute( TC_attach_gmm_attach_req_while_gmm_attach() );
+       execute( TC_attach_gmm_attach_req_while_gmm_attach_retransmit() );

        execute( TC_xid_empty_l3() );
        execute( TC_xid_n201u() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/39255?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8d208c0a98675238dba439ab3e75758293928588
Gerrit-Change-Number: 39255
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <[email protected]>

Reply via email to