Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-09-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..

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
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 73 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 3f479da..0112483 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1943,6 +1943,78 @@
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 @@
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() );
 }



--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 

Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-09-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Tue, 04 Sep 2018 17:13:26 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-20 Thread lynxis lazus
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/10392

to look at the new patch set (#4).

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..

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
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 73 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/92/10392/4
--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-14 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..


Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/10392/3//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/10392/3//COMMIT_MSG@10
PS3, Line 10: Attach Request
should this read "Attach Complete"?



--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 14 Aug 2018 13:28:06 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-13 Thread lynxis lazus
Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/10392

to look at the new patch set (#3).

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..

sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

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

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
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 73 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/92/10392/3
--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-09 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/10392/1/sgsn/SGSN_Tests.ttcn
File sgsn/SGSN_Tests.ttcn:

https://gerrit.osmocom.org/#/c/10392/1/sgsn/SGSN_Tests.ttcn@1944
PS1, Line 1944: }
do you have a 'default activated altstep somewhere?  I'm asking as I don't see 
any "catch-all" clause here that would e.g. catch any other L3 PDU received 
from the SGSN.  In such situations, we would block until the guard timer times 
out and fail with a very nondescript error message.

As default-activated altsteps are somewhat un-obvious, an explicit altstep 
invocation like might be the best option. Avoids copying code around, while 
still making it explicit which alternatives exist in an alt{}

[] as_any_other_l3();



--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Thu, 09 Aug 2018 11:13:51 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-07 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10392 )

Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I0bac50dc5a72ba8f9010b05bcb98aa7ff0b81cf6
Gerrit-Change-Number: 10392
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 07 Aug 2018 18:13:35 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

2018-08-07 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/10392


Change subject: sgsn: add TC_attach_gmm_attach_req_while_gmm_attach
..

sgsn: add TC_attach_gmm_attach_req_while_gmm_attach

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

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
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 73 insertions(+), 0 deletions(-)



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

diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index a6a3c6c..2c987c4 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1915,6 +1915,78 @@
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_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_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_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_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_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_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() );
@@ -1957,6 +2029,7 @@
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() );
 }



--
To view, visit https://gerrit.osmocom.org/10392
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks