blob: 0a589b9f276ef8c0a5cf0128fd4f8083ac0236f9 [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;
Vadim Yanitskiy3bed6a42024-05-15 01:33:18 +05007import from BSSGP_Emulation all;
Harald Welte900d01a2019-08-13 13:27:51 +02008
9import from RAN_Adapter all;
10import from RAN_Emulation all;
11import from RANAP_Templates all;
12import from RANAP_PDU_Descriptions all;
13import from RANAP_IEs all;
14
Vadim Yanitskiyf0bbadc2024-05-15 00:41:23 +050015private function f_init() runs on test_CT {
16 g_ranap_enable := true;
17 SGSN_Tests.f_init();
Vadim Yanitskiye42f8d62024-05-15 00:53:13 +050018
19 /* default VTY configuration */
20 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
Vadim Yanitskiyf0bbadc2024-05-15 00:41:23 +050021}
Harald Welte900d01a2019-08-13 13:27:51 +020022
23private function f_TC_iu_attach(charstring id) runs on BSSGP_ConnHdlr {
24 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
25
26 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020027 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Harald Welte900d01a2019-08-13 13:27:51 +020028 setverdict(pass);
29}
30testcase TC_iu_attach() runs on test_CT {
31 /* MS -> SGSN: Attach Request IMSI
32 * MS <- SGSN: Identity Request IMEI
33 * MS -> SGSN: Identity Response IMEI
34 * MS <- SGSN: Auth Request
35 * MS -> SGSN: Auth Response
36 * MS <- SGSN: Attach Accept
37 * MS -> SGSN: Attach Complete
38 */
39 var BSSGP_ConnHdlr vc_conn;
Harald Welte900d01a2019-08-13 13:27:51 +020040 f_init();
41 f_sleep(1.0);
Vadim Yanitskiyb5a002e2024-05-15 00:47:25 +050042 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
Harald Welte900d01a2019-08-13 13:27:51 +020043 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001);
44 vc_conn.done;
45 f_cleanup();
46}
47
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010048testcase TC_iu_attach_encr() runs on test_CT {
49 /* MS -> SGSN: Attach Request IMSI
50 * MS <- SGSN: Identity Request IMEI
51 * MS -> SGSN: Identity Response IMEI
52 * MS <- SGSN: Auth Request
53 * MS -> SGSN: Auth Response
54 * MS <- SGSN: Security Mode Command
55 * MS -> SGSN: Security Mode Complete
56 * hNodeB <- SGSN: Common Id
57 * MS <- SGSN: Attach Accept
58 * MS -> SGSN: Attach Complete
59 */
60 var BSSGP_ConnHdlr vc_conn;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010061 f_init();
62 f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2");
63 f_sleep(1.0);
64 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true);
65 vc_conn.done;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010066 f_cleanup();
67}
68
Alexander Couzense5f4a912019-08-12 18:07:27 +020069private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr {
70 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
Harald Welte900d01a2019-08-13 13:27:51 +020071
Alexander Couzense5f4a912019-08-12 18:07:27 +020072 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020073 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Alexander Couzense5f4a912019-08-12 18:07:27 +020074
Vadim Yanitskiy3bed6a42024-05-15 01:33:18 +050075 /* we got a new TLLI, register it */
76 f_bssgp_client_unregister(g_pars.imsi);
77 f_bssgp_client_register(g_pars.imsi, g_pars.tlli);
78
Alexander Couzense5f4a912019-08-12 18:07:27 +020079 /* do a routing area update */
80 f_routing_area_update(g_pars.ra);
81}
82
83testcase TC_iu_attach_geran_rau() runs on test_CT {
84 /* MS <-> SGSN: Successful Attach over Iu
85 * MS <-> SGSN: Routing Area Update over Geran
86 */
87 var BSSGP_ConnHdlr vc_conn;
Alexander Couzense5f4a912019-08-12 18:07:27 +020088 f_init();
89 f_sleep(1.0);
90 vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002);
91 vc_conn.done;
92 f_cleanup();
93}
Harald Welte900d01a2019-08-13 13:27:51 +020094
Alexander Couzens6da25e32019-08-16 03:50:44 +020095private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr {
96 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
97
98 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020099 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0);
Alexander Couzens6da25e32019-08-16 03:50:44 +0200100
101 /* do a routing area update */
Alexander Couzensbe76d9c2019-09-15 22:48:03 +0200102 f_routing_area_update(g_pars.ra, ran_index := 3);
Alexander Couzens6da25e32019-08-16 03:50:44 +0200103 setverdict(pass);
104}
105
106testcase TC_geran_attach_iu_rau() runs on test_CT {
107 /* MS <-> SGSN: Successful Attach over Geran
108 * MS <-> SGSN: Routing Area Update over Iu
109 */
110 var BSSGP_ConnHdlr vc_conn;
Alexander Couzens6da25e32019-08-16 03:50:44 +0200111 f_init();
112 f_sleep(1.0);
113 vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003);
114 vc_conn.done;
115 f_cleanup();
116}
117
Harald Welte900d01a2019-08-13 13:27:51 +0200118control {
119 execute( TC_iu_attach() );
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +0100120 execute( TC_iu_attach_encr() );
Daniel Willmann69cfc5e2020-01-22 18:23:46 +0100121 execute( TC_iu_attach_geran_rau() );
122 execute( TC_geran_attach_iu_rau() );
Harald Welte900d01a2019-08-13 13:27:51 +0200123}
124
125
126}