blob: e5d012f232bf4cceefce4193df9e7bff33203315 [file] [log] [blame]
Alexander Couzens8e1dfd02020-09-07 04:26:20 +02001module SGSN_Tests_NS {
2
3/* Osmocom SGSN test suite in TTCN-3
4 * (C) 2020 sysmocom - s.f.m.c. GmbH
5 * All rights reserved.
6 *
7 * Released under the terms of GNU General Public License, Version 2 or
8 * (at your option) any later version.
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13import from Osmocom_Types all;
14import from Osmocom_Gb_Types all;
15import from Osmocom_VTY_Functions all;
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020016import from NS_Types all;
17import from RAW_NS all;
18import from SGSN_Tests all;
19
20type component RAW_Test_CT extends RAW_NS_CT, test_CT {
21}
22
23testcase TC_NS_connect_reset() runs on RAW_Test_CT {
24 f_init_vty();
Alexander Couzensc3165722021-01-11 02:51:45 +010025 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020026
27 /* Send a NS-ALIVE */
28 f_outgoing_ns_reset();
29
30 f_sleep(1.0);
Alexander Couzensc3165722021-01-11 02:51:45 +010031 f_clean_ns_codec();
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020032}
33
34testcase TC_NS_connect_alive() runs on RAW_Test_CT {
35 f_init_vty();
Alexander Couzensc3165722021-01-11 02:51:45 +010036 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020037
38 /* Send a NS-ALIVE */
Alexander Couzensc3165722021-01-11 02:51:45 +010039 NSCP[0].send(t_NS_ALIVE);
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020040 alt {
Alexander Couzensc3165722021-01-11 02:51:45 +010041 [] NSCP[0].receive(t_NS_ALIVE_ACK);
42 [] NSCP[0].receive(tr_NS_STATUS(*)) { setverdict(fail); }
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020043 [] NSCP[0].receive { repeat; }
44 }
45
46 f_sleep(1.0);
Alexander Couzensc3165722021-01-11 02:51:45 +010047 f_clean_ns_codec();
Alexander Couzens8e1dfd02020-09-07 04:26:20 +020048}
49
Harald Welte424ec522021-03-23 18:20:12 +010050/* perform outgoing SNS-SIZE procedure */
51testcase TC_SNS_size() runs on RAW_Test_CT {
52 f_init_vty();
53 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
54 g_handle_rx_alive := true;
55
56 f_outgoing_sns_size();
57 setverdict(pass);
58}
59
60/* outgoing SNS-SIZE procedure with more BSS side IPs than SGSN can handle */
61testcase TC_SNS_size_too_big() runs on RAW_Test_CT {
62 f_init_vty();
63 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
64 g_handle_rx_alive := true;
65
66 f_outgoing_sns_size(cause := NS_CAUSE_INVALID_NR_OF_NSVCS, num_ip := 100);
67 setverdict(pass);
68}
69
70/* perform outgoing SNS-CONFIG procedure (for BSS) */
71testcase TC_SNS_config_bss() runs on RAW_Test_CT {
72 f_init_vty();
73 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
74 g_handle_rx_alive := true;
75
76 f_outgoing_sns_size();
77 f_outgoing_sns_config();
78 setverdict(pass);
79}
80
81/* perform incoming SNS-CONFIG procedure (for SGSN) */
82testcase TC_SNS_config_sgsn() runs on RAW_Test_CT {
83 f_init_vty();
84 f_init_ns_codec(mp_nsconfig[0], guard_secs := 10.0);
85 g_handle_rx_alive := true;
86
87 f_outgoing_sns_size();
88 f_outgoing_sns_config();
89 f_incoming_sns_config();
90 setverdict(pass);
91}
92
93/* perform full SNS handshake and then outbound NS-ALIVE */
94testcase TC_SNS_and_alive() runs on RAW_Test_CT {
95 f_init_vty();
96 f_init_ns_codec(mp_nsconfig[0], guard_secs := 120.0);
97 g_handle_rx_alive := true;
98
99 f_outgoing_sns_size();
100 f_outgoing_sns_config();
101 f_incoming_sns_config();
102 f_outgoing_ns_alive();
103 setverdict(pass);
104}
105
Alexander Couzens8e1dfd02020-09-07 04:26:20 +0200106control {
Harald Welte424ec522021-03-23 18:20:12 +0100107
108 if (mp_nsconfig[0].handle_sns) {
109 execute( TC_SNS_size() );
110 execute( TC_SNS_size_too_big() );
111 execute( TC_SNS_config_bss() );
112 execute( TC_SNS_config_sgsn() );
113 execute( TC_SNS_and_alive() );
114 } else {
115 execute( TC_NS_connect_alive() );
116 execute( TC_NS_connect_reset() );
117 }
Alexander Couzens8e1dfd02020-09-07 04:26:20 +0200118}
119
120}