summaryrefslogtreecommitdiffstats
path: root/msc/MSC_Tests_Iu.ttcn
blob: 628fbcdc24b39d2c67a72076bacde28ee82f41fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
module MSC_Tests_Iu {

/* Osmocom MSC test suite for Iu interface in TTCN-3
 * (C) 2019 Harald Welte <laforge@gnumonks.org>
 * All rights reserved.
 *
 * Released under the terms of GNU General Public License, Version 2 or
 * (at your option) any later version.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

import from General_Types all;
import from Osmocom_Types all;

import from BSC_ConnectionHandler all;
import from MSC_Tests all;

import from Osmocom_VTY_Functions all;

import from GSUP_Emulation all;
import from RAN_Emulation all;

import from RANAP_Templates all;

import from MobileL3_Types all;
import from MobileL3_CommonIE_Types all;
import from MobileL3_SMS_Types all;
import from L3_Templates all;
import from L3_Common all;



testcase TC_iu_lu_imsi_reject() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_lu_imsi_reject), 1003, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_imsi_timeout_gsup() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_lu_imsi_timeout_gsup), 1004, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_imsi_auth3g_tmsi() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "network", "authentication required");

	vc_conn := f_start_handler(refers(f_tc_lu_imsi_auth3g_tmsi), 1005, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_cmserv_imsi_unknown() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_cmserv_imsi_unknown), 1006, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mo_call() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_call), 1007, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_auth_sai_timeout() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "network", "authentication required");

	vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_timeout), 1008, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_auth_sai_err() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "network", "authentication required");

	vc_conn := f_start_handler(refers(f_tc_lu_auth_sai_err), 1009, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

/* Test LU but RNC will send a Iu Release request in the middle */
private function f_tc_iu_lu_release_request(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
	f_init_handler(pars);

	var PDU_ML3_MS_NW l3_lu := f_build_lu_imsi(g_pars.imsi)
	var PDU_DTAP_MT dtap_mt;

	/* tell GSUP dispatcher to send this IMSI to us */
	f_create_gsup_expect(hex2str(g_pars.imsi));

	/* Send BSSAP_Conn_Req with COMPL L3 INFO to MSC */
	f_cl3_or_initial_ue(l3_lu);

	f_sleep(1.0);
	/* send release request in the middle of the LU */
	BSSAP.send(ts_RANAP_IuReleaseRequest(ts_RanapCause_om_intervention));
	alt {
	[] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_LU_Rej)) { repeat; }
	[] BSSAP.receive(tr_RANAP_IuReleaseCommand(?)) {}
	}
	BSSAP.send(ts_RANAP_IuReleaseComplete);
	alt {
	/* See https://osmocom.org/issues/2862 */
	[] BSSAP.receive(tr_RANAP_IuReleaseCommand(?)) {
			setverdict(fail, "Got a second Iu Release Command, only one expected");
			mtc.stop;
			repeat;
		}
	[] BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_IND) {}
	}
	setverdict(pass);
}
testcase TC_iu_lu_release_request() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_iu_lu_release_request), 1010, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_disconnect() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_lu_disconnect), 1011, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_by_imei() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_lu_by_imei), 1012, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_imsi_detach_by_imsi() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imsi), 1014, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_imsi_detach_by_tmsi() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_tmsi), 1015, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_imsi_detach_by_imei() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_imsi_detach_by_imei), 1016, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_emerg_call_imei_reject() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_emerg_call_imei_reject), 1017, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_emerg_call_imsi() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_emerg_call_imsi), 1018, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_establish_and_nothing() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_establish_and_nothing), 1027, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mo_setup_and_nothing() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mo_setup_and_nothing), 1028, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mo_crcx_ran_timeout() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_timeout), 1029, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mo_crcx_ran_reject() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mo_crcx_ran_reject), 1030, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mt_crcx_ran_reject() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mt_crcx_ran_reject), 1031, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mt_t310() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mt_t310), 1032, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_gsup_cancel() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_gsup_cancel), 1033, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_mo_release_timeout() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mo_release_timeout), 1040, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mo_sms() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_sms), 1042, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mt_sms() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(1043, ran_idx := 2, ran_is_geran := false);
	vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms), pars);
	vc_conn.done;
}

testcase TC_iu_lu_and_mt_sms_paging_and_nothing() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(101843, ran_idx := 2, ran_is_geran := false);
	vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms_paging_and_nothing), pars);
	vc_conn.done;
}

testcase TC_iu_lu_and_mt_sms_paging_repeated() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(101844);
	vc_conn := f_start_handler_with_pars(refers(f_tc_lu_and_mt_sms_paging_repeated), pars);
	vc_conn.done;
}

testcase TC_iu_smpp_mo_sms() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "default-route");
	vc_conn := f_start_handler(refers(f_tc_smpp_mo_sms), 1044, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
	f_vty_config2(MSCVTY, { "smpp", "esme msc_tester"}, "no default-route");
}

