blob: b63b51e1318c2b754a7248985d1c250d54ecd2ae [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;
Harald Welte90f19742020-11-06 19:34:40 +010017import from NS_Emulation all;
Harald Weltec4d7beb2019-02-21 18:21:01 +010018import from NS_Types all;
Alexander Couzens3c268da2020-09-07 04:25:05 +020019import from RAW_NS all;
Alexander Couzens025bbc02021-02-22 03:00:28 +010020import from BSSGP_Types all;
Harald Weltef7b74072019-02-20 20:48:50 +010021
22/**********************************************************************************
23 * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS)
24 **********************************************************************************/
25
Harald Weltef7b74072019-02-20 20:48:50 +010026/* PCU-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010027testcase TC_sns_po_size_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020028 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010029 f_init_pcuif();
30 f_incoming_sns_size();
31 f_sleep(1.0);
32 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010033 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010034}
35
36/* PCU-originated SNS-SIZE: NACK from our side */
Harald Welteea3c7e92019-03-01 19:34:55 +010037testcase TC_sns_po_size_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020038 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010039 f_init_pcuif();
40 f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
41 /* FIXME: ensure we don't get a SNS-CONFIG */
42 /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
43 f_sleep(10.0);
44 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010045 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010046}
47
48/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010049testcase TC_sns_po_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020050 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010051 f_init_pcuif();
52 f_incoming_sns_size();
53 f_incoming_sns_config();
54 f_sleep(1.0);
55 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010056 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010057}
58
59/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010060testcase TC_sns_po_config_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020061 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010062 f_init_pcuif();
63 f_incoming_sns_size();
64 f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
65 /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
66 f_sleep(10.0);
67 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010068 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010069}
70
71
72/* SGSN-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010073testcase TC_sns_so_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020074 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010075 f_init_pcuif();
76 f_incoming_sns_size();
77 f_incoming_sns_config();
78 f_outgoing_sns_config();
79
80 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
81 as_rx_alive_tx_ack(oneshot := true);
82 activate(as_rx_alive_tx_ack());
83
84 f_outgoing_ns_alive();
85
86 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
Harald Weltee97e3af2020-10-09 14:56:54 +020087 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true);
88 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true);
Harald Welte5339b2e2020-10-04 22:52:56 +020089 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Weltef7b74072019-02-20 20:48:50 +010090
91 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
Harald Welte5339b2e2020-10-04 22:52:56 +020092 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
93 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci));
Harald Weltef7b74072019-02-20 20:48:50 +010094 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010095 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010096}
97
Harald Welte64d07312019-03-20 09:48:39 +010098private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +010099 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200100 f_init_ns_codec(mp_nsconfig);
101 f_init_ns_codec(mp_nsconfig, 1);
Harald Welte630d0e62019-02-22 23:26:40 +0100102 f_init_pcuif();
103 /* Perform Size + BSS-originated config */
104 f_incoming_sns_size();
105 f_incoming_sns_config();
106 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
107 f_outgoing_sns_config_1c1u();
108
109 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
110 * for both NS-VCs */
111 as_rx_alive_tx_ack(oneshot := true, idx := 0);
112 activate(as_rx_alive_tx_ack(idx := 0));
113 as_rx_alive_tx_ack(oneshot := true, idx := 1);
114 activate(as_rx_alive_tx_ack(idx := 1));
115
116 /* perform outgoing ALIVE procedure for both NS-VCs */
117 f_outgoing_ns_alive(0);
118 f_outgoing_ns_alive(1);
119
Harald Welte64d07312019-03-20 09:48:39 +0100120 if (sgsn_originated_reset) {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100121 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
122 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
123 f_ns_exp(pdu);
124 /* SGSN originated BVC-RESET on an uninitialized signalling BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200125 f_tx_bvc_reset_rx_ack(0, omit, omit);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100126
127 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
128 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
129 f_ns_exp(pdu);
130 /* SGSN originated BVC-RESET on an uninitialized PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200131 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id);
Harald Welte64d07312019-03-20 09:48:39 +0100132 } else {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100133 /* Expect BVC-RESET for signaling BVCI=0 */
Harald Weltee97e3af2020-10-09 14:56:54 +0200134 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100135 /* Expect BVC-RESET from the PCU on PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200136 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true);
Harald Welte64d07312019-03-20 09:48:39 +0100137 }
Harald Welte630d0e62019-02-22 23:26:40 +0100138 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200139 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Welte630d0e62019-02-22 23:26:40 +0100140
141 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
142 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200143 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
144 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 1));
Harald Welte630d0e62019-02-22 23:26:40 +0100145}
146
147/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only */
Harald Welteea3c7e92019-03-01 19:34:55 +0100148testcase TC_sns_1c1u() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100149 f_sns_bringup_1c1u();
150 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100151 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100152}
153
Harald Welte64d07312019-03-20 09:48:39 +0100154private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welteecd159e2019-03-16 13:36:07 +0100155 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200156 f_init_ns_codec(mp_nsconfig);
157 f_init_ns_codec(mp_nsconfig, 1);
158 f_init_ns_codec(mp_nsconfig, 2);
Harald Welteecd159e2019-03-16 13:36:07 +0100159 f_init_pcuif();
160 /* Perform Size + BSS-originated config */
161 f_incoming_sns_size();
162 f_incoming_sns_config();
163 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
164 f_outgoing_sns_config_1c1u_separate();
165
166 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
167 * for both NS-VCs */
168 as_rx_alive_tx_ack(oneshot := true, idx := 1);
169 activate(as_rx_alive_tx_ack(idx := 1));
170 as_rx_alive_tx_ack(oneshot := true, idx := 2);
171 activate(as_rx_alive_tx_ack(idx := 2));
172 /* ensure there's no NS-ALIVE received on idx==0 */
173 f_ensure_no_ns(t_NS_ALIVE, idx := 0);
174
175 /* perform outgoing ALIVE procedure for both NS-VCs */
176 f_outgoing_ns_alive(1);
177 f_outgoing_ns_alive(2);
178 /* ensure there's no response to NS-ALIVE sent on idx==0 */
179 f_outgoing_ns_alive_no_ack(idx := 0);
180
Harald Welte64d07312019-03-20 09:48:39 +0100181 if (sgsn_originated_reset) {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100182 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
183 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
184 f_ns_exp(pdu, idx := 1);
185 /* SGSN originated BVC-RESET on an uninitialized sign BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200186 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100187
188 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
189 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
190 f_ns_exp(pdu, idx := 1);
Harald Weltee97e3af2020-10-09 14:56:54 +0200191 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id, idx := 1);
Harald Welte64d07312019-03-20 09:48:39 +0100192 } else {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100193 /* Expect BVC-RESET for signaling BVCI=0 */
Harald Weltee97e3af2020-10-09 14:56:54 +0200194 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true, idx := 1);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100195 /* Expect BVC-RESET from the PCU on PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200196 as_rx_bvc_reset_tx_ack(mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id, omit, oneshot := true, idx := 1);
Harald Welte64d07312019-03-20 09:48:39 +0100197 }
Harald Welteecd159e2019-03-16 13:36:07 +0100198 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200199 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
Harald Welteecd159e2019-03-16 13:36:07 +0100200
201 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
202 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200203 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 2);
204 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 2));
Harald Welteecd159e2019-03-16 13:36:07 +0100205}
206
207/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only - and where
208 * the initial IP/port for the SNS procedure is *not* part of the NS-VCs later */
209testcase TC_sns_1c1u_separate() runs on RAW_Test_CT {
210 f_sns_bringup_1c1u_separate();
211 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100212 f_clean_ns_codec();
Harald Welteecd159e2019-03-16 13:36:07 +0100213}
214
Harald Welte64d07312019-03-20 09:48:39 +0100215/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use
216 * SGSN-originated BVC-RESET rather than BSS-originated */
217testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT {
218 f_sns_bringup_1c1u_separate(sgsn_originated_reset := true);
219 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100220 f_clean_ns_codec();
Harald Welte64d07312019-03-20 09:48:39 +0100221}
222
223/* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */
224testcase TC_sns_1c1u_so_bvc_reset_too_early() runs on RAW_Test_CT {
225 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200226 f_init_ns_codec(mp_nsconfig);
227 f_init_ns_codec(mp_nsconfig, 1);
228 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte64d07312019-03-20 09:48:39 +0100229 f_init_pcuif();
230 /* Perform Size + BSS-originated config */
231 f_incoming_sns_size();
232 f_incoming_sns_config();
233 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
234 f_outgoing_sns_config_1c1u_separate();
235
236 /* DON'T ACK ANY INBOUND NS-ALIVE HERE! */
237
238 /* perform outgoing ALIVE procedure for both NS-VCs */
239 f_outgoing_ns_alive(1);
240 f_outgoing_ns_alive(2);
241 /* ensure there's no response to NS-ALIVE sent on idx==0 */
242 f_outgoing_ns_alive_no_ack(idx := 0);
243
244 /* Transmit BVC-RESET and expect no ACK*/
Harald Weltee97e3af2020-10-09 14:56:54 +0200245 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1, exp_ack := false);
246 f_tx_bvc_reset_rx_ack(mp_gb_cfg.bvc[0].bvci, omit, mp_gb_cfg.bvc[0].cell_id, idx := 1, exp_ack := false);
Alexander Couzensc3165722021-01-11 02:51:45 +0100247 f_clean_ns_codec();
Harald Welte64d07312019-03-20 09:48:39 +0100248}
249
Alexander Couzens025bbc02021-02-22 03:00:28 +0100250/* Do an SGSN originated BSSGP-Reset of a not-configured BVCI.
251 *
252 * PCU -X SGSN: BVCI 0 BSSGP-RESET (ignores reset)
253 * PCU <- SGSN: BVCI 0 BSSGP-RESET
254 * PCU -> SGSN: BVCI 0 BSSGP-RESET-ACK (with cell information)
255 * PCU -X SGSN: BVCI 23 BSSGP-RESET (ignores reset, 23 is configured on PCU, 24 is not configured)
256 * PCU <- SGSN: BVCI 24 BSSGP-RESET (unconfigured BVCI)
257 * PCU -> SGSN: BVCI 24 BSSGP-STATUS Unknown BVCI
258 */
259testcase TC_sns_so_bvc_reset_unknown_bvci() runs on RAW_Test_CT {
260 f_init_ns_codec(mp_nsconfig);
261 f_init_pcuif();
262 f_incoming_sns_size();
263 f_incoming_sns_config();
264 f_outgoing_sns_config();
265
266 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
267 as_rx_alive_tx_ack(oneshot := true);
268 activate(as_rx_alive_tx_ack());
269
270 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
271 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
272 f_ns_exp(pdu, idx := 0);
273 /* SGSN originated BVC-RESET on an uninitialized sign BVC */
274 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 0);
275
276 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
277 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
278 f_ns_exp(pdu);
279
280 /* Send a BVC-RESET on the wrong BVC */
Harald Welte5a8540f2021-03-05 12:14:09 +0100281 var BssgpCellId cell_id := mp_gb_cfg.bvc[0].cell_id;
282 cell_id.cell_id := cell_id.cell_id + 1;
283 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS,
284 mp_gb_cfg.bvc[0].bvci + 1, cell_id));
Alexander Couzens025bbc02021-02-22 03:00:28 +0100285 NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
286 NSCP[0].receive(tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BSSGP_STATUS(mp_gb_cfg.bvc[0].bvci + 1, BSSGP_CAUSE_BVCI_UNKNOWN, *)));
287 setverdict(pass);
288
289 f_clean_ns_codec();
290}
291
Harald Welte630d0e62019-02-22 23:26:40 +0100292/* Test adding new IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100293testcase TC_sns_add() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100294 f_sns_bringup_1c1u();
295
Alexander Couzens2373afc2020-12-09 02:19:49 +0100296 /* create another NS codec port on the tester side */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200297 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte630d0e62019-02-22 23:26:40 +0100298
299 f_outgoing_sns_add(idx_add := 2, w_sig := 0, w_user := 1, idx := 0);
300
301 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
302 as_rx_alive_tx_ack(oneshot := true, idx := 2);
303 activate(as_rx_alive_tx_ack(idx := 2));
304
305 f_outgoing_ns_alive(2);
Harald Welte630d0e62019-02-22 23:26:40 +0100306 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100307 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100308}
309
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100310/* Test adding an already present IP endpoint at runtime */
311testcase TC_sns_add_nack() runs on RAW_Test_CT {
312 f_sns_bringup_1c1u();
313
314 f_outgoing_sns_add(idx_add := 0, w_sig := 0, w_user := 1, idx := 0, cause := NS_CAUSE_PROTOCOL_ERROR_UNSPEIFIED);
315 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100316 f_clean_ns_codec();
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100317}
318
Harald Welte630d0e62019-02-22 23:26:40 +0100319/* Test deleting IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100320testcase TC_sns_del() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100321 f_sns_bringup_1c1u();
322
323 f_outgoing_sns_del(idx_del := 1, w_sig := 0, w_user := 1, idx := 0);
324 /* FIXME: ensure we don't receive anything on just-deleted NS-VC anymore */
325 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100326 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100327}
328
Harald Welte72099552019-02-23 15:09:22 +0100329/* Test changing weights at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100330testcase TC_sns_chg_weight() runs on RAW_Test_CT {
Harald Welte72099552019-02-23 15:09:22 +0100331 f_sns_bringup_1c1u();
332
333 /* change w_user from 1 to 200 */
334 f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0);
335 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100336 f_clean_ns_codec();
Harald Welte72099552019-02-23 15:09:22 +0100337}
338
Harald Welte16e92f42019-03-02 00:03:44 +0100339import from PCUIF_Types all;
340import from PCUIF_CodecPort all;
341
Harald Welte3b335832019-03-15 22:38:06 +0100342altstep as_pcu_activate() runs on RAW_PCU_CT {
343 var PCUIF_send_data sd;
344 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ACT_REQ(?, ?, ?))) -> value sd { repeat; }
345
346}
347
Harald Welte16e92f42019-03-02 00:03:44 +0100348testcase TC_pcuif_rach() runs on RAW_Test_CT {
349 f_sns_bringup_1c1u();
Harald Welte3b335832019-03-15 22:38:06 +0100350 activate(as_pcu_activate());
Harald Welte16e92f42019-03-02 00:03:44 +0100351
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700352 f_pcuif_tx(ts_PCUIF_RACH_IND(bts_nr:=0, trx_nr:=0, ts_nr:=0, ra:=23,
353 is_11bit:=0, burst_type:=BURST_TYPE_0,
Harald Welte16e92f42019-03-02 00:03:44 +0100354 fn:=42, arfcn:=871, qta:=0));
355 PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
356 tr_PCUIF_DATA_REQ(bts_nr:=0, trx_nr:=0, ts_nr:=0, block_nr:=?, fn:=?,
357 sapi:=PCU_IF_SAPI_AGCH, data:=?)));
358 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100359 f_clean_ns_codec();
Harald Welte16e92f42019-03-02 00:03:44 +0100360}
361
Harald Welte630d0e62019-02-22 23:26:40 +0100362
363
Harald Weltef7b74072019-02-20 20:48:50 +0100364control {
365 execute( TC_sns_po_size_success() );
366 execute( TC_sns_po_size_nack() );
367 execute( TC_sns_po_config_success() );
368 execute( TC_sns_po_config_nack() );
369 execute( TC_sns_so_config_success() );
Harald Welte630d0e62019-02-22 23:26:40 +0100370 execute( TC_sns_1c1u() );
Harald Welteecd159e2019-03-16 13:36:07 +0100371 execute( TC_sns_1c1u_separate() );
Harald Welte64d07312019-03-20 09:48:39 +0100372 execute( TC_sns_1c1u_so_bvc_reset() );
373 execute( TC_sns_1c1u_so_bvc_reset_too_early() );
Alexander Couzens025bbc02021-02-22 03:00:28 +0100374 execute( TC_sns_so_bvc_reset_unknown_bvci() );
Harald Welte630d0e62019-02-22 23:26:40 +0100375 execute( TC_sns_add() );
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100376 execute( TC_sns_add_nack() );
Harald Welte630d0e62019-02-22 23:26:40 +0100377 execute( TC_sns_del() );
Harald Welte72099552019-02-23 15:09:22 +0100378 execute( TC_sns_chg_weight() );
Harald Welte16e92f42019-03-02 00:03:44 +0100379
380 execute( TC_pcuif_rach() );
Harald Weltef7b74072019-02-20 20:48:50 +0100381}
382
383}