blob: b90fe37e8448aa663505738d12a12a4b3dda5777 [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;
Alexander Couzens3efa5012021-04-06 15:57:05 +020014import from Osmocom_VTY_Functions all;
Pau Espin Pedrol8dd59fb2020-04-29 15:08:16 +020015import from PCU_Tests_NS all;
Pau Espin Pedrol0e6ed2e2020-04-29 14:33:13 +020016import from SGSN_Components all;
Harald Weltec4d7beb2019-02-21 18:21:01 +010017import from Osmocom_Gb_Types all;
Harald Welte90f19742020-11-06 19:34:40 +010018import from NS_Emulation all;
Harald Weltec4d7beb2019-02-21 18:21:01 +010019import from NS_Types all;
Alexander Couzens3c268da2020-09-07 04:25:05 +020020import from RAW_NS all;
Alexander Couzens025bbc02021-02-22 03:00:28 +010021import from BSSGP_Types all;
Harald Weltef7b74072019-02-20 20:48:50 +010022
23/**********************************************************************************
24 * Modern Gb/IP bring-up test cases using IP Sub-Network Service (SNS)
25 **********************************************************************************/
26
Harald Weltef7b74072019-02-20 20:48:50 +010027/* PCU-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010028testcase TC_sns_po_size_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020029 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010030 f_init_pcuif();
31 f_incoming_sns_size();
32 f_sleep(1.0);
33 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010034 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010035}
36
37/* PCU-originated SNS-SIZE: NACK from our side */
Harald Welteea3c7e92019-03-01 19:34:55 +010038testcase TC_sns_po_size_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020039 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010040 f_init_pcuif();
Alexander Couzens619213f2021-04-20 10:54:51 +020041 f_incoming_sns_size(NS_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
Harald Weltef7b74072019-02-20 20:48:50 +010042 /* FIXME: ensure we don't get a SNS-CONFIG */
43 /* FIXME: ensure we get re-transmitted SNS-SIZE attempts */
44 f_sleep(10.0);
45 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010046 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010047}
48
49/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010050testcase TC_sns_po_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020051 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010052 f_init_pcuif();
53 f_incoming_sns_size();
54 f_incoming_sns_config();
55 f_sleep(1.0);
56 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010057 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010058}
59
60/* PCU-originated SNS-CONFIG: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010061testcase TC_sns_po_config_nack() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020062 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010063 f_init_pcuif();
64 f_incoming_sns_size();
Alexander Couzens619213f2021-04-20 10:54:51 +020065 f_incoming_sns_config(NS_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
Harald Weltef7b74072019-02-20 20:48:50 +010066 /* FIXME: ensure we get re-transmitted SNS-CONFIG attempts */
67 f_sleep(10.0);
68 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010069 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010070}
71
72
73/* SGSN-originated SNS-SIZE: successful case */
Harald Welteea3c7e92019-03-01 19:34:55 +010074testcase TC_sns_so_config_success() runs on RAW_Test_CT {
Alexander Couzens2beaa202020-09-11 20:08:41 +020075 f_init_ns_codec(mp_nsconfig);
Harald Weltef7b74072019-02-20 20:48:50 +010076 f_init_pcuif();
77 f_incoming_sns_size();
78 f_incoming_sns_config();
79 f_outgoing_sns_config();
80
81 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
82 as_rx_alive_tx_ack(oneshot := true);
83 activate(as_rx_alive_tx_ack());
84
85 f_outgoing_ns_alive();
86
87 /* Expect BVC-RESET for signaling (0) and ptp BVCI */
Harald Weltee97e3af2020-10-09 14:56:54 +020088 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true);
89 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 +020090 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Weltef7b74072019-02-20 20:48:50 +010091
92 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future */
Harald Welte5339b2e2020-10-04 22:52:56 +020093 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
94 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci));
Harald Weltef7b74072019-02-20 20:48:50 +010095 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +010096 f_clean_ns_codec();
Harald Weltef7b74072019-02-20 20:48:50 +010097}
98
Harald Welte64d07312019-03-20 09:48:39 +010099private function f_sns_bringup_1c1u(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100100 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200101 f_init_ns_codec(mp_nsconfig);
102 f_init_ns_codec(mp_nsconfig, 1);
Harald Welte630d0e62019-02-22 23:26:40 +0100103 f_init_pcuif();
104 /* Perform Size + BSS-originated config */
105 f_incoming_sns_size();
106 f_incoming_sns_config();
107 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
108 f_outgoing_sns_config_1c1u();
109
110 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
111 * for both NS-VCs */
112 as_rx_alive_tx_ack(oneshot := true, idx := 0);
113 activate(as_rx_alive_tx_ack(idx := 0));
114 as_rx_alive_tx_ack(oneshot := true, idx := 1);
115 activate(as_rx_alive_tx_ack(idx := 1));
116
117 /* perform outgoing ALIVE procedure for both NS-VCs */
118 f_outgoing_ns_alive(0);
119 f_outgoing_ns_alive(1);
120
Harald Welte64d07312019-03-20 09:48:39 +0100121 if (sgsn_originated_reset) {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100122 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
123 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
124 f_ns_exp(pdu);
125 /* SGSN originated BVC-RESET on an uninitialized signalling BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200126 f_tx_bvc_reset_rx_ack(0, omit, omit);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100127
128 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
129 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
130 f_ns_exp(pdu);
131 /* SGSN originated BVC-RESET on an uninitialized PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200132 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 +0100133 } else {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100134 /* Expect BVC-RESET for signaling BVCI=0 */
Harald Weltee97e3af2020-10-09 14:56:54 +0200135 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100136 /* Expect BVC-RESET from the PCU on PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200137 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 +0100138 }
Harald Welte630d0e62019-02-22 23:26:40 +0100139 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==0) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200140 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true);
Harald Welte630d0e62019-02-22 23:26:40 +0100141
142 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
143 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200144 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
145 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 1));
Harald Welte630d0e62019-02-22 23:26:40 +0100146}
147
148/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only */
Harald Welteea3c7e92019-03-01 19:34:55 +0100149testcase TC_sns_1c1u() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100150 f_sns_bringup_1c1u();
151 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100152 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100153}
154
Harald Welte64d07312019-03-20 09:48:39 +0100155private function f_sns_bringup_1c1u_separate(boolean sgsn_originated_reset := false) runs on RAW_Test_CT {
Harald Welteecd159e2019-03-16 13:36:07 +0100156 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200157 f_init_ns_codec(mp_nsconfig);
158 f_init_ns_codec(mp_nsconfig, 1);
159 f_init_ns_codec(mp_nsconfig, 2);
Harald Welteecd159e2019-03-16 13:36:07 +0100160 f_init_pcuif();
161 /* Perform Size + BSS-originated config */
162 f_incoming_sns_size();
163 f_incoming_sns_config();
164 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
165 f_outgoing_sns_config_1c1u_separate();
166
167 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background
168 * for both NS-VCs */
169 as_rx_alive_tx_ack(oneshot := true, idx := 1);
170 activate(as_rx_alive_tx_ack(idx := 1));
171 as_rx_alive_tx_ack(oneshot := true, idx := 2);
172 activate(as_rx_alive_tx_ack(idx := 2));
173 /* ensure there's no NS-ALIVE received on idx==0 */
174 f_ensure_no_ns(t_NS_ALIVE, idx := 0);
175
176 /* perform outgoing ALIVE procedure for both NS-VCs */
177 f_outgoing_ns_alive(1);
178 f_outgoing_ns_alive(2);
179 /* ensure there's no response to NS-ALIVE sent on idx==0 */
180 f_outgoing_ns_alive_no_ack(idx := 0);
181
Harald Welte64d07312019-03-20 09:48:39 +0100182 if (sgsn_originated_reset) {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100183 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
184 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
185 f_ns_exp(pdu, idx := 1);
186 /* SGSN originated BVC-RESET on an uninitialized sign BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200187 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100188
189 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
190 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
191 f_ns_exp(pdu, idx := 1);
Harald Weltee97e3af2020-10-09 14:56:54 +0200192 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 +0100193 } else {
Alexander Couzens195c9e72020-10-26 23:09:16 +0100194 /* Expect BVC-RESET for signaling BVCI=0 */
Harald Weltee97e3af2020-10-09 14:56:54 +0200195 as_rx_bvc_reset_tx_ack(0, omit, omit, oneshot := true, idx := 1);
Alexander Couzens195c9e72020-10-26 23:09:16 +0100196 /* Expect BVC-RESET from the PCU on PTP BVC */
Harald Weltee97e3af2020-10-09 14:56:54 +0200197 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 +0100198 }
Harald Welteecd159e2019-03-16 13:36:07 +0100199 /* Expect UNBLOCK for ptp BVCI on signaling NS-VC (idx==1) */
Harald Welte5339b2e2020-10-04 22:52:56 +0200200 as_rx_bvc_unblock_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 1);
Harald Welteecd159e2019-03-16 13:36:07 +0100201
202 /* wait for one FLOW-CONTROL BVC and then ACK any further in the future. Flow
203 * control happens on the p-t-p BVCI and hence on index 1 */
Harald Welte5339b2e2020-10-04 22:52:56 +0200204 as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, oneshot := true, idx := 2);
205 activate(as_rx_bvc_fc_tx_ack(mp_gb_cfg.bvc[0].bvci, idx := 2));
Harald Welteecd159e2019-03-16 13:36:07 +0100206}
207
208/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only - and where
209 * the initial IP/port for the SNS procedure is *not* part of the NS-VCs later */
210testcase TC_sns_1c1u_separate() runs on RAW_Test_CT {
211 f_sns_bringup_1c1u_separate();
212 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100213 f_clean_ns_codec();
Harald Welteecd159e2019-03-16 13:36:07 +0100214}
215
Harald Welte64d07312019-03-20 09:48:39 +0100216/* Test full IP-SNS bring-up with two NS-VCs, one sig-only and one user-only and use
217 * SGSN-originated BVC-RESET rather than BSS-originated */
218testcase TC_sns_1c1u_so_bvc_reset() runs on RAW_Test_CT {
219 f_sns_bringup_1c1u_separate(sgsn_originated_reset := true);
220 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100221 f_clean_ns_codec();
Harald Welte64d07312019-03-20 09:48:39 +0100222}
223
Alexander Couzens3efa5012021-04-06 15:57:05 +0200224/* Test full IP_SNS bring-up over an initial NS-VC with two NS-VCs */
225testcase TC_sns_1c1u_unconfigured_nsvc() runs on RAW_Test_CT {
226 f_init_vty(testcasename());
227 f_sns_bringup_1c1u_separate();
228 f_vty_transceive_not_match(PCUVTY, "show ns entities", pattern "*UNCONFIGURED*");
229 setverdict(pass);
230 f_clean_ns_codec();
231}
232
Harald Welte64d07312019-03-20 09:48:39 +0100233/* Transmit BVC-RESET before NS-ALIVE of PCU was ACKed: expect no response */
234testcase TC_sns_1c1u_so_bvc_reset_too_early() runs on RAW_Test_CT {
235 /* Activate two NS codec ports */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200236 f_init_ns_codec(mp_nsconfig);
237 f_init_ns_codec(mp_nsconfig, 1);
238 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte64d07312019-03-20 09:48:39 +0100239 f_init_pcuif();
240 /* Perform Size + BSS-originated config */
241 f_incoming_sns_size();
242 f_incoming_sns_config();
243 /* perform SGSN-originated config using idx==0 for signalling and idx==1 for user traffic */
244 f_outgoing_sns_config_1c1u_separate();
245
246 /* DON'T ACK ANY INBOUND NS-ALIVE HERE! */
247
248 /* perform outgoing ALIVE procedure for both NS-VCs */
249 f_outgoing_ns_alive(1);
250 f_outgoing_ns_alive(2);
251 /* ensure there's no response to NS-ALIVE sent on idx==0 */
252 f_outgoing_ns_alive_no_ack(idx := 0);
253
254 /* Transmit BVC-RESET and expect no ACK*/
Harald Weltee97e3af2020-10-09 14:56:54 +0200255 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 1, exp_ack := false);
256 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 +0100257 f_clean_ns_codec();
Harald Welte64d07312019-03-20 09:48:39 +0100258}
259
Alexander Couzens025bbc02021-02-22 03:00:28 +0100260/* Do an SGSN originated BSSGP-Reset of a not-configured BVCI.
261 *
262 * PCU -X SGSN: BVCI 0 BSSGP-RESET (ignores reset)
263 * PCU <- SGSN: BVCI 0 BSSGP-RESET
264 * PCU -> SGSN: BVCI 0 BSSGP-RESET-ACK (with cell information)
265 * PCU -X SGSN: BVCI 23 BSSGP-RESET (ignores reset, 23 is configured on PCU, 24 is not configured)
266 * PCU <- SGSN: BVCI 24 BSSGP-RESET (unconfigured BVCI)
267 * PCU -> SGSN: BVCI 24 BSSGP-STATUS Unknown BVCI
268 */
269testcase TC_sns_so_bvc_reset_unknown_bvci() runs on RAW_Test_CT {
Alexander Couzens4e048c32021-04-06 16:23:23 +0200270 g_handle_rx_alive := true;
Alexander Couzens025bbc02021-02-22 03:00:28 +0100271 f_init_ns_codec(mp_nsconfig);
272 f_init_pcuif();
273 f_incoming_sns_size();
274 f_incoming_sns_config();
275 f_outgoing_sns_config();
276
Alexander Couzens025bbc02021-02-22 03:00:28 +0100277 /* Expect BVC-RESET, but ignore it to prevent a race condition of BVC RESETs */
278 var template PDU_NS pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, 0, omit));
279 f_ns_exp(pdu, idx := 0);
280 /* SGSN originated BVC-RESET on an uninitialized sign BVC */
281 f_tx_bvc_reset_rx_ack(0, omit, omit, idx := 0);
282
283 /* Expect BVC-RESET PTP BVC, but ignore it to prevent a race condition of BVC RESETs */
284 pdu := tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BVC_RESET(?, mp_gb_cfg.bvc[0].bvci, mp_gb_cfg.bvc[0].cell_id));
285 f_ns_exp(pdu);
286
287 /* Send a BVC-RESET on the wrong BVC */
Harald Welte5a8540f2021-03-05 12:14:09 +0100288 var BssgpCellId cell_id := mp_gb_cfg.bvc[0].cell_id;
289 cell_id.cell_id := cell_id.cell_id + 1;
290 var PDU_BSSGP bssgp_tx := valueof(ts_BVC_RESET(BSSGP_CAUSE_NET_SV_CAP_MOD_GT_ZERO_KBPS,
291 mp_gb_cfg.bvc[0].bvci + 1, cell_id));
Alexander Couzens025bbc02021-02-22 03:00:28 +0100292 NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 0, enc_PDU_BSSGP(bssgp_tx)));
293 NSCP[0].receive(tr_NS_UNITDATA(t_SduCtrlB, 0, decmatch tr_BSSGP_STATUS(mp_gb_cfg.bvc[0].bvci + 1, BSSGP_CAUSE_BVCI_UNKNOWN, *)));
294 setverdict(pass);
295
296 f_clean_ns_codec();
297}
298
Harald Welte630d0e62019-02-22 23:26:40 +0100299/* Test adding new IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100300testcase TC_sns_add() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100301 f_sns_bringup_1c1u();
302
Alexander Couzens2373afc2020-12-09 02:19:49 +0100303 /* create another NS codec port on the tester side */
Alexander Couzens2beaa202020-09-11 20:08:41 +0200304 f_init_ns_codec(mp_nsconfig, 2);
Harald Welte630d0e62019-02-22 23:26:40 +0100305
306 f_outgoing_sns_add(idx_add := 2, w_sig := 0, w_user := 1, idx := 0);
307
308 /* wait for one ALIVE cycle, then ACK any further ALIVE in the background */
309 as_rx_alive_tx_ack(oneshot := true, idx := 2);
310 activate(as_rx_alive_tx_ack(idx := 2));
311
312 f_outgoing_ns_alive(2);
Harald Welte630d0e62019-02-22 23:26:40 +0100313 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100314 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100315}
316
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100317/* Test adding an already present IP endpoint at runtime */
318testcase TC_sns_add_nack() runs on RAW_Test_CT {
319 f_sns_bringup_1c1u();
320
Alexander Couzens619213f2021-04-20 10:54:51 +0200321 f_outgoing_sns_add(idx_add := 0, w_sig := 0, w_user := 1, idx := 0, cause := NS_CAUSE_PROTOCOL_ERROR_UNSPECIFIED);
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100322 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100323 f_clean_ns_codec();
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100324}
325
Harald Welte630d0e62019-02-22 23:26:40 +0100326/* Test deleting IP endpoints at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100327testcase TC_sns_del() runs on RAW_Test_CT {
Harald Welte630d0e62019-02-22 23:26:40 +0100328 f_sns_bringup_1c1u();
329
330 f_outgoing_sns_del(idx_del := 1, w_sig := 0, w_user := 1, idx := 0);
331 /* FIXME: ensure we don't receive anything on just-deleted NS-VC anymore */
332 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100333 f_clean_ns_codec();
Harald Welte630d0e62019-02-22 23:26:40 +0100334}
335
Harald Welte72099552019-02-23 15:09:22 +0100336/* Test changing weights at runtime */
Harald Welteea3c7e92019-03-01 19:34:55 +0100337testcase TC_sns_chg_weight() runs on RAW_Test_CT {
Harald Welte72099552019-02-23 15:09:22 +0100338 f_sns_bringup_1c1u();
339
340 /* change w_user from 1 to 200 */
341 f_outgoing_sns_chg_weight(idx_chg := 1, w_sig := 0, w_user := 200, idx := 0);
342 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100343 f_clean_ns_codec();
Harald Welte72099552019-02-23 15:09:22 +0100344}
345
Harald Welte16e92f42019-03-02 00:03:44 +0100346import from PCUIF_Types all;
347import from PCUIF_CodecPort all;
348
Harald Welte3b335832019-03-15 22:38:06 +0100349altstep as_pcu_activate() runs on RAW_PCU_CT {
350 var PCUIF_send_data sd;
351 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ACT_REQ(?, ?, ?))) -> value sd { repeat; }
352
353}
354
Harald Welte16e92f42019-03-02 00:03:44 +0100355testcase TC_pcuif_rach() runs on RAW_Test_CT {
356 f_sns_bringup_1c1u();
Harald Welte3b335832019-03-15 22:38:06 +0100357 activate(as_pcu_activate());
Harald Welte16e92f42019-03-02 00:03:44 +0100358
Vadim Yanitskiy36558d92019-11-17 02:23:51 +0700359 f_pcuif_tx(ts_PCUIF_RACH_IND(bts_nr:=0, trx_nr:=0, ts_nr:=0, ra:=23,
360 is_11bit:=0, burst_type:=BURST_TYPE_0,
Harald Welte16e92f42019-03-02 00:03:44 +0100361 fn:=42, arfcn:=871, qta:=0));
362 PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
363 tr_PCUIF_DATA_REQ(bts_nr:=0, trx_nr:=0, ts_nr:=0, block_nr:=?, fn:=?,
Philipp Maier707a3fc2023-09-27 17:20:16 +0200364 sapi:=PCU_IF_SAPI_AGCH_2, data:=?)));
Harald Welte16e92f42019-03-02 00:03:44 +0100365 setverdict(pass);
Alexander Couzensc3165722021-01-11 02:51:45 +0100366 f_clean_ns_codec();
Harald Welte16e92f42019-03-02 00:03:44 +0100367}
368
Harald Welte630d0e62019-02-22 23:26:40 +0100369
370
Harald Weltef7b74072019-02-20 20:48:50 +0100371control {
372 execute( TC_sns_po_size_success() );
373 execute( TC_sns_po_size_nack() );
374 execute( TC_sns_po_config_success() );
375 execute( TC_sns_po_config_nack() );
376 execute( TC_sns_so_config_success() );
Harald Welte630d0e62019-02-22 23:26:40 +0100377 execute( TC_sns_1c1u() );
Harald Welteecd159e2019-03-16 13:36:07 +0100378 execute( TC_sns_1c1u_separate() );
Harald Welte64d07312019-03-20 09:48:39 +0100379 execute( TC_sns_1c1u_so_bvc_reset() );
380 execute( TC_sns_1c1u_so_bvc_reset_too_early() );
Alexander Couzens3efa5012021-04-06 15:57:05 +0200381 execute( TC_sns_1c1u_unconfigured_nsvc() );
Alexander Couzens025bbc02021-02-22 03:00:28 +0100382 execute( TC_sns_so_bvc_reset_unknown_bvci() );
Harald Welte630d0e62019-02-22 23:26:40 +0100383 execute( TC_sns_add() );
Alexander Couzens2a0ac802020-12-09 02:19:29 +0100384 execute( TC_sns_add_nack() );
Harald Welte630d0e62019-02-22 23:26:40 +0100385 execute( TC_sns_del() );
Harald Welte72099552019-02-23 15:09:22 +0100386 execute( TC_sns_chg_weight() );
Harald Welte16e92f42019-03-02 00:03:44 +0100387
388 execute( TC_pcuif_rach() );
Harald Weltef7b74072019-02-20 20:48:50 +0100389}
390
391}