osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14516


Change subject: sgsn: new test for N(U) = 0 in GMM ID response
......................................................................

sgsn: new test for N(U) = 0 in GMM ID response

Related: OS#2951
Change-Id: I19939892d6a49f80453de977021892ba02d3bed2
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 39 insertions(+), 5 deletions(-)



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

diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 03c9d05..b8b2d29 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -392,23 +392,26 @@
        BSSGP[gb_index].send(ts_BSSGP_UL_UD(g_pars.tlli, 
g_pars.bssgp_cell_id[gb_index], llc_enc));
 }

-function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 
0) runs on BSSGP_ConnHdlr {
+function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 
0, integer n_u := -1) runs on BSSGP_ConnHdlr {
        var octetstring l3_enc := enc_PDU_L3_MS_SGSN(valueof(l3_mo));
        var BIT4 sapi := f_llc_sapi_by_l3_mo(valueof(l3_mo));
-       var integer n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]);
+
+       if (n_u == -1) {
+               n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]);
+       }
        f_send_llc(ts_LLC_UI(l3_enc, sapi, '0'B, n_u), gb_index);
 }

-altstep as_mm_identity(integer gb_idx := 0) runs on BSSGP_ConnHdlr {
+altstep as_mm_identity(integer gb_idx := 0, integer n_u := -1) runs on 
BSSGP_ConnHdlr {
        var MobileL3_CommonIE_Types.MobileIdentityLV mi;
        [] BSSGP[gb_idx].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('001'B))) {
                mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
-               f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx);
+               f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx, n_u);
                repeat;
        }
        [] BSSGP[gb_idx].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('010'B))) {
                mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
-               f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx);
+               f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi), gb_idx, n_u);
                repeat;
        }
 }
@@ -2447,6 +2450,36 @@
        vc_conn.done;
 }

+/* Attach reject after sending two ML L3 messages with N(U) set to zero 
(OS#2951) */
+private function f_TC_attach_pdp_resp_nu_0(charstring id) runs on 
BSSGP_ConnHdlr {
+       var RoutingAreaIdentificationV old_ra := f_random_RAI();
+
+       f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), old_ra, false, 
false, omit, omit), n_u := 0);
+
+       alt {
+       [] as_mm_identity(n_u := 0);
+       /* FIXME: sgsn ignores the wrong N(U) two times, and then "learns" the 
one we are using. Is this what we want?
+         *        if this test gets used, count the ID REQs we get from sgsn, 
and add verdicts here. */
+       }
+}
+testcase TC_attach_pdp_resp_nu_0() runs on test_CT {
+       /* MS  -> SGSN: Attach Request, with N(U) = 0
+        * MS <-  SGSN: Identity Request
+        * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)
+        *              (SGSN drops the message due to invalid N(U))
+        * MS <-  SGSN: Identity Request (2nd try)
+        * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)
+        *              (SGSN drops the message due to invalid N(U))
+        * MS <-  SGSN: Identity Request (3rd try)
+        * MS  -> SGSN: Identity Response, with N(U) = 0 (broken behavior!)
+        *              (SGSN does recovery handling and accepts the message)
+        * MS <-  SGSN: Attach Reject (Network Failure)
+        *              (SGSN requests subscriber auth info from HLR, but HLR 
does not answer in this test) */
+       var BSSGP_ConnHdlr vc_conn;
+       f_init();
+       vc_conn := f_start_handler(refers(f_TC_attach_pdp_resp_nu_0), 
testcasename(), g_gb, 2, 40.0);
+       vc_conn.done;
+}

 control {
        execute( TC_attach() );
@@ -2502,6 +2535,7 @@
        execute( TC_llc_null() );
        execute( TC_llc_sabm_dm_llgmm() );
        execute( TC_llc_sabm_dm_ll5() );
+       execute( TC_attach_pdp_resp_nu_0() );
 }



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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I19939892d6a49f80453de977021892ba02d3bed2
Gerrit-Change-Number: 14516
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>
Gerrit-MessageType: newchange

Reply via email to