blob: a99214bbb85e4a9bca242c5a1880b66ab8c1dca7 [file] [log] [blame]
Harald Welte28d943e2017-11-25 15:00:50 +01001module BSC_Tests {
2
Harald Welte21b46bd2017-12-17 19:46:32 +01003/* Integration Tests for OsmoBSC
Harald Weltea0630032018-03-20 21:09:55 +01004 * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org>
Harald Welte21b46bd2017-12-17 19:46:32 +01005 * 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 * This test suite tests OsmoBSC while emulating both multiple BTS + MS as
11 * well as the MSC. See README for more details.
12 *
13 * There are test cases that run in so-called 'handler mode' and test cases
14 * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode"
15 * tests abstract the multiplexing/demultiplexing of multiple SCCP connections
16 * and/or RSL channels and are hence suitable for higher-level test cases, while
17 * the "raw" tests directly on top of the CodecPorts are more suitable for lower-
18 * level testing.
19 */
20
Harald Welte4003d112017-12-09 22:35:39 +010021import from General_Types all;
Harald Welte28d943e2017-11-25 15:00:50 +010022import from Osmocom_Types all;
Harald Welteae026692017-12-09 01:03:01 +010023import from GSM_Types all;
Harald Welte28d943e2017-11-25 15:00:50 +010024import from IPL4asp_Types all;
25
Harald Welte6f521d82017-12-11 19:52:02 +010026import from BSSAP_Types all;
Harald Welteae026692017-12-09 01:03:01 +010027import from BSSAP_Adapter all;
28import from BSSAP_CodecPort all;
29import from BSSMAP_Templates all;
Harald Welte28d943e2017-11-25 15:00:50 +010030import from IPA_Emulation all;
Stefan Sperling830dc9d2018-02-12 21:08:28 +010031import from IPA_CodecPort all;
Harald Welteae026692017-12-09 01:03:01 +010032import from IPA_Types all;
33import from RSL_Types all;
Harald Welte624f9632017-12-16 19:26:04 +010034import from RSL_Emulation all;
Daniel Willmann191e0d92018-01-17 12:44:35 +010035import from MGCP_Emulation all;
Harald Welte28d943e2017-11-25 15:00:50 +010036
Harald Welte96c94412017-12-09 03:12:45 +010037import from Osmocom_CTRL_Functions all;
Harald Weltea5d2ab22017-12-09 14:21:42 +010038import from Osmocom_CTRL_Types all;
Harald Welteffe55fc2018-01-17 22:39:54 +010039import from Osmocom_CTRL_Adapter all;
Harald Welte96c94412017-12-09 03:12:45 +010040
Harald Weltebc03c762018-02-12 18:09:38 +010041import from Osmocom_VTY_Functions all;
42import from TELNETasp_PortType all;
43
Harald Welte6f521d82017-12-11 19:52:02 +010044import from MobileL3_CommonIE_Types all;
Harald Weltee3bd6582018-01-31 22:51:25 +010045import from MobileL3_Types all;
Harald Welte6f521d82017-12-11 19:52:02 +010046import from L3_Templates all;
47import from GSM_RR_Types all;
48
Stefan Sperlingc307e682018-06-14 15:15:46 +020049import from SCCP_Templates all;
Neels Hofmeyr4ff93282018-03-12 04:25:35 +010050import from BSSMAP_Templates all;
51
Harald Welte5d1a2202017-12-13 19:51:29 +010052const integer NUM_BTS := 3;
Harald Welteae026692017-12-09 01:03:01 +010053const float T3101_MAX := 12.0;
Harald Welte28d943e2017-11-25 15:00:50 +010054
Harald Welte799c97b2017-12-14 17:50:30 +010055/* make sure to sync this with the osmo-bts.cfg you're using */
Philipp Maiercb6cc482018-03-26 13:08:00 +020056const integer NUM_TCHH_PER_BTS := 2;
57const integer NUM_TCHF_PER_BTS := 4;
Harald Weltedd8cbf32018-01-28 12:07:52 +010058const integer NUM_SDCCH_PER_BTS := 4;
Harald Welte799c97b2017-12-14 17:50:30 +010059
Harald Welte4003d112017-12-09 22:35:39 +010060
Harald Welte21b46bd2017-12-17 19:46:32 +010061/* per-BTS state which we keep */
Harald Welte96c94412017-12-09 03:12:45 +010062type record BTS_State {
Harald Welte21b46bd2017-12-17 19:46:32 +010063 /* component reference to the IPA_Client component used for RSL */
Harald Weltea5d2ab22017-12-09 14:21:42 +010064 IPA_Client rsl
Harald Welte96c94412017-12-09 03:12:45 +010065}
66
Harald Weltea4ca4462018-02-09 00:17:14 +010067type component test_CT extends CTRL_Adapter_CT {
Harald Welte21b46bd2017-12-17 19:46:32 +010068 /* Array of per-BTS state */
Harald Welte96c94412017-12-09 03:12:45 +010069 var BTS_State bts[NUM_BTS];
Harald Welte89ab1912018-02-23 18:56:29 +010070 /* RSL common Channel Port (for RSL_Emulation) */
71 port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS];
Harald Welte21b46bd2017-12-17 19:46:32 +010072 /* array of per-BTS RSL test ports */
Harald Welteae026692017-12-09 01:03:01 +010073 port IPA_RSL_PT IPA_RSL[NUM_BTS];
Stefan Sperling830dc9d2018-02-12 21:08:28 +010074 port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */
Harald Weltea5d2ab22017-12-09 14:21:42 +010075
Daniel Willmann191e0d92018-01-17 12:44:35 +010076 var MGCP_Emulation_CT vc_MGCP;
Harald Weltebc03c762018-02-12 18:09:38 +010077 port TELNETasp_PT BSCVTY;
Daniel Willmann191e0d92018-01-17 12:44:35 +010078
Harald Weltea4ca4462018-02-09 00:17:14 +010079 var BSSAP_Adapter g_bssap;
80 /* for old legacy-tests only */
81 port BSSAP_CODEC_PT BSSAP;
82
Harald Welte21b46bd2017-12-17 19:46:32 +010083 /* are we initialized yet */
Harald Welte28d943e2017-11-25 15:00:50 +010084 var boolean g_initialized := false;
Harald Welte21b46bd2017-12-17 19:46:32 +010085
86 /* global test case guard timer */
Harald Welteae026692017-12-09 01:03:01 +010087 timer T_guard := 30.0;
88
Harald Welte28d943e2017-11-25 15:00:50 +010089}
90
91modulepar {
Harald Welte21b46bd2017-12-17 19:46:32 +010092 /* IP address at which the BSC can be reached */
Harald Welte696ddb62017-12-08 14:01:43 +010093 charstring mp_bsc_ip := "127.0.0.1";
Stefan Sperling830dc9d2018-02-12 21:08:28 +010094 /* port number to which to establish the IPA OML connections */
95 integer mp_bsc_oml_port := 3002;
Harald Welte21b46bd2017-12-17 19:46:32 +010096 /* port number to which to establish the IPA RSL connections */
Harald Welte696ddb62017-12-08 14:01:43 +010097 integer mp_bsc_rsl_port := 3003;
Harald Welte21b46bd2017-12-17 19:46:32 +010098 /* port number to which to establish the IPA CTRL connection */
Harald Welte96c94412017-12-09 03:12:45 +010099 integer mp_bsc_ctrl_port := 4249;
Daniel Willmann191e0d92018-01-17 12:44:35 +0100100 /* IP address at which the test binds */
101 charstring mp_test_ip := "127.0.0.1";
Harald Weltea4ca4462018-02-09 00:17:14 +0100102
103 BSSAP_Configuration mp_bssap_cfg := {
Harald Welte7ef51aa2018-04-16 19:16:01 +0200104 transport := BSSAP_TRANSPORT_AoIP,
Harald Weltea4ca4462018-02-09 00:17:14 +0100105 sccp_service_type := "mtp3_itu",
106 sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
107 own_pc := 185,
108 own_ssn := 254,
109 peer_pc := 187,
110 peer_ssn := 254,
Philipp Maier38d68942018-03-29 15:38:09 +0200111 sio := '83'O,
112 rctx := 0
Harald Weltea4ca4462018-02-09 00:17:14 +0100113 };
114}
115
Philipp Maier282ca4b2018-02-27 17:17:00 +0100116private function f_shutdown_helper() runs on test_CT {
Daniel Willmann637ef6c2018-07-25 10:49:09 +0200117 all component.stop;
Philipp Maier282ca4b2018-02-27 17:17:00 +0100118 setverdict(pass);
Daniel Willmannafce8662018-07-06 23:11:32 +0200119 mtc.stop;
Philipp Maier282ca4b2018-02-27 17:17:00 +0100120}
121
Harald Weltea4ca4462018-02-09 00:17:14 +0100122private function f_legacy_bssap_reset() runs on test_CT {
123 var BSSAP_N_UNITDATA_ind ud_ind;
124 timer T := 5.0;
125 BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
126 T.start;
127 alt {
128 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) {
129 log("Received RESET-ACK in response to RESET, we're ready to go!");
130 }
131 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind {
132 log("Respoding to inbound RESET with RESET-ACK");
133 BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
134 ts_BSSMAP_ResetAck));
135 repeat;
136 }
137 [] BSSAP.receive { repeat; }
138 [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); }
139 }
Harald Welte28d943e2017-11-25 15:00:50 +0100140}
141
Harald Welteae026692017-12-09 01:03:01 +0100142type record IPA_Client {
Harald Welte21b46bd2017-12-17 19:46:32 +0100143 /* IPA Emulation component reference */
Harald Welteae026692017-12-09 01:03:01 +0100144 IPA_Emulation_CT vc_IPA,
Harald Welte21b46bd2017-12-17 19:46:32 +0100145 /* Unit-ID and other CCM parameters to use for IPA client emulation */
Harald Welteae026692017-12-09 01:03:01 +0100146 IPA_CCM_Parameters ccm_pars,
Harald Welte21b46bd2017-12-17 19:46:32 +0100147 /* String identifier for this IPA Client */
Harald Welte624f9632017-12-16 19:26:04 +0100148 charstring id,
Harald Welte21b46bd2017-12-17 19:46:32 +0100149 /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */
Harald Welte624f9632017-12-16 19:26:04 +0100150 RSL_Emulation_CT vc_RSL optional
Harald Welte28d943e2017-11-25 15:00:50 +0100151}
152
Harald Welte21b46bd2017-12-17 19:46:32 +0100153/*! Start the IPA/RSL related bits for one IPA_Client.
154 * \param clnt IPA_Client for which to establish
155 * \param bsc_host IP address / hostname of the BSC
156 * \param bsc_port TCP port number of the BSC
157 * \param i number identifying this BTS
158 * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */
Harald Welte624f9632017-12-16 19:26:04 +0100159function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i,
160 boolean handler_mode := false)
Harald Welte28d943e2017-11-25 15:00:50 +0100161runs on test_CT {
Harald Welteae026692017-12-09 01:03:01 +0100162 timer T := 10.0;
163
Harald Welte96c94412017-12-09 03:12:45 +0100164 clnt.id := "IPA" & int2str(i) & "-RSL";
Harald Welteae026692017-12-09 01:03:01 +0100165 clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA");
166 clnt.ccm_pars := c_IPA_default_ccm_pars;
167 clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
168 clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0";
Harald Welte624f9632017-12-16 19:26:04 +0100169 if (handler_mode) {
170 clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL");
Harald Welte89ab1912018-02-23 18:56:29 +0100171 connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]);
Harald Welte624f9632017-12-16 19:26:04 +0100172 }
Harald Welteae026692017-12-09 01:03:01 +0100173
174 map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
Harald Welte624f9632017-12-16 19:26:04 +0100175 if (handler_mode) {
176 connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT);
177 } else {
178 connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]);
179 }
Harald Welteae026692017-12-09 01:03:01 +0100180
Harald Welte5d1a2202017-12-13 19:51:29 +0100181 clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars));
Harald Welte624f9632017-12-16 19:26:04 +0100182 if (handler_mode) {
183 clnt.vc_RSL.start(RSL_Emulation.main());
184 return;
185 }
Harald Welteae026692017-12-09 01:03:01 +0100186
187 /* wait for IPA RSL link to connect and send ID ACK */
188 T.start;
189 alt {
190 [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) {
191 T.stop;
192 IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23)));
193 }
Harald Welte60e823a2017-12-10 14:10:59 +0100194 [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat }
Harald Welteae026692017-12-09 01:03:01 +0100195 [] IPA_RSL[i].receive { repeat }
196 [] T.timeout {
Harald Welte96c94412017-12-09 03:12:45 +0100197 setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK");
Daniel Willmannafce8662018-07-06 23:11:32 +0200198 mtc.stop;
Harald Welteae026692017-12-09 01:03:01 +0100199 }
200 }
201}
202
Harald Welte12055472018-03-17 20:10:08 +0100203function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT {
204 if (not isbound(clnt) or not isbound(clnt.vc_IPA)) {
205 return;
206 }
207 clnt.vc_IPA.stop;
208 if (isbound(clnt.vc_RSL)) {
209 clnt.vc_RSL.stop;
210 }
211}
212
Harald Welte21b46bd2017-12-17 19:46:32 +0100213/* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */
Harald Weltea5d2ab22017-12-09 14:21:42 +0100214function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT {
215 timer T := secs_max;
216 T.start;
217 while (true) {
218 if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) {
219 T.stop;
Harald Weltebd868bd2017-12-10 18:28:40 +0100220 /* the 'degraded' state exists from OML connection time, and we have to wait
221 * until all MO's are initialized */
222 T.start(1.0);
223 T.timeout;
Harald Weltea5d2ab22017-12-09 14:21:42 +0100224 return;
225 }
Harald Weltef0d6ac62017-12-17 17:02:21 +0100226 f_sleep(0.1);
Harald Weltea5d2ab22017-12-09 14:21:42 +0100227 if (not T.running) {
228 setverdict(fail, "Timeout waiting for oml-connection-state ", status);
Daniel Willmannafce8662018-07-06 23:11:32 +0200229 mtc.stop;
Harald Weltea5d2ab22017-12-09 14:21:42 +0100230 }
231 }
232}
233
Harald Welte21b46bd2017-12-17 19:46:32 +0100234/* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */
Harald Welteae026692017-12-09 01:03:01 +0100235altstep as_Tguard() runs on test_CT {
Harald Welte60e823a2017-12-10 14:10:59 +0100236 var BSSAP_N_UNITDATA_ind ud_ind;
Neels Hofmeyrcc3f76a2018-03-12 01:43:25 +0100237 [] T_guard.timeout {
238 setverdict(fail, "Timeout of T_guard");
Daniel Willmannafce8662018-07-06 23:11:32 +0200239 mtc.stop;
Neels Hofmeyrcc3f76a2018-03-12 01:43:25 +0100240 }
Harald Welte60e823a2017-12-10 14:10:59 +0100241 /* always respond with RESET ACK to RESET */
242 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind {
243 BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress,
244 ts_BSSMAP_ResetAck));
Harald Welte69c1c262017-12-13 21:02:08 +0100245 repeat;
Harald Welte60e823a2017-12-10 14:10:59 +0100246 }
Harald Welte28d943e2017-11-25 15:00:50 +0100247}
248
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +0100249altstep no_bssmap_reset() runs on test_CT {
250 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) {
251 setverdict(fail, "unexpected BSSMAP Reset");
Daniel Willmannafce8662018-07-06 23:11:32 +0200252 mtc.stop;
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +0100253 }
254}
255
Daniel Willmann191e0d92018-01-17 12:44:35 +0100256function f_init_mgcp(charstring id) runs on test_CT {
257 id := id & "-MGCP";
258
259 var MGCPOps ops := {
260 create_cb := refers(MGCP_Emulation.ExpectedCreateCallback),
261 unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback)
262 };
263 var MGCP_conn_parameters mgcp_pars := {
264 callagent_ip := mp_bsc_ip,
Harald Welte9e4273e2018-01-29 22:01:22 +0100265 callagent_udp_port := -1,
Daniel Willmann191e0d92018-01-17 12:44:35 +0100266 mgw_ip := mp_test_ip,
267 mgw_udp_port := 2427
268 };
269
270 vc_MGCP := MGCP_Emulation_CT.create(id);
271 vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
272}
273
Harald Welte94e0c342018-04-07 11:33:23 +0200274private function f_init_vty(charstring id := "foo") runs on test_CT {
275 if (BSCVTY.checkstate("Mapped")) {
276 /* skip initialization if already executed once */
277 return;
278 }
Harald Weltebc03c762018-02-12 18:09:38 +0100279 map(self:BSCVTY, system:BSCVTY);
280 f_vty_set_prompts(BSCVTY);
281 f_vty_transceive(BSCVTY, "enable");
282}
283
Harald Welte21b46bd2017-12-17 19:46:32 +0100284/* global initialization function
285 * \param nr_bts Number of BTSs we should start/bring up
286 * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */
Harald Welte89d42e82017-12-17 16:42:41 +0100287function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs on test_CT {
Harald Welte28d943e2017-11-25 15:00:50 +0100288 var integer i;
Harald Welte28d943e2017-11-25 15:00:50 +0100289
Harald Welteae026692017-12-09 01:03:01 +0100290 if (g_initialized) {
291 return;
Harald Welte28d943e2017-11-25 15:00:50 +0100292 }
Harald Welteae026692017-12-09 01:03:01 +0100293 g_initialized := true;
294
295 /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the
296 * MSC-side BSSAP emulation */
Harald Welte67089ee2018-01-17 22:19:03 +0100297 if (handler_mode) {
Harald Weltea4ca4462018-02-09 00:17:14 +0100298 f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps);
Harald Welte4bcbd172018-05-27 19:47:44 +0200299 f_bssap_start(g_bssap);
Harald Welte67089ee2018-01-17 22:19:03 +0100300 } else {
Harald Weltea4ca4462018-02-09 00:17:14 +0100301 f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit);
302 connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT);
Harald Welte4bcbd172018-05-27 19:47:44 +0200303 f_bssap_start(g_bssap);
Harald Weltea4ca4462018-02-09 00:17:14 +0100304 f_legacy_bssap_reset();
Harald Welte67089ee2018-01-17 22:19:03 +0100305 }
Harald Welted5833a82018-05-27 16:52:56 +0200306
Harald Welteffe55fc2018-01-17 22:39:54 +0100307 f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
Harald Welte28d943e2017-11-25 15:00:50 +0100308
Daniel Willmann191e0d92018-01-17 12:44:35 +0100309 f_init_mgcp("VirtMSC");
Harald Weltebc03c762018-02-12 18:09:38 +0100310 f_init_vty("VirtMSC");
Daniel Willmann191e0d92018-01-17 12:44:35 +0100311
Harald Welte89d42e82017-12-17 16:42:41 +0100312 for (i := 0; i < nr_bts; i := i+1) {
Harald Weltea5d2ab22017-12-09 14:21:42 +0100313 /* wait until osmo-bts-omldummy has respawned */
314 f_wait_oml(i, "degraded", 5.0);
315 /* start RSL connection */
Harald Welte624f9632017-12-16 19:26:04 +0100316 f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i, handler_mode);
Harald Weltea5d2ab22017-12-09 14:21:42 +0100317 /* wait until BSC tells us "connected" */
318 f_wait_oml(i, "connected", 5.0);
Harald Welte696ddb62017-12-08 14:01:43 +0100319 }
320
Harald Welteae026692017-12-09 01:03:01 +0100321 T_guard.start;
322 activate(as_Tguard());
Harald Welte28d943e2017-11-25 15:00:50 +0100323}
324
Harald Welte21b46bd2017-12-17 19:46:32 +0100325/* expect to receive a RSL message matching a specified templaten on a given BTS / stream */
Harald Welteae026692017-12-09 01:03:01 +0100326function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0)
327runs on test_CT return RSL_Message {
328 var ASP_RSL_Unitdata rx_rsl_ud;
329 timer T := t_secs;
330
331 T.start;
332 alt {
333 [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud {
334 T.stop;
335 }
336 [] IPA_RSL[bts_nr].receive { repeat; }
Harald Welteb2917702017-12-10 15:48:52 +0100337 [] T.timeout {
338 setverdict(fail, "Timeout expecting ", t_rx);
Daniel Willmannafce8662018-07-06 23:11:32 +0200339 mtc.stop;
Harald Welteb2917702017-12-10 15:48:52 +0100340 }
Harald Welteae026692017-12-09 01:03:01 +0100341 }
342 return rx_rsl_ud.rsl;
343}
344
Harald Welte21b46bd2017-12-17 19:46:32 +0100345/* helper function to transmit RSL on a given BTS/stream */
Harald Welteae026692017-12-09 01:03:01 +0100346function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0)
347runs on test_CT {
348 IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx));
349}
350
351
Harald Welte4003d112017-12-09 22:35:39 +0100352/* verify we get a CHAN_ACT after CHAN RQD */
Harald Welteae026692017-12-09 01:03:01 +0100353testcase TC_chan_act_noreply() runs on test_CT {
354 var BSSAP_N_UNITDATA_ind ud_ind;
Harald Welte930d0a72018-03-22 22:08:40 +0100355 var RSL_Message rsl_unused;
Harald Welte28d943e2017-11-25 15:00:50 +0100356
Harald Welte89d42e82017-12-17 16:42:41 +0100357 f_init(1);
Harald Welte28d943e2017-11-25 15:00:50 +0100358
Harald Welteae026692017-12-09 01:03:01 +0100359 IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
Harald Welte930d0a72018-03-22 22:08:40 +0100360 rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
Harald Welteae026692017-12-09 01:03:01 +0100361 setverdict(pass);
Harald Welte28d943e2017-11-25 15:00:50 +0100362}
363
Harald Welte4003d112017-12-09 22:35:39 +0100364/* verify if the "chreq:total" counter increments as expected */
365testcase TC_chan_act_counter() runs on test_CT {
366 var BSSAP_N_UNITDATA_ind ud_ind;
367 var integer chreq_total;
Harald Welte930d0a72018-03-22 22:08:40 +0100368 var RSL_Message rsl_unused;
Harald Welte4003d112017-12-09 22:35:39 +0100369
Harald Welte89d42e82017-12-17 16:42:41 +0100370 f_init(1);
Harald Welte4003d112017-12-09 22:35:39 +0100371
372 chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total");
373 IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
Harald Welte930d0a72018-03-22 22:08:40 +0100374 rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
Harald Welte4003d112017-12-09 22:35:39 +0100375 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1);
376
377 setverdict(pass);
378}
379
Harald Welteae026692017-12-09 01:03:01 +0100380/* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */
381testcase TC_chan_act_ack_noest() runs on test_CT {
382 var RSL_Message rx_rsl;
383
Harald Welte89d42e82017-12-17 16:42:41 +0100384 f_init(1);
Harald Welteae026692017-12-09 01:03:01 +0100385
386 /* Send CHAN RQD and wait for allocation; acknowledge it */
Harald Welted6939652017-12-13 21:02:46 +0100387 var RslChannelNr chan_nr := f_chreq_act_ack();
Harald Welteae026692017-12-09 01:03:01 +0100388
389 /* expect BSC to disable the channel again if there's no RLL EST IND */
390 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
391
392 setverdict(pass);
393}
394
395/* Test behavior if MSC never answers to CR */
396testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT {
Harald Weltef77aef62018-01-28 15:35:42 +0100397 var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
398 var IpaStreamId sid := IPAC_PROTO_RSL_TRX0;
Harald Welteae026692017-12-09 01:03:01 +0100399 var RSL_Message rx_rsl;
Harald Weltef77aef62018-01-28 15:35:42 +0100400 var ASP_RSL_Unitdata rx_rsl_ud;
Harald Welteae026692017-12-09 01:03:01 +0100401
Harald Welte89d42e82017-12-17 16:42:41 +0100402 f_init(1);
Harald Welteae026692017-12-09 01:03:01 +0100403
404 /* Send CHAN RQD and wait for allocation; acknowledge it */
Harald Welted6939652017-12-13 21:02:46 +0100405 var RslChannelNr chan_nr := f_chreq_act_ack();
Harald Welteae026692017-12-09 01:03:01 +0100406
407 var octetstring l3 := '00010203040506'O
408 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
409
410 BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3)));
411
412 /* expect BSC to disable the channel again if there's no response from MSC */
Harald Weltef77aef62018-01-28 15:35:42 +0100413 /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */
414 IPA_RSL[0].clear;
415 alt {
416 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { }
417 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) -> value rx_rsl_ud {
418 f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch));
419 repeat;
420 }
421 }
Harald Welteae026692017-12-09 01:03:01 +0100422
423 setverdict(pass);
424}
425
426/* Test behavior if MSC answers with CREF to CR */
427testcase TC_chan_act_ack_est_ind_refused() runs on test_CT {
428 var BSSAP_N_CONNECT_ind rx_c_ind;
429 var RSL_Message rx_rsl;
430
Harald Welte89d42e82017-12-17 16:42:41 +0100431 f_init(1);
Harald Welteae026692017-12-09 01:03:01 +0100432
433 /* Send CHAN RQD and wait for allocation; acknowledge it */
Harald Welted6939652017-12-13 21:02:46 +0100434 var RslChannelNr chan_nr := f_chreq_act_ack();
Harald Welteae026692017-12-09 01:03:01 +0100435
436 var octetstring l3 := '00010203040506'O
437 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
438
439 BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind;
440 BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0));
441
442 /* expect BSC to disable the channel */
Harald Welte725844b2018-01-28 16:18:32 +0100443 f_expect_chan_rel(0, chan_nr);
Harald Welteae026692017-12-09 01:03:01 +0100444 setverdict(pass);
445}
446
Harald Welte618ef642017-12-14 14:58:20 +0100447/* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */
448testcase TC_chan_act_nack() runs on test_CT {
449 var RSL_Message rx_rsl;
450 var integer chact_nack;
451
Harald Welte89d42e82017-12-17 16:42:41 +0100452 f_init(1);
Harald Welte618ef642017-12-14 14:58:20 +0100453
454 chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack");
455
456 f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33));
457 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
458 var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr;
459
460 f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL));
461
462 /* wait for some time to hope the NACK arrives before the CTRL GET below */
463 f_sleep(0.5);
464
465 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1);
466
467 setverdict(pass);
468}
469
Harald Welte799c97b2017-12-14 17:50:30 +0100470/* Test for channel exhaustion due to RACH overload */
471testcase TC_chan_exhaustion() runs on test_CT {
472 var ASP_RSL_Unitdata rsl_ud;
473 var integer i;
474 var integer chreq_total, chreq_nochan;
475
Harald Welte89d42e82017-12-17 16:42:41 +0100476 f_init(1);
Harald Welte799c97b2017-12-14 17:50:30 +0100477
478 chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total");
479 chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel");
480
481 /* expect 5xTCH/F to succeed */
Philipp Maiercb6cc482018-03-26 13:08:00 +0200482 for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) {
Harald Welte930d0a72018-03-22 22:08:40 +0100483 var RslChannelNr chan_nr := f_chreq_act_ack('23'O, i);
Harald Welte799c97b2017-12-14 17:50:30 +0100484 }
485
486 IPA_RSL[0].clear;
487
Harald Weltedd8cbf32018-01-28 12:07:52 +0100488 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total",
Philipp Maiercb6cc482018-03-26 13:08:00 +0200489 chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS);
Harald Welte799c97b2017-12-14 17:50:30 +0100490
491 /* now expect additional channel activations to fail */
492 f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42));
493
494 alt {
495 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
496 tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) {
497 setverdict(fail, "Received CHAN ACT ACK without resources?!?");
498 }
499 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud {
500 var GsmRrMessage rr;
501 /* match on IMM ASS REJ */
502 rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload);
503 if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) {
504 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total",
Philipp Maiercb6cc482018-03-26 13:08:00 +0200505 chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS+1);
Harald Welte799c97b2017-12-14 17:50:30 +0100506 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel",
507 chreq_nochan+1);
508 setverdict(pass);
509 } else {
510 repeat;
511 }
512 }
513 [] IPA_RSL[0].receive { repeat; }
514 }
515}
516
Harald Weltecfe2c962017-12-15 12:09:32 +0100517/***********************************************************************
518 * Assignment Testing
519 ***********************************************************************/
520
Neels Hofmeyrda4a6952018-06-14 04:02:49 +0200521/* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction,
522 * except for the inter-BSC handover, MT side) */
Harald Weltecfe2c962017-12-15 12:09:32 +0100523testcase TC_outbound_connect() runs on test_CT {
Harald Welte89d42e82017-12-17 16:42:41 +0100524 f_init(1);
Harald Weltecfe2c962017-12-15 12:09:32 +0100525
Harald Weltea4ca4462018-02-09 00:17:14 +0100526 BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, 2342, ts_BSSMAP_AssignmentReq));
Harald Weltecfe2c962017-12-15 12:09:32 +0100527 BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?));
528 setverdict(pass);
529}
530
Harald Welte16a4adf2017-12-14 18:54:01 +0100531/* Test behavior if MSC answers with CREF to CR */
532testcase TC_assignment_cic_only() runs on test_CT {
533 var BSSAP_N_CONNECT_ind rx_c_ind;
534 var RSL_Message rx_rsl;
535 var DchanTuple dt;
536
Harald Welte89d42e82017-12-17 16:42:41 +0100537 f_init(1);
Harald Welte16a4adf2017-12-14 18:54:01 +0100538
539 dt := f_est_dchan('23'O, 23, '00000000'O);
Harald Welte17b27da2018-05-25 20:33:53 +0200540 if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
541 /* send assignment without AoIP IEs */
542 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1))));
543 } else {
544 /* Send assignmetn without CIC in IPA case */
545 var BSSMAP_IE_AoIP_TransportLayerAddress tla :=
546 valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342));
547 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla)));
548 }
Harald Welte16a4adf2017-12-14 18:54:01 +0100549 alt {
550 [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) {
551 setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE");
552 }
Harald Welte235ebf12017-12-15 14:18:16 +0100553 /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */
Harald Welte16a4adf2017-12-14 18:54:01 +0100554 [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) {
555 setverdict(pass);
556 }
557 [] BSSAP.receive { repeat; }
558 }
559}
560
Harald Welteed848512018-05-24 22:27:58 +0200561/* generate an assignment request for either AoIP or SCCPlite */
Harald Weltee102eae2018-05-31 21:03:47 +0200562function f_gen_ass_req() return PDU_BSSAP {
Harald Welteed848512018-05-24 22:27:58 +0200563 var PDU_BSSAP ass_cmd;
564 if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
565 var BSSMAP_IE_AoIP_TransportLayerAddress tla :=
566 valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342));
567 ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla));
568 } else {
569 var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1));
570 ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit));
571 }
572 return ass_cmd;
573}
574
575/* generate an assignment complete template for either AoIP or SCCPlite */
Harald Weltee102eae2018-05-31 21:03:47 +0200576function f_gen_exp_compl() return template PDU_BSSAP {
Harald Welteed848512018-05-24 22:27:58 +0200577 var template PDU_BSSAP exp_compl;
578 if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
579 exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?);
580 } else {
581 /* CIC is optional "*" as the MSC allocated it */
582 exp_compl := tr_BSSMAP_AssignmentComplete(*, omit);
583 }
584 return exp_compl;
585}
586
Harald Welte235ebf12017-12-15 14:18:16 +0100587/* Run everything required up to sending a caller-specified assignment command and expect response */
588function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text)
589runs on test_CT {
590 var BSSAP_N_CONNECT_ind rx_c_ind;
591 var RSL_Message rx_rsl;
592 var DchanTuple dt;
593
Harald Welte89d42e82017-12-17 16:42:41 +0100594 f_init(1);
Harald Welte235ebf12017-12-15 14:18:16 +0100595
596 dt := f_est_dchan('23'O, 23, '00000000'O);
597 /* send assignment without AoIP IEs */
598 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd));
599 alt {
600 [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) {
601 if (ischosen(exp.pdu.bssmap.assignmentComplete)) {
602 setverdict(pass);
603 } else {
604 setverdict(fail, fail_text);
605 }
606 }
607 [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) {
608 if (ischosen(exp.pdu.bssmap.assignmentFailure)) {
609 setverdict(pass);
610 } else {
611 setverdict(fail, fail_text);
612 }
613 }
614 [] BSSAP.receive { repeat; }
615 }
616}
617testcase TC_assignment_csd() runs on test_CT {
618 var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
Harald Welteed848512018-05-24 22:27:58 +0200619 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte235ebf12017-12-15 14:18:16 +0100620 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD);
621 //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7);
622 f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD");
623}
624
625testcase TC_assignment_ctm() runs on test_CT {
626 var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
Harald Welteed848512018-05-24 22:27:58 +0200627 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte235ebf12017-12-15 14:18:16 +0100628 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM);
629 //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7);
630 f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM");
631}
632
Harald Welte4003d112017-12-09 22:35:39 +0100633type record DchanTuple {
634 integer sccp_conn_id,
635 RslChannelNr rsl_chan_nr
Harald Weltea5d2ab22017-12-09 14:21:42 +0100636}
637
Harald Welted6939652017-12-13 21:02:46 +0100638/* Send CHAN RQD and wait for allocation; acknowledge it */
639private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23)
640runs on test_CT return RslChannelNr {
641 var RSL_Message rx_rsl;
642 f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn));
643 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
644 var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr;
645 f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10));
Daniel Willmannf4ac4ce2018-08-02 14:06:30 +0200646 rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0));
Harald Welted6939652017-12-13 21:02:46 +0100647 return chan_nr;
648}
649
Harald Welte4003d112017-12-09 22:35:39 +0100650/* helper function to establish a dedicated channel via BTS and MSC */
651function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3)
652runs on test_CT return DchanTuple {
653 var BSSAP_N_CONNECT_ind rx_c_ind;
Harald Welte4003d112017-12-09 22:35:39 +0100654 var DchanTuple dt;
Harald Weltea5d2ab22017-12-09 14:21:42 +0100655
Harald Welte4003d112017-12-09 22:35:39 +0100656 /* Send CHAN RQD and wait for allocation; acknowledge it */
Harald Welted6939652017-12-13 21:02:46 +0100657 dt.rsl_chan_nr := f_chreq_act_ack(ra, fn);
Harald Welte4003d112017-12-09 22:35:39 +0100658
659 f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
660
661 BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind;
662 dt.sccp_conn_id := rx_c_ind.connectionId;
663 BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id));
664
665 return dt;
Harald Weltea5d2ab22017-12-09 14:21:42 +0100666}
667
Harald Welte641fcbe2018-06-14 10:58:35 +0200668/* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */
669private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT {
670 var RSL_Message rx_rsl;
671 /* expect BSC to disable the channel */
672 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX);
673 /* respond with CHAN REL ACK */
674 f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
675
676 /* expect Clear Complete from BSC */
677 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
678
679 /* MSC disconnects as instructed. */
680 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
681}
682
Harald Welte4003d112017-12-09 22:35:39 +0100683/* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */
684testcase TC_chan_rel_rll_rel_ind() runs on test_CT {
Neels Hofmeyr27f64362018-03-12 01:44:00 +0100685 var BSSAP_N_DATA_ind rx_di;
Harald Welte4003d112017-12-09 22:35:39 +0100686 var DchanTuple dt;
Harald Welte96c94412017-12-09 03:12:45 +0100687
Harald Welte89d42e82017-12-17 16:42:41 +0100688 f_init(1);
Harald Welte96c94412017-12-09 03:12:45 +0100689
Harald Welte4003d112017-12-09 22:35:39 +0100690 dt := f_est_dchan('23'O, 23, '00010203040506'O);
691
692 /* simulate RLL REL IND */
693 f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0))));
694
Neels Hofmeyr27f64362018-03-12 01:44:00 +0100695 /* expect Clear Request on MSC side */
696 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di;
697
698 /* Instruct BSC to clear channel */
699 var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
700 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
701
Harald Welte4003d112017-12-09 22:35:39 +0100702 /* expect BSC to disable the channel */
Harald Welte641fcbe2018-06-14 10:58:35 +0200703 f_exp_chan_rel_and_clear(dt, 0);
Neels Hofmeyr27f64362018-03-12 01:44:00 +0100704
705 /* wait for SCCP emulation to do its job */
706 f_sleep(1.0);
Harald Welte4003d112017-12-09 22:35:39 +0100707
708 setverdict(pass);
709}
710
711/* Test behavior of channel release after CONN FAIL IND from BTS */
712testcase TC_chan_rel_conn_fail() runs on test_CT {
713 var BSSAP_N_DATA_ind rx_di;
Harald Welte4003d112017-12-09 22:35:39 +0100714 var DchanTuple dt;
715
Harald Welte89d42e82017-12-17 16:42:41 +0100716 f_init(1);
Harald Welte4003d112017-12-09 22:35:39 +0100717
718 dt := f_est_dchan('23'O, 23, '00010203040506'O);
719
720 /* simulate CONN FAIL IND */
Harald Weltea8ed9062017-12-14 09:46:01 +0100721 f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL));
Harald Welte4003d112017-12-09 22:35:39 +0100722 /* TODO: different cause values? */
723
Harald Welte4003d112017-12-09 22:35:39 +0100724 /* expect Clear Request from BSC */
725 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di;
726
727 /* Instruct BSC to clear channel */
728 var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
729 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
730
Harald Welte6ff76ea2018-01-28 13:08:01 +0100731 /* expect BSC to disable the channel */
Harald Welte641fcbe2018-06-14 10:58:35 +0200732 f_exp_chan_rel_and_clear(dt, 0);
Harald Welte4003d112017-12-09 22:35:39 +0100733
734 /* wait for SCCP emulation to do its job */
735 f_sleep(1.0);
736
737 setverdict(pass);
738}
739
Harald Welte99f3ca02018-06-14 13:40:29 +0200740/* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */
741/* See also https://www.osmocom.org/issues/3182 */
742testcase TC_early_conn_fail() runs on test_CT {
743 var RSL_Message rx_rsl;
744 var DchanTuple dt;
745
746 f_init(1);
747
748 /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */
749 dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23);
750
751 /* BTS->BSC: simulate CONN FAIL IND */
752 f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL));
753
754 /* BTS->BSC: Expect RF channel release from BSC on Abis */
755 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0);
756
757 /* BTS<-BSC: respond with CHAN REL ACK */
758 f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
759
760 setverdict(pass);
761}
762
763/* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */
764/* See also https://www.osmocom.org/issues/3182 */
765testcase TC_late_conn_fail() runs on test_CT {
766 var RSL_Message rx_rsl;
767 var DchanTuple dt;
768
769 f_init(1);
770
771 dt := f_est_dchan('23'O, 23, '00010203040506'O);
772
773 /* BSC<-MSC: Instruct BSC to clear connection */
774 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0)));
775
776 /* BTS->BSC: expect BSC to deactivate SACCH */
777 rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr));
778
779 /* BTS->BSC: simulate a late CONN FAIL IND from BTS */
780 f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL));
781
782 /* BTS<-BSC: Expect RF channel release from BSC on Abis */
783 rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0);
784 /* BTS->BSC: respond with CHAN REL ACK */
785 f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr));
786
787 /* BSC->MSC: expect Clear Complete from BSC */
788 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete));
789
790 /* BSC<-MSC: MSC disconnects as requested. */
791 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
792
793 setverdict(pass);
794}
795
Harald Welte91d54a52018-01-28 15:35:07 +0100796function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean flush := true,
797 boolean handle_rll_rel := true) runs on test_CT {
798
799 var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0));
800 if (flush) {
801 /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */
802 IPA_RSL[bts_nr].clear;
803 }
804 alt {
805 /* ignore DEACTIVATE SACCH (if any) */
806 [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
807 tr_RSL_DEACT_SACCH(rsl_chan_nr))) {
808 repeat;
809 }
810 /* acknowledge RLL release (if any)*/
811 [handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
812 tr_RSL_REL_REQ(rsl_chan_nr, ?))) {
813 /* FIXME: Why are we getting this for LinkID SACCH? */
814 f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch));
815 repeat;
816 }
Neels Hofmeyr92d48422018-06-14 04:05:07 +0200817 [not handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
818 tr_RSL_REL_REQ(rsl_chan_nr, ?))) {
819 /* Do not reply, just continue */
820 repeat;
821 }
Harald Welte91d54a52018-01-28 15:35:07 +0100822 /* Expect RF channel release from BSC on Abis */
823 [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,
824 tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) {
825 /* respond with CHAN REL ACK */
826 f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr));
827 }
828 /* ignore any user data */
829 [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) {
830 repeat;
831 }
832 }
833}
834
Harald Welte4003d112017-12-09 22:35:39 +0100835/* Test behavior of channel release after hard Clear Command from MSC */
836testcase TC_chan_rel_hard_clear() runs on test_CT {
837 var BSSAP_N_DATA_ind rx_di;
Harald Welte4003d112017-12-09 22:35:39 +0100838 var DchanTuple dt;
Harald Welte4003d112017-12-09 22:35:39 +0100839
Harald Welte89d42e82017-12-17 16:42:41 +0100840 f_init(1);
Harald Welte4003d112017-12-09 22:35:39 +0100841
842 dt := f_est_dchan('23'O, 23, '00010203040506'O);
843
844 /* Instruct BSC to clear channel */
845 var BssmapCause cause := 0;
846 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
847
848 /* expect Clear Complete from BSC on A */
849 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) {
850 /* release the SCCP connection */
851 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
852 }
853
Harald Welte91d54a52018-01-28 15:35:07 +0100854 f_expect_chan_rel(0, dt.rsl_chan_nr);
Harald Welte4003d112017-12-09 22:35:39 +0100855 setverdict(pass);
856}
857
Harald Welted8c36cd2017-12-09 23:05:31 +0100858/* Test behavior of channel release after hard RLSD from MSC */
859testcase TC_chan_rel_hard_rlsd() runs on test_CT {
Harald Welted8c36cd2017-12-09 23:05:31 +0100860 var DchanTuple dt;
Harald Welted8c36cd2017-12-09 23:05:31 +0100861
Harald Welte89d42e82017-12-17 16:42:41 +0100862 f_init(1);
Harald Welted8c36cd2017-12-09 23:05:31 +0100863
864 dt := f_est_dchan('23'O, 23, '00010203040506'O);
865
866 /* release the SCCP connection */
867 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
868
Harald Welte91d54a52018-01-28 15:35:07 +0100869 f_expect_chan_rel(0, dt.rsl_chan_nr);
Harald Welted8c36cd2017-12-09 23:05:31 +0100870 setverdict(pass);
871}
872
Harald Welte550daf92018-06-11 19:22:13 +0200873/* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */
874testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT {
875 var DchanTuple dt;
876
877 f_init(1);
878
879 dt := f_est_dchan('23'O, 23, '00010203040506'O);
880
881 /* release the SCCP connection */
882 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
883
884 f_expect_chan_rel(0, dt.rsl_chan_nr, true, false);
885 setverdict(pass);
886}
887
Harald Welte85804d42017-12-10 14:11:58 +0100888/* Test behavior of channel release after BSSMAP RESET from MSC */
889testcase TC_chan_rel_a_reset() runs on test_CT {
Harald Welte85804d42017-12-10 14:11:58 +0100890 var DchanTuple dt;
Harald Welte85804d42017-12-10 14:11:58 +0100891
Harald Welte89d42e82017-12-17 16:42:41 +0100892 f_init(1);
Harald Welte85804d42017-12-10 14:11:58 +0100893
894 dt := f_est_dchan('23'O, 23, '00010203040506'O);
895
896 /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */
897 IPA_RSL[0].clear;
898
899 /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */
Harald Weltea4ca4462018-02-09 00:17:14 +0100900 BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
Harald Welte85804d42017-12-10 14:11:58 +0100901 interleave {
Harald Weltea4ca4462018-02-09 00:17:14 +0100902 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
Harald Welte85804d42017-12-10 14:11:58 +0100903 [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { }
904 }
905
Philipp Maiere8f38ed2018-02-09 10:30:31 +0100906 f_expect_chan_rel(0, dt.rsl_chan_nr, false);
Harald Welte85804d42017-12-10 14:11:58 +0100907 setverdict(pass);
908}
909
Harald Welte5cd20ed2017-12-13 21:03:20 +0100910/* Test behavior if RSL EST IND for non-active channel */
911testcase TC_rll_est_ind_inact_lchan() runs on test_CT {
912 timer T := 2.0;
913
Harald Welte89d42e82017-12-17 16:42:41 +0100914 f_init(1);
Harald Welte5cd20ed2017-12-13 21:03:20 +0100915
916 var octetstring l3 := '00010203040506'O;
917 var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6));
918 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3));
919
920 T.start;
921 alt {
922 [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) {
923 setverdict(fail, "MSC received COMPL L3 for non-active lchan");
924 }
925 [] BSSAP.receive {}
926 [] IPA_RSL[0].receive {}
927 [] T.timeout {}
928 }
929
930 setverdict(pass);
931}
932
933/* Test behavior if RSL EST IND for invalid SAPI */
934testcase TC_rll_est_ind_inval_sapi1() runs on test_CT {
935 var RslChannelNr chan_nr;
936
Harald Welte89d42e82017-12-17 16:42:41 +0100937 f_init(1);
Harald Welte5cd20ed2017-12-13 21:03:20 +0100938
939 chan_nr := f_chreq_act_ack()
940
941 var octetstring l3 := '00010203040506'O;
942 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3));
943
944 timer T := 2.0;
945 T.start;
946 alt {
947 [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) {
948 setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1");
949 }
950 [] BSSAP.receive { repeat; }
951 [] IPA_RSL[0].receive { repeat; }
952 [] T.timeout {}
953 }
954
955 setverdict(pass);
956}
957
958/* Test behavior if RSL EST IND for invalid SAPI */
959testcase TC_rll_est_ind_inval_sapi3() runs on test_CT {
960 timer T := 2.0;
961
Harald Welte89d42e82017-12-17 16:42:41 +0100962 f_init(1);
Harald Welte5cd20ed2017-12-13 21:03:20 +0100963
964 var RslChannelNr chan_nr := f_chreq_act_ack();
965
966 var octetstring l3 := '00010203040506'O;
967 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3));
968
969 T.start;
970 alt {
971 [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) {
972 setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3");
973 }
974 [] BSSAP.receive { repeat; }
975 [] IPA_RSL[0].receive { repeat; }
976 [] T.timeout {}
977 }
978
979 setverdict(pass);
980}
981
982/* Test behavior if RSL EST IND for invalid SACCH */
983testcase TC_rll_est_ind_inval_sacch() runs on test_CT {
984 timer T := 2.0;
985
Harald Welte89d42e82017-12-17 16:42:41 +0100986 f_init(1);
Harald Welte5cd20ed2017-12-13 21:03:20 +0100987
988 var RslChannelNr chan_nr := f_chreq_act_ack();
989
990 var octetstring l3 := '00010203040506'O;
991 f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3));
992
993 T.start;
994 alt {
995 [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) {
996 setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH");
997 }
998 [] BSSAP.receive { repeat; }
999 [] IPA_RSL[0].receive { repeat; }
1000 [] T.timeout {}
1001 }
1002
1003 setverdict(pass);
1004}
1005
1006
1007
Harald Welte4003d112017-12-09 22:35:39 +01001008
1009testcase TC_ctrl_msc_connection_status() runs on test_CT {
1010 var charstring ctrl_resp;
1011
Harald Welte89d42e82017-12-17 16:42:41 +01001012 f_init(1);
Harald Welte4003d112017-12-09 22:35:39 +01001013
1014 /* See https://osmocom.org/issues/2729 */
1015 f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected");
1016 setverdict(pass);
1017}
1018
Stefan Sperlingb041b3d2018-01-03 17:14:55 +01001019testcase TC_ctrl_msc0_connection_status() runs on test_CT {
1020 var charstring ctrl_resp;
1021
1022 f_init(1);
Stefan Sperlingb041b3d2018-01-03 17:14:55 +01001023
1024 f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected");
1025 setverdict(pass);
1026}
1027
Harald Welte4003d112017-12-09 22:35:39 +01001028testcase TC_ctrl() runs on test_CT {
1029 var charstring ctrl_resp;
1030
Harald Welte89d42e82017-12-17 16:42:41 +01001031 f_init(1);
Harald Welte4003d112017-12-09 22:35:39 +01001032
1033 /* all below values must match the osmo-bsc.cfg config file used */
1034
Harald Welte6a129692018-03-17 17:30:14 +01001035 f_ctrl_get_exp(IPA_CTRL, "mcc", "001");
1036 f_ctrl_get_exp(IPA_CTRL, "mnc", "01");
Harald Welte44bdaa52017-12-17 17:01:47 +01001037 f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3");
Harald Welte4003d112017-12-09 22:35:39 +01001038
1039 var integer bts_nr := 0;
1040 f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1");
1041 f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0");
1042 f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected");
1043 f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs");
1044 f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on");
1045 f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871");
1046 f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20");
1047
1048 var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime"));
1049 f_sleep(2.0);
1050 if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) {
1051 setverdict(fail, "oml-uptime not incrementing as expected");
1052 }
1053 /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */
1054
1055 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0);
1056
1057 setverdict(pass);
Harald Welte96c94412017-12-09 03:12:45 +01001058}
1059
Harald Welte6f521d82017-12-11 19:52:02 +01001060function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT {
Harald Weltea4ca4462018-02-09 00:17:14 +01001061 BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, bssap));
Harald Welte6f521d82017-12-11 19:52:02 +01001062}
1063
1064
1065/***********************************************************************
1066 * Paging Testing
1067 ***********************************************************************/
1068
1069type record Cell_Identity {
1070 GsmMcc mcc,
1071 GsmMnc mnc,
1072 GsmLac lac,
1073 GsmCellId ci
1074};
Harald Welte24135bd2018-03-17 19:27:53 +01001075private const Cell_Identity cid := { '001'H, '01'H, 1, 0 };
Stefan Sperling049a86e2018-03-20 15:51:00 +01001076private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 };
Harald Welte6f521d82017-12-11 19:52:02 +01001077
Harald Welte5d1a2202017-12-13 19:51:29 +01001078type set of integer BtsIdList;
1079
1080private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean {
1081 for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) {
1082 if (bts_id == bts_ids[j]) {
1083 return true;
1084 }
1085 }
1086 return false;
1087}
Harald Welte6f521d82017-12-11 19:52:02 +01001088
1089/* core paging test helper function; used by most paging test cases */
1090private function f_pageing_helper(hexstring imsi,
1091 template BSSMAP_FIELD_CellIdentificationList cid_list,
Harald Welte5d1a2202017-12-13 19:51:29 +01001092 BtsIdList bts_ids := { 0 },
Harald Welte6f521d82017-12-11 19:52:02 +01001093 template RSL_ChanNeeded rsl_chneed := omit,
1094 template OCT4 tmsi := omit) runs on test_CT
1095{
1096 var template BSSMAP_IE_ChannelNeeded bssmap_chneed;
1097 var MobileIdentity mi;
1098 var template octetstring id_enc; /* FIXME */
1099 var RSL_Message rx_rsl;
1100 var integer paging_group := hex2int(imsi[lengthof(imsi)-1]);
Harald Welte5d1a2202017-12-13 19:51:29 +01001101 var integer i;
Harald Welte6f521d82017-12-11 19:52:02 +01001102
1103 f_init();
Harald Welte6f521d82017-12-11 19:52:02 +01001104
1105 /* Clear the queue, it might still contain stuff like BCCH FILLING */
Harald Weltec3068592018-03-17 19:55:31 +01001106 for (i := 0; i < NUM_BTS; i := i + 1) {
1107 IPA_RSL[i].clear;
Harald Welte5d1a2202017-12-13 19:51:29 +01001108 }
Harald Welte6f521d82017-12-11 19:52:02 +01001109
1110 if (isvalue(rsl_chneed)) {
1111 /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */
1112 bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2));
1113 } else {
1114 bssmap_chneed := omit;
1115 }
1116
1117 f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed));
1118
1119/* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder
1120 if (isvalue(tmsi)) {
1121 mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi))));
1122 } else {
1123 mi := valueof(ts_Osmo_MI_IMSI(imsi));
1124 }
1125 id_enc := enc_MobileIdentity(mi);
1126*/
1127 id_enc := ?;
Harald Welte5d1a2202017-12-13 19:51:29 +01001128 for (i := 0; i < sizeof(bts_ids); i := i + 1) {
1129 rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc));
1130 /* check channel type, paging group */
1131 if (rx_rsl.ies[1].body.paging_group != paging_group) {
1132 setverdict(fail, "Paging for wrong paging group");
1133 }
1134 if (ispresent(rsl_chneed) and
1135 rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) {
1136 setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed");
1137 }
Harald Welte6f521d82017-12-11 19:52:02 +01001138 }
Harald Welte2fccd982018-01-31 15:48:19 +01001139 f_sleep(2.0);
Harald Welte5d1a2202017-12-13 19:51:29 +01001140 /* do a quick check on all not-included BTSs if they received paging */
1141 for (i := 0; i < NUM_BTS; i := i + 1) {
1142 timer T := 0.1;
1143 if (f_bts_in_list(i, bts_ids)) {
1144 continue;
1145 }
1146 T.start;
1147 alt {
1148 [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) {
1149 setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids);
1150 }
1151 [] IPA_RSL[i].receive { repeat; }
1152 [] T.timeout { }
1153 }
Harald Welte6f521d82017-12-11 19:52:02 +01001154 }
1155
1156 setverdict(pass);
1157}
1158
Harald Welte5d1a2202017-12-13 19:51:29 +01001159const BtsIdList c_BtsId_all := { 0, 1, 2 };
Harald Welte751d3eb2018-01-31 15:51:06 +01001160const BtsIdList c_BtsId_none := { };
Harald Welte5d1a2202017-12-13 19:51:29 +01001161const BtsIdList c_BtsId_LAC1 := { 0, 1 };
1162const BtsIdList c_BtsId_LAC2 := { 2 };
1163
Harald Welte6f521d82017-12-11 19:52:02 +01001164/* PAGING by IMSI + TMSI */
1165testcase TC_paging_imsi_nochan() runs on test_CT {
1166 var BSSMAP_FIELD_CellIdentificationList cid_list;
1167 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Philipp Maier8c04b0a2018-02-23 13:48:48 +01001168 f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001169 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001170}
1171
1172/* PAGING by IMSI + TMSI */
1173testcase TC_paging_tmsi_nochan() runs on test_CT {
1174 var BSSMAP_FIELD_CellIdentificationList cid_list;
1175 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001176 f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, 'A1B2C301'O);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001177 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001178}
1179
1180/* Paging with different "channel needed' values */
1181testcase TC_paging_tmsi_any() runs on test_CT {
1182 var BSSMAP_FIELD_CellIdentificationList cid_list;
1183 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001184 f_pageing_helper('001010100000002'H, cid_list, c_BtsId_all, RSL_CHANNEED_ANY, 'A1B2C302'O);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001185 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001186}
1187testcase TC_paging_tmsi_sdcch() runs on test_CT {
1188 var BSSMAP_FIELD_CellIdentificationList cid_list;
1189 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001190 f_pageing_helper('001010100000003'H, cid_list, c_BtsId_all, RSL_CHANNEED_SDCCH, 'A1B2C303'O);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001191 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001192}
1193testcase TC_paging_tmsi_tch_f() runs on test_CT {
1194 var BSSMAP_FIELD_CellIdentificationList cid_list;
1195 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001196 f_pageing_helper('001010000000004'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_F, 'A1B2C304'O);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001197 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001198}
1199testcase TC_paging_tmsi_tch_hf() runs on test_CT {
1200 var BSSMAP_FIELD_CellIdentificationList cid_list;
1201 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001202 f_pageing_helper('001010000000005'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_ForH, 'A1B2C305'O);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001203 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001204}
1205
1206/* Paging by CGI */
1207testcase TC_paging_imsi_nochan_cgi() runs on test_CT {
1208 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1209 cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, cid.ci) } };
Harald Welte5d1a2202017-12-13 19:51:29 +01001210 f_pageing_helper('001010000000006'H, cid_list, { 0 });
Philipp Maier282ca4b2018-02-27 17:17:00 +01001211 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001212}
1213
1214/* Paging by LAC+CI */
1215testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT {
1216 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1217 cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } };
Harald Welte5d1a2202017-12-13 19:51:29 +01001218 f_pageing_helper('001010000000007'H, cid_list, { 0 });
Philipp Maier282ca4b2018-02-27 17:17:00 +01001219 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001220}
1221
1222/* Paging by CI */
1223testcase TC_paging_imsi_nochan_ci() runs on test_CT {
1224 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1225 cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } };
Harald Welte5d1a2202017-12-13 19:51:29 +01001226 f_pageing_helper('001010000000008'H, cid_list, { 0 });
Philipp Maier282ca4b2018-02-27 17:17:00 +01001227 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001228}
1229
1230/* Paging by LAI */
1231testcase TC_paging_imsi_nochan_lai() runs on test_CT {
1232 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1233 cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) } };
Harald Welte5d1a2202017-12-13 19:51:29 +01001234 f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001235 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001236}
1237
1238/* Paging by LAC */
1239testcase TC_paging_imsi_nochan_lac() runs on test_CT {
1240 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1241 cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } };
Harald Welte5d1a2202017-12-13 19:51:29 +01001242 f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001243 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001244}
1245
1246/* Paging by "all in BSS" */
1247testcase TC_paging_imsi_nochan_all() runs on test_CT {
1248 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1249 cid_list := { cIl_allInBSS := ''O };
Harald Welte5d1a2202017-12-13 19:51:29 +01001250 f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001251 f_shutdown_helper();
Harald Welte6f521d82017-12-11 19:52:02 +01001252}
1253
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001254/* Paging by PLMN+LAC+RNC; We do not implement this; Verify nothing is paged */
Harald Welte751d3eb2018-01-31 15:51:06 +01001255testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT {
1256 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1257 cid_list := { cIl_PLMN_LAC_RNC := { ts_BSSMAP_CI_PLMN_LAC_RNC(cid.mcc, cid.mnc, cid.lac, 12) } };
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001258 f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001259 f_shutdown_helper();
Harald Welte751d3eb2018-01-31 15:51:06 +01001260}
Harald Welte6f521d82017-12-11 19:52:02 +01001261
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001262/* Paging by RNC; We do not implement this; Verify nothing is paged */
Harald Welte751d3eb2018-01-31 15:51:06 +01001263testcase TC_paging_imsi_nochan_rnc() runs on test_CT {
1264 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1265 cid_list := { cIl_RNC := { int2oct(13, 2) } };
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001266 f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001267 f_shutdown_helper();
Harald Welte751d3eb2018-01-31 15:51:06 +01001268}
1269
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001270/* Paging by LAC+RNC; We do not implement; Verify nothing is paged */
Harald Welte751d3eb2018-01-31 15:51:06 +01001271testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT {
1272 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1273 cid_list := { cIl_LAC_RNC := { ts_BSSMAP_CI_LAC_RNC(cid.lac, 14) } };
Stefan Sperling7b5e1782018-03-20 19:32:43 +01001274 f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001275 f_shutdown_helper();
Harald Welte751d3eb2018-01-31 15:51:06 +01001276}
1277
Harald Welte6f521d82017-12-11 19:52:02 +01001278/* Paging on multiple cells (multiple entries in list): Verify all of them page */
Harald Welte751d3eb2018-01-31 15:51:06 +01001279testcase TC_paging_imsi_nochan_lacs() runs on test_CT {
1280 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1281 cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } };
1282 f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001283 f_shutdown_helper();
Harald Welte751d3eb2018-01-31 15:51:06 +01001284}
1285
1286/* Paging on empty list: Verify none of them page */
1287testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT {
1288 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1289 cid_list := { cIl_LAC := { } };
1290 f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none);
Philipp Maier282ca4b2018-02-27 17:17:00 +01001291 f_shutdown_helper();
Harald Welte751d3eb2018-01-31 15:51:06 +01001292}
1293
Stefan Sperling049a86e2018-03-20 15:51:00 +01001294/* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */
1295testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT {
1296 var template BSSMAP_FIELD_CellIdentificationList cid_list;
1297 cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } };
1298 f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none);
1299 f_shutdown_helper();
1300}
1301
Harald Welte6f521d82017-12-11 19:52:02 +01001302/* Verify paging retransmission interval + count */
1303/* Verify paging stops after channel establishment */
Harald Welte6f521d82017-12-11 19:52:02 +01001304/* Test behavior under paging overload */
Harald Welteae026692017-12-09 01:03:01 +01001305
Harald Weltee65d40e2017-12-13 00:09:06 +01001306/* Verify PCH load */
1307testcase TC_paging_imsi_load() runs on test_CT {
1308 var BSSMAP_FIELD_CellIdentificationList cid_list;
1309 timer T := 4.0;
Harald Welte2caa1062018-03-17 18:19:05 +01001310 timer T_retrans := 1.0;
Harald Weltee65d40e2017-12-13 00:09:06 +01001311 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001312 f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all);
Harald Weltee65d40e2017-12-13 00:09:06 +01001313
1314 /* tell BSC there is no paging space anymore */
1315 f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0));
Harald Welte3b57ab52018-03-17 18:01:10 +01001316 f_sleep(0.2);
1317 IPA_RSL[0].clear;
Harald Weltee65d40e2017-12-13 00:09:06 +01001318
1319 /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally,
1320 * there would be 8 retransmissions during 4 seconds */
1321 T.start;
Harald Welte2caa1062018-03-17 18:19:05 +01001322 T_retrans.start;
Harald Weltee65d40e2017-12-13 00:09:06 +01001323 alt {
1324 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) {
1325 setverdict(fail, "Received PAGING after LOAD_IND(0)");
Daniel Willmannafce8662018-07-06 23:11:32 +02001326 mtc.stop;
Harald Weltee65d40e2017-12-13 00:09:06 +01001327 }
Harald Welte2caa1062018-03-17 18:19:05 +01001328 [] T_retrans.timeout {
1329 /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */
1330 f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0));
1331 T_retrans.start;
1332 repeat;
1333 }
Harald Weltee65d40e2017-12-13 00:09:06 +01001334 [] T.timeout {
1335 setverdict(pass);
1336 }
1337 }
Philipp Maier282ca4b2018-02-27 17:17:00 +01001338
1339 f_shutdown_helper();
Harald Weltee65d40e2017-12-13 00:09:06 +01001340}
1341
Harald Welte235ebf12017-12-15 14:18:16 +01001342/* Verify Paging Counter */
Harald Welte1ff69992017-12-14 12:31:17 +01001343testcase TC_paging_counter() runs on test_CT {
1344 var BSSMAP_FIELD_CellIdentificationList cid_list;
1345 timer T := 4.0;
1346 var integer i;
1347 var integer paging_attempted_bsc;
1348 var integer paging_attempted_bts[NUM_BTS];
1349 var integer paging_expired_bts[NUM_BTS];
1350 cid_list := valueof(ts_BSSMAP_CIL_noCell);
1351
1352 f_init();
1353
1354 /* read counters before paging */
1355 paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted");
1356 for (i := 0; i < NUM_BTS; i := i+1) {
1357 paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted");
1358 paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired");
1359 }
1360
1361 f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all);
1362
1363 /* expect the attempted pages on BSC and each BTSs to have incremented by one */
1364 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1);
1365 for (i := 0; i < NUM_BTS; i := i+1) {
1366 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted",
1367 paging_attempted_bts[i]+1);
1368 }
1369
1370 /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */
1371 f_sleep(12.0);
1372 for (i := 0; i < NUM_BTS; i := i+1) {
1373 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired",
1374 paging_expired_bts[i]+1);
1375 }
Harald Welte1ff69992017-12-14 12:31:17 +01001376
Philipp Maier282ca4b2018-02-27 17:17:00 +01001377 f_shutdown_helper();
Harald Welte1ff69992017-12-14 12:31:17 +01001378}
1379
1380
Harald Welte10985002017-12-12 09:29:15 +01001381/* Verify paging stops after A-RESET */
1382testcase TC_paging_imsi_a_reset() runs on test_CT {
1383 var BSSMAP_FIELD_CellIdentificationList cid_list;
1384 timer T := 3.0;
1385 cid_list := valueof(ts_BSSMAP_CIL_noCell);
Harald Welte5d1a2202017-12-13 19:51:29 +01001386 f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all);
Harald Welte10985002017-12-12 09:29:15 +01001387
1388 /* Perform a BSSMAP Reset and wait for ACK */
Harald Weltea4ca4462018-02-09 00:17:14 +01001389 BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
Harald Welte10985002017-12-12 09:29:15 +01001390 alt {
Harald Weltea4ca4462018-02-09 00:17:14 +01001391 [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { }
Harald Welte10985002017-12-12 09:29:15 +01001392 [] BSSAP.receive { repeat; }
1393 }
1394
Daniel Willmanncbef3982018-07-30 09:22:40 +02001395 /* Wait to avoid a possible race condition if a paging message is
1396 * received right before the reset ACK. */
1397 f_sleep(0.2);
1398
Harald Welte10985002017-12-12 09:29:15 +01001399 /* Clear the queue, it might still contain stuff like BCCH FILLING */
Philipp Maier1e6b4422018-02-23 14:02:13 +01001400 for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) {
1401 IPA_RSL[i].clear;
1402 }
Harald Welte10985002017-12-12 09:29:15 +01001403
1404 /* Wait for 3 seconds if any more PAGING CMD are received on RSL */
1405 T.start;
1406 alt {
1407 [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) {
1408 setverdict(fail, "Received PAGING after A-RESET");
Daniel Willmannafce8662018-07-06 23:11:32 +02001409 mtc.stop;
Harald Welte10985002017-12-12 09:29:15 +01001410 }
Harald Welte5d1a2202017-12-13 19:51:29 +01001411 [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) {
1412 setverdict(fail, "Received PAGING after A-RESET");
Daniel Willmannafce8662018-07-06 23:11:32 +02001413 mtc.stop;
Harald Welte5d1a2202017-12-13 19:51:29 +01001414 }
1415 [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) {
1416 setverdict(fail, "Received PAGING after A-RESET");
Daniel Willmannafce8662018-07-06 23:11:32 +02001417 mtc.stop;
Harald Welte5d1a2202017-12-13 19:51:29 +01001418 }
Harald Welte10985002017-12-12 09:29:15 +01001419 [] T.timeout {
1420 setverdict(pass);
1421 }
1422 }
Philipp Maier282ca4b2018-02-27 17:17:00 +01001423
1424 f_shutdown_helper();
Harald Welte10985002017-12-12 09:29:15 +01001425}
Harald Welteae026692017-12-09 01:03:01 +01001426
Harald Welte4e9b9cc2017-12-14 18:31:02 +01001427/* Test RSL link drop causes counter increment */
1428testcase TC_rsl_drop_counter() runs on test_CT {
1429 var integer rsl_fail;
1430
Harald Welte89d42e82017-12-17 16:42:41 +01001431 f_init(1);
Harald Welte4e9b9cc2017-12-14 18:31:02 +01001432
1433 rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail");
1434
1435 bts[0].rsl.vc_IPA.stop;
1436
1437 f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1);
1438
1439 setverdict(pass);
1440}
1441
1442/* TODO: Test OML link drop causes counter increment */
1443
Stefan Sperling830dc9d2018-02-12 21:08:28 +01001444/* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */
1445function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean {
1446 timer T := 10.0;
1447
1448 bts[0].rsl.id := "IPA-0-RSL";
1449 bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
1450 bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
1451 bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
1452 bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at BTS */
1453
Stefan Sperling830dc9d2018-02-12 21:08:28 +01001454 f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
1455
1456 f_init_mgcp("VirtMSC");
1457
1458 /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */
1459 map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
1460 connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
1461 bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars));
1462
1463 /* wait for IPA OML link to connect and then disconnect */
1464 T.start;
1465 alt {
1466 [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
1467 T.stop;
1468 return true;
1469 }
1470 [] IPA_RSL[0].receive { repeat }
1471 [] T.timeout {
Daniel Willmannafce8662018-07-06 23:11:32 +02001472 return false;
Stefan Sperling830dc9d2018-02-12 21:08:28 +01001473 }
1474 }
Stefan Sperling830dc9d2018-02-12 21:08:28 +01001475 return false;
1476}
1477
1478/* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */
1479testcase TC_rsl_unknown_unit_id() runs on test_CT {
1480 if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) {
1481 setverdict(pass);
1482 } else {
1483 setverdict(fail, "Timeout RSL waiting for connection to close");
1484 }
1485}
1486
1487
1488/* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */
1489testcase TC_oml_unknown_unit_id() runs on test_CT {
1490 if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) {
1491 setverdict(pass);
1492 } else {
1493 setverdict(fail, "Timeout OML waiting for connection to close");
1494 }
1495}
1496
1497
Harald Weltec1a2fff2017-12-17 11:06:19 +01001498/***********************************************************************
1499 * "New world" test cases using RSL_Emulation + BSSMAP_Emulation
1500 ***********************************************************************/
1501
1502import from BSSMAP_Emulation all;
1503import from RSL_Emulation all;
1504import from MSC_ConnectionHandler all;
1505
1506type function void_fn(charstring id) runs on MSC_ConnHdlr;
1507
Harald Welte336820c2018-05-31 20:34:52 +02001508/* helper function to create and connect a MSC_ConnHdlr component */
Harald Welteff579f92018-05-31 22:19:39 +02001509private function f_connect_handler(inout MSC_ConnHdlr vc_conn) runs on test_CT {
Harald Weltea4ca4462018-02-09 00:17:14 +01001510 connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC);
Daniel Willmann191e0d92018-01-17 12:44:35 +01001511 connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
Harald Weltec1a2fff2017-12-17 11:06:19 +01001512 connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
Harald Weltef70df652018-01-29 22:00:23 +01001513 connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC);
Philipp Maier88f4ae82018-03-01 14:00:58 +01001514 if (isvalue(bts[1])) {
Philipp Maier956a92f2018-02-16 10:58:07 +01001515 connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT);
1516 connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC);
1517 }
Harald Weltea4ca4462018-02-09 00:17:14 +01001518 connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT);
Daniel Willmann191e0d92018-01-17 12:44:35 +01001519 connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
Harald Welte336820c2018-05-31 20:34:52 +02001520}
1521
1522function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit)
1523runs on test_CT return MSC_ConnHdlr {
1524 var charstring id := testcasename();
1525 var MSC_ConnHdlr vc_conn;
1526 vc_conn := MSC_ConnHdlr.create(id);
1527 f_connect_handler(vc_conn);
Harald Weltea0630032018-03-20 21:09:55 +01001528 vc_conn.start(f_handler_init(fn, id, pars));
Harald Weltec1a2fff2017-12-17 11:06:19 +01001529 return vc_conn;
1530}
1531
Harald Weltea0630032018-03-20 21:09:55 +01001532/* first function inside ConnHdlr component; sets g_pars + starts function */
1533private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit)
1534runs on MSC_ConnHdlr {
1535 if (isvalue(pars)) {
1536 g_pars := valueof(pars);
1537 }
1538 fn.apply(id);
1539}
1540
Harald Welte3c86ea02018-05-10 22:28:05 +02001541/* Establish signalling channel (non-assignment case) followed by cipher mode */
1542private function f_tc_ciph_mode_a5(charstring id) runs on MSC_ConnHdlr {
Harald Welteed848512018-05-24 22:27:58 +02001543 var template PDU_BSSAP exp_compl := f_gen_exp_compl();
1544 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte3c86ea02018-05-10 22:28:05 +02001545 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL);
Philipp Maier23000732018-05-18 11:25:37 +02001546 ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit;
1547 ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit;
1548 exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit;
1549 exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit;
Harald Welte3c86ea02018-05-10 22:28:05 +02001550
Philipp Maier23000732018-05-18 11:25:37 +02001551 f_establish_fully(ass_cmd, exp_compl);
Harald Welte3c86ea02018-05-10 22:28:05 +02001552}
1553testcase TC_ciph_mode_a5_0() runs on test_CT {
1554 var MSC_ConnHdlr vc_conn;
1555 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1556 pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8)));
1557
1558 f_init(1, true);
1559 f_sleep(1.0);
1560 vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars);
1561 vc_conn.done;
1562}
1563testcase TC_ciph_mode_a5_1() runs on test_CT {
1564 var MSC_ConnHdlr vc_conn;
1565 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1566 pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8)));
1567
1568 f_init(1, true);
1569 f_sleep(1.0);
1570 vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars);
1571 vc_conn.done;
1572}
1573testcase TC_ciph_mode_a5_3() runs on test_CT {
1574 var MSC_ConnHdlr vc_conn;
1575 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1576 pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8)));
1577
1578 f_init(1, true);
1579 f_sleep(1.0);
1580 vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars);
1581 vc_conn.done;
1582}
1583
1584
1585/* establish initial channel, enable ciphering followed by assignment to ciphered channel */
Harald Welte651fcdc2018-05-10 20:23:16 +02001586private function f_tc_assignment_fr_a5(charstring id) runs on MSC_ConnHdlr {
Harald Welteed848512018-05-24 22:27:58 +02001587 var template PDU_BSSAP exp_compl := f_gen_exp_compl();
1588 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Weltec1a2fff2017-12-17 11:06:19 +01001589
Harald Welte552620d2017-12-16 23:21:36 +01001590 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
1591 ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
Harald Welte73cd2712017-12-17 00:44:52 +01001592
Harald Weltea0630032018-03-20 21:09:55 +01001593 f_establish_fully(ass_cmd, exp_compl);
Harald Welte552620d2017-12-16 23:21:36 +01001594}
Harald Welte552620d2017-12-16 23:21:36 +01001595testcase TC_assignment_fr_a5_0() runs on test_CT {
1596 var MSC_ConnHdlr vc_conn;
Harald Welte651fcdc2018-05-10 20:23:16 +02001597 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1598 pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8)));
Harald Welte552620d2017-12-16 23:21:36 +01001599
Harald Welte89d42e82017-12-17 16:42:41 +01001600 f_init(1, true);
Harald Welte552620d2017-12-16 23:21:36 +01001601 f_sleep(1.0);
Harald Welte651fcdc2018-05-10 20:23:16 +02001602 vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars);
Harald Welte552620d2017-12-16 23:21:36 +01001603 vc_conn.done;
1604}
Harald Welte552620d2017-12-16 23:21:36 +01001605testcase TC_assignment_fr_a5_1() runs on test_CT {
Harald Weltec1a2fff2017-12-17 11:06:19 +01001606 var MSC_ConnHdlr vc_conn;
Harald Welte651fcdc2018-05-10 20:23:16 +02001607 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1608 pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8)));
Harald Weltec1a2fff2017-12-17 11:06:19 +01001609
Harald Welte89d42e82017-12-17 16:42:41 +01001610 f_init(1, true);
Harald Weltec1a2fff2017-12-17 11:06:19 +01001611 f_sleep(1.0);
Harald Welte651fcdc2018-05-10 20:23:16 +02001612 vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars);
1613 vc_conn.done;
1614}
1615testcase TC_assignment_fr_a5_3() runs on test_CT {
1616 var MSC_ConnHdlr vc_conn;
1617 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1618 pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8)));
Harald Weltec1a2fff2017-12-17 11:06:19 +01001619
Harald Welte651fcdc2018-05-10 20:23:16 +02001620 f_init(1, true);
1621 f_sleep(1.0);
1622 vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars);
Harald Weltec1a2fff2017-12-17 11:06:19 +01001623 vc_conn.done;
1624}
1625
Harald Welte552620d2017-12-16 23:21:36 +01001626/* Expect ASSIGNMENT FAIL if mandatory IE is missing */
1627private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01001628 g_pars := valueof(t_def_TestHdlrPars);
Harald Welte552620d2017-12-16 23:21:36 +01001629 var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail;
Harald Welteed848512018-05-24 22:27:58 +02001630 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte552620d2017-12-16 23:21:36 +01001631 const OCT8 kc := '0001020304050607'O;
1632
1633 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02001634 /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */
1635
Harald Weltea0630032018-03-20 21:09:55 +01001636 f_establish_fully(ass_cmd, exp_fail);
Harald Welte552620d2017-12-16 23:21:36 +01001637}
Harald Welte552620d2017-12-16 23:21:36 +01001638testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT {
1639 var MSC_ConnHdlr vc_conn;
1640
Harald Welte89d42e82017-12-17 16:42:41 +01001641 f_init(1, true);
Harald Welte552620d2017-12-16 23:21:36 +01001642 f_sleep(1.0);
1643
Harald Welte8863fa12018-05-10 20:15:27 +02001644 vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_1_codec_missing));
Harald Welte552620d2017-12-16 23:21:36 +01001645 vc_conn.done;
1646}
1647
Harald Welte552620d2017-12-16 23:21:36 +01001648private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01001649 g_pars := valueof(t_def_TestHdlrPars);
Harald Welteed848512018-05-24 22:27:58 +02001650 var template PDU_BSSAP exp_compl := f_gen_exp_compl();
1651 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte552620d2017-12-16 23:21:36 +01001652 const OCT8 kc := '0001020304050607'O;
1653 const OCT16 kc128 := kc & kc;
1654
1655 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
1656 ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
Harald Weltea0630032018-03-20 21:09:55 +01001657 f_establish_fully(ass_cmd, exp_compl);
Harald Welte38b2a102017-12-23 02:42:58 +01001658 f_cipher_mode('10'O, kc, kc128, true);
Harald Welte552620d2017-12-16 23:21:36 +01001659 /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */
Harald Welte552620d2017-12-16 23:21:36 +01001660}
Harald Welte552620d2017-12-16 23:21:36 +01001661testcase TC_assignment_fr_a5_4() runs on test_CT {
1662 var MSC_ConnHdlr vc_conn;
1663
Harald Welte89d42e82017-12-17 16:42:41 +01001664 f_init(1, true);
Harald Welte552620d2017-12-16 23:21:36 +01001665 f_sleep(1.0);
1666
Harald Welte8863fa12018-05-10 20:15:27 +02001667 vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4));
Harald Welte552620d2017-12-16 23:21:36 +01001668 vc_conn.done;
1669}
1670
1671
Harald Welte4532e0a2017-12-23 02:05:44 +01001672private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr {
Philipp Maier6a50c7c2018-04-16 16:15:59 +02001673 g_pars := valueof(t_def_TestHdlrPars);
Harald Welte4532e0a2017-12-23 02:05:44 +01001674 var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit);
1675 var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, omit));
1676
1677 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL);
Harald Weltea0630032018-03-20 21:09:55 +01001678 f_establish_fully(ass_cmd, exp_compl);
Harald Welte4532e0a2017-12-23 02:05:44 +01001679}
1680
1681testcase TC_assignment_sign() runs on test_CT {
1682 var MSC_ConnHdlr vc_conn;
1683
1684 f_init(1, true);
1685 f_sleep(1.0);
1686
Harald Welte8863fa12018-05-10 20:15:27 +02001687 vc_conn := f_start_handler(refers(f_tc_assignment_sign));
Harald Welte4532e0a2017-12-23 02:05:44 +01001688 vc_conn.done;
1689}
1690
Harald Welte60aa5762018-03-21 19:33:13 +01001691/***********************************************************************
1692 * Codec (list) testing
1693 ***********************************************************************/
1694
1695/* check if the given rsl_mode is compatible with the a_elem */
1696private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode)
1697return boolean {
1698 select (a_elem.codecType) {
1699 case (GSM_FR) {
1700 if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) {
1701 return true;
1702 }
1703 }
1704 case (GSM_HR) {
1705 if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) {
1706 return true;
1707 }
1708 }
1709 case (GSM_EFR) {
1710 if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) {
1711 return true;
1712 }
1713 }
1714 case (FR_AMR) {
1715 if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) {
1716 return true;
1717 }
1718 }
1719 case (HR_AMR) {
1720 if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) {
1721 return true;
1722 }
1723 }
1724 case else { }
1725 }
1726 return false;
1727}
1728
1729/* check if the given rsl_mode is compatible with the a_list */
1730private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode)
1731return boolean {
1732 for (var integer i := 0; i < sizeof(a_list); i := i+1) {
1733 if (f_match_codec(a_list.codecElements[i], rsl_mode)) {
1734 return true;
1735 }
1736 }
1737 return false;
1738}
1739
1740/* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */
Philipp Maier61f6b572018-07-06 14:03:38 +02001741function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem)
Harald Welte60aa5762018-03-21 19:33:13 +01001742return BSSMAP_IE_ChannelType {
1743 /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */
1744 var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType);
1745 select (a_elem.codecType) {
1746 case (GSM_FR) {
1747 ret.channelRateAndType := ChRate_TCHF;
1748 ret.speechId_DataIndicator := Spdi_TCHF_FR;
1749 }
1750 case (GSM_HR) {
1751 ret.channelRateAndType := ChRate_TCHH;
1752 ret.speechId_DataIndicator := Spdi_TCHH_HR;
1753 }
1754 case (GSM_EFR) {
1755 ret.channelRateAndType := ChRate_TCHF;
1756 ret.speechId_DataIndicator := Spdi_TCHF_EFR;
1757 }
1758 case (FR_AMR) {
1759 ret.channelRateAndType := ChRate_TCHF;
1760 ret.speechId_DataIndicator := Spdi_TCHF_AMR;
1761 }
1762 case (HR_AMR) {
1763 ret.channelRateAndType := ChRate_TCHH;
1764 ret.speechId_DataIndicator := Spdi_TCHH_AMR;
1765 }
1766 case else {
1767 setverdict(fail, "Unsupported codec ", a_elem);
Daniel Willmannafce8662018-07-06 23:11:32 +02001768 mtc.stop;
Harald Welte60aa5762018-03-21 19:33:13 +01001769 }
1770 }
1771 return ret;
1772}
1773
Harald Weltea63b9102018-03-22 20:36:16 +01001774private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem)
1775return template RSL_IE_Body {
1776 var template RSL_IE_Body mode_ie := {
1777 chan_mode := {
1778 len := ?,
1779 reserved := ?,
1780 dtx_d := ?,
1781 dtx_u := ?,
1782 spd_ind := RSL_SPDI_SPEECH,
1783 ch_rate_type := -,
1784 coding_alg_rate := -
1785 }
1786 }
1787
1788 select (a_elem.codecType) {
1789 case (GSM_FR) {
1790 mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F;
1791 mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1;
1792 }
1793 case (GSM_HR) {
1794 mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H;
1795 mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1;
1796 }
1797 case (GSM_EFR) {
1798 mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F;
1799 mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2;
1800 }
1801 case (FR_AMR) {
1802 mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F;
1803 mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3;
1804 }
1805 case (HR_AMR) {
1806 mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H;
1807 mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3;
1808 }
1809 }
1810 return mode_ie;
1811}
1812
Harald Welte60aa5762018-03-21 19:33:13 +01001813type record CodecListTest {
1814 BSSMAP_IE_SpeechCodecList codec_list,
1815 charstring id
1816}
1817type record of CodecListTest CodecListTests
1818
1819private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr {
Harald Welteed848512018-05-24 22:27:58 +02001820 var PDU_BSSAP ass_cmd := f_gen_ass_req();
1821 var template PDU_BSSAP exp_compl := f_gen_exp_compl();
Harald Welte60aa5762018-03-21 19:33:13 +01001822
1823 /* puzzle together the ASSIGNMENT REQ for given codec[s] */
Harald Welte79f3f542018-05-25 20:02:37 +02001824 if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
1825 ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list;
1826 exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] :=
1827 g_pars.ass_codec_list.codecElements[0];
1828 }
Harald Welte60aa5762018-03-21 19:33:13 +01001829 ass_cmd.pdu.bssmap.assignmentRequest.channelType :=
1830 f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]);
Harald Welte60aa5762018-03-21 19:33:13 +01001831 log("expecting ASS COMPL like this: ", exp_compl);
1832
1833 f_establish_fully(ass_cmd, exp_compl);
Harald Weltea63b9102018-03-22 20:36:16 +01001834
1835 /* Verify that the RSL-side activation actually matches our expectations */
1836 var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr);
1837
1838 var RSL_IE_Body mode_ie;
1839 if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) {
1840 setverdict(fail, "Couldn't find CHAN_MODE IE");
Daniel Willmannafce8662018-07-06 23:11:32 +02001841 mtc.stop;
Harald Weltea63b9102018-03-22 20:36:16 +01001842 }
1843 var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]);
1844 if (not match(mode_ie, t_mode_ie)) {
1845 setverdict(fail, "RSL Channel Mode IE doesn't match expectation");
1846 }
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001847
1848 var RSL_IE_Body mr_conf;
1849 if (g_pars.expect_mr_conf_ie != omit) {
1850 if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) {
1851 setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ");
Daniel Willmannafce8662018-07-06 23:11:32 +02001852 mtc.stop;
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001853 }
1854 log("found RSL MR CONFIG IE: ", mr_conf);
1855
1856 if (not match(mr_conf, g_pars.expect_mr_conf_ie)) {
1857 setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ",
1858 g_pars.expect_mr_conf_ie);
1859 }
1860 } else {
1861 if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) {
1862 log("found RSL MR CONFIG IE: ", mr_conf);
1863 setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit");
Daniel Willmannafce8662018-07-06 23:11:32 +02001864 mtc.stop;
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001865 }
1866 }
Harald Welte60aa5762018-03-21 19:33:13 +01001867}
1868
1869testcase TC_assignment_codec_fr() runs on test_CT {
1870 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1871 var MSC_ConnHdlr vc_conn;
1872
1873 f_init(1, true);
1874 f_sleep(1.0);
1875
1876 pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
Harald Welte8863fa12018-05-10 20:15:27 +02001877 vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
Harald Welte60aa5762018-03-21 19:33:13 +01001878 vc_conn.done;
1879}
1880
1881testcase TC_assignment_codec_hr() runs on test_CT {
1882 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1883 var MSC_ConnHdlr vc_conn;
1884
1885 f_init(1, true);
1886 f_sleep(1.0);
1887
1888 pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR}));
Harald Welte8863fa12018-05-10 20:15:27 +02001889 vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
Harald Welte60aa5762018-03-21 19:33:13 +01001890 vc_conn.done;
1891}
1892
1893testcase TC_assignment_codec_efr() runs on test_CT {
1894 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1895 var MSC_ConnHdlr vc_conn;
1896
1897 f_init(1, true);
1898 f_sleep(1.0);
1899
1900 pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR}));
Harald Welte8863fa12018-05-10 20:15:27 +02001901 vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
Harald Welte60aa5762018-03-21 19:33:13 +01001902 vc_conn.done;
1903}
1904
1905testcase TC_assignment_codec_amr_f() runs on test_CT {
1906 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1907 var MSC_ConnHdlr vc_conn;
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001908 var RSL_IE_Body mr_conf := {
1909 other := {
1910 len := 2,
1911 payload := '2804'O
1912 }
1913 };
Harald Welte60aa5762018-03-21 19:33:13 +01001914
1915 f_init(1, true);
1916 f_sleep(1.0);
1917
1918 pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F}));
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001919 pars.expect_mr_conf_ie := mr_conf;
Harald Welte8863fa12018-05-10 20:15:27 +02001920 vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
Harald Welte60aa5762018-03-21 19:33:13 +01001921 vc_conn.done;
1922}
1923
1924testcase TC_assignment_codec_amr_h() runs on test_CT {
1925 var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
1926 var MSC_ConnHdlr vc_conn;
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001927 var RSL_IE_Body mr_conf := {
1928 other := {
1929 len := 2,
1930 payload := '2804'O
1931 }
1932 };
Harald Welte60aa5762018-03-21 19:33:13 +01001933
1934 f_init(1, true);
1935 f_sleep(1.0);
1936
1937 pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H}));
Neels Hofmeyrbcf62bc2018-07-04 00:24:33 +02001938 pars.expect_mr_conf_ie := mr_conf;
Harald Welte8863fa12018-05-10 20:15:27 +02001939 vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars);
Harald Welte60aa5762018-03-21 19:33:13 +01001940 vc_conn.done;
1941}
1942
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001943/* test the procedure of the MSC requesting a Classmark Update:
1944 * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY,
1945 * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */
Harald Welte898113b2018-01-31 18:32:21 +01001946private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01001947 g_pars := valueof(t_def_TestHdlrPars);
1948 f_create_chan_and_exp();
Harald Welte898113b2018-01-31 18:32:21 +01001949 /* we should now have a COMPL_L3 at the MSC */
1950 BSSAP.receive(tr_BSSMAP_ComplL3);
1951
Neels Hofmeyr92b12b72018-09-18 14:30:23 +02001952 BSSAP.send(ts_BSSMAP_ClassmarkRequest);
1953 RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY));
1954
Harald Welte898113b2018-01-31 18:32:21 +01001955 f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2)));
1956 BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit));
1957 setverdict(pass);
1958}
1959testcase TC_classmark() runs on test_CT {
1960 var MSC_ConnHdlr vc_conn;
1961 f_init(1, true);
1962 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02001963 vc_conn := f_start_handler(refers(f_tc_classmark));
Harald Welte898113b2018-01-31 18:32:21 +01001964 vc_conn.done;
1965}
1966
Harald Weltee3bd6582018-01-31 22:51:25 +01001967private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01001968 g_pars := valueof(t_def_TestHdlrPars);
1969 f_create_chan_and_exp();
Harald Welte898113b2018-01-31 18:32:21 +01001970 /* we should now have a COMPL_L3 at the MSC */
1971 BSSAP.receive(tr_BSSMAP_ComplL3);
1972
Harald Weltee3bd6582018-01-31 22:51:25 +01001973 /* send the single message we want to send */
1974 f_rsl_send_l3(l3);
1975}
1976
1977private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr {
1978 timer T := sec;
1979 var PDU_BSSAP bssap;
Harald Welte898113b2018-01-31 18:32:21 +01001980 T.start;
1981 alt {
Harald Weltee3bd6582018-01-31 22:51:25 +01001982 [] BSSAP.receive(PDU_BSSAP:?) -> value bssap {
1983 setverdict(fail, "Unexpected BSSMAP ", bssap);
Daniel Willmannafce8662018-07-06 23:11:32 +02001984 mtc.stop;
Harald Welte898113b2018-01-31 18:32:21 +01001985 }
1986 [] T.timeout {
1987 setverdict(pass);
1988 }
1989 }
1990}
1991
Harald Weltee3bd6582018-01-31 22:51:25 +01001992/* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */
1993private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr {
1994 f_est_single_l3(ts_RRM_AssignmentFailure('00'O));
1995 f_bssap_expect_nothing();
1996}
Harald Welte898113b2018-01-31 18:32:21 +01001997testcase TC_unsol_ass_fail() runs on test_CT {
1998 var MSC_ConnHdlr vc_conn;
1999 f_init(1, true);
2000 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002001 vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail));
Harald Welte898113b2018-01-31 18:32:21 +01002002 vc_conn.done;
2003}
Harald Welte552620d2017-12-16 23:21:36 +01002004
Harald Welteea99a002018-01-31 20:46:43 +01002005
2006/* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */
2007private function f_tc_unsol_ass_compl(charstring id) runs on MSC_ConnHdlr {
Harald Weltee3bd6582018-01-31 22:51:25 +01002008 f_est_single_l3(ts_RRM_AssignmentComplete('00'O));
2009 f_bssap_expect_nothing();
Harald Welteea99a002018-01-31 20:46:43 +01002010}
2011testcase TC_unsol_ass_compl() runs on test_CT {
2012 var MSC_ConnHdlr vc_conn;
2013 f_init(1, true);
2014 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002015 vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl));
Harald Welteea99a002018-01-31 20:46:43 +01002016 vc_conn.done;
2017}
2018
2019
Harald Weltefbf9b5e2018-01-31 20:41:23 +01002020/* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */
2021private function f_tc_unsol_ho_fail(charstring id) runs on MSC_ConnHdlr {
Harald Weltee3bd6582018-01-31 22:51:25 +01002022 f_est_single_l3(ts_RRM_HandoverFailure('00'O));
2023 f_bssap_expect_nothing();
Harald Weltefbf9b5e2018-01-31 20:41:23 +01002024}
Harald Weltefbf9b5e2018-01-31 20:41:23 +01002025testcase TC_unsol_ho_fail() runs on test_CT {
2026 var MSC_ConnHdlr vc_conn;
2027 f_init(1, true);
2028 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002029 vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail));
Harald Weltefbf9b5e2018-01-31 20:41:23 +01002030 vc_conn.done;
2031}
2032
2033
Harald Weltee3bd6582018-01-31 22:51:25 +01002034/* short message from MS should be ignored */
2035private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01002036 g_pars := valueof(t_def_TestHdlrPars);
2037 f_create_chan_and_exp();
Harald Weltee3bd6582018-01-31 22:51:25 +01002038 /* we should now have a COMPL_L3 at the MSC */
2039 BSSAP.receive(tr_BSSMAP_ComplL3);
2040
2041 /* send short message */
2042 RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O));
2043 f_bssap_expect_nothing();
2044}
2045testcase TC_err_82_short_msg() runs on test_CT {
2046 var MSC_ConnHdlr vc_conn;
2047 f_init(1, true);
2048 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002049 vc_conn := f_start_handler(refers(f_tc_err_82_short_msg));
Harald Weltee3bd6582018-01-31 22:51:25 +01002050 vc_conn.done;
2051}
2052
2053
Harald Weltee9e02e42018-01-31 23:36:25 +01002054/* 24.008 8.4 Unknown message must trigger RR STATUS */
2055private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr {
2056 f_est_single_l3(ts_RRM_UL_REL('00'O));
2057 timer T := 3.0
2058 alt {
2059 [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) {
2060 setverdict(pass);
2061 }
2062 [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); }
Harald Welte458fd372018-03-21 11:26:23 +01002063 [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); }
Harald Weltee9e02e42018-01-31 23:36:25 +01002064 }
2065}
2066testcase TC_err_84_unknown_msg() runs on test_CT {
2067 var MSC_ConnHdlr vc_conn;
2068 f_init(1, true);
2069 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002070 vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg));
Harald Weltee9e02e42018-01-31 23:36:25 +01002071 vc_conn.done;
2072}
2073
Harald Welte94e0c342018-04-07 11:33:23 +02002074/* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */
2075private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr)
2076runs on test_CT {
2077 var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)&
2078 " timeslot "&int2str(ts_nr)&" ";
2079 f_vty_transceive(BSCVTY, cmd & suffix);
2080}
2081
Harald Welte261af4b2018-02-12 21:20:39 +01002082/* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */
2083private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr)
2084runs on MSC_ConnHdlr {
2085 /* FIXME: resolve those from component-global state */
2086 var integer ts_nr := chan_nr.tn;
2087 var integer ss_nr;
2088 if (ischosen(chan_nr.u.ch0)) {
2089 ss_nr := 0;
2090 } else if (ischosen(chan_nr.u.lm)) {
2091 ss_nr := chan_nr.u.lm.sub_chan;
2092 } else if (ischosen(chan_nr.u.sdcch4)) {
2093 ss_nr := chan_nr.u.sdcch4.sub_chan;
2094 } else if (ischosen(chan_nr.u.sdcch8)) {
2095 ss_nr := chan_nr.u.sdcch8.sub_chan;
2096 } else {
2097 setverdict(fail, "Invalid ChanNr ", chan_nr);
Daniel Willmannafce8662018-07-06 23:11:32 +02002098 mtc.stop;
Harald Welte261af4b2018-02-12 21:20:39 +01002099 }
2100
2101 var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)&
2102 " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" ";
2103 f_vty_transceive(BSCVTY, cmd & suffix);
2104}
2105
2106private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr,
2107 integer new_bts_nr)
2108runs on MSC_ConnHdlr {
2109 f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr);
2110}
2111
2112/* intra-BSC hand-over between BTS0 and BTS1 */
2113private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr {
Harald Weltea0630032018-03-20 21:09:55 +01002114 g_pars := valueof(t_def_TestHdlrPars);
Harald Welteed848512018-05-24 22:27:58 +02002115 var template PDU_BSSAP exp_compl := f_gen_exp_compl();
2116 var PDU_BSSAP ass_cmd := f_gen_ass_req();
Harald Welte261af4b2018-02-12 21:20:39 +01002117 const OCT8 kc := '0001020304050607'O;
2118
2119 ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType);
2120 ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
2121
Harald Weltea0630032018-03-20 21:09:55 +01002122 f_establish_fully(ass_cmd, exp_compl);
Harald Welte261af4b2018-02-12 21:20:39 +01002123
2124 var HandoverState hs := {
2125 rr_ho_cmpl_seen := false,
2126 handover_done := false,
2127 old_chan_nr := -
2128 };
2129 /* issue hand-over command on VTY */
2130 f_vty_handover(0, 0, g_chan_nr, 1);
2131 /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */
2132 f_rslem_suspend(RSL1_PROC);
Philipp Maier3e2af5d2018-07-11 17:01:05 +02002133
2134 /* From the MGW perspective, a handover is is characterized by
2135 * performing one MDCX operation with the MGW. So we expect to see
2136 * one more MDCX during handover. */
2137 g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1;
2138
Harald Welte261af4b2018-02-12 21:20:39 +01002139 alt {
2140 [] as_handover(hs);
Harald Welte261af4b2018-02-12 21:20:39 +01002141 }
Philipp Maier3e2af5d2018-07-11 17:01:05 +02002142
2143 /* Check the amount of MGCP transactions is still consistant with the
2144 * test expectation */
2145 f_check_mgcp_expectations()
Harald Welte261af4b2018-02-12 21:20:39 +01002146}
2147
2148testcase TC_ho_int() runs on test_CT {
2149 var MSC_ConnHdlr vc_conn;
2150 f_init(2, true);
2151 f_sleep(1.0);
Harald Welte8863fa12018-05-10 20:15:27 +02002152 vc_conn := f_start_handler(refers(f_tc_ho_int));
Harald Welte261af4b2018-02-12 21:20:39 +01002153 vc_conn.done;
2154}
Harald Weltee9e02e42018-01-31 23:36:25 +01002155
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +01002156/* OS#3041: Open and close N connections in a normal fashion, and expect no
2157 * BSSMAP Reset just because of that. */
2158testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT {
2159 var default d;
2160 var integer i;
2161 var DchanTuple dt;
2162
2163 f_init();
2164
2165 /* Wait for initial BSSMAP Reset to pass */
2166 f_sleep(4.0);
2167
2168 d := activate(no_bssmap_reset());
2169
2170 /* Setup up a number of connections and RLSD them again from the MSC
2171 * side. In the buggy behavior, the fourth one triggers BSSMAP Reset.
2172 * Let's do it some more times for good measure. */
Harald Weltec3260d92018-06-11 17:48:16 +02002173 for (i := 0; i < 4; i := i+1) {
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +01002174 /* Since we're doing a lot of runs, give each one a fresh
2175 * T_guard from the top. */
2176 T_guard.start;
2177
2178 /* Setup a BSSAP connection and clear it right away. This is
2179 * the MSC telling the BSC about a planned release, it's not an
2180 * erratic loss of a connection. */
Harald Weltea1897182018-06-11 13:53:09 +02002181 dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O);
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +01002182
2183 /* MSC disconnects (RLSD). */
2184 BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0));
2185 }
2186
2187 /* In the buggy behavior, a timeout of 2 seconds happens between above
2188 * trigger (logs "SIGTRAN connection down, reconnecting...") and the
2189 * actual BSSMAP Reset. Wait a bit longer just to make sure. */
2190 f_sleep(4.0);
2191
2192 deactivate(d);
2193 f_shutdown_helper();
2194}
Harald Welte552620d2017-12-16 23:21:36 +01002195
Neels Hofmeyr4ff93282018-03-12 04:25:35 +01002196/* OS#3041: Open and close N connections in a normal fashion, and expect no
2197 * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from
2198 * the MSC. */
2199testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT {
2200 var default d;
2201 var integer i;
2202 var DchanTuple dt;
2203 var BSSAP_N_DATA_ind rx_di;
Neels Hofmeyr4ff93282018-03-12 04:25:35 +01002204 var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL;
2205 var BssmapCause cause := enum2int(cause_val);
2206
2207 f_init();
2208
2209 /* Wait for initial BSSMAP Reset to pass */
2210 f_sleep(4.0);
2211
2212 d := activate(no_bssmap_reset());
2213
2214 /* Setup up a number of connections and RLSD them again from the MSC
2215 * side. In the buggy behavior, the fourth one triggers BSSMAP Reset.
2216 * Let's do it some more times for good measure. */
2217 for (i := 0; i < 8; i := i+1) {
2218 /* Since we're doing a lot of runs, give each one a fresh
2219 * T_guard from the top. */
2220 T_guard.start;
2221
2222 /* Setup a BSSAP connection and clear it right away. This is
2223 * the MSC telling the BSC about a planned release, it's not an
2224 * erratic loss of a connection. */
Harald Weltea1897182018-06-11 13:53:09 +02002225 dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O);
Neels Hofmeyr4ff93282018-03-12 04:25:35 +01002226
2227 /* Instruct BSC to clear channel */
2228 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
2229
2230 /* expect BSC to disable the channel */
Harald Welte641fcbe2018-06-14 10:58:35 +02002231 f_exp_chan_rel_and_clear(dt, 0);
Neels Hofmeyr4ff93282018-03-12 04:25:35 +01002232 }
2233
2234 /* In the buggy behavior, a timeout of 2 seconds happens between above
2235 * trigger (logs "SIGTRAN connection down, reconnecting...") and the
2236 * actual BSSMAP Reset. Wait a bit longer just to make sure. */
2237 f_sleep(4.0);
2238
2239 deactivate(d);
2240 f_shutdown_helper();
2241}
2242
Neels Hofmeyrfd445c32018-03-09 15:39:31 +01002243/* OS#3041: Open and close N connections in a normal fashion, and expect no
2244 * BSSMAP Reset just because of that. Close connections from the MS side with a
2245 * Release Ind on RSL. */
2246testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT {
2247 var default d;
2248 var integer i;
2249 var DchanTuple dt;
2250 var BSSAP_N_DATA_ind rx_di;
Neels Hofmeyrfd445c32018-03-09 15:39:31 +01002251 var integer j;
2252
2253 f_init();
2254
2255 /* Wait for initial BSSMAP Reset to pass */
2256 f_sleep(4.0);
2257
2258 d := activate(no_bssmap_reset());
2259
2260 /* Setup up a number of connections and RLSD them again from the MSC
2261 * side. In the buggy behavior, the fourth one triggers BSSMAP Reset.
2262 * Let's do it some more times for good measure. */
2263 for (i := 0; i < 8; i := i+1) {
2264 /* Since we're doing a lot of runs, give each one a fresh
2265 * T_guard from the top. */
2266 T_guard.start;
2267
2268 /* Setup a BSSAP connection and clear it right away. This is
2269 * the MSC telling the BSC about a planned release, it's not an
2270 * erratic loss of a connection. */
2271 dt := f_est_dchan('23'O, 23, '00010203040506'O);
2272
2273 /* simulate RLL REL IND */
2274 f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0))));
2275
2276 /* expect Clear Request on MSC side */
2277 BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di;
2278
2279 /* Instruct BSC to clear channel */
2280 var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue);
2281 BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause)));
2282
2283 /* expect BSC to disable the channel */
Harald Welte641fcbe2018-06-14 10:58:35 +02002284 f_exp_chan_rel_and_clear(dt, 0);
Neels Hofmeyrfd445c32018-03-09 15:39:31 +01002285 }
2286
2287 /* In the buggy behavior, a timeout of 2 seconds happens between above
2288 * trigger (logs "SIGTRAN connection down, reconnecting...") and the
2289 * actual BSSMAP Reset. Wait a bit longer just to make sure. */
2290 f_sleep(4.0);
2291
2292 deactivate(d);
2293 f_shutdown_helper();
2294}
2295
Harald Welte94e0c342018-04-07 11:33:23 +02002296/***********************************************************************
2297 * IPA style dynamic PDCH
2298 ***********************************************************************/
2299
2300private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr,
2301 template (omit) RSL_Cause nack := omit)
2302runs on test_CT {
2303 var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr));
2304 var RSL_Message rsl_unused;
2305 /* ask BSC via VTY to activate a given IPA style chan as PDCH */
2306 f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr);
2307 /* expect the BSC to issue the related RSL command */
2308 rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr));
2309 if (istemplatekind(nack, "omit")) {
2310 /* respond with a related acknowledgement */
2311 f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342)));
2312 } else {
2313 f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack)));
2314 }
2315}
2316
2317private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr,
2318 template (omit) RSL_Cause nack := omit)
2319runs on test_CT {
2320 var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr));
2321 var RSL_Message rsl_unused;
2322 /* ask BSC via VTY to activate a given IPA style chan as PDCH */
2323 f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr);
2324 /* expect the BSC to issue the related RSL command */
2325 rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr));
2326 if (istemplatekind(nack, "omit")) {
2327 /* respond with a related acknowledgement */
2328 f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr));
2329 } else {
2330 f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack)));
2331 }
2332}
2333
2334private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr)
2335runs on test_CT return charstring {
2336 var charstring cmd, resp;
2337 cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr);
2338 resp := f_vty_transceive_ret(BSCVTY, cmd);
2339 return regexp(resp, "*\((*)\)*", 0);
2340}
2341
2342private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr,
2343 template charstring exp)
2344runs on test_CT {
2345 var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr);
2346 if (not match(mode, exp)) {
2347 setverdict(fail, "Unexpected TS Mode: ", mode);
Daniel Willmannafce8662018-07-06 23:11:32 +02002348 mtc.stop;
Harald Welte94e0c342018-04-07 11:33:23 +02002349 }
2350}
2351
2352private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb)
2353runs on test_CT {
2354 f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr);
2355 f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb);
2356 f_vty_transceive(BSCVTY, "end");
2357}
2358
2359private const charstring TCHF_MODE := "TCH/F mode";
2360private const charstring TCHH_MODE := "TCH/H mode";
2361private const charstring PDCH_MODE := "PDCH mode";
2362private const charstring NONE_MODE := "NONE mode";
2363
2364/* Test IPA PDCH activation / deactivation triggered by VTY */
2365testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT {
2366 var RSL_Message rsl_unused;
2367
2368 /* change Timeslot 6 before f_init() starts RSL */
2369 f_init_vty();
2370 f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH");
2371 f_vty_transceive(BSCVTY, "drop bts connection 0 oml");
2372
2373 f_init(1, false);
2374 f_sleep(1.0);
2375
2376 var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6));
2377
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002378 log("TCH/F_PDCH pchan starts out in TCH/F mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002379 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2380 /* The BSC will activate the dynamic PDCH by default, so confirm that */
2381 rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr));
2382 f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342)));
2383 f_sleep(1.0);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002384 log("TCH/F_PDCH pchan, PDCH ACT was ACKed, so now in PDCH mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002385 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE);
2386
2387 /* De-activate it via VTY */
2388 f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn);
2389 f_sleep(1.0);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002390 log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002391 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2392
2393 /* re-activate it via VTY */
2394 f_dyn_ipa_pdch_act(0, 0, chan_nr.tn);
2395 f_sleep(1.0);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002396 log("TCH/F_PDCH pchan, PDCH ACT via VTY, so now in PDCH mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002397 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE);
2398
2399 /* and finally de-activate it again */
2400 f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn);
2401 f_sleep(1.0);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002402 log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002403 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2404
Neels Hofmeyr887e8f12018-06-27 01:01:55 +02002405 /* clean up config */
2406 f_ts_set_chcomb(0, 0, 6, "PDCH");
2407
Harald Welte94e0c342018-04-07 11:33:23 +02002408 setverdict(pass);
2409}
2410
2411/* Test IPA PDCH activation NACK */
2412testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT {
2413 var RSL_Message rsl_unused;
2414
2415 /* change Timeslot 6 before f_init() starts RSL */
2416 f_init_vty();
2417 f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH");
2418 f_vty_transceive(BSCVTY, "drop bts connection 0 oml");
2419
2420 f_init(1, false);
2421 f_sleep(1.0);
2422
2423 var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6));
2424
2425 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2426 /* The BSC will activate the dynamic PDCH by default, so confirm that */
2427 rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr));
2428 f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342)));
2429 f_sleep(1.0);
2430 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE);
2431
2432 /* De-activate it via VTY */
2433 f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn);
2434 f_sleep(1.0);
2435 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2436
2437 /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */
2438 f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL);
2439 f_sleep(1.0);
2440 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE);
2441
Neels Hofmeyr887e8f12018-06-27 01:01:55 +02002442 /* clean up config */
2443 f_ts_set_chcomb(0, 0, 6, "PDCH");
2444
Harald Welte94e0c342018-04-07 11:33:23 +02002445 setverdict(pass);
2446}
2447
2448
2449/***********************************************************************
2450 * Osmocom style dynamic PDCH
2451 ***********************************************************************/
2452
2453private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr,
2454 template (omit) RSL_Cause nack := omit)
2455runs on test_CT {
2456 var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr));
2457 var RSL_Message rsl_unused;
2458 /* ask BSC via VTY to activate a given IPA style chan as PDCH */
2459 /* FIXME: no VTY command to activate Osmocom PDCH !! */
2460 /* expect the BSC to issue the related RSL command */
2461 rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?));
2462 if (istemplatekind(nack, "omit")) {
2463 /* respond with a related acknowledgement */
2464 f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342));
2465 } else {
2466 f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack)));
2467 }
2468}
2469
2470private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr,
2471 template (omit) RSL_Cause nack := omit)
2472runs on test_CT {
2473 var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr));
2474 var RSL_Message rsl_unused;
2475 /* ask BSC via VTY to activate a given IPA style chan as PDCH */
2476 /* FIXME: no VTY command to activate Osmocom PDCH !! */
2477 /* expect the BSC to issue the related RSL command */
2478 rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr));
2479 if (istemplatekind(nack, "omit")) {
2480 /* respond with a related acknowledgement */
2481 f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr));
2482 } else {
2483 //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack)));
2484 }
2485}
2486
2487/* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */
2488testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT {
2489 var RSL_Message rsl_unused;
2490
2491 /* change Timeslot 6 before f_init() starts RSL */
2492 f_init_vty();
2493 f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH");
2494 f_vty_transceive(BSCVTY, "drop bts connection 0 oml");
2495
2496 f_init(1, false);
2497 f_sleep(1.0);
2498
2499 var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6));
2500
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002501 log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:");
Harald Welte94e0c342018-04-07 11:33:23 +02002502 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE);
2503 /* The BSC will activate the dynamic PDCH by default, so confirm that */
2504 rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?));
2505
2506 f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342));
2507 f_sleep(1.0);
Neels Hofmeyrda4a6952018-06-14 04:02:49 +02002508 log("TCH/F_TCH/H_PDCH requested to PDCH ACT on startup, which was ACKed, so now in PDCH:");
Harald Welte94e0c342018-04-07 11:33:23 +02002509 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE);
2510
Neels Hofmeyr887e8f12018-06-27 01:01:55 +02002511 /* clean up config */
2512 f_ts_set_chcomb(0, 0, 6, "PDCH");
2513
Harald Welte94e0c342018-04-07 11:33:23 +02002514 setverdict(pass);
2515}
2516
2517/* Test Osmocom dyn PDCH activation NACK behavior */
2518testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT {
2519 var RSL_Message rsl_unused;
2520
2521 /* change Timeslot 6 before f_init() starts RSL */
2522 f_init_vty();
2523 f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH");
2524 f_vty_transceive(BSCVTY, "drop bts connection 0 oml");
2525
2526 f_init(1, false);
2527 f_sleep(1.0);
2528
2529 var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6));
2530
2531 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE);
2532 /* The BSC will activate the dynamic PDCH by default, so confirm that */
2533 rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?));
2534
2535 /* NACK this activation and expect the "show timeslot" mode still to be NONE */
2536 f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL));
2537 f_sleep(1.0);
2538 f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE);
2539
Neels Hofmeyr887e8f12018-06-27 01:01:55 +02002540 /* clean up config */
2541 f_ts_set_chcomb(0, 0, 6, "PDCH");
2542
Harald Welte94e0c342018-04-07 11:33:23 +02002543 setverdict(pass);
2544}
2545
Harald Welte0ea2d5e2018-04-07 21:40:29 +02002546/* Dyn PDCH todo:
2547 * activate OSMO as TCH/F
2548 * activate OSMO as TCH/H
2549 * does the BSC-located PCU socket get the updated INFO?
2550 * what if no PCU is connected at the time?
2551 * is the info correct on delayed PCU (re)connect?
2552 */
Harald Welte94e0c342018-04-07 11:33:23 +02002553
Harald Welte28d943e2017-11-25 15:00:50 +01002554control {
Harald Welte898113b2018-01-31 18:32:21 +01002555 /* CTRL interface testing */
Harald Welte4003d112017-12-09 22:35:39 +01002556 execute( TC_ctrl_msc_connection_status() );
Stefan Sperlingb041b3d2018-01-03 17:14:55 +01002557 execute( TC_ctrl_msc0_connection_status() );
Harald Welte96c94412017-12-09 03:12:45 +01002558 execute( TC_ctrl() );
Harald Welte898113b2018-01-31 18:32:21 +01002559
2560 /* RSL DCHAN Channel ACtivation / Deactivation */
Harald Welteae026692017-12-09 01:03:01 +01002561 execute( TC_chan_act_noreply() );
Harald Welte4003d112017-12-09 22:35:39 +01002562 execute( TC_chan_act_counter() );
Harald Welteae026692017-12-09 01:03:01 +01002563 execute( TC_chan_act_ack_noest() );
2564 execute( TC_chan_act_ack_est_ind_noreply() );
2565 execute( TC_chan_act_ack_est_ind_refused() );
Harald Welte618ef642017-12-14 14:58:20 +01002566 execute( TC_chan_act_nack() );
Harald Welte799c97b2017-12-14 17:50:30 +01002567 execute( TC_chan_exhaustion() );
Harald Welte4003d112017-12-09 22:35:39 +01002568 execute( TC_chan_rel_rll_rel_ind() );
2569 execute( TC_chan_rel_conn_fail() );
2570 execute( TC_chan_rel_hard_clear() );
Harald Welted8c36cd2017-12-09 23:05:31 +01002571 execute( TC_chan_rel_hard_rlsd() );
Harald Welte550daf92018-06-11 19:22:13 +02002572 execute( TC_chan_rel_hard_rlsd_ms_dead() );
Harald Welte85804d42017-12-10 14:11:58 +01002573 execute( TC_chan_rel_a_reset() );
Harald Welte6f521d82017-12-11 19:52:02 +01002574
Harald Weltecfe2c962017-12-15 12:09:32 +01002575 execute( TC_outbound_connect() );
Harald Welte898113b2018-01-31 18:32:21 +01002576
2577 /* Assignment related */
Harald Welte16a4adf2017-12-14 18:54:01 +01002578 execute( TC_assignment_cic_only() );
Harald Welte235ebf12017-12-15 14:18:16 +01002579 execute( TC_assignment_csd() );
2580 execute( TC_assignment_ctm() );
2581 execute( TC_assignment_sign() );
2582 execute( TC_assignment_fr_a5_0() );
2583 execute( TC_assignment_fr_a5_1() );
Harald Welte8f67d1d2018-05-25 20:38:42 +02002584 if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) {
2585 execute( TC_assignment_fr_a5_1_codec_missing() );
2586 }
Harald Welte235ebf12017-12-15 14:18:16 +01002587 execute( TC_assignment_fr_a5_3() );
2588 execute( TC_assignment_fr_a5_4() );
Harald Welte3c86ea02018-05-10 22:28:05 +02002589 execute( TC_ciph_mode_a5_0() );
2590 execute( TC_ciph_mode_a5_1() );
2591 execute( TC_ciph_mode_a5_3() );
Harald Welte16a4adf2017-12-14 18:54:01 +01002592
Harald Welte60aa5762018-03-21 19:33:13 +01002593 execute( TC_assignment_codec_fr() );
2594 execute( TC_assignment_codec_hr() );
2595 execute( TC_assignment_codec_efr() );
2596 execute( TC_assignment_codec_amr_f() );
2597 execute( TC_assignment_codec_amr_h() );
2598
Harald Welte898113b2018-01-31 18:32:21 +01002599 /* RLL Establish Indication on inactive DCHAN / SAPI */
Harald Welte5cd20ed2017-12-13 21:03:20 +01002600 execute( TC_rll_est_ind_inact_lchan() );
2601 execute( TC_rll_est_ind_inval_sapi1() );
2602 execute( TC_rll_est_ind_inval_sapi3() );
2603 execute( TC_rll_est_ind_inval_sacch() );
2604
Harald Welte898113b2018-01-31 18:32:21 +01002605 /* Paging related tests */
Harald Welte6f521d82017-12-11 19:52:02 +01002606 execute( TC_paging_imsi_nochan() );
2607 execute( TC_paging_tmsi_nochan() );
2608 execute( TC_paging_tmsi_any() );
2609 execute( TC_paging_tmsi_sdcch() );
2610 execute( TC_paging_tmsi_tch_f() );
2611 execute( TC_paging_tmsi_tch_hf() );
2612 execute( TC_paging_imsi_nochan_cgi() );
2613 execute( TC_paging_imsi_nochan_lac_ci() );
2614 execute( TC_paging_imsi_nochan_ci() );
2615 execute( TC_paging_imsi_nochan_lai() );
2616 execute( TC_paging_imsi_nochan_lac() );
2617 execute( TC_paging_imsi_nochan_all() );
Harald Welte751d3eb2018-01-31 15:51:06 +01002618 execute( TC_paging_imsi_nochan_plmn_lac_rnc() );
2619 execute( TC_paging_imsi_nochan_rnc() );
2620 execute( TC_paging_imsi_nochan_lac_rnc() );
2621 execute( TC_paging_imsi_nochan_lacs() );
2622 execute( TC_paging_imsi_nochan_lacs_empty() );
Stefan Sperling049a86e2018-03-20 15:51:00 +01002623 execute( TC_paging_imsi_nochan_cgi_unknown_cid() );
Harald Welte10985002017-12-12 09:29:15 +01002624 execute( TC_paging_imsi_a_reset() );
Harald Weltee65d40e2017-12-13 00:09:06 +01002625 execute( TC_paging_imsi_load() );
Philipp Maier779a7922018-02-16 11:00:37 +01002626 execute( TC_paging_counter() );
Harald Welte4e9b9cc2017-12-14 18:31:02 +01002627
2628 execute( TC_rsl_drop_counter() );
Stefan Sperling830dc9d2018-02-12 21:08:28 +01002629 execute( TC_rsl_unknown_unit_id() );
2630
2631 execute( TC_oml_unknown_unit_id() );
Harald Welte898113b2018-01-31 18:32:21 +01002632
2633 execute( TC_classmark() );
2634 execute( TC_unsol_ass_fail() );
Harald Welteea99a002018-01-31 20:46:43 +01002635 execute( TC_unsol_ass_compl() );
Harald Weltefbf9b5e2018-01-31 20:41:23 +01002636 execute( TC_unsol_ho_fail() );
Harald Weltee3bd6582018-01-31 22:51:25 +01002637 execute( TC_err_82_short_msg() );
Harald Weltee9e02e42018-01-31 23:36:25 +01002638 execute( TC_err_84_unknown_msg() );
Harald Welte261af4b2018-02-12 21:20:39 +01002639 execute( TC_ho_int() );
Neels Hofmeyrcdc2d762018-03-12 01:48:11 +01002640
2641 execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() );
Neels Hofmeyr4ff93282018-03-12 04:25:35 +01002642 execute( TC_bssmap_clear_does_not_cause_bssmap_reset() );
Neels Hofmeyrfd445c32018-03-09 15:39:31 +01002643 execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() );
Harald Welte94e0c342018-04-07 11:33:23 +02002644
2645 execute( TC_dyn_pdch_ipa_act_deact() );
2646 execute( TC_dyn_pdch_ipa_act_nack() );
2647 execute( TC_dyn_pdch_osmo_act_deact() );
2648 execute( TC_dyn_pdch_osmo_act_nack() );
Harald Welte99f3ca02018-06-14 13:40:29 +02002649
2650 /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */
2651 execute( TC_early_conn_fail() );
2652 execute( TC_late_conn_fail() );
2653
Harald Welte28d943e2017-11-25 15:00:50 +01002654}
2655
2656}