blob: dc4cd82cb2fbf6e90c8333d7793980d63e937250 [file] [log] [blame]
Pau Espin Pedrol8dd59fb2020-04-29 15:08:16 +02001module PCU_Tests_SNS {
Harald Weltef7b74072019-02-20 20:48:50 +01002
Harald Welte34b5a952019-05-27 11:54:11 +02003/* Osmocom PCU test suite for IP Sub-Network-Service (SNS) in TTCN-3
4 * (C) 2018-2019 Harald Welte <laforge@gnumonks.org>
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
Harald Weltef7b74072019-02-20 20:48:50 +010013import from Osmocom_Types all;
Pau Espin Pedrol8dd59fb2020-04-29 15:08:16 +020014import from PCU_Tests_NS all;
Pau Espin Pedrol0e6ed2e2020-04-29 14:33:13 +020015import from SGSN_Components all;
Harald Weltec4d7beb2019-02-21 18:21:01 +010016import from Osmocom_Gb_Types all;
17import from NS_CodecPort all;
18import from NS_Types all;
Alexander Couzens3c268da2020-09-07 04:25:05 +020019import from RAW_NS all;
Harald Weltef7b74072019-02-20 20:48:50 +010020
21/**********************************************************************************
22 * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS)
23 **********************************************************************************/
24
Harald Weltec4d7beb2019-02-21 18:21:01 +010025/* perform inbound SNS-SIZE procedure */
Harald Weltebf768242019-02-21 22:19:21 +010026function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx := 0)
27runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010028 log("f_incoming_sns_size(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010029 var PDU_NS rx;
30 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010031 rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
32 num_v4 := 4, num_v6 := omit), idx);
33 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause)));
Harald Weltec4d7beb2019-02-21 18:21:01 +010034}
35
36/* perform outbound SNS-SIZE procedure */
Harald Weltebf768242019-02-21 22:19:21 +010037function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:= 0)
38runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010039 log("f_outgoing_sns_size(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010040 var PDU_NS rx;
Harald Weltebf768242019-02-21 22:19:21 +010041 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 1,
Harald Weltec4d7beb2019-02-21 18:21:01 +010042 num_v4 := 1, num_v6 := omit)
43 ));
44 /* expect one single SNS-SIZE with RESET flag; one remote v4 EP; no v6 EP */
Harald Weltebf768242019-02-21 22:19:21 +010045 rx := f_ns_exp(tr_SNS_SIZE_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010046}
47
48/* perform inbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010049function f_incoming_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
50runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010051 log("f_incoming_sns_config(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010052 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +020053 var template IP4_Elements v4_elem := { tr_SNS_IPv4(mp_nsconfig.provider.ip.remote_ip,
54 mp_nsconfig.provider.ip.remote_udp_port) };
Harald Welte7e6a35c2019-03-16 18:36:08 +010055 rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := v4_elem), idx);
Harald Weltebf768242019-02-21 22:19:21 +010056 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause)));
Harald Weltec4d7beb2019-02-21 18:21:01 +010057}
58
59/* perform outbound SNS-CONFIG procedure */
Harald Weltebf768242019-02-21 22:19:21 +010060function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer idx := 0)
61runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010062 log("f_outgoing_sns_config(idx=", idx, ")");
Harald Weltec4d7beb2019-02-21 18:21:01 +010063 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +020064 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].provider.ip.local_ip,
65 g_nsconfig[idx].provider.ip.local_udp_port) }
Harald Weltebf768242019-02-21 22:19:21 +010066 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
67 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
Harald Weltec4d7beb2019-02-21 18:21:01 +010068}
69
Harald Weltebf768242019-02-21 22:19:21 +010070/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
71function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integer idx := 0)
72runs on RAW_NS_CT {
Harald Welteb63c3a12019-02-22 23:27:12 +010073 log("f_outgoing_sns_config_1c1u(idx=", idx, ")");
Harald Weltebf768242019-02-21 22:19:21 +010074 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +020075 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].provider.ip.local_ip,
76 g_nsconfig[0].provider.ip.local_udp_port, 1, 0),
77 ts_SNS_IPv4(g_nsconfig[1].provider.ip.local_ip,
78 g_nsconfig[1].provider.ip.local_udp_port, 0, 1) };
Harald Weltebf768242019-02-21 22:19:21 +010079 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
80 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
81}
82
Harald Welteecd159e2019-03-16 13:36:07 +010083/* perform outbound SNS-CONFIG procedure (separate endpoints: 1 for control, 1 for user */
84function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := omit, integer idx := 0)
85runs on RAW_NS_CT {
86 log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
87 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +020088 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[1].provider.ip.local_ip,
89 g_nsconfig[1].provider.ip.local_udp_port, 1, 0),
90 ts_SNS_IPv4(g_nsconfig[2].provider.ip.local_ip,
91 g_nsconfig[2].provider.ip.local_udp_port, 0, 1) };
Harald Welteecd159e2019-03-16 13:36:07 +010092 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
93 rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
94}
95
Harald Welte630d0e62019-02-22 23:26:40 +010096function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0)
97runs on RAW_NS_CT {
98 log("f_outgoing_sns_add(idx_add=", idx_add, ")");
99 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +0200100 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_add].provider.ip.local_ip,
101 g_nsconfig[idx_add].provider.ip.local_udp_port,
Harald Welte630d0e62019-02-22 23:26:40 +0100102 w_sig, w_user) };
103 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_ADD(g_nsconfig[idx].nsei, 23, v4)));
104 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 23, omit, v4));
105}
106
107function f_outgoing_sns_del(integer idx_del, uint8_t w_sig := 1, uint8_t w_user := 1, integer idx := 0)
108runs on RAW_NS_CT {
109 log("f_outgoing_sns_del(idx_del=", idx_del, ")");
110 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +0200111 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_del].provider.ip.local_ip,
112 g_nsconfig[idx_del].provider.ip.local_udp_port,
Harald Welte630d0e62019-02-22 23:26:40 +0100113 w_sig, w_user) };
114 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_DEL(g_nsconfig[idx].nsei, 24, omit, v4)));
115 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, v4));
116}
117
Harald Welte72099552019-02-23 15:09:22 +0100118function f_outgoing_sns_chg_weight(integer idx_chg, uint8_t w_sig, uint8_t w_user, integer idx := 0)
119runs on RAW_NS_CT {
120 log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")");
121 var PDU_NS rx;
Harald Welte5e8573e2020-09-13 15:32:56 +0200122 var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_chg].provider.ip.local_ip,
123 g_nsconfig[idx_chg].provider.ip.local_udp_port,
Harald Welte72099552019-02-23 15:09:22 +0100124 w_sig, w_user) };
125 NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, v4)));
126 rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, v4));
127}
128
129
130
Harald Welte630d0e62019-02-22 23:26:40 +0100131
Harald Weltebf768242019-02-21 22:19:21 +0100132
Harald Weltef7b74072019-02-20 20:48:50 +0100133/* PCU-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +0100134testcase TC_sns_po_size_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +0200135 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +0100136 f_init_pcuif();
137 f_incoming_sns_size();
138 f_sleep(1.0);
139 setverdict(pass);
140}
141
142/* PCU-originated SNS-SIZE: NACK from our side */
Harald Welteea3c7e92019-03-01 19:34:55 +0100143testcase TC_sns_po_size_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +0200144 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +0100145 f_init_pcuif();
146 f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
147 /* FIXME: ensure we don't get a SNS-CONFIG */
148 /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
149 f_sleep(10.0);
150 setverdict(pass);
151}
152
153/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +0100154testcase TC_sns_po_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +0200155 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +0100156 f_init_pcuif();
157 f_incoming_sns_size();
158 f_incoming_sns_config();
159 f_sleep(1.0);
160 setverdict(pass);
161}
162
163/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +0100164testcase TC_sns_po_config_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +0200165 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +0100166 f_init_pcuif();
167 f_incoming_sns_size();
168 f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
169 /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
170 f_sleep(10.0);
171 setverdict(pass);
172}
173
174
175/* SGSN-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +0100176testcase TC_sns_so_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +0200177 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +0100178 f_init_pcuif();
179 f_incoming_sns_size();
180 f_incoming_sns_config();
181 f_outgoing_sns_config();
182
183 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
184 as_rx_alive_tx_ack(oneshot := true);
185 activate(as_rx_alive_tx_ack());
186
187 f_outgoing_ns_alive();
188
189 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
Harald Welte5339b2e2020-10-04 22:52:56 +0200190 as_rx_bvc_reset_tx_ack(0, mp_gb_cfg.bvc[0].cell_id, oneshot := true);
191 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, oneshot := true);
192 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Weltef7b74072019-02-20 20:48:50 +0100193
194 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
Harald Welte5339b2e2020-10-04 22:52:56 +0200195 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
196 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci));
Harald Weltef7b74072019-02-20 20:48:50 +0100197 setverdict(pass);
198}
199
Harald Welte64d07312019-03-20 09:48:39 +0100200private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100201 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200202 f_init_ns_codec(mp_nsconfig);
203 f_init_ns_codec(mp_nsconfig, 1);
Harald Welte630d0e62019-02-22 23:26:40 +0100204 f_init_pcuif();
205 /* Perform Size + BSS-originated config */
206 f_incoming_sns_size();
207 f_incoming_sns_config();
208 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
209 f_outgoing_sns_config_1c1u();
210
211 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
212 * for both NS-VCs */
213 as_rx_alive_tx_ack(oneshot := true, idx := 0);
214 activate(as_rx_alive_tx_ack(idx := 0));
215 as_rx_alive_tx_ack(oneshot := true, idx := 1);
216 activate(as_rx_alive_tx_ack(idx := 1));
217
218 /* perform outgoing ALIVE procedure for both NS-VCs */
219 f_outgoing_ns_alive(0);
220 f_outgoing_ns_alive(1);
221
Harald Welte64d07312019-03-20 09:48:39 +0100222 if (sgsn_originated_reset) {
Harald Welte5339b2e2020-10-04 22:52:56 +0200223 f_tx_bvc_reset_rx_ack(0, mp_gb_cfg.bvc[0].cell_id);
224 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id);
Harald Welte64d07312019-03-20 09:48:39 +0100225 } else {
226 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
Harald Welte5339b2e2020-10-04 22:52:56 +0200227 as_rx_bvc_reset_tx_ack(0, mp_gb_cfg.bvc[0].cell_id, oneshot := true);
228 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, oneshot := true);
Harald Welte64d07312019-03-20 09:48:39 +0100229 }
Harald Welte630d0e62019-02-22 23:26:40 +0100230 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200231 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Welte630d0e62019-02-22 23:26:40 +0100232
233 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
234 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200235 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
236 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 1));
Harald Welte630d0e62019-02-22 23:26:40 +0100237}
238
239/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only */
Harald Welteea3c7e92019-03-01 19:34:55 +0100240testcase TC_sns_1c1u() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100241 f_sns_bringup_1c1u();
242 setverdict(pass);
243}
244
Harald Welte64d07312019-03-20 09:48:39 +0100245private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welteecd159e2019-03-16 13:36:07 +0100246 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200247 f_init_ns_codec(mp_nsconfig);
248 f_init_ns_codec(mp_nsconfig, 1);
249 f_init_ns_codec(mp_nsconfig, 2);
Harald Welteecd159e2019-03-16 13:36:07 +0100250 f_init_pcuif();
251 /* Perform Size + BSS-originated config */
252 f_incoming_sns_size();
253 f_incoming_sns_config();
254 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
255 f_outgoing_sns_config_1c1u_separate();
256
257 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
258 * for both NS-VCs */
259 as_rx_alive_tx_ack(oneshot := true, idx := 1);
260 activate(as_rx_alive_tx_ack(idx := 1));
261 as_rx_alive_tx_ack(oneshot := true, idx := 2);
262 activate(as_rx_alive_tx_ack(idx := 2));
263 /* ensure there's no NS-ALIVE received on idx==0 */
264 f_ensure_no_ns(t_NS_ALIVE, idx := 0);
265
266 /* perform outgoing ALIVE procedure for both NS-VCs */
267 f_outgoing_ns_alive(1);
268 f_outgoing_ns_alive(2);
269 /* ensure there's no response to NS-ALIVE sent on idx==0 */
270 f_outgoing_ns_alive_no_ack(idx := 0);
271
Harald Welte64d07312019-03-20 09:48:39 +0100272 if (sgsn_originated_reset) {
Harald Welte5339b2e2020-10-04 22:52:56 +0200273 f_tx_bvc_reset_rx_ack(0, mp_gb_cfg.bvc[0].cell_id, idx := 1);
274 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, idx := 1);
Harald Welte64d07312019-03-20 09:48:39 +0100275 } else {
276 /* Expect BVC-RESET for signaling BVCI=0 and ptp BVCI */
Harald Welte5339b2e2020-10-04 22:52:56 +0200277 as_rx_bvc_reset_tx_ack(0, mp_gb_cfg.bvc[0].cell_id, oneshot := true, idx := 1);
278 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, oneshot := true, idx := 1);
Harald Welte64d07312019-03-20 09:48:39 +0100279 }
Harald Welteecd159e2019-03-16 13:36:07 +0100280 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200281 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
Harald Welteecd159e2019-03-16 13:36:07 +0100282
283 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
284 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200285 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 2);
286 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 2));
Harald Welteecd159e2019-03-16 13:36:07 +0100287}
288
289/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only - and where
290 * the initial IP/port for the SNS procedure is *not* part of the NS-VCs later */
291testcase TC_sns_1c1u_separate() runs on RAW_Test_CT {
292 f_sns_bringup_1c1u_separate();
293 setverdict(pass);
294}
295
Harald Welte64d07312019-03-20 09:48:39 +0100296/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use
297 * SGSN-originated BVC-RESET rather than BSS-originated */
298testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT {
299 f_sns_bringup_1c1u_separate(sgsn_originated_reset := true);
300 setverdict(pass);
301}
302
303/* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */
304testcase TC_sns_1c1u_so_bvc_reset_too_early() runs on RAW_Test_CT {
305 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200306 f_init_ns_codec(mp_nsconfig);
307 f_init_ns_codec(mp_nsconfig, 1);
308 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte64d07312019-03-20 09:48:39 +0100309 f_init_pcuif();
310 /* Perform Size + BSS-originated config */
311 f_incoming_sns_size();
312 f_incoming_sns_config();
313 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
314 f_outgoing_sns_config_1c1u_separate();
315
316 /* DON'T ACK ANY INBOUND NS-ALIVE HERE! */
317
318 /* perform outgoing ALIVE procedure for both NS-VCs */
319 f_outgoing_ns_alive(1);
320 f_outgoing_ns_alive(2);
321 /* ensure there's no response to NS-ALIVE sent on idx==0 */
322 f_outgoing_ns_alive_no_ack(idx := 0);
323
324 /* Transmit BVC-RESET and expect no ACK*/
Harald Welte5339b2e2020-10-04 22:52:56 +0200325 f_tx_bvc_reset_rx_ack(0, mp_gb_cfg.bvc[0].cell_id, idx := 1, exp_ack := false);
326 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, idx := 1, exp_ack := false);
Harald Welte64d07312019-03-20 09:48:39 +0100327}
328
Harald Welte630d0e62019-02-22 23:26:40 +0100329/* Test adding new IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100330testcase TC_sns_add() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100331 f_sns_bringup_1c1u();
332
333 /* crate another NS codec port on the tester side */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200334 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte630d0e62019-02-22 23:26:40 +0100335
336 f_outgoing_sns_add(idx_add := 2, w_sig := 0, w_user := 1, idx := 0);
337
338 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
339 as_rx_alive_tx_ack(oneshot := true, idx := 2);
340 activate(as_rx_alive_tx_ack(idx := 2));
341
342 f_outgoing_ns_alive(2);
343 /* TODO: Should we expect FLOW-CONTROL BVC here too? */
344 setverdict(pass);
345}
346
347/* Test deleting IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100348testcase TC_sns_del() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100349 f_sns_bringup_1c1u();
350
351 f_outgoing_sns_del(idx_del := 1, w_sig := 0, w_user := 1, idx := 0);
352 /* FIXME: ensure we don't receive anything on just-deleted NS-VC anymore */
353 setverdict(pass);
354}
355
Harald Welte72099552019-02-23 15:09:22 +0100356/* Test changing weights at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100357testcase TC_sns_chg_weight() runs on RAW_Test_CT {
Harald Welte72099552019-02-23 15:09:22 +0100358 f_sns_bringup_1c1u();
359
360 /* change w_user from 1 to 200 */
361 f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0);
362 setverdict(pass);
363}
364
Harald Welte16e92f42019-03-02 00:03:44 +0100365import from PCUIF_Types all;
366import from PCUIF_CodecPort all;
367
Harald Welte3b335832019-03-15 22:38:06 +0100368altstep as_pcu_activate() runs on RAW_PCU_CT {
369 var PCUIF_send_data sd;
370 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ACT_REQ(?, ?, ?))) -> value sd { repeat; }
371
372}
373
Harald Welte16e92f42019-03-02 00:03:44 +0100374testcase TC_pcuif_rach() runs on RAW_Test_CT {
375 f_sns_bringup_1c1u();
Harald Welte3b335832019-03-15 22:38:06 +0100376 activate(as_pcu_activate());
Harald Welte16e92f42019-03-02 00:03:44 +0100377
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700378 f_pcuif_tx(ts_PCUIF_RACH_IND(bts_nr:=0, trx_nr:=0, ts_nr:=0, ra:=23,
379 is_11bit:=0, burst_type:=BURST_TYPE_0,
Harald Welte16e92f42019-03-02 00:03:44 +0100380 fn:=42, arfcn:=871, qta:=0));
381 PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
382 tr_PCUIF_DATA_REQ(bts_nr:=0, trx_nr:=0, ts_nr:=0, block_nr:=?, fn:=?,
383 sapi:=PCU_IF_SAPI_AGCH, data:=?)));
384 setverdict(pass);
385}
386
Harald Welte630d0e62019-02-22 23:26:40 +0100387
388
Harald Weltef7b74072019-02-20 20:48:50 +0100389control {
390 execute( TC_sns_po_size_success() );
391 execute( TC_sns_po_size_nack() );
392 execute( TC_sns_po_config_success() );
393 execute( TC_sns_po_config_nack() );
394 execute( TC_sns_so_config_success() );
Harald Welte630d0e62019-02-22 23:26:40 +0100395 execute( TC_sns_1c1u() );
Harald Welteecd159e2019-03-16 13:36:07 +0100396 execute( TC_sns_1c1u_separate() );
Harald Welte64d07312019-03-20 09:48:39 +0100397 execute( TC_sns_1c1u_so_bvc_reset() );
398 execute( TC_sns_1c1u_so_bvc_reset_too_early() );
Harald Welte630d0e62019-02-22 23:26:40 +0100399 execute( TC_sns_add() );
400 execute( TC_sns_del() );
Harald Welte72099552019-02-23 15:09:22 +0100401 execute( TC_sns_chg_weight() );
Harald Welte16e92f42019-03-02 00:03:44 +0100402
403 execute( TC_pcuif_rach() );
Harald Weltef7b74072019-02-20 20:48:50 +0100404}
405
406}