blob: 53aa0325644fe2588eb4b8921a8c9d01ac463d97 [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);
38 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001);
39 vc_conn.done;
40 f_cleanup();
41}
42
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010043testcase TC_iu_attach_encr() runs on test_CT {
44 /* MS -> SGSN: Attach Request IMSI
45 * MS <- SGSN: Identity Request IMEI
46 * MS -> SGSN: Identity Response IMEI
47 * MS <- SGSN: Auth Request
48 * MS -> SGSN: Auth Response
49 * MS <- SGSN: Security Mode Command
50 * MS -> SGSN: Security Mode Complete
51 * hNodeB <- SGSN: Common Id
52 * MS <- SGSN: Attach Accept
53 * MS -> SGSN: Attach Complete
54 */
55 var BSSGP_ConnHdlr vc_conn;
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +010056 f_init();
57 f_vty_config(SGSNVTY, "sgsn", "encryption uea 1 2");
58 f_sleep(1.0);
59 vc_conn := f_start_handler(refers(f_TC_iu_attach), testcasename(), g_gb, 1001, expect_ciph := true);
60 vc_conn.done;
61 f_vty_config(SGSNVTY, "sgsn", "encryption uea 0");
62 f_cleanup();
63}
64
Alexander Couzense5f4a912019-08-12 18:07:27 +020065private function f_TC_iu_attach_geran_rau(charstring id) runs on BSSGP_ConnHdlr {
66 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
Harald Welte900d01a2019-08-13 13:27:51 +020067
Alexander Couzense5f4a912019-08-12 18:07:27 +020068 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020069 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 3);
Alexander Couzense5f4a912019-08-12 18:07:27 +020070
71 /* do a routing area update */
72 f_routing_area_update(g_pars.ra);
73}
74
75testcase TC_iu_attach_geran_rau() runs on test_CT {
76 /* MS <-> SGSN: Successful Attach over Iu
77 * MS <-> SGSN: Routing Area Update over Geran
78 */
79 var BSSGP_ConnHdlr vc_conn;
Alexander Couzense5f4a912019-08-12 18:07:27 +020080 f_init();
81 f_sleep(1.0);
82 vc_conn := f_start_handler(refers(f_TC_iu_attach_geran_rau), testcasename(), g_gb, 1002);
83 vc_conn.done;
84 f_cleanup();
85}
Harald Welte900d01a2019-08-13 13:27:51 +020086
Alexander Couzens6da25e32019-08-16 03:50:44 +020087private function f_TC_geran_attach_iu_rau(charstring id) runs on BSSGP_ConnHdlr {
88 var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
89
90 /* first perform regular attach */
Alexander Couzensb1ce1182019-09-15 22:43:40 +020091 f_gmm_attach(umts_aka_challenge := true, force_gsm_sres := false, ran_index := 0);
Alexander Couzens6da25e32019-08-16 03:50:44 +020092
93 /* do a routing area update */
Alexander Couzensbe76d9c2019-09-15 22:48:03 +020094 f_routing_area_update(g_pars.ra, ran_index := 3);
Alexander Couzens6da25e32019-08-16 03:50:44 +020095 setverdict(pass);
96}
97
98testcase TC_geran_attach_iu_rau() runs on test_CT {
99 /* MS <-> SGSN: Successful Attach over Geran
100 * MS <-> SGSN: Routing Area Update over Iu
101 */
102 var BSSGP_ConnHdlr vc_conn;
Alexander Couzens6da25e32019-08-16 03:50:44 +0200103 f_init();
104 f_sleep(1.0);
105 vc_conn := f_start_handler(refers(f_TC_geran_attach_iu_rau), testcasename(), g_gb, 1003);
106 vc_conn.done;
107 f_cleanup();
108}
109
Harald Welte900d01a2019-08-13 13:27:51 +0200110control {
111 execute( TC_iu_attach() );
Neels Hofmeyr3ee71d82022-03-08 21:46:41 +0100112 execute( TC_iu_attach_encr() );
Daniel Willmann69cfc5e2020-01-22 18:23:46 +0100113 execute( TC_iu_attach_geran_rau() );
114 execute( TC_geran_attach_iu_rau() );
Harald Welte900d01a2019-08-13 13:27:51 +0200115}
116
117
118}