testcase TC_iu_gsup_mo_sms() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler(refers(f_tc_gsup_mo_sms), 1088, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_gsup_mo_smma() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler(refers(f_tc_gsup_mo_smma), 1089, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_gsup_mt_sms_ack() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(1090, ran_idx := 2, ran_is_geran := false);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_ack), pars);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_gsup_mt_sms_err() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(1091, ran_idx := 2, ran_is_geran := false);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_err), pars);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_gsup_mt_sms_rp_mr() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(1092, ran_idx := 2, ran_is_geran := false);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mt_sms_rp_mr), pars);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_gsup_mo_mt_sms_rp_mr() runs on MTC_CT {
	var BSC_ConnHdlrPars pars;
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	pars := f_init_pars(1093, ran_idx := 2, ran_is_geran := false);
	f_vty_config(MSCVTY, "msc", "sms-over-gsup");
	vc_conn := f_start_handler_with_pars(refers(f_tc_gsup_mo_mt_sms_rp_mr), pars);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "no sms-over-gsup");
}

testcase TC_iu_lu_and_mo_ussd_single_request() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_single_request), 1046, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mt_ussd_notification() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mt_ussd_notification), 1047, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mo_ussd_during_mt_call() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_during_mt_call), 1048, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_mo_cc_iu_release() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);

	vc_conn := f_start_handler(refers(f_tc_mo_cc_bssmap_clear), 1043, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mt_ussd_during_mt_call() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mt_ussd_during_mt_call), 1049, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_mo_ussd_mo_release() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_and_mo_ussd_mo_release), 1050, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

testcase TC_iu_lu_and_ss_session_timeout() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	f_vty_config(MSCVTY, "msc", "ncss guard-timeout 3");
	vc_conn := f_start_handler(refers(f_tc_lu_and_ss_session_timeout), 1051, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
	f_vty_config(MSCVTY, "msc", "ncss guard-timeout 0");
}

testcase TC_iu_lu_with_invalid_mcc_mnc() runs on MTC_CT {
	var BSC_ConnHdlr vc_conn;
	f_init(3);
	vc_conn := f_start_handler(refers(f_tc_lu_with_invalid_mcc_mnc), 1054, ran_idx := 2, ran_is_geran := false);
	vc_conn.done;
}

control {
	execute( TC_iu_lu_imsi_reject() );
	execute( TC_iu_lu_imsi_timeout_gsup() );
	execute( TC_iu_lu_imsi_auth3g_tmsi() );
	execute( TC_iu_cmserv_imsi_unknown() );
	execute( TC_iu_lu_and_mo_call() );
	execute( TC_iu_lu_auth_sai_timeout() );
	execute( TC_iu_lu_auth_sai_err() );
	execute( TC_iu_lu_release_request() );
	execute( TC_iu_lu_disconnect() );
	execute( TC_iu_lu_by_imei() );
	execute( TC_iu_imsi_detach_by_imsi() );
	execute( TC_iu_imsi_detach_by_tmsi() );
	execute( TC_iu_imsi_detach_by_imei() );
	execute( TC_iu_emerg_call_imei_reject() );
	execute( TC_iu_emerg_call_imsi() );
	execute( TC_iu_establish_and_nothing() );
	execute( TC_iu_mo_setup_and_nothing() );
	execute( TC_iu_mo_crcx_ran_timeout() );
	execute( TC_iu_mo_crcx_ran_reject() );
	execute( TC_iu_mt_crcx_ran_reject() );
	execute( TC_iu_gsup_cancel() );
	execute( TC_iu_mo_release_timeout() );
	execute( TC_reset_two_1iu() );

	execute( TC_iu_lu_and_mo_sms() );
	execute( TC_iu_lu_and_mt_sms() );
	execute( TC_iu_lu_and_mt_sms_paging_and_nothing() );
	execute( TC_iu_lu_and_mt_sms_paging_repeated() );
	execute( TC_iu_smpp_mo_sms() );

	execute( TC_iu_gsup_mo_sms() );
	execute( TC_iu_gsup_mo_smma() );
	execute( TC_iu_gsup_mt_sms_ack() );
	execute( TC_iu_gsup_mt_sms_err() );
	execute( TC_iu_gsup_mt_sms_rp_mr() );
	execute( TC_iu_gsup_mo_mt_sms_rp_mr() );

	execute( TC_iu_lu_and_mo_ussd_single_request() );
	execute( TC_iu_lu_and_mt_ussd_notification() );
	execute( TC_iu_lu_and_mo_ussd_during_mt_call() );
	execute( TC_iu_lu_and_mt_ussd_during_mt_call() );
	execute( TC_iu_lu_and_mo_ussd_mo_release() );
	execute( TC_iu_lu_and_ss_session_timeout() );
	execute( TC_iu_lu_with_invalid_mcc_mnc() );

	/* TODO: Iu + SGsAP related tests, e.g. paging on IuCS */

	/* Run this last: at the time of writing this test crashes the MSC */
	execute( TC_mo_cc_iu_release() );
}


}