blob: 1c81d98a3395305e7d6b03c85e680cad5e9d6b3c [file] [log] [blame]
Harald Welte9adf57b2020-01-10 12:33:44 +01001/* (C) 2019 by Harald Welte <laforge@gnumonks.org>
2 * All Rights Reserved
3 *
4 * The idea is that these tests are executed against sccp_demo_user from
5 * libosmo-sccp.git in server mode.
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
13module SCCP_Tests_RAW {
14
15import from General_Types all;
16import from Osmocom_Types all;
17
18import from M3UA_Emulation all;
19
20import from SCCP_Types all;
21import from SCCPasp_Types all;
22import from SCCP_Templates all;
23import from SCCP_Emulation all;
24import from SCCP_CodecPort all;
25
26import from TELNETasp_PortType all;
27import from Osmocom_VTY_Functions all;
28
29import from SCCP_Tests all;
30
31type component SCCP_Test_RAW_CT {
32 /* VTY to sccp_demo_user (not used yet) */
33 port TELNETasp_PT SCCP_DEMO_USER_VTY;
34
35 /* SCCP raw port runs on top of M3UA Emulation.
36 * "System Under Test" is libosmo-sccp's sccp_demo_user example program. */
37 var M3UA_CT vc_M3UA;
38 port SCCP_CODEC_PT MTP3;
39
40 var MSC_SCCP_MTP3_parameters g_param;
Pau Espin Pedrola2473da2020-01-20 13:20:58 +010041
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +010042 var OCT3 g_own_lref := '000001'O
43
Pau Espin Pedrola2473da2020-01-20 13:20:58 +010044 /*Configure T(tias) over VTY, seconds */
45 var integer g_demo_sccp_timer_ias := 7 * 60;
46 /*Configure T(tiar) over VTY, seconds */
47 var integer g_demo_sccp_timer_iar := 15 * 60;
48}
49
50type record of charstring Commands;
51private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {})
52{
53 f_vty_enter_cfg_cs7_inst(pt, 0);
54 for (var integer i := 0; i < sizeof(cmds); i := i+1) {
55 f_vty_transceive(pt, cmds[i]);
56 }
57 f_vty_transceive(pt, "end");
58}
59
60function f_init_vty() runs on SCCP_Test_RAW_CT {
61 if (SCCP_DEMO_USER_VTY.checkstate("Mapped")) {
62 /* skip initialization if already executed once */
63 return;
64 }
65 map(self:SCCP_DEMO_USER_VTY, system:SCCP_DEMO_USER_VTY);
66 f_vty_set_prompts(SCCP_DEMO_USER_VTY);
67 f_vty_transceive(SCCP_DEMO_USER_VTY, "enable");
68 f_cs7_inst_0_cfg(SCCP_DEMO_USER_VTY, {"sccp-timer ias " & int2str(g_demo_sccp_timer_ias),
69 "sccp-timer iar " & int2str(g_demo_sccp_timer_iar)});
Harald Welte9adf57b2020-01-10 12:33:44 +010070}
71
72private function f_init_raw(SCCP_Configuration cfg) runs on SCCP_Test_RAW_CT {
73 g_param := {
74 sio := {
75 ni := substr(oct2bit(cfg.sio),0,2),
76 prio := substr(oct2bit(cfg.sio),2,2),
77 si := substr(oct2bit(cfg.sio),4,4)
78 },
79 opc := cfg.own_pc,
80 dpc := cfg.peer_pc,
81 sls := 0,
82 sccp_serviceType := cfg.sccp_service_type,
83 ssn := cfg.own_ssn
84 };
85
Pau Espin Pedrola2473da2020-01-20 13:20:58 +010086 f_init_vty();
Harald Welte9adf57b2020-01-10 12:33:44 +010087
88 /* Create and connect test components */
89 vc_M3UA := M3UA_CT.create;
90 connect(self:MTP3, vc_M3UA:MTP3_SP_PORT);
91 map(vc_M3UA:SCTP_PORT, system:sctp);
92
93 vc_M3UA.start(f_M3UA_Emulation(cfg.sctp_addr));
94}
95
96private function f_cleanup() runs on SCCP_Test_RAW_CT {
97 all component.stop;
98 unmap(vc_M3UA:SCTP_PORT, system:sctp);
99 disconnect(vc_M3UA:MTP3_SP_PORT, self:MTP3);
100 self.stop
101}
102
Harald Welte9adf57b2020-01-10 12:33:44 +0100103private function f_send_sccp(template PDU_SCCP sccp) runs on SCCP_Test_RAW_CT {
104 var SCCP_MTP3_TRANSFERreq tx := {
105 sio := g_param.sio,
106 opc := g_param.opc,
107 dpc := g_param.dpc,
108 sls := g_param.sls,
109 data := valueof(sccp)
110 };
111 MTP3.send(tx);
112}
113
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100114private function tr_SCCP_MTP3_TRANSFERind(template PDU_SCCP sccp)
115runs on SCCP_Test_RAW_CT return template SCCP_MTP3_TRANSFERind {
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100116
Harald Welte9adf57b2020-01-10 12:33:44 +0100117 var template SCCP_MTP3_TRANSFERind exp := {
118 sio := g_param.sio,
119 opc := g_param.dpc,
120 dpc := g_param.opc,
121 sls := g_param.sls,
122 data := sccp
123 };
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100124 return exp;
125}
126
127private function f_exp_sccp(template PDU_SCCP sccp)
128runs on SCCP_Test_RAW_CT return SCCP_MTP3_TRANSFERind {
129 var template SCCP_MTP3_TRANSFERind exp := tr_SCCP_MTP3_TRANSFERind(sccp);
130 var SCCP_MTP3_TRANSFERind rx;
Harald Welte9adf57b2020-01-10 12:33:44 +0100131 timer T := 10.0;
132 T.start;
133 alt {
134 [] MTP3.receive(exp) -> value rx {
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100135 return rx;
Harald Welte9adf57b2020-01-10 12:33:44 +0100136 }
137 [] MTP3.receive {
138 setverdict(fail, "Unexpected MTP/SCCP received");
Pau Espin Pedrol94b7a682020-01-20 19:30:07 +0100139 self.stop
Harald Welte9adf57b2020-01-10 12:33:44 +0100140 }
141 [] T.timeout {
142 setverdict(fail, "Timeout waiting for ", exp);
Pau Espin Pedrol94b7a682020-01-20 19:30:07 +0100143 self.stop
Harald Welte9adf57b2020-01-10 12:33:44 +0100144 }
145 }
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100146 return rx;
Harald Welte9adf57b2020-01-10 12:33:44 +0100147}
148
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100149private function f_establish_conn(SCCP_PAR_Address calling, SCCP_PAR_Address called)
150runs on SCCP_Test_RAW_CT return OCT3 {
151 var SCCP_MTP3_TRANSFERind mtp3_rx;
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100152
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100153 f_send_sccp(ts_SCCP_CR(g_own_lref, calling, called));
154 mtp3_rx := f_exp_sccp(tr_SCCP_CC(?, g_own_lref));
155
156 return mtp3_rx.data.connconfirm.sourceLocRef;
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100157}
158
159private function f_tx_udt_exp(SCCP_PAR_Address calling, SCCP_PAR_Address called, octetstring data) runs on SCCP_Test_RAW_CT {
160
161 f_send_sccp(ts_SCCP_UDT(calling, called, data));
162 f_exp_sccp(tr_SCCP_UDT(called, calling, data));
163}
164
Harald Welte9adf57b2020-01-10 12:33:44 +0100165/* Verify sccp_demo_user answers a CR with a CC for PC and SSN set up to echo back */
166testcase TC_cr_cc() runs on SCCP_Test_RAW_CT {
167 var SCCP_PAR_Address calling, called;
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100168
169 f_init_raw(mp_sccp_cfg[0]);
170 f_sleep(1.0);
171
Pau Espin Pedrole1870912020-01-17 17:30:19 +0100172 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
173 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
174 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
175 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100176 f_establish_conn(calling, called);
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100177 setverdict(pass);
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100178}
179
Pau Espin Pedrol1269b1b2020-01-21 12:58:48 +0100180/* Verify sccp_demo_user inactivty timers are not armed upon dealing with
Alexander Couzens3b2b32e2022-11-22 12:55:05 +0000181 * connectionless data-unit messages. Since no connection exists. */
Pau Espin Pedrolf7ba2342020-01-20 20:19:47 +0100182testcase TC_udt_without_cr_cc() runs on SCCP_Test_RAW_CT {
183 var SCCP_PAR_Address calling, called;
Pau Espin Pedrol1269b1b2020-01-21 12:58:48 +0100184 var SCCP_MTP3_TRANSFERind rx;
Harald Welte67881ae2022-04-12 22:52:47 +0200185 var octetstring data := f_rnd_octstring_rnd_len(100);
Pau Espin Pedrolf7ba2342020-01-20 20:19:47 +0100186
Pau Espin Pedrol1269b1b2020-01-21 12:58:48 +0100187 /* Keep recommended ratio of T(iar) >= T(ias)*2, but anyway no IT
188 should be received in this case. */
189 g_demo_sccp_timer_ias := 1;
190 g_demo_sccp_timer_iar := 3;
Pau Espin Pedrolf7ba2342020-01-20 20:19:47 +0100191 f_init_raw(mp_sccp_cfg[0]);
192 f_sleep(1.0);
193
194 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
195 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
196 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
197 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
198
199 f_tx_udt_exp(calling, called, data);
Pau Espin Pedrol1269b1b2020-01-21 12:58:48 +0100200
201 /* Make sure no SCCP message is received at all, since no connection is active. */
202 timer T := int2float(g_demo_sccp_timer_iar + 1);
203 T.start;
204 alt {
205 [] MTP3.receive {
206 setverdict(fail, "Unexpected MTP/SCCP received");
207 self.stop;
208 }
209 [] T.timeout {}
210 }
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100211 setverdict(pass);
Pau Espin Pedrolf7ba2342020-01-20 20:19:47 +0100212}
213
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100214/* Verify T(iar) triggers and releases the channel */
215testcase TC_tiar_timeout() runs on SCCP_Test_RAW_CT {
216 var SCCP_PAR_Address calling, called;
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100217 var OCT3 remote_lref;
Harald Welte67881ae2022-04-12 22:52:47 +0200218 var octetstring data := f_rnd_octstring_rnd_len(100);
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100219
220 /* Set T(iar) in sccp_demo_user low enough that it will trigger before other side
221 has time to keep alive with a T(ias). Keep recommended ratio of
222 T(iar) >= T(ias)*2 */
223 g_demo_sccp_timer_ias := 2;
224 g_demo_sccp_timer_iar := 5;
Pau Espin Pedrole1870912020-01-17 17:30:19 +0100225 f_init_raw(mp_sccp_cfg[0]);
Harald Welte9adf57b2020-01-10 12:33:44 +0100226 f_sleep(1.0);
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100227
228 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
229 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
230 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
231 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100232 remote_lref := f_establish_conn(calling, called);
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100233 f_tx_udt_exp(calling, called, data);
234
235 log("Waiting for first IT");
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100236 f_exp_sccp(tr_SCCP_IT(remote_lref, g_own_lref));
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100237 log("Waiting for second IT");
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100238 f_exp_sccp(tr_SCCP_IT(remote_lref, g_own_lref));
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100239
240 log("Waiting for RLSD");
Pau Espin Pedrol392eaf32020-01-21 12:21:05 +0100241 f_exp_sccp(tr_SCCP_RLSD(remote_lref, g_own_lref, hex2int('0D'H))); /* Cause: Expiration of Rx Inactivity Timer */
242 f_send_sccp(ts_SCCP_RLC(g_own_lref, remote_lref));
243 setverdict(pass);
Harald Welte9adf57b2020-01-10 12:33:44 +0100244}
245
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100246/* Verify T(iar) triggers and releases the channel */
247testcase TC_it_avoids_tiar() runs on SCCP_Test_RAW_CT {
248 var SCCP_PAR_Address calling, called;
249 var OCT3 remote_lref;
250 var boolean it_received := false;
Alexander Couzens9e8e96f2022-11-22 15:52:18 +0000251 var SCCP_MTP3_TRANSFERind rx;
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100252
253 g_demo_sccp_timer_ias := 1;
254 g_demo_sccp_timer_iar := 3;
255 f_init_raw(mp_sccp_cfg[0]);
256 f_sleep(1.0);
257
258 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
259 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
260 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
261 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
262 remote_lref := f_establish_conn(calling, called);
263
264 timer T_total := 7.0; /* Higher than g_demo_sccp_timer_iar */
265 timer T_tias := 1.0; /* Lower than g_demo_sccp_timer_iar */
266 T_total.start;
267 T_tias.start;
268 alt {
269 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_IT(remote_lref, g_own_lref))) {
270 it_received := true;
271 repeat;
272 }
273 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_RLSD(remote_lref, g_own_lref, hex2int('0D'H)))) {
274 setverdict(fail, "Unexpected SCCP RLSD received");
275 self.stop;
276 }
Alexander Couzens9e8e96f2022-11-22 15:52:18 +0000277 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(*)) -> value rx {
278 setverdict(fail, "Unexpected MTP/SCCP TRANSFERind received: ", rx);
279 self.stop;
280 }
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100281 [] MTP3.receive {
282 setverdict(fail, "Unexpected MTP/SCCP received");
283 self.stop;
284 }
285 [] T_tias.timeout {
286 f_send_sccp(ts_SCCP_IT(g_own_lref, remote_lref));
287 T_tias.start;
288 repeat;
289 }
290 [] T_total.timeout {
291 /* We kept the connection alive only with IT messages for a while, cool! */
292 T_tias.stop;
293 setverdict(pass);
294 }
295 }
296
297 if (not it_received) {
298 setverdict(fail, "Didn't receive any IT (Tias) from peer");
299 }
300
301 /* After we stop sending IT, we should be receiving an RLSD triggered from T(iar) */
302 log("Waiting for RLSD");
303 alt {
304 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_IT(remote_lref, g_own_lref))) {
305 repeat;
306 }
307 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_RLSD(remote_lref, g_own_lref, hex2int('0D'H)))) {
308 f_send_sccp(ts_SCCP_RLC(g_own_lref, remote_lref));
309 setverdict(pass);
310 }
311 [] MTP3.receive {
312 setverdict(fail, "Unexpected MTP/SCCP received");
313 self.stop;
314 }
315 }
316}
317
Harald Welte4038d4c2021-10-26 14:37:54 +0200318private function f_tx_xudt_exp(SCCP_PAR_Address calling, SCCP_PAR_Address called, octetstring data) runs on SCCP_Test_RAW_CT {
319 var template PDU_SCCP exp_rx;
320 f_send_sccp(ts_SCCP_XUDT(calling, called, data));
321 exp_rx := (tr_SCCP_UDT(called, calling, data), tr_SCCP_XUDT(called, calling, data));
322 f_exp_sccp(exp_rx);
323}
324
325/* Test if the IUT SCCP code processes an XUDT [treat it like UDT] and answers back. */
326testcase TC_process_rx_xudt() runs on SCCP_Test_RAW_CT {
327 var SCCP_PAR_Address calling, called;
Harald Welte67881ae2022-04-12 22:52:47 +0200328 var octetstring data := f_rnd_octstring_rnd_len(100);
Harald Welte4038d4c2021-10-26 14:37:54 +0200329
330 f_init_raw(mp_sccp_cfg[0]);
331 f_sleep(1.0);
332
333 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
334 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
335 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
336 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
337
338 /* Make sure an XUDT is echoed back just like an UDT */
339 f_tx_xudt_exp(calling, called, data);
340 setverdict(pass);
341}
342
Pau Espin Pedrol0c613ab2023-09-19 14:39:34 +0200343private function f_tx_ludt_exp(SCCP_PAR_Address calling, SCCP_PAR_Address called, octetstring data) runs on SCCP_Test_RAW_CT {
344 var template PDU_SCCP exp_rx;
345 f_send_sccp(ts_SCCP_LUDT(calling, called, data));
346 exp_rx := tr_SCCP_LUDT(called, calling, data);
347 f_exp_sccp(exp_rx);
348}
349
350/* Test if the IUT SCCP code processes a LUDT [treat it like UDT] and answers back. */
351testcase TC_process_rx_ludt() runs on SCCP_Test_RAW_CT {
352 var SCCP_PAR_Address calling, called;
353 var octetstring data := f_rnd_octstring(1000);
354
355 f_init_raw(mp_sccp_cfg[0]);
356 f_sleep(1.0);
357
358 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, mp_sccp_cfg[0].peer_ssn,
359 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
360 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, mp_sccp_cfg[0].own_ssn,
361 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
362
363 /* Make sure an LUDT is echoed back just like an UDT */
364 f_tx_ludt_exp(calling, called, data);
365 setverdict(pass);
366}
367
Harald Welte24f921b2021-02-10 19:37:45 +0100368function f_scmg_xceive(SCCP_PAR_Address calling, SCCP_PAR_Address called,
369 template (value) PDU_SCMG_message tx,
Harald Welteaed9f942021-05-13 21:54:58 +0200370 template (omit) PDU_SCMG_message rx_exp,
371 boolean accept_other_called_resp := false) runs on SCCP_Test_RAW_CT
Harald Welte24f921b2021-02-10 19:37:45 +0100372{
373 var boolean exp_something := true;
Alexander Couzens9e8e96f2022-11-22 15:52:18 +0000374 var SCCP_MTP3_TRANSFERind rx;
Harald Welte24f921b2021-02-10 19:37:45 +0100375 timer T := 5.0;
376
377 if (istemplatekind(rx_exp, "omit")) {
378 exp_something := false;
379 }
380
381 MTP3.clear;
382 f_send_sccp(ts_SCCP_UDT(calling, called, enc_PDU_SCMG_message(valueof(tx))));
383 T.start;
384 alt {
385 [exp_something] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, decmatch rx_exp))) {
386 setverdict(pass);
387 }
Harald Welteaed9f942021-05-13 21:54:58 +0200388 [exp_something and accept_other_called_resp] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, ?, decmatch rx_exp))) {
389 setverdict(pass);
390 }
Alexander Couzens9e8e96f2022-11-22 15:52:18 +0000391 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(tr_SCCP_UDT(called, calling, ?))) -> value rx {
392 setverdict(fail, "Received unexpected SCCP/MTP3 TRANSFERind (specific): ", rx, " but waiting for (specific) ", rx_exp);
393 }
394 [] MTP3.receive(tr_SCCP_MTP3_TRANSFERind(*)) -> value rx {
395 setverdict(fail, "Received unexpected SCCP/MTP3 TRANSFERind (*): ", rx, " but waiting for ", rx_exp);
Harald Welte24f921b2021-02-10 19:37:45 +0100396 }
397 [] MTP3.receive {
398 setverdict(fail, "Received unexpected waiting for ", rx_exp);
399 }
400 [exp_something] T.timeout {
401 setverdict(fail, "Timeout waiting for ", rx_exp);
402 }
403 [not exp_something] T.timeout {
404 setverdict(pass);
405 }
406 }
407
408}
409
410/* Test is SST(SSN=1) returns SSA */
411testcase TC_scmg_sst_ssn1() runs on SCCP_Test_RAW_CT {
412 var SCCP_PAR_Address calling, called;
413 var template (value) PDU_SCMG_message tx;
414 var template (present) PDU_SCMG_message rx_exp;
415
416 f_init_raw(mp_sccp_cfg[0]);
417 f_sleep(1.0);
418
419 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
420 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
421 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
422 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
423
424 tx := ts_SCMG_SST(1, mp_sccp_cfg[0].peer_pc);
425 rx_exp := ts_SCMG_SSA(1, mp_sccp_cfg[0].peer_pc);
426 f_scmg_xceive(calling, called, tx, rx_exp);
427}
428
429/* Test is SST(SSN=valid) returns SSA */
430testcase TC_scmg_sst_ssn_valid() runs on SCCP_Test_RAW_CT {
431 var SCCP_PAR_Address calling, called;
432 var template (value) PDU_SCMG_message tx;
433 var template (present) PDU_SCMG_message rx_exp;
434
435 f_init_raw(mp_sccp_cfg[0]);
436 f_sleep(1.0);
437
438 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
439 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
440 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
441 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
442
443 tx := ts_SCMG_SST(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);
444 rx_exp := ts_SCMG_SSA(mp_sccp_cfg[0].peer_ssn, mp_sccp_cfg[0].peer_pc);
445 f_scmg_xceive(calling, called, tx, rx_exp);
446}
447
448
449/* Test is SST(SSN=invalid) returns nothing */
450testcase TC_scmg_sst_ssn_invalid() runs on SCCP_Test_RAW_CT {
451 var SCCP_PAR_Address calling, called;
452 var template (value) PDU_SCMG_message tx;
453 var template (omit) PDU_SCMG_message rx_exp;
454
455 f_init_raw(mp_sccp_cfg[0]);
456 f_sleep(1.0);
457
458 called := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].peer_pc, 1,
459 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
460 calling := valueof(ts_SccpAddr_PC_SSN(mp_sccp_cfg[0].own_pc, 1,
461 mp_sccp_cfg[0].sio, mp_sccp_cfg[0].sccp_service_type));
462
463 tx := ts_SCMG_SST(123, mp_sccp_cfg[0].peer_pc);
464 rx_exp := omit;
465 f_scmg_xceive(calling, called, tx, rx_exp);
466}
467
Harald Welteaed9f942021-05-13 21:54:58 +0200468/* Test CallingParty(only SSN) solicits response (OS#5146) */
469testcase TC_callingparty_ssn_only() runs on SCCP_Test_RAW_CT {
470 var SCCP_PAR_Address calling, called;
471 var template (value) PDU_SCMG_message tx;
472 var template (present) PDU_SCMG_message rx_exp;
473
474 f_init_raw(mp_sccp_cfg[0]);
475 f_sleep(1.0);
476
477 called := valueof(ts_SccpAddr_SSN(1));
478 calling := valueof(ts_SccpAddr_SSN(1));
479
480 tx := ts_SCMG_SST(1, mp_sccp_cfg[0].peer_pc);
481 rx_exp := ts_SCMG_SSA(1, mp_sccp_cfg[0].peer_pc);
482 f_scmg_xceive(calling, called, tx, rx_exp, accept_other_called_resp:=true);
483}
Harald Welte24f921b2021-02-10 19:37:45 +0100484
485
Harald Welte9adf57b2020-01-10 12:33:44 +0100486control {
487 execute( TC_cr_cc() );
Pau Espin Pedrolf7ba2342020-01-20 20:19:47 +0100488 execute( TC_udt_without_cr_cc() );
Pau Espin Pedrola2473da2020-01-20 13:20:58 +0100489 execute( TC_tiar_timeout() );
Pau Espin Pedrole30d5432020-01-21 13:47:32 +0100490 execute( TC_it_avoids_tiar() );
Harald Welte4038d4c2021-10-26 14:37:54 +0200491 execute( TC_process_rx_xudt() );
Pau Espin Pedrol0c613ab2023-09-19 14:39:34 +0200492 execute( TC_process_rx_ludt() );
Harald Welte24f921b2021-02-10 19:37:45 +0100493
494 execute( TC_scmg_sst_ssn1() );
495 execute( TC_scmg_sst_ssn_valid() );
496 execute( TC_scmg_sst_ssn_invalid() );
Harald Welteaed9f942021-05-13 21:54:58 +0200497
498 execute( TC_callingparty_ssn_only() );
Harald Welte9adf57b2020-01-10 12:33:44 +0100499}
500
501
502}