blob: f6a4243b83d4a5e95d8354cf4199e6b417675092 [file] [log] [blame]
Harald Welte900d01a2019-08-13 13:27:51 +02001module SGSN_Tests_Iu {
2
3import from Osmocom_Types all;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +01004import from Osmocom_VTY_Functions all;
Harald Welte900d01a2019-08-13 13:27:51 +02005
6import from SGSN_Tests all;
7
8import from RAN_Adapter all;
9import from RAN_Emulation all;
10import from RANAP_Templates all;
11import from RANAP_PDU_Descriptions all;
12import from RANAP_IEs all;
13
Vadim Yanitskiyf0bbadc2024-05-15 00:41:23 +050014private function f_init() runs on test_CT {
15 g_ranap_enable := true;
16 SGSN_Tests.f_init();
17}
Harald Welte900d01a2019-08-13 13:27:51 +020018
19private function f_TC_iu_attach(charstring id) runs on BSSGP_ConnHdlr {
20 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
21
22 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020023 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Harald Welte900d01a2019-08-13 13:27:51 +020024 setverdict(pass);
25}
26testcase TC_iu_attach() runs on test_CT {
27 /* MS -> SGSN: Attach Request IMSI
28 * MS <- SGSN: Identity Request IMEI
29 * MS -> SGSN: Identity Response IMEI
30 * MS <- SGSN: Auth Request
31 * MS -> SGSN: Auth Response
32 * MS <- SGSN: Attach Accept
33 * MS -> SGSN: Attach Complete
34 */
35 var BSSGP_ConnHdlr vc_conn;
Harald Welte900d01a2019-08-13 13:27:51 +020036 f_init();
37 f_sleep(1.0);
Vadim Yanitskiyb5a002e2024-05-15 00:47:25 +050038 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
Harald Welte900d01a2019-08-13 13:27:51 +020039 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001);
40 vc_conn.done;
41 f_cleanup();
42}
43
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010044testcase TC_iu_attach_encr() runs on test_CT {
45 /* MS -> SGSN: Attach Request IMSI
46 * MS <- SGSN: Identity Request IMEI
47 * MS -> SGSN: Identity Response IMEI
48 * MS <- SGSN: Auth Request
49 * MS -> SGSN: Auth Response
50 * MS <- SGSN: Security Mode Command
51 * MS -> SGSN: Security Mode Complete
52 * hNodeB <- SGSN: Common Id
53 * MS <- SGSN: Attach Accept
54 * MS -> SGSN: Attach Complete
55 */
56 var BSSGP_ConnHdlr vc_conn;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010057 f_init();
58 f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2");
59 f_sleep(1.0);
60 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true);
61 vc_conn.done;
62 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
63 f_cleanup();
64}
65
Alexander Couzense5f4a912019-08-12 18:07:27 +020066private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr {
67 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
Harald Welte900d01a2019-08-13 13:27:51 +020068
Alexander Couzense5f4a912019-08-12 18:07:27 +020069 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020070 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Alexander Couzense5f4a912019-08-12 18:07:27 +020071
72 /* do a routing area update */
73 f_routing_area_update(g_pars.ra);
74}
75
76testcase TC_iu_attach_geran_rau() runs on test_CT {
77 /* MS <-> SGSN: Successful Attach over Iu
78 * MS <-> SGSN: Routing Area Update over Geran
79 */
80 var BSSGP_ConnHdlr vc_conn;
Alexander Couzense5f4a912019-08-12 18:07:27 +020081 f_init();
82 f_sleep(1.0);
83 vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002);
84 vc_conn.done;
85 f_cleanup();
86}
Harald Welte900d01a2019-08-13 13:27:51 +020087
Alexander Couzens6da25e32019-08-16 03:50:44 +020088private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr {
89 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
90
91 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020092 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0);
Alexander Couzens6da25e32019-08-16 03:50:44 +020093
94 /* do a routing area update */
Alexander Couzensbe76d9c2019-09-15 22:48:03 +020095 f_routing_area_update(g_pars.ra, ran_index := 3);
Alexander Couzens6da25e32019-08-16 03:50:44 +020096 setverdict(pass);
97}
98
99testcase TC_geran_attach_iu_rau() runs on test_CT {
100 /* MS <-> SGSN: Successful Attach over Geran
101 * MS <-> SGSN: Routing Area Update over Iu
102 */
103 var BSSGP_ConnHdlr vc_conn;
Alexander Couzens6da25e32019-08-16 03:50:44 +0200104 f_init();
105 f_sleep(1.0);
106 vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003);
107 vc_conn.done;
108 f_cleanup();
109}
110
Harald Welte900d01a2019-08-13 13:27:51 +0200111control {
112 execute( TC_iu_attach() );
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +0100113 execute( TC_iu_attach_encr() );
Daniel Willmann69cfc5e2020-01-22 18:23:46 +0100114 execute( TC_iu_attach_geran_rau() );
115 execute( TC_geran_attach_iu_rau() );
Harald Welte900d01a2019-08-13 13:27:51 +0200116}
117
118
119}