sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

Testing the corner case of receiving an Attach Request
while not (yet) sent an Attach Accept.

MS -> SGSN: Attach Request IMSI
MS <- SGSN: Identity Request IMSI (optional)
MS -> SGSN: Identity Response IMSI (optional)
MS <- SGSN: Identity Request IMEI
MS -> SGSN: Attach Request (2nd)
MS <- SGSN: Identity Response IMEI
MS <- SGSN: Attach Accept
MS -> SGSN: Attach Complete

Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
This commit is contained in:
Alexander Couzens 2018-08-07 19:48:27 +02:00
parent 03d1224474
commit cf3c93d959
1 changed files with 73 additions and 0 deletions

View File

@ -1943,6 +1943,78 @@ testcase TC_attach_rau_a_b() runs on test_CT {
vc_conn.done;
}
private function f_TC_attach_gmm_attach_req_while_gmm_attach(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 BssgpDecoded bd;
f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit));
alt {
[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
setverdict(fail, "Unexpected GMM ATTACH REJECT");
mtc.stop;
}
[] BSSGP[0].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));
repeat;
}
[] BSSGP[0].receive(tr_BD_L3_MT(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 */
f_send_l3_gmm_llc(ts_GMM_ATTACH_REQ(f_mi_get_lv(), rand_rai, true, false, omit, omit));
mi := valueof(ts_MI_IMEI_LV(g_pars.imei));
f_send_l3_gmm_llc(ts_GMM_ID_RESP(mi));
}
}
f_sleep(1.0);
/* we've sent already a IMEI answer, we should NOT asked again for IMEI */
alt {
[] BSSGP[0].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));
repeat;
}
[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ID_REQ('010'B))) {
setverdict(fail, "Unexpected GMM ID REQ (IMEI).");
mtc.stop;
}
[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_REJECT(?))) {
setverdict(fail, "Unexpected GMM ATTACH REJECT");
mtc.stop;
}
[] BSSGP[0].receive(tr_BD_L3_MT(tr_GMM_ATTACH_ACCEPT('001'B, ?, ?))) -> value bd {
f_process_attach_accept(bd.l3_mt.msgs.gprs_mm.attachAccept);
f_send_l3_gmm_llc(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() runs on test_CT {
/* Testing if the SGSN ignore Attach Request with the exact same content */
/* MS -> SGSN: Attach Request IMSI
* MS <- SGSN: Identity Request IMSI (optional)
* MS -> SGSN: Identity Response IMSI (optional)
* MS <- SGSN: Identity Request IMEI
* MS -> SGSN: Attach Request (2nd)
* MS <- SGSN: Identity Response IMEI
* MS <- SGSN: Attach Accept
* MS -> SGSN: Attach Complete
*/
var BSSGP_ConnHdlr vc_conn;
f_init();
f_sleep(1.0);
f_vty_config(SGSNVTY, "sgsn", "auth-policy accept-all");
vc_conn := f_start_handler(refers(f_TC_attach_gmm_attach_req_while_gmm_attach), testcasename(), g_gb, 39);
vc_conn.done;
}
control {
execute( TC_attach() );
execute( TC_attach_mnc3() );
@ -1985,6 +2057,7 @@ control {
execute( TC_attach_restart_ctr_create() );
execute( TC_attach_pdp_act_deact_mt_t3395_expire() );
execute( TC_attach_pdp_act_user_error_ind_ggsn() );
execute( TC_attach_gmm_attach_req_while_gmm_attach() );
}