blob: 5f1bb553be335e7ee0b376629efb6235bba36e7a [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();
Vadim Yanitskiye42f8d62024-05-15 00:53:13 +050017
18 /* default VTY configuration */
19 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
Vadim Yanitskiyf0bbadc2024-05-15 00:41:23 +050020}
Harald Welte900d01a2019-08-13 13:27:51 +020021
22private function f_TC_iu_attach(charstring id) runs on BSSGP_ConnHdlr {
23 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
24
25 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020026 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Harald Welte900d01a2019-08-13 13:27:51 +020027 setverdict(pass);
28}
29testcase TC_iu_attach() runs on test_CT {
30 /* MS -> SGSN: Attach Request IMSI
31 * MS <- SGSN: Identity Request IMEI
32 * MS -> SGSN: Identity Response IMEI
33 * MS <- SGSN: Auth Request
34 * MS -> SGSN: Auth Response
35 * MS <- SGSN: Attach Accept
36 * MS -> SGSN: Attach Complete
37 */
38 var BSSGP_ConnHdlr vc_conn;
Harald Welte900d01a2019-08-13 13:27:51 +020039 f_init();
40 f_sleep(1.0);
Vadim Yanitskiyb5a002e2024-05-15 00:47:25 +050041 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
Harald Welte900d01a2019-08-13 13:27:51 +020042 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001);
43 vc_conn.done;
44 f_cleanup();
45}
46
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010047testcase TC_iu_attach_encr() runs on test_CT {
48 /* MS -> SGSN: Attach Request IMSI
49 * MS <- SGSN: Identity Request IMEI
50 * MS -> SGSN: Identity Response IMEI
51 * MS <- SGSN: Auth Request
52 * MS -> SGSN: Auth Response
53 * MS <- SGSN: Security Mode Command
54 * MS -> SGSN: Security Mode Complete
55 * hNodeB <- SGSN: Common Id
56 * MS <- SGSN: Attach Accept
57 * MS -> SGSN: Attach Complete
58 */
59 var BSSGP_ConnHdlr vc_conn;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010060 f_init();
61 f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2");
62 f_sleep(1.0);
63 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true);
64 vc_conn.done;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010065 f_cleanup();
66}
67
Alexander Couzense5f4a912019-08-12 18:07:27 +020068private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr {
69 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
Harald Welte900d01a2019-08-13 13:27:51 +020070
Alexander Couzense5f4a912019-08-12 18:07:27 +020071 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020072 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Alexander Couzense5f4a912019-08-12 18:07:27 +020073
74 /* do a routing area update */
75 f_routing_area_update(g_pars.ra);
76}
77
78testcase TC_iu_attach_geran_rau() runs on test_CT {
79 /* MS <-> SGSN: Successful Attach over Iu
80 * MS <-> SGSN: Routing Area Update over Geran
81 */
82 var BSSGP_ConnHdlr vc_conn;
Alexander Couzense5f4a912019-08-12 18:07:27 +020083 f_init();
84 f_sleep(1.0);
85 vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002);
86 vc_conn.done;
87 f_cleanup();
88}
Harald Welte900d01a2019-08-13 13:27:51 +020089
Alexander Couzens6da25e32019-08-16 03:50:44 +020090private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr {
91 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
92
93 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020094 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0);
Alexander Couzens6da25e32019-08-16 03:50:44 +020095
96 /* do a routing area update */
Alexander Couzensbe76d9c2019-09-15 22:48:03 +020097 f_routing_area_update(g_pars.ra, ran_index := 3);
Alexander Couzens6da25e32019-08-16 03:50:44 +020098 setverdict(pass);
99}
100
101testcase TC_geran_attach_iu_rau() runs on test_CT {
102 /* MS <-> SGSN: Successful Attach over Geran
103 * MS <-> SGSN: Routing Area Update over Iu
104 */
105 var BSSGP_ConnHdlr vc_conn;
Alexander Couzens6da25e32019-08-16 03:50:44 +0200106 f_init();
107 f_sleep(1.0);
108 vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003);
109 vc_conn.done;
110 f_cleanup();
111}
112
Harald Welte900d01a2019-08-13 13:27:51 +0200113control {
114 execute( TC_iu_attach() );
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +0100115 execute( TC_iu_attach_encr() );
Daniel Willmann69cfc5e2020-01-22 18:23:46 +0100116 execute( TC_iu_attach_geran_rau() );
117 execute( TC_geran_attach_iu_rau() );
Harald Welte900d01a2019-08-13 13:27:51 +0200118}
119
120
121}