blob: 7b6fc2f89aa518d2dcb8e3bdfd3a904fc38a7547 [file] [log] [blame]
Harald Welte70767382018-02-21 12:16:40 +01001module BTS_Tests {
2
3import from General_Types all;
4import from GSM_Types all;
5import from GSM_RR_Types all;
6import from Osmocom_Types all;
7import from GSM_Types all;
8import from GSM_RR_Types all;
Harald Welte82ccef72018-02-25 16:17:33 +01009import from GSM_SystemInformation all;
Harald Welte70767382018-02-21 12:16:40 +010010import from L1CTL_PortType all;
11import from L1CTL_Types all;
12import from LAPDm_Types all;
13import from Osmocom_CTRL_Adapter all;
14
15import from RSL_Types all;
Harald Welte7484fc42018-02-24 14:09:45 +010016import from IPA_Types all;
Harald Welte70767382018-02-21 12:16:40 +010017import from IPA_Emulation all;
18import from RSL_Emulation all;
19
20import from IPL4asp_Types all;
21import from TRXC_Types all;
22import from TRXC_CodecPort all;
23import from TRXC_CodecPort_CtrlFunct all;
24
Harald Welte883340c2018-02-28 18:59:29 +010025import from PCUIF_Types all;
26import from PCUIF_CodecPort all;
27
Harald Welte7484fc42018-02-24 14:09:45 +010028import from MobileL3_CommonIE_Types all;
Harald Welte68e495b2018-02-25 00:05:57 +010029import from MobileL3_RRM_Types all;
30import from MobileL3_Types all;
31import from L3_Templates all;
Harald Welte7484fc42018-02-24 14:09:45 +010032
Harald Welte8da48242018-02-27 20:41:32 +010033import from Osmocom_VTY_Functions all;
34import from TELNETasp_PortType all;
35
Harald Welte70767382018-02-21 12:16:40 +010036/* The tests assume a BTS with the following timeslot configuration:
37 * TS0 : Combined CCCH + SDCCH/4
38 * TS1 .. TS 4: TCH/F
39 * TS5 : TCH/H
40 * TS6 : SDCCH/8
41 * TS7 : PDCH
42 */
43
44modulepar {
45 charstring mp_rsl_ip := "127.0.0.2";
46 integer mp_rsl_port := 3003;
47 integer mp_trx0_arfcn := 871;
Harald Weltea4d8f352018-03-01 15:47:20 +010048 charstring mp_bb_trxc_ip := "127.0.0.1";
Harald Welteef3e1c92018-02-28 23:40:14 +010049 integer mp_bb_trxc_port := 6701;
Harald Welte883340c2018-02-28 18:59:29 +010050 charstring mp_pcu_socket := PCU_SOCK_DEFAULT;
Harald Welted5684392018-03-10 18:22:04 +010051 integer mp_tolerance_rxqual := 1;
52 integer mp_tolerance_rxlev := 3;
Harald Welte70767382018-02-21 12:16:40 +010053}
54
55type component test_CT extends CTRL_Adapter_CT {
Harald Welte68e495b2018-02-25 00:05:57 +010056 /* IPA Emulation component underneath RSL */
Harald Welte70767382018-02-21 12:16:40 +010057 var IPA_Emulation_CT vc_IPA;
Harald Welte68e495b2018-02-25 00:05:57 +010058 /* RSL Emulation component (for ConnHdlr tests) */
Harald Welte70767382018-02-21 12:16:40 +010059 var RSL_Emulation_CT vc_RSL;
Harald Welte68e495b2018-02-25 00:05:57 +010060 /* Direct RSL_CCHAN_PT */
Harald Welte70767382018-02-21 12:16:40 +010061 port RSL_CCHAN_PT RSL_CCHAN;
Harald Welte68e495b2018-02-25 00:05:57 +010062
63 /* L1CTL port (for classic tests) */
64 port L1CTL_PT L1CTL;
Harald Welte48494ca2018-02-25 16:59:50 +010065
Harald Welte54a2a2d2018-02-26 09:14:05 +010066 /* TRXC port (for classic tests) */
67 port TRXC_CODEC_PT BB_TRXC;
68 var integer g_bb_trxc_conn_id;
69
Harald Welte8da48242018-02-27 20:41:32 +010070 port TELNETasp_PT BTSVTY;
71
Harald Welte883340c2018-02-28 18:59:29 +010072 /* PCU Interface of BTS */
73 port PCUIF_CODEC_PT PCU;
74 var integer g_pcu_conn_id;
75 /* Last PCU INFO IND we received */
76 var PCUIF_Message g_pcu_last_info;
77
Harald Welte48494ca2018-02-25 16:59:50 +010078 /* SI configuration */
79 var SystemInformationConfig si_cfg := {
80 bcch_extended := false,
81 si1_present := false,
82 si2bis_present := false,
83 si2ter_present := false,
84 si2quater_present := false,
85 si7_present := false,
86 si8_present := false,
87 si9_present := false,
88 si13_present := false,
89 si13alt_present := false,
90 si15_present := false,
91 si16_present := false,
92 si17_present := false,
93 si2n_present := false,
94 si21_present := false,
95 si22_present := false
96 };
Harald Welte70767382018-02-21 12:16:40 +010097}
98
99/* an individual call / channel */
100type component ConnHdlr extends RSL_DchanHdlr {
101 port L1CTL_PT L1CTL;
102
103 port TRXC_CODEC_PT BB_TRXC;
104 var integer g_bb_trxc_conn_id;
105
106 timer g_Tguard;
107 timer g_Tmeas_exp := 2.0; /* >= 103 SACCH multiframe ~ 500ms */
108
109 var ConnHdlrPars g_pars;
110 var uint8_t g_next_meas_res_nr := 0;
Harald Weltefa45e9e2018-03-10 18:59:03 +0100111 var boolean g_first_meas_res := true;
Harald Welte70767382018-02-21 12:16:40 +0100112}
113
114function f_init_rsl(charstring id) runs on test_CT {
115 vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA");
116 vc_RSL := RSL_Emulation_CT.create(id & "-RSL");
117
118 map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT);
119 connect(vc_IPA:IPA_RSL_PORT, vc_RSL:IPA_PT);
120 connect(self:RSL_CCHAN, vc_RSL:CCHAN_PT);
121
122 vc_IPA.start(IPA_Emulation.main_server(mp_rsl_ip, mp_rsl_port));
123 vc_RSL.start(RSL_Emulation.main(false));
124}
125
126type record ConnHdlrPars {
127 RslChannelNr chan_nr,
128 RSL_IE_ChannelMode chan_mode,
129 float t_guard,
130 ConnL1Pars l1_pars
131}
132
Harald Welte82ccef72018-02-25 16:17:33 +0100133template (value) RachControlParameters ts_RachCtrl_default := {
Harald Welte0fd1fb02018-03-10 17:19:50 +0100134 max_retrans := RACH_MAX_RETRANS_7,
135 tx_integer := '1001'B, /* 12 slots */
Harald Welte82ccef72018-02-25 16:17:33 +0100136 cell_barr_access := false,
137 re_not_allowed := true,
Harald Welteb9585f82018-03-10 17:18:47 +0100138 acc := '0000010000000000'B
Harald Welte82ccef72018-02-25 16:17:33 +0100139};
140
Harald Weltef10153f2018-02-25 16:34:05 +0100141template (value) CellSelectionParameters ts_CellSelPar_default := {
Harald Welte0fd1fb02018-03-10 17:19:50 +0100142 cell_resel_hyst_2dB := 2,
143 ms_txpwr_max_cch := 7,
Harald Weltef10153f2018-02-25 16:34:05 +0100144 acs := '0'B,
145 neci := true,
146 rxlev_access_min := 0
147}
148
149template (value) LocationAreaIdentification ts_LAI_default := {
150 mcc_mnc := '262F42'H,
151 lac := 42
152}
153
Harald Welte7484fc42018-02-24 14:09:45 +0100154/* Default SYSTEM INFORMATION 3 */
Harald Weltef8df4cb2018-03-10 15:15:08 +0100155template (value) SystemInformation ts_SI3_default := {
156 header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_3, 18),
Harald Welte7484fc42018-02-24 14:09:45 +0100157 payload := {
158 si3 := {
159 cell_id := 23,
Harald Weltef10153f2018-02-25 16:34:05 +0100160 lai := ts_LAI_default,
Harald Welte7484fc42018-02-24 14:09:45 +0100161 ctrl_chan_desc := {
162 msc_r99 := true,
163 att := true,
164 bs_ag_blks_res := 1,
165 ccch_conf := CCHAN_DESC_1CCCH_COMBINED,
Harald Welte82ccef72018-02-25 16:17:33 +0100166 si22ind := false,
Harald Welte7484fc42018-02-24 14:09:45 +0100167 cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED,
168 spare := '00'B,
169 bs_pa_mfrms := 0, /* 2 multiframes */
170 t3212 := 1 /* 6 minutes */
171 },
Harald Welte82ccef72018-02-25 16:17:33 +0100172 cell_options := {
Harald Welte7484fc42018-02-24 14:09:45 +0100173 dn_ind := false,
174 pwrc := false,
175 dtx := MS_MAY_USE_UL_DTX,
Harald Welte0fd1fb02018-03-10 17:19:50 +0100176 radio_link_tout_div4 := (32/4)-1
Harald Welte7484fc42018-02-24 14:09:45 +0100177 },
Harald Weltef10153f2018-02-25 16:34:05 +0100178 cell_sel_par := ts_CellSelPar_default,
Harald Welte82ccef72018-02-25 16:17:33 +0100179 rach_control := ts_RachCtrl_default,
Harald Welte3778acc2018-03-09 19:32:31 +0100180 rest_octets := '2B2B2B2B'O
Harald Welte7484fc42018-02-24 14:09:45 +0100181 }
182 }
183}
Harald Welte70767382018-02-21 12:16:40 +0100184
Harald Weltef8df4cb2018-03-10 15:15:08 +0100185template (value) SystemInformation ts_SI2_default := {
186 header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_2, 22),
Harald Weltef10153f2018-02-25 16:34:05 +0100187 payload := {
188 si2 := {
189 bcch_freq_list := '00000000000000000000000000000000'O,
190 ncc_permitted := '11111111'B,
191 rach_control := ts_RachCtrl_default
192 }
193 }
194}
195
Harald Weltef8df4cb2018-03-10 15:15:08 +0100196template (value) SystemInformation ts_SI4_default := {
197 header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_4, 12), /* no CBCH / restoct */
Harald Weltef10153f2018-02-25 16:34:05 +0100198 payload := {
199 si4 := {
200 lai := ts_LAI_default,
201 cell_sel_par := ts_CellSelPar_default,
202 rach_control := ts_RachCtrl_default,
203 cbch_chan_desc := omit,
204 cbch_mobile_alloc := omit,
205 rest_octets := ''O
206 }
207 }
208}
209
210function f_rsl_bcch_fill_raw(RSL_IE_SysinfoType rsl_si_type, octetstring si_enc)
211runs on test_CT {
212 log("Setting ", rsl_si_type, ": ", si_enc);
213 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_BCCH_INFO(rsl_si_type, si_enc)));
214}
215
216function f_rsl_bcch_fill(RSL_IE_SysinfoType rsl_si_type, template (value) SystemInformation si_dec)
217runs on test_CT {
218 var octetstring si_enc := enc_SystemInformation(valueof(si_dec));
219 log("Setting ", rsl_si_type, ": ", si_dec);
220 f_rsl_bcch_fill_raw(rsl_si_type, si_enc);
221}
222
Harald Welte8da48242018-02-27 20:41:32 +0100223private function f_init_vty(charstring id) runs on test_CT {
224 map(self:BTSVTY, system:BTSVTY);
225 f_vty_set_prompts(BTSVTY);
226 f_vty_transceive(BTSVTY, "enable");
227}
228
Harald Welte883340c2018-02-28 18:59:29 +0100229/* PCU socket may at any time receive a new INFO.ind */
230private altstep as_pcu_info_ind() runs on test_CT {
231 var PCUIF_send_data sd;
232 [] PCU.receive(t_SD_PCUIF_MSGT(g_pcu_conn_id, PCU_IF_MSG_INFO_IND)) -> value sd {
233 g_pcu_last_info := sd.data;
234 repeat;
235 }
236}
237
238private function f_init_pcu(charstring id) runs on test_CT {
239 timer T := 2.0;
240 var PCUIF_send_data sd;
241 map(self:PCU, system:PCU);
Harald Welte84271622018-03-10 17:21:03 +0100242 if (mp_pcu_socket == "") {
243 g_pcu_conn_id := -1;
244 return;
245 }
Harald Welte883340c2018-02-28 18:59:29 +0100246 g_pcu_conn_id := f_pcuif_connect(PCU, mp_pcu_socket);
247
248 T.start;
249 alt {
250 [] PCU.receive(t_SD_PCUIF_MSGT(g_pcu_conn_id, PCU_IF_MSG_INFO_IND)) -> value sd {
251 g_pcu_last_info := sd.data;
252 }
253 [] T.timeout {
254 setverdict(fail, "Timeout waiting for PCU INFO_IND");
255 self.stop;
256 }
257 }
258}
259
Harald Welte70767382018-02-21 12:16:40 +0100260/* global init function */
Harald Welte68e495b2018-02-25 00:05:57 +0100261function f_init(charstring id := "BTS-Test") runs on test_CT {
Harald Welte70767382018-02-21 12:16:40 +0100262 f_init_rsl(id);
263 RSL_CCHAN.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP});
Harald Welte2d142592018-02-25 13:19:44 +0100264 f_sleep(0.5); /* workaround for OS#3000 */
Harald Welte8da48242018-02-27 20:41:32 +0100265 f_init_vty(id);
Harald Welte7484fc42018-02-24 14:09:45 +0100266
267 /* Send SI3 to the BTS, it is needed for various computations */
Harald Weltef10153f2018-02-25 16:34:05 +0100268 f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default);
269 /* SI2 + SI4 are required for SI testing as they are mandatory defaults */
270 f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default);
271 f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default);
Harald Welte57fe8232018-02-26 17:52:50 +0100272
Harald Welte883340c2018-02-28 18:59:29 +0100273 f_init_pcu(id);
274
Harald Welte84271622018-03-10 17:21:03 +0100275 if (mp_bb_trxc_port != -1) {
276 var TrxcMessage ret;
277 /* start with a default moderate timing offset equalling TA=2 */
278 f_main_trxc_connect();
279 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(2*256)));
280 }
Harald Welte70767382018-02-21 12:16:40 +0100281}
282
Harald Welte68e495b2018-02-25 00:05:57 +0100283/* Attach L1CTL to master test_CT (classic tests, non-handler mode) */
284function f_init_l1ctl() runs on test_CT {
285 map(self:L1CTL, system:L1CTL);
286 f_connect_reset(L1CTL);
287}
288
Harald Welte70767382018-02-21 12:16:40 +0100289type function void_fn(charstring id) runs on ConnHdlr;
290
291/* create a new test component */
292function f_start_handler(void_fn fn, ConnHdlrPars pars)
293runs on test_CT return ConnHdlr {
294 var charstring id := testcasename();
295 var ConnHdlr vc_conn;
296
297 vc_conn := ConnHdlr.create(id);
298 /* connect to RSL Emulation main component */
299 connect(vc_conn:RSL, vc_RSL:CLIENT_PT);
300 connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC);
301
302 vc_conn.start(f_handler_init(fn, id, pars));
303 return vc_conn;
304}
305
Harald Welte7484fc42018-02-24 14:09:45 +0100306template ASP_RSL_Unitdata ts_RSL_UD(template RSL_Message rsl, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
307 streamId := sid,
308 rsl := rsl
309}
310
311template ASP_RSL_Unitdata tr_RSL_UD(template RSL_Message rsl,
312 template IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
313 streamId := sid,
314 rsl := rsl
315}
316
Harald Welte70767382018-02-21 12:16:40 +0100317private altstep as_Tguard() runs on ConnHdlr {
318 [] g_Tguard.timeout {
319 setverdict(fail, "Tguard timeout");
320 self.stop;
321 }
322}
323
Harald Welte68e495b2018-02-25 00:05:57 +0100324private function f_l1_tune(L1CTL_PT L1CTL) {
Harald Welte70767382018-02-21 12:16:40 +0100325 f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, CCCH_MODE_COMBINED);
326}
327
328private function f_trxc_connect() runs on ConnHdlr {
329 map(self:BB_TRXC, system:BB_TRXC);
330 var Result res;
Harald Weltea4d8f352018-03-01 15:47:20 +0100331 res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
332 "", -1, -1, {udp:={}}, {});
Harald Welte70767382018-02-21 12:16:40 +0100333 g_bb_trxc_conn_id := res.connId;
334}
335
336private function f_trxc_fake_rssi(uint8_t rssi) runs on ConnHdlr {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100337 var TrxcMessage ret;
338 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_RSSI(rssi)));
Harald Welte70767382018-02-21 12:16:40 +0100339}
340
341private function f_trx_fake_toffs256(int16_t toffs256) runs on ConnHdlr {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100342 var TrxcMessage ret;
343 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256)));
Harald Welte70767382018-02-21 12:16:40 +0100344}
345
346/* first function started in ConnHdlr component */
347private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars)
348runs on ConnHdlr {
349 g_pars := pars;
350 g_chan_nr := pars.chan_nr;
351
352 map(self:L1CTL, system:L1CTL);
353 f_connect_reset(L1CTL);
354
Harald Welte84271622018-03-10 17:21:03 +0100355 if (mp_bb_trxc_port != -1) {
356 f_trxc_connect();
357 }
Harald Welte70767382018-02-21 12:16:40 +0100358
359 g_Tguard.start(pars.t_guard);
360 activate(as_Tguard());
361
362 f_rslem_register(0, pars.chan_nr);
363
364 /* call the user-supplied test case function */
365 fn.apply(id);
366}
367
Harald Welte1eba3742018-02-25 12:48:14 +0100368function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, charstring id)
369runs on ConnHdlr {
370 timer T := 3.0;
371 RSL.send(tx);
372 T.start;
Harald Welte70767382018-02-21 12:16:40 +0100373 alt {
Harald Welte1eba3742018-02-25 12:48:14 +0100374 [] RSL.receive(exp_rx) {
375 T.stop;
376 setverdict(pass);
Harald Welte70767382018-02-21 12:16:40 +0100377 }
Harald Welte1eba3742018-02-25 12:48:14 +0100378 [] T.timeout {
379 setverdict(fail, "Timeout expecting " & id);
380 self.stop;
381 }
382 [] RSL.receive {
383 setverdict(fail, "Unexpected RSL message received");
Harald Welte70767382018-02-21 12:16:40 +0100384 }
385 }
386}
387
Harald Welte1eba3742018-02-25 12:48:14 +0100388function f_rsl_chan_act(RSL_IE_ChannelMode mode) runs on ConnHdlr {
389 f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr),
390 "RSL CHAN ACT");
391}
392
Harald Welte70767382018-02-21 12:16:40 +0100393function f_rsl_chan_deact() runs on ConnHdlr {
Harald Welte1eba3742018-02-25 12:48:14 +0100394 f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr),
395 "RF CHAN REL");
Harald Welte70767382018-02-21 12:16:40 +0100396}
397
Harald Welte70767382018-02-21 12:16:40 +0100398private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr,
399 template RSL_IE_ChannelMode chan_mode,
400 float t_guard := 20.0) := {
401 chan_nr := valueof(chan_nr),
402 chan_mode := valueof(chan_mode),
403 t_guard := t_guard,
404 l1_pars := {
405 dtx_enabled := false,
Harald Welte685d5982018-02-27 20:42:05 +0100406 toa256_enabled := false,
Harald Welte70767382018-02-21 12:16:40 +0100407 meas_ul := {
408 full := {
409 rxlev := dbm2rxlev(-53),
410 rxqual := 0
411 },
412 sub := {
413 rxlev := dbm2rxlev(-53),
414 rxqual := 0
415 }
416 },
417 timing_offset_256syms := 0,
418 bs_power_level := 0,
419 ms_power_level := 0,
420 ms_actual_ta := 0
421 }
422}
423
Harald Welte93640c62018-02-25 16:59:33 +0100424/***********************************************************************
425 * Channel Activation / Deactivation
426 ***********************************************************************/
427
Harald Welte70767382018-02-21 12:16:40 +0100428/* Stress test: Do 500 channel activations/deactivations in rapid succession */
429function f_TC_chan_act_stress(charstring id) runs on ConnHdlr {
430 for (var integer i := 0; i < 500; i := i+1) {
431 f_rsl_chan_act(g_pars.chan_mode);
432 f_rsl_chan_deact();
433 }
434 setverdict(pass);
435}
436testcase TC_chan_act_stress() runs on test_CT {
437 var ConnHdlr vc_conn;
438 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
439 f_init(testcasename());
440 vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars);
441 vc_conn.done;
442}
443
444/* Test if re-activation of an already active channel fails as expected */
445function f_TC_chan_act_react(charstring id) runs on ConnHdlr {
446 f_rsl_chan_act(g_pars.chan_mode);
447 /* attempt to activate the same lchan again -> expect reject */
448 RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
449 alt {
450 [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
451 setverdict(fail, "Unexpected CHAN ACT ACK on double activation");
452 }
453 [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
454 setverdict(pass);
455 }
456 }
457 f_rsl_chan_deact();
458}
459testcase TC_chan_act_react() runs on test_CT {
460 var ConnHdlr vc_conn;
461 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
462 f_init(testcasename());
463 vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars);
464 vc_conn.done;
465}
466
467/* Attempt to de-activate a channel that's not active */
468function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr {
469 timer T := 3.0;
470 RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr));
471 T.start;
472 alt {
473 [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) {
474 setverdict(pass);
475 }
476 [] T.timeout {
477 setverdict(fail, "Timeout expecting RF_CHAN_REL_ACK");
478 }
479 }
480}
481testcase TC_chan_deact_not_active() runs on test_CT {
482 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
483 f_init(testcasename());
484 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars);
485 vc_conn.done;
486}
487
488/* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */
489function f_TC_chan_act_wrong_nr(charstring id) runs on ConnHdlr {
490 RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
491 alt {
492 [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
493 setverdict(fail, "Unexpected CHAN ACT ACK");
494 }
495 [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
496 setverdict(pass);
497 }
498 }
499}
500private type record WrongChanNrCase {
501 RslChannelNr chan_nr,
502 charstring description
503}
504private type record of WrongChanNrCase WrongChanNrCases;
505private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := {
506 chan_nr := chan_nr,
507 description := desc
508}
509
510testcase TC_chan_act_wrong_nr() runs on test_CT {
511 var ConnHdlr vc_conn;
512 var ConnHdlrPars pars;
513
514 f_init(testcasename());
515
516 var WrongChanNrCases wrong := {
517 valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")),
518 valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")),
519 valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")),
520 valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")),
521 valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")),
522 valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")),
523 valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")),
524 valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")),
525 valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")),
526 valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")),
527 valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")),
528 valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")),
529 valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H"))
530 };
531
532 for (var integer i := 0; i < sizeof(wrong); i := i+1) {
533 pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN));
534 vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars);
535 vc_conn.done;
536 }
537}
538
Harald Welte93640c62018-02-25 16:59:33 +0100539/***********************************************************************
540 * RACH Handling
541 ***********************************************************************/
542
Harald Welte8c24c2b2018-02-26 08:31:31 +0100543/* like L1SAP_IS_PACKET_RACH */
544private function ra_is_ps(OCT1 ra) return boolean {
Harald Welte56c05802018-02-28 21:39:35 +0100545 if ((ra and4b 'F0'O == '70'O) and (ra and4b '0F'O != '0F'O)) {
Harald Welte8c24c2b2018-02-26 08:31:31 +0100546 return true;
547 }
548 return false;
549}
550
551/* generate a random RACH for circuit-switched */
552private function f_rnd_ra_cs() return OCT1 {
553 var OCT1 ra;
554 do {
555 ra := f_rnd_octstring(1);
556 } while (ra_is_ps(ra));
557 return ra;
558}
559
Harald Welte883340c2018-02-28 18:59:29 +0100560/* generate a random RACH for packet-switched */
561private function f_rnd_ra_ps() return OCT1 {
562 var OCT1 ra;
563 do {
564 ra := f_rnd_octstring(1);
565 } while (not ra_is_ps(ra));
566 return ra;
567}
568
Harald Welte8c24c2b2018-02-26 08:31:31 +0100569/* Send 1000 RACH requests and check their RA+FN on the RSL side */
570testcase TC_rach_content() runs on test_CT {
571 f_init(testcasename());
572 f_init_l1ctl();
Harald Welte68e495b2018-02-25 00:05:57 +0100573 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +0100574
Harald Welte8c24c2b2018-02-26 08:31:31 +0100575 var GsmFrameNumber fn_last := 0;
576 for (var integer i := 0; i < 1000; i := i+1) {
577 var OCT1 ra := f_rnd_ra_cs();
578 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
579 if (fn == fn_last) {
580 setverdict(fail, "Two RACH in same FN?!?");
581 self.stop;
582 }
583 fn_last := fn;
584
585 timer T := 5.0;
Harald Welte56c05802018-02-28 21:39:35 +0100586 T.start;
Harald Welte8c24c2b2018-02-26 08:31:31 +0100587 alt {
588 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, ?))) {
589 T.stop;
590 }
591 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) {
592 setverdict(fail, "Unexpected CHAN RQD");
593 self.stop;
594 }
595 [] RSL_CCHAN.receive { repeat; }
596 [] T.timeout {
597 setverdict(fail, "Timeout waiting for CHAN RQD");
598 self.stop;
599 }
600 }
601 }
602 setverdict(pass);
Harald Welte70767382018-02-21 12:16:40 +0100603}
Harald Welte8c24c2b2018-02-26 08:31:31 +0100604
605/* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */
606testcase TC_rach_count() runs on test_CT {
Harald Welte70767382018-02-21 12:16:40 +0100607 f_init(testcasename());
Harald Welte8c24c2b2018-02-26 08:31:31 +0100608 f_init_l1ctl();
609 f_l1_tune(L1CTL);
610
611 var GsmFrameNumber fn_last := 0;
612 for (var integer i := 0; i < 1000; i := i+1) {
613 var OCT1 ra := f_rnd_ra_cs();
614 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
615 if (fn == fn_last) {
616 setverdict(fail, "Two RACH in same FN?!?");
617 self.stop;
618 }
619 fn_last := fn;
620 }
621 var integer rsl_chrqd := 0;
622 timer T := 3.0;
Harald Welte56c05802018-02-28 21:39:35 +0100623 T.start;
Harald Welte8c24c2b2018-02-26 08:31:31 +0100624 alt {
625 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
626 rsl_chrqd := rsl_chrqd + 1;
Harald Weltec3a3f452018-02-26 17:37:47 +0100627 f_timer_safe_restart(T);
Harald Welte8c24c2b2018-02-26 08:31:31 +0100628 repeat;
629 }
630 [] RSL_CCHAN.receive { repeat; }
631 [] T.timeout { }
632 }
633 if (rsl_chrqd == 1000) {
634 setverdict(pass);
635 } else {
636 setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 RACH");
637 }
Harald Welte70767382018-02-21 12:16:40 +0100638}
639
Harald Welte54a2a2d2018-02-26 09:14:05 +0100640private function f_main_trxc_connect() runs on test_CT {
641 map(self:BB_TRXC, system:BB_TRXC);
642 var Result res;
Harald Welted3a88a62018-03-01 16:04:52 +0100643 res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
644 "", -1, -1, {udp:={}}, {});
Harald Welte54a2a2d2018-02-26 09:14:05 +0100645 g_bb_trxc_conn_id := res.connId;
646}
647
648private function f_rach_toffs(int16_t toffs256, boolean expect_pass) runs on test_CT {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100649 var TrxcMessage ret;
Harald Welte54a2a2d2018-02-26 09:14:05 +0100650 /* tell fake_trx to use a given timing offset for all bursts */
Harald Weltef8df4cb2018-03-10 15:15:08 +0100651 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256)));
Harald Welte54a2a2d2018-02-26 09:14:05 +0100652 f_sleep(0.5);
653
654 /* Transmit RACH request + wait for confirmation */
655 var OCT1 ra := f_rnd_ra_cs();
656 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
657
658 /* Check for expected result */
659 timer T := 1.5;
660 T.start;
661 alt {
662 [expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
663 setverdict(pass);
664 }
665 [not expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
Harald Welteb3e30942018-03-02 10:33:42 +0100666 setverdict(fail, "RACH passed but was expected to be dropped: ", toffs256);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100667 }
668 [] RSL_CCHAN.receive { repeat; }
669 [not expect_pass] T.timeout {
670 setverdict(pass);
671 }
672 [expect_pass] T.timeout {
673 setverdict(fail, "Timeout waiting for CHAN RQD");
674 }
675 }
676}
677
678/* Test if dropping of RACH Based on NM_ATT_MAX_TA works */
679testcase TC_rach_max_ta() runs on test_CT {
680 f_init(testcasename());
681 f_init_l1ctl();
682 f_l1_tune(L1CTL);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100683 f_sleep(1.0);
684
685 /* default max-ta is 63 (full range of GSM timing advance */
686
Vadim Yanitskiyc81d6e42018-03-05 22:39:01 +0700687 /* We allow early arrival up to 2 symbols */
688 f_rach_toffs(-1*256, true);
689 f_rach_toffs(-2*256, true);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100690 f_rach_toffs(-10*256, false);
691
692 /* 0 / 32 / 63 bits is legal / permitted */
693 f_rach_toffs(0, true);
694 f_rach_toffs(32*256, true);
695 f_rach_toffs(63*256, true);
696
697 /* more than 63 bits is not legal / permitted */
698 f_rach_toffs(64*256, false);
699 f_rach_toffs(127*256, false);
700}
Harald Welte8c24c2b2018-02-26 08:31:31 +0100701
Harald Welte93640c62018-02-25 16:59:33 +0100702/***********************************************************************
703 * Measurement Processing / Reporting
704 ***********************************************************************/
705
Harald Welte70767382018-02-21 12:16:40 +0100706template LapdmAddressField ts_LapdmAddr(LapdmSapi sapi, boolean c_r) := {
707 spare := '0'B,
708 lpd := 0,
709 sapi := sapi,
710 c_r := c_r,
711 ea := true
712}
713
714template LapdmFrameB ts_LAPDm_B(LapdmSapi sapi, boolean c_r, boolean p, octetstring pl) := {
715 addr := ts_LapdmAddr(sapi, c_r),
716 ctrl := t_LapdmCtrlUI(p),
717 len := 0, /* overwritten */
718 m := false,
719 el := 1,
720 payload := pl
721}
722
723/* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */
724altstep as_l1_sacch() runs on ConnHdlr {
725 var L1ctlDlMessage l1_dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100726 [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl {
Harald Welte70767382018-02-21 12:16:40 +0100727 log("SACCH received: ", l1_dl.payload.data_ind.payload);
728 var GsmRrL3Message meas_rep := valueof(ts_MEAS_REP(true, 23, 23, 0, 0, omit));
729 var LapdmFrameB lb := valueof(ts_LAPDm_B(0, false, false, enc_GsmRrL3Message(meas_rep)));
730 log("LAPDm: ", lb);
731 var octetstring pl := '0000'O & enc_LapdmFrameB(lb);
Harald Weltef8df4cb2018-03-10 15:15:08 +0100732 L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_SACCH(0), pl));
Harald Welte70767382018-02-21 12:16:40 +0100733 repeat;
734 }
735}
736
737altstep as_l1_dcch() runs on ConnHdlr {
738 var L1ctlDlMessage l1_dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100739 [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value l1_dl {
Harald Welte70767382018-02-21 12:16:40 +0100740 log("DCCH received: ", l1_dl.payload.data_ind.payload);
741 var octetstring pl := '010301'O;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100742 L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), pl));
Harald Welte70767382018-02-21 12:16:40 +0100743 repeat;
744 }
745}
746
747type record MeasElem {
748 uint6_t rxlev,
749 uint3_t rxqual
750}
751
752type record MeasElemFS {
753 MeasElem full,
754 MeasElem sub
755}
756
757type record ConnL1Pars {
758 boolean dtx_enabled,
Harald Welte685d5982018-02-27 20:42:05 +0100759 boolean toa256_enabled,
Harald Welte70767382018-02-21 12:16:40 +0100760 MeasElemFS meas_ul,
761 int16_t timing_offset_256syms,
762 uint5_t bs_power_level,
763 uint5_t ms_power_level,
764 uint8_t ms_actual_ta
765}
766
767/* Convert tiing offset from 1/256th symbol to RSL Timing Offset */
768private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t {
769 return 63 + (toffs256s/256);
770}
771
Harald Welted5684392018-03-10 18:22:04 +0100772private function f_max(integer a, integer b) return integer {
773 if (a > b) {
774 return a;
775 } else {
776 return b;
777 }
778}
779
780private function f_min(integer a, integer b) return integer {
781 if (a < b) {
782 return a;
783 } else {
784 return b;
785 }
786}
787
788/* compute negative tolerance val-tolerance, ensure >= min */
789private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer {
790 val := val - tolerance;
791 return f_max(val, min);
792}
793
794/* compute positive tolerance val+tolerance, ensure <= max */
795private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer {
796 val := val + tolerance;
797 return f_min(val, max);
798}
799
800/* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */
801private function f_tolerance(integer val, integer min, integer max, integer tolerance)
802return template integer {
803 var template integer ret;
804 ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance));
805 return ret;
806}
807
808
Harald Welte70767382018-02-21 12:16:40 +0100809/* build a template for matching measurement results against */
810private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message {
811 var ConnL1Pars l1p := g_pars.l1_pars;
812 var template RSL_IE_UplinkMeas ul_meas := {
813 len := 3,
814 rfu := '0'B,
815 dtx_d := l1p.dtx_enabled,
Harald Welted5684392018-03-10 18:22:04 +0100816 rxlev_f_u := f_tolerance(l1p.meas_ul.full.rxlev, 0, 63, mp_tolerance_rxlev),
Harald Welte70767382018-02-21 12:16:40 +0100817 reserved1 := '00'B,
Harald Welted5684392018-03-10 18:22:04 +0100818 rxlev_s_u := f_tolerance(l1p.meas_ul.sub.rxlev, 0, 63, mp_tolerance_rxlev),
Harald Welte70767382018-02-21 12:16:40 +0100819 reserved2 := '00'B,
Harald Welted5684392018-03-10 18:22:04 +0100820 rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual),
821 rxq_s_u := f_tolerance(l1p.meas_ul.sub.rxqual, 0, 7, mp_tolerance_rxqual),
Harald Welte70767382018-02-21 12:16:40 +0100822 supp_meas_info := omit
823 };
Harald Welte685d5982018-02-27 20:42:05 +0100824 if (l1p.toa256_enabled) {
825 ul_meas.len := 5;
826 ul_meas.supp_meas_info := int2oct(l1p.timing_offset_256syms, 2);
827 }
Harald Welte70767382018-02-21 12:16:40 +0100828 /* HACK HACK HACK FIXME HACK HACK HACK see https://osmocom.org/issues/2988 */
829 ul_meas.rxlev_f_u := ?;
830 ul_meas.rxlev_s_u := ?;
831 ul_meas.rxq_f_u := ?;
832 ul_meas.rxq_s_u := ?;
833 var template RSL_IE_BS_Power bs_power := {
834 reserved := 0,
835 epc := false,
836 fpc := false,
837 power_level := l1p.bs_power_level
838 };
839 var template RSL_IE_L1Info l1_info := {
840 ms_power_lvl := l1p.ms_power_level,
841 fpc := false,
842 reserved := 0,
843 actual_ta := l1p.ms_actual_ta
844 };
845 var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms);
846 var template uint8_t t_toffs := (offs-1 .. offs+1); /* some tolerance */
847 return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info,
848 ?, t_toffs);
849}
850
851/* verify we regularly receive measurement reports with incrementing numbers */
852altstep as_meas_res() runs on ConnHdlr {
853 var RSL_Message rsl;
854 [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl {
855 /* increment counter of next to-be-expected meas rep */
856 g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
857 /* Re-start the timer expecting the next MEAS RES */
Harald Weltec3a3f452018-02-26 17:37:47 +0100858 f_timer_safe_restart(g_Tmeas_exp);
Harald Welte70767382018-02-21 12:16:40 +0100859 repeat;
860 }
861 [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl {
Harald Weltefa45e9e2018-03-10 18:59:03 +0100862 /* increment counter of next to-be-expected meas rep */
863 g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
864 if (g_first_meas_res) {
865 g_first_meas_res := false;
866 repeat;
867 } else {
868 setverdict(fail, "Received unspecific MEAS RES ", rsl);
869 self.stop;
870 }
Harald Welte70767382018-02-21 12:16:40 +0100871 }
872 [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl {
873 setverdict(fail, "Received unexpected MEAS RES ", rsl);
874 self.stop;
875 }
876 [] g_Tmeas_exp.timeout {
877 setverdict(fail, "Didn't receive expected measurement result")
878 self.stop;
879 }
880}
881
882/* Establish dedicated channel: L1CTL + RSL side */
883private function f_est_dchan() runs on ConnHdlr {
884 var GsmFrameNumber fn;
885 var ImmediateAssignment imm_ass;
886 var integer ra := 23;
887
888 fn := f_L1CTL_RACH(L1CTL, ra);
889 /* This arrives on CCHAN, so we cannot test for receiving CHAN RQDhere */
890 //RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1)));
891
892 /* Activate channel on BTS side */
893 f_rsl_chan_act(g_pars.chan_mode);
894
895 /* Send IMM.ASS via CCHAN */
896 var ChannelDescription ch_desc := {
897 chan_nr := g_pars.chan_nr,
898 tsc := 7,
899 h := false,
900 arfcn := mp_trx0_arfcn,
901 maio_hsn := omit
902 };
903 var MobileAllocation ma := {
904 len := 0,
905 ma := ''B
906 };
907 var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, ma));
908 RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg)));
909
910 /* receive IMM.ASS on MS side */
911 var ImmediateAssignment ia_um;
912 ia_um := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn);
913 /* enable dedicated mode */
914 f_L1CTL_DM_EST_REQ_IA(L1CTL, ia_um);
Harald Weltefa45e9e2018-03-10 18:59:03 +0100915
916 g_first_meas_res := true;
Harald Welte70767382018-02-21 12:16:40 +0100917}
918
919/* establish DChan, verify existance + contents of measurement reports */
920function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr {
Harald Welte68e495b2018-02-25 00:05:57 +0100921 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +0100922 RSL.clear;
923
Harald Welte5398d5e2018-03-10 19:00:24 +0100924 if (mp_bb_trxc_port != -1) {
925 g_pars.l1_pars.meas_ul.full.rxlev := dbm2rxlev(-100);
926 f_trxc_fake_rssi(100);
Harald Welte70767382018-02-21 12:16:40 +0100927
Harald Welte5398d5e2018-03-10 19:00:24 +0100928 g_pars.l1_pars.timing_offset_256syms := 512; /* 2 symbols */
929 f_trx_fake_toffs256(g_pars.l1_pars.timing_offset_256syms);
930 } else {
931 g_pars.l1_pars.timing_offset_256syms := 0; /* FIXME */
932 g_pars.l1_pars.meas_ul.full.rxlev := dbm2rxlev(-55); /* FIXME */
933 }
934 g_pars.l1_pars.meas_ul.sub.rxlev := g_pars.l1_pars.meas_ul.full.rxlev;
Harald Welte70767382018-02-21 12:16:40 +0100935
936 f_est_dchan();
937
938 /* run for a number of seconds, send SACCH + FACCH from MS side and verify
939 * RSL measurement reports on Abis side */
940 timer T := 8.0;
941 T.start;
942 alt {
943 [] as_l1_sacch();
944 [] as_meas_res();
945 [] as_l1_dcch();
946 [] L1CTL.receive { repeat; }
947 [g_Tmeas_exp.running] T.timeout {
948 /* as_meas_res() would have done setverdict(fail) / self.stop in case
949 * of any earlier errors, so if we reach this timeout, we're good */
950 setverdict(pass);
951 }
952 [] T.timeout {
953 setverdict(fail, "No MEAS RES received at all");
954 }
955 }
956 f_rsl_chan_deact();
957}
958testcase TC_meas_res_sign_tchf() runs on test_CT {
959 var ConnHdlr vc_conn;
960 var ConnHdlrPars pars;
961 f_init(testcasename());
962 for (var integer tn := 1; tn <= 4; tn := tn+1) {
963 pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN));
964 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
965 vc_conn.done;
966 }
967}
968testcase TC_meas_res_sign_tchh() runs on test_CT {
969 var ConnHdlr vc_conn;
970 var ConnHdlrPars pars;
971 f_init(testcasename());
972 for (var integer ss := 0; ss <= 1; ss := ss+1) {
973 pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
974 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
975 vc_conn.done;
976 }
977}
978testcase TC_meas_res_sign_sdcch4() runs on test_CT {
979 var ConnHdlr vc_conn;
980 var ConnHdlrPars pars;
981 f_init(testcasename());
982 for (var integer ss := 0; ss <= 3; ss := ss+1) {
983 pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN));
984 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
985 vc_conn.done;
986 }
987}
988testcase TC_meas_res_sign_sdcch8() runs on test_CT {
989 var ConnHdlr vc_conn;
990 var ConnHdlrPars pars;
991 f_init(testcasename());
992 for (var integer ss := 0; ss <= 7; ss := ss+1) {
993 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN));
994 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
995 vc_conn.done;
996 }
997}
Harald Welte685d5982018-02-27 20:42:05 +0100998testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
999 var ConnHdlr vc_conn;
1000 var ConnHdlrPars pars;
1001 f_init(testcasename());
1002 f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256");
1003 for (var integer ss := 0; ss <= 1; ss := ss+1) {
1004 pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
1005 pars.l1_pars.toa256_enabled := true;
1006 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
1007 vc_conn.done;
1008 }
1009}
1010
Harald Welte70767382018-02-21 12:16:40 +01001011
1012/* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND */
1013private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr {
Harald Welte68e495b2018-02-25 00:05:57 +01001014 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +01001015 RSL.clear;
1016
1017 f_est_dchan();
1018 f_sleep(2.0);
Harald Weltef8df4cb2018-03-10 15:15:08 +01001019 L1CTL.send(ts_L1CTL_DM_REL_REQ(g_chan_nr));
Harald Welte70767382018-02-21 12:16:40 +01001020
1021 timer T := 40.0;
1022 T.start;
1023 alt {
1024 [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) {
1025 setverdict(pass)
1026 }
1027 [] RSL.receive { repeat };
1028 [] T.timeout {
1029 setverdict(fail, "No CONN FAIL IND received");
1030 }
1031 }
1032 f_rsl_chan_deact();
1033}
1034testcase TC_conn_fail_crit() runs on test_CT {
1035 var ConnHdlr vc_conn;
1036 var ConnHdlrPars pars;
1037 f_init(testcasename());
1038 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN));
1039 pars.t_guard := 60.0;
1040 vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars);
1041 vc_conn.done;
1042}
1043
Harald Welte93640c62018-02-25 16:59:33 +01001044/***********************************************************************
1045 * Paging
1046 ***********************************************************************/
1047
Harald Welte68e495b2018-02-25 00:05:57 +01001048function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean {
1049 if (tmsi == 'FFFFFFFF'O) {
1050 return true;
1051 } else {
1052 return false;
1053 }
1054}
Harald Welte70767382018-02-21 12:16:40 +01001055
Harald Welte68e495b2018-02-25 00:05:57 +01001056altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, inout integer num_paging_rcv_ids)
1057runs on test_CT {
1058 var L1ctlDlMessage dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +01001059 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_DummyUI)) {
Harald Welte68e495b2018-02-25 00:05:57 +01001060 repeat;
1061 }
Harald Weltef8df4cb2018-03-10 15:15:08 +01001062 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl {
Harald Welte68e495b2018-02-25 00:05:57 +01001063 var octetstring without_plen :=
1064 substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1);
1065 var PDU_ML3_NW_MS rr := dec_PDU_ML3_NW_MS(without_plen);
1066 if (match(rr, tr_PAGING_REQ1)) {
1067 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1068 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1069 if (isvalue(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) {
1070 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1071 }
1072 } else if (match(rr, tr_PAGING_REQ2)) {
1073 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1074 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) {
1075 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1076 }
1077 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) {
1078 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1079 }
1080 if (isvalue(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) {
1081 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1082 }
1083 } else if (match(rr, tr_PAGING_REQ3)) {
1084 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1085 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) {
1086 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1087 }
1088 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) {
1089 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1090 }
1091 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) {
1092 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1093 }
1094 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) {
1095 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1096 }
1097 }
1098 repeat;
1099 }
1100}
1101
1102type record PagingTestCfg {
1103 boolean combined_ccch,
1104 integer bs_ag_blks_res,
1105 float load_factor,
1106 boolean exp_load_ind,
1107 boolean exp_overload,
1108 boolean use_tmsi
1109}
1110
1111type record PagingTestState {
1112 integer num_paging_sent,
1113 integer num_paging_rcv_msgs,
1114 integer num_paging_rcv_ids,
1115 integer num_overload
1116}
1117
1118/* receive + ignore RSL RF RES IND */
1119altstep as_rsl_res_ind() runs on test_CT {
1120 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_RF_RES_IND)) {
1121 repeat;
1122 }
1123}
1124
1125/* Helper function for paging related testing */
1126private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState {
1127 f_init(testcasename());
1128 f_init_l1ctl();
1129 f_l1_tune(L1CTL);
1130
1131 var PagingTestState st := {
1132 num_paging_sent := 0,
1133 num_paging_rcv_msgs := 0,
1134 num_paging_rcv_ids := 0,
1135 num_overload := 0
1136 };
1137
1138 var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res);
1139 var float max_pch_imsi_per_sec;
1140 if (cfg.use_tmsi) {
1141 max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */
1142 } else {
1143 max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */
1144 }
1145 var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor;
1146 var float interval := 1.0 / pch_blocks_per_sec;
1147 log("pch_blocks_per_sec=", pch_blocks_per_sec, " interval=", interval);
1148
1149 for (var integer i := 0; i < float2int(20.0/interval); i := i+1) {
1150 /* build mobile Identity */
1151 var MobileL3_CommonIE_Types.MobileIdentityLV mi;
1152 if (cfg.use_tmsi) {
1153 mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4)));
1154 } else {
1155 mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i)));
1156 }
1157 var octetstring mi_enc_lv := enc_MobileIdentityLV(mi);
1158 var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1);
1159
1160 /* Send RSL PAGING COMMAND */
1161 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4)));
1162 st.num_paging_sent := st.num_paging_sent + 1;
1163
1164 /* Wait for interval to next PAGING COMMAND */
1165 timer T_itv := interval;
1166 T_itv.start;
1167 alt {
1168 /* check for presence of CCCH LOAD IND (paging load) */
1169 [cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) {
1170 st.num_overload := st.num_overload + 1;
1171 repeat;
1172 }
1173 [not cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) {
1174 setverdict(fail, "Unexpected PCH Overload");
1175 }
1176 [cfg.exp_load_ind] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) {
1177 log("Rx LOAD_IND");
1178 /* FIXME: analyze/verify interval + contents */
1179 repeat;
1180 }
1181 /* check if paging requests arrive on Um side */
1182 [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids);
1183 [] L1CTL.receive { repeat; }
1184 [] T_itv.timeout { }
1185 [] as_rsl_res_ind();
1186 }
1187 }
1188
1189 /* wait for max 18s for paging queue to drain (size: 200, ~ 13 per s -> 15s) */
1190 timer T_wait := 18.0;
1191 T_wait.start;
1192 alt {
1193 [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids);
1194 [] L1CTL.receive { repeat; }
1195 /* 65535 == empty paging queue, we can terminate*/
1196 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { }
1197 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; }
1198 [] T_wait.timeout {
1199 setverdict(fail, "Waiting for empty paging queue");
1200 }
1201 [] as_rsl_res_ind();
1202 }
1203
1204 log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs,
1205 " rcvd_ids=", st.num_paging_rcv_ids);
1206 return st;
1207}
1208
1209/* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that
1210 * - the number of Mobile Identities on Um PCH match the number of pages on RSL
1211 * - that CCCH LOAD IND (PCH) are being generated
1212 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1213testcase TC_paging_imsi_80percent() runs on test_CT {
1214 var PagingTestCfg cfg := {
1215 combined_ccch := true,
1216 bs_ag_blks_res := 1,
1217 load_factor := 0.8,
1218 exp_load_ind := true,
1219 exp_overload := false,
1220 use_tmsi := false
1221 };
1222 var PagingTestState st := f_TC_paging(cfg);
1223 if (st.num_paging_sent != st.num_paging_rcv_ids) {
1224 setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
1225 st.num_paging_rcv_ids);
1226 } else {
1227 setverdict(pass);
1228 }
1229}
1230
1231/* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that
1232 * - the number of Mobile Identities on Um PCH match the number of pages on RSL
1233 * - that CCCH LOAD IND (PCH) are being generated
1234 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1235testcase TC_paging_tmsi_80percent() runs on test_CT {
1236 var PagingTestCfg cfg := {
1237 combined_ccch := true,
1238 bs_ag_blks_res := 1,
1239 load_factor := 0.8,
1240 exp_load_ind := true,
1241 exp_overload := false,
1242 use_tmsi := true
1243 };
1244 var PagingTestState st := f_TC_paging(cfg);
1245 if (st.num_paging_sent != st.num_paging_rcv_ids) {
1246 setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
1247 st.num_paging_rcv_ids);
1248 } else {
1249 setverdict(pass);
1250 }
1251}
1252
1253/* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that
1254 * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL
1255 * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point
1256 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1257testcase TC_paging_imsi_200percent() runs on test_CT {
1258 var PagingTestCfg cfg := {
1259 combined_ccch := true,
1260 bs_ag_blks_res := 1,
1261 load_factor := 2.0,
1262 exp_load_ind := true,
1263 exp_overload := true,
1264 use_tmsi := false
1265 };
1266 var PagingTestState st := f_TC_paging(cfg);
1267 /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200
1268 * slots and will fully drain that buffer before returning */
1269 var template integer tpl := (st.num_paging_sent*80/100 .. st.num_paging_sent *85/100);
1270 if (not match(st.num_paging_rcv_ids, tpl)) {
1271 setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
1272 } else {
1273 setverdict(pass);
1274 }
1275}
1276
1277/* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that
1278 * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL
1279 * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point
1280 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1281testcase TC_paging_tmsi_200percent() runs on test_CT {
1282 var PagingTestCfg cfg := {
1283 combined_ccch := true,
1284 bs_ag_blks_res := 1,
1285 load_factor := 2.0,
1286 exp_load_ind := true,
1287 exp_overload := true,
1288 use_tmsi := true
1289 };
1290 var PagingTestState st := f_TC_paging(cfg);
1291 /* We expect about 70% to pass, given that we can fill the paging buffer of 200
1292 * slots and will fully drain that buffer before returning */
1293 var template integer tpl := (st.num_paging_sent*68/100 .. st.num_paging_sent *72/100);
1294 if (not match(st.num_paging_rcv_ids, tpl)) {
1295 setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
1296 } else {
1297 setverdict(pass);
1298 }
1299}
1300
1301
Harald Welte93640c62018-02-25 16:59:33 +01001302/***********************************************************************
1303 * Immediate Assignment / AGCH
1304 ***********************************************************************/
1305
Harald Welte68e495b2018-02-25 00:05:57 +01001306testcase TC_imm_ass() runs on test_CT {
1307 f_init(testcasename());
1308 for (var integer i := 0; i < 1000; i := i+1) {
1309 var octetstring ia_enc := f_rnd_octstring(8);
1310 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_IMM_ASSIGN(ia_enc, 0)));
1311 f_sleep(0.02);
1312 }
1313 /* FIXME: check if imm.ass arrive on Um side */
1314 /* FIXME: check for DELETE INDICATION */
1315 f_sleep(100.0);
1316}
1317
Harald Welte48494ca2018-02-25 16:59:50 +01001318/***********************************************************************
1319 * BCCH
1320 ***********************************************************************/
1321
1322/* tuple of Frame Number + decoded SI */
1323type record SystemInformationFn {
1324 GsmFrameNumber frame_number,
1325 SystemInformation si
1326}
1327
1328/* an arbitrary-length vector of decoded SI + gsmtap header */
1329type record of SystemInformationFn SystemInformationVector;
1330
1331/* an array of SI-vectors indexed by TC value */
1332type SystemInformationVector SystemInformationVectorPerTc[8];
1333
1334/* determine if a given SI vector contains given SI type at least once */
1335function f_si_vecslot_contains(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean {
1336 for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
1337 var integer fn_mod51 := arr[i].frame_number mod 51;
1338 if (not bcch_ext and fn_mod51 == 2 or
1339 bcch_ext and fn_mod51 == 6) {
1340 if (arr[i].si.header.message_type == key) {
1341 return true;
1342 }
1343 }
1344 }
1345 return false;
1346}
1347
1348/* ensure a given TC slot of the SI vector contains given SI type at least once at TC */
1349function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
1350 if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) {
1351 setverdict(fail, "No ", key, " in TC=", tc, "!");
1352 }
1353}
1354
1355/* check if a given SI vector contains given SI type at least once on any TC */
1356function f_si_vec_contains(SystemInformationVectorPerTc arr, RrMessageType key) return boolean {
1357 for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) {
1358 if (f_si_vecslot_contains(arr[tc], key) or
1359 f_si_vecslot_contains(arr[tc], key, true)) {
1360 return true;
1361 }
1362 }
1363 return false;
1364}
1365
1366/* determine if a given SI vector contains given SI type at least N of M times */
1367function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false, integer n := 1, integer m := 4) return boolean {
1368 var integer count := 0;
1369 if (sizeof(arr) < m) {
1370 setverdict(fail, "Error: Insufficient SI in array");
1371 self.stop;
1372 }
1373 for (var integer i:= 0; i < m; i := i + 1) {
1374 var integer fn_mod51 := arr[i].frame_number mod 51;
1375 if (not bcch_ext and fn_mod51 == 2 or
1376 bcch_ext and fn_mod51 == 6) {
1377 if (arr[i].si.header.message_type == key) {
1378 count := count + 1;
1379 }
1380 }
1381 }
1382 if (count >= n) {
1383 return true;
1384 } else {
1385 return false;
1386 }
1387}
1388
1389/* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */
1390function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false, integer n, integer m) {
1391 if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) {
1392 setverdict(fail, "Not ", n, "/", m, " of ", key, " in TC=", tc, "!");
1393 }
1394}
1395
1396/* determine if a given SI vector contains given SI type at least once */
1397function f_si_vecslot_contains_only(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean {
1398 for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
1399 var integer fn_mod51 := arr[i].frame_number mod 51;
1400 if (not bcch_ext and fn_mod51 == 2 or
1401 bcch_ext and fn_mod51 == 6) {
1402 if (arr[i].si.header.message_type != key) {
1403 return false;
1404 }
1405 }
1406 }
1407 return true;
1408}
1409
1410/* ensure a given TC slot of the SI vector contains only given SI type */
1411function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
1412 if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) {
1413 setverdict(fail, "Not all ", key, " in TC=", tc, "!");
1414 }
1415}
1416
1417/* SI configuration of cell, against which we validate actual SI messages */
1418type set SystemInformationConfig {
1419 boolean bcch_extended,
1420 boolean si1_present,
1421 boolean si2bis_present,
1422 boolean si2ter_present,
1423 boolean si2quater_present,
1424 boolean si7_present,
1425 boolean si8_present,
1426 boolean si9_present,
1427 boolean si13_present,
1428 boolean si13alt_present,
1429 boolean si15_present,
1430 boolean si16_present,
1431 boolean si17_present,
1432 boolean si2n_present,
1433 boolean si21_present,
1434 boolean si22_present
1435}
1436
1437/* validate the SI scheduling according to TS 45.002 version 14.1.0 Release 14, Section 6.3.1.3 */
1438function f_validate_si_scheduling(SystemInformationConfig cfg, SystemInformationVectorPerTc si_per_tc) {
1439 var integer i;
1440 for (i := 0; i < sizeof(si_per_tc); i := i + 1) {
1441 if (sizeof(si_per_tc[i]) == 0) {
Harald Welte544565a2018-03-02 10:34:08 +01001442 setverdict(fail, "No SI messages for TC=", i);
Harald Welte48494ca2018-02-25 16:59:50 +01001443 }
1444 }
1445 if (cfg.si1_present) {
1446 /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or
1447 * when the NCH is present in a cell. If the MS finds another message on BCCH Norm
1448 * when TC = 0, it can assume that System Information Type 1 is not in use. */
1449 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1);
1450 /* make sure *ALL* contain SI1 */
1451 f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1);
1452 }
1453 f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2);
1454 /* iii) A SI 2 message will be sent at least every time TC = 1 */
1455 f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3);
1456 f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3);
1457 f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4);
1458 f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4);
1459
1460 /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the
1461 * system operator. If only one of them is needed, it is sent when TC = 5. If both are
1462 * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4
1463 * consecutive occurrences of TC = 4. */
1464 if (cfg.si2bis_present and not cfg.si2ter_present) {
1465 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis);
1466 } else if (cfg.si2ter_present and not cfg.si2bis_present) {
1467 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter);
1468 } else if (cfg.si2ter_present and cfg.si2bis_present) {
1469 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis);
1470 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4);
1471 }
1472
1473 if (cfg.si7_present or cfg.si8_present) {
1474 /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary
1475 * if System Information type 4 does not contain all information needed for cell
1476 * selection and reselection. */
1477 if (not cfg.bcch_extended) {
1478 testcase.stop("Error: SI7/SI8 require BCCH Extd.");
1479 }
1480 if (cfg.si7_present) {
1481 f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true);
1482 }
1483 if (cfg.si8_present) {
1484 f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true);
1485 }
1486 }
1487
1488 if (cfg.si2quater_present) {
1489 /* iii) System information type 2 quater is sent if needed, as determined by the system
1490 * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis
1491 * and 2ter are used, otherwise it shall be sent at least once within any of 4
1492 * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once
1493 * within any of 4 consecutive occurrences of TC = 5. */
1494 if (not (cfg.bcch_extended)) {
1495 if (not (cfg.si2bis_present or cfg.si2ter_present)) {
1496 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater);
1497 } else {
1498 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4);
1499 }
1500 } else {
1501 f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4);
1502 }
1503 }
1504 if (cfg.si9_present) {
1505 /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified
1506 * in system information type 3 as defined in 3GPP TS 44.018. */
1507 f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3
1508 }
1509 if (cfg.si13_present) {
1510 /* vii) System Information type 13 is only related to the GPRS service. System Information
1511 * Type 13 need only be sent if GPRS support is indicated in one or more of System
1512 * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the
1513 * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext.
1514 * In the case that the message is sent on the BCCH Norm, it is sent at least once
1515 * within any of 4 consecutive occurrences of TC=4. */
1516 if (not cfg.bcch_extended) {
1517 log("not-bccch-extended");
1518 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4);
1519 } else {
1520 log("bccch-extended");
1521 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true);
1522 }
1523 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) {
1524 setverdict(fail, "Cannot have SI13alt and SI13");
1525 }
1526 }
1527 if (cfg.si16_present or cfg.si17_present) {
1528 /* viii) System Information type 16 and 17 are only related to the SoLSA service. They
1529 * should not be sent in a cell where network sharing is used (see rule xv). */
1530 if (cfg.si22_present) {
1531 testcase.stop("Error: Cannot have SI16/SI17 and SI22!");
1532 }
1533 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) {
1534 setverdict(fail, "Cannot have SI16/SI17 and SI22!");
1535 }
1536 if (not cfg.bcch_extended) {
1537 testcase.stop("Error: SI16/SI17 requires BCCH Extd!");
1538 }
1539 if (cfg.si16_present) {
1540 f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true);
1541 }
1542 if (cfg.si17_present) {
1543 f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true);
1544 }
1545 }
1546
1547 /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM
1548 * broadcast information. The frequency with which they are sent is determined by the
1549 * system operator. System Information type 9 identifies the scheduling of System
1550 * Information type 18 and 20 messages. */
1551
1552 /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System
1553 * Information Type 19 is present, then its scheduling shall be indicated in System
1554 * Information Type 9. */
1555
1556 if (cfg.si15_present) {
1557 /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the
1558 * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive
1559 * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of
1560 * 4 consecutive occurrences of TC = 1. */
1561 if (not cfg.bcch_extended) {
1562 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4);
1563 } else {
1564 f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4);
1565 }
1566 }
1567 if (cfg.si13alt_present) {
1568 /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System
1569 * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in
1570 * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not
1571 * broadcast. These messages also indicate if the message is sent on the BCCH Norm or
1572 * if the message is transmitted on the BCCH Ext. In the case that the message is sent
1573 * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences
1574 * of TC = 4. */
1575 if (cfg.si13_present) {
1576 testcase.stop("Error: Cannot have SI13alt and SI13");
1577 }
1578 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) {
1579 setverdict(fail, "Cannot have SI13alt and SI13");
1580 }
1581 if (not cfg.bcch_extended) {
1582 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4);
1583 } else {
1584 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true);
1585 }
1586 }
1587 if (cfg.si2n_present) {
1588 /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed,
1589 * as determined by the system operator. In the case that the message is sent on the
1590 * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC =
1591 * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2
1592 * consecutive occurrences of TC = 4. */
1593 if (not cfg.bcch_extended) {
1594 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4);
1595 } else {
1596 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4);
1597 }
1598 }
1599 if (cfg.si21_present) {
1600 /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as
1601 * determined by the system operator. If Extended Access Barring is in use in the cell
1602 * then this message is sent at least once within any of 4 consecutive occurrences of
1603 * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a
1604 * cell then this message shall only be sent on BCCH Ext. */
1605 if (not cfg.bcch_extended) {
1606 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4);
1607 } else {
1608 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4);
1609 if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) {
1610 setverdict(fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!");
1611 }
1612 }
1613 }
1614 if (cfg.si22_present) {
1615 /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It
1616 * should not be sent in a cell where SoLSA is used (see rule viii). System
1617 * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC
1618 * =2 and TC=6. */
1619 if (cfg.si16_present or cfg.si17_present) {
1620 testcase.stop("Error: Cannot have SI16/SI17 and SI22!");
1621 }
1622 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or
1623 f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) {
1624 setverdict(fail, "Cannot have SI16/SI17 and SI22!");
1625 }
1626 if (not cfg.bcch_extended) {
1627 testcase.stop("Error: SI22 requires BCCH Extd!");
1628 } else {
1629 f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true);
1630 f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true);
1631 }
1632 }
1633}
1634
1635/* sample Systme Information for specified duration via L1CTL */
1636function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) return SystemInformationVectorPerTc {
1637 timer T := duration;
1638 var SystemInformationVectorPerTc si_per_tc;
1639 var L1ctlDlMessage l1_dl;
1640
1641 /* initialize all per-TC vectors empty */
1642 for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) {
1643 si_per_tc[i] := {};
1644 }
1645
1646 /* flush all previous L1 queued msgs */
1647 pt.clear;
1648
1649 T.start;
1650 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01001651 [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl {
Harald Welte48494ca2018-02-25 16:59:50 +01001652 /* somehow dec_SystemInformation will try to decode even non-RR as SI */
1653 if (not (l1_dl.payload.data_ind.payload[1] == '06'O)) {
1654 log("Ignoring non-RR SI ", l1_dl);
1655 repeat;
1656 }
1657 var SystemInformationFn sig := {
1658 frame_number := l1_dl.dl_info.frame_nr,
1659 si := dec_SystemInformation(l1_dl.payload.data_ind.payload)
1660 }
1661 var integer tc := f_gsm_compute_tc(sig.frame_number);
1662 log("SI received at TC=", tc, ": ", sig.si);
1663 /* append to the per-TC bucket */
1664 si_per_tc[tc] := si_per_tc[tc] & { sig };
1665 repeat;
1666 }
1667 [] pt.receive { repeat; }
1668 [] T.timeout { }
1669 }
1670
1671 for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) {
1672 log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i]));
1673 }
1674 log("si_per_tc=", si_per_tc);
1675 return si_per_tc;
1676}
1677
1678/* helper function: Set given SI via RSL + validate scheduling.
1679 * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */
1680function f_TC_si_sched() runs on test_CT {
1681 var SystemInformationVectorPerTc si_per_tc;
1682 f_init_l1ctl();
1683 f_l1_tune(L1CTL);
1684
1685 /* Sample + Validate Scheduling */
1686 si_per_tc := f_l1_sample_si(L1CTL);
1687 f_validate_si_scheduling(si_cfg, si_per_tc);
1688
1689 setverdict(pass);
1690}
1691
1692testcase TC_si_sched_default() runs on test_CT {
1693 f_init();
Harald Welte0cae4552018-03-09 22:20:26 +01001694 /* 2+3+4 are mandatory and set in f_init() */
1695 f_TC_si_sched();
1696}
1697
1698testcase TC_si_sched_1() runs on test_CT {
1699 f_init();
1700 si_cfg.si1_present := true;
1701 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O);
Harald Welte48494ca2018-02-25 16:59:50 +01001702 f_TC_si_sched();
1703}
1704
1705testcase TC_si_sched_2bis() runs on test_CT {
1706 f_init();
1707 si_cfg.si2bis_present := true;
1708 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1709 f_TC_si_sched();
1710}
1711
1712testcase TC_si_sched_2ter() runs on test_CT {
1713 f_init();
1714 si_cfg.si2ter_present := true;
1715 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1716 f_TC_si_sched();
1717}
1718
1719testcase TC_si_sched_2ter_2bis() runs on test_CT {
1720 f_init();
1721 si_cfg.si2bis_present := true;
1722 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1723 si_cfg.si2ter_present := true;
1724 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1725 f_TC_si_sched();
1726}
1727
1728testcase TC_si_sched_2quater() runs on test_CT {
1729 f_init();
1730 si_cfg.si2quater_present := true;
1731 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
1732 f_TC_si_sched();
1733}
1734
1735testcase TC_si_sched_13() runs on test_CT {
1736 f_init();
1737 si_cfg.si13_present := true;
1738 //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
1739 f_TC_si_sched();
1740}
1741
1742testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT {
1743 f_init();
1744 si_cfg.si2bis_present := true;
1745 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1746 si_cfg.si2ter_present := true;
1747 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1748 si_cfg.si2quater_present := true;
1749 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
1750 si_cfg.si13_present := true;
1751 //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
1752 f_TC_si_sched();
1753}
1754
1755
Harald Welte68e495b2018-02-25 00:05:57 +01001756testcase TC_bcch_info() runs on test_CT {
1757 f_init(testcasename());
1758 /* FIXME: enable / disable individual BCCH info */
1759 //ts_RSL_BCCH_INFO(si_type, info);
1760 /* expect no ERROR REPORT after either of them *
1761 /* negative test: ensure ERROR REPORT on unsupported types */
1762}
1763
Harald Welte93640c62018-02-25 16:59:33 +01001764/***********************************************************************
1765 * Low-Level Protocol Errors / ERROR REPORT
1766 ***********************************************************************/
1767
Harald Welte01d982c2018-02-25 01:31:40 +01001768private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT {
1769 timer T := 5.0;
1770 T.start;
1771 alt {
1772 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(cause))) {
1773 setverdict(pass);
1774 }
1775 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(?))) {
1776 setverdict(fail, "Wrong cause in RSL ERR REP");
1777 }
1778 [] RSL_CCHAN.receive {
1779 repeat;
1780 }
1781 [] T.timeout {
1782 setverdict(fail, "Timeout waiting for RSL ERR REP");
1783 }
1784 }
1785}
1786
1787/* Provoke a protocol error (message too short) and match on ERROR REPORT */
1788testcase TC_rsl_protocol_error() runs on test_CT {
1789 f_init(testcasename());
1790 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1791 rsl.ies := omit;
1792 RSL_CCHAN.send(ts_RSL_UD(rsl));
1793
1794 f_exp_err_rep(RSL_ERR_PROTO);
1795}
1796
1797/* Provoke a mandatory IE error and match on ERROR REPORT */
1798testcase TC_rsl_mand_ie_error() runs on test_CT {
1799 f_init(testcasename());
1800
1801 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1802 rsl.ies := { rsl.ies[0] };
1803 RSL_CCHAN.send(ts_RSL_UD(rsl));
1804
1805 f_exp_err_rep(RSL_ERR_MAND_IE_ERROR);
1806}
1807
1808/* Provoke an IE content error and match on ERROR REPORT */
1809testcase TC_rsl_ie_content_error() runs on test_CT {
1810 f_init(testcasename());
1811 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1812 rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5;
1813 RSL_CCHAN.send(ts_RSL_UD(rsl));
1814
1815 f_exp_err_rep(RSL_ERR_IE_CONTENT);
1816}
1817
Harald Welte93640c62018-02-25 16:59:33 +01001818/***********************************************************************
1819 * IPA CRCX/MDCX/DLCS media stream handling
1820 ***********************************************************************/
1821
Harald Weltea871a382018-02-25 02:03:14 +01001822/* Send IPA DLCX to inactive lchan */
1823function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr {
Harald Welte1eba3742018-02-25 12:48:14 +01001824 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1825 "IPA DLCX ACK");
Harald Weltea871a382018-02-25 02:03:14 +01001826}
1827testcase TC_ipa_dlcx_not_active() runs on test_CT {
1828 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1829 f_init(testcasename());
1830 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_dlcx_not_active), pars);
1831 vc_conn.done;
1832}
Harald Welte68e495b2018-02-25 00:05:57 +01001833
Harald Weltea3f1df92018-02-25 12:49:55 +01001834/* Send IPA CRCX twice to inactive lchan */
1835function f_TC_ipa_crcx_twice_not_active(charstring id) runs on ConnHdlr {
1836 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
1837 "IPA CRCX ACK");
1838 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL),
1839 "IPA CRCX NACK");
1840}
1841testcase TC_ipa_crcx_twice_not_active() runs on test_CT {
1842 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1843 f_init(testcasename());
1844 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars);
1845 vc_conn.done;
1846}
1847
1848/* Regular sequence of CRCX/MDCX/DLCX */
1849function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
1850 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
1851 "IPA CRCX ACK");
1852 var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
1853 var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
1854 var uint7_t rtp_pt2 := f_rnd_int(127);
1855 var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
1856 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1857 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1858 "IPA MDCX ACK");
1859 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1860 "IPA DLCX ACK");
1861}
1862testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT {
1863 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1864 f_init(testcasename());
1865 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars);
1866 vc_conn.done;
1867}
1868
Harald Welte3ae11da2018-02-25 13:36:06 +01001869/* Sequence of CRCX, 2x MDCX, DLCX */
1870function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
1871 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
1872 "IPA CRCX ACK");
1873 var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
1874 var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
1875 var uint7_t rtp_pt2 := f_rnd_int(127);
1876 var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
1877 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1878 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1879 "IPA MDCX ACK");
1880 /* Second MDCX */
1881 remote_ip := f_rnd_int(c_UINT32_MAX);
1882 remote_port := f_rnd_int(c_UINT16_MAX);
1883 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1884 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1885 "IPA MDCX ACK");
1886 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1887 "IPA DLCX ACK");
1888}
1889testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT {
1890 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1891 f_init(testcasename());
1892 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars);
1893 vc_conn.done;
1894}
1895
Harald Welte9912eb52018-02-25 13:30:15 +01001896/* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */
1897function f_TC_ipa_crcx_sdcch_not_active(charstring id) runs on ConnHdlr {
1898 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?),
1899 "IPA CRCX NACK");
1900}
1901testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT {
1902 var ConnHdlrPars pars;
1903 var ConnHdlr vc_conn;
1904 f_init(testcasename());
1905
1906 pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN));
1907 vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars);
1908 vc_conn.done;
1909
1910 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN));
1911 vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars);
1912 vc_conn.done;
1913}
1914
Harald Weltea3f1df92018-02-25 12:49:55 +01001915
Harald Welte883340c2018-02-28 18:59:29 +01001916/***********************************************************************
1917 * PCU Socket related tests
1918 ***********************************************************************/
1919
1920private function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success)
1921runs on test_CT {
1922 timer T := 3.0;
1923
1924 /* we don't expect any RTS.req before PDCH are active */
1925 T.start;
1926 alt {
1927 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr))) {
1928 setverdict(fail, "PCU RTS.req before PDCH active?");
1929 self.stop;
1930 }
1931 [] PCU.receive { repeat; }
1932 [] T.timeout { }
1933 }
1934
1935 /* Send PDCH activate request for known PDCH timeslot */
1936 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, ts_nr)));
1937
1938 /* we now expect RTS.req for this timeslot (only) */
1939 T.start;
1940 alt {
1941 [exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
1942 setverdict(pass);
1943 }
1944 [not exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
1945 tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
1946 setverdict(fail, "Unexpected RTS.req for supposedly failing activation");
1947 self.stop;
1948 }
1949 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) {
1950 setverdict(fail, "RTS.req for wrong TRX/TS");
1951 self.stop;
1952 }
1953 [] PCU.receive { repeat; }
1954 [exp_success] T.timeout {
1955 setverdict(fail, "Timeout waiting for PCU RTS.req");
1956 }
1957 [not exp_success] T.timeout {
1958 setverdict(pass);
1959 }
1960 }
1961}
1962
1963private function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr)
1964runs on test_CT {
1965 timer T := 3.0;
1966
1967 /* Send PDCH activate request for known PDCH timeslot */
1968 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, ts_nr)));
1969
1970 PCU.clear;
1971 /* we now expect no RTS.req for this timeslot */
1972 T.start;
1973 alt {
1974 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
1975 setverdict(fail, "Received unexpected PCU RTS.req");
1976 self.stop;
1977 }
1978 [] PCU.receive { repeat; }
1979 [] T.timeout {
1980 setverdict(pass);
1981 }
1982 }
1983}
1984
1985/* PDCH activation via PCU socket; check for presence of RTS.req */
1986testcase TC_pcu_act_req() runs on test_CT {
1987 f_init();
1988 f_TC_pcu_act_req(0, 0, 7, true);
1989}
1990
1991/* PDCH activation via PCU socket on non-PDCU timeslot */
1992testcase TC_pcu_act_req_wrong_ts() runs on test_CT {
1993 f_init();
1994 f_TC_pcu_act_req(0, 0, 1, false);
1995}
1996
1997/* PDCH activation via PCU socket on wrong BTS */
1998testcase TC_pcu_act_req_wrong_bts() runs on test_CT {
1999 f_init();
2000 f_TC_pcu_act_req(23, 0, 7, false);
2001}
2002
2003/* PDCH activation via PCU socket on wrong TRX */
2004testcase TC_pcu_act_req_wrong_trx() runs on test_CT {
2005 f_init();
2006 f_TC_pcu_act_req(0, 23, 7, false);
2007}
2008
2009/* PDCH deactivation via PCU socket; check for absence of RTS.req */
2010testcase TC_pcu_deact_req() runs on test_CT {
2011 f_init();
2012 /* Activate PDCH */
2013 f_TC_pcu_act_req(0, 0, 7, true);
2014 f_sleep(1.0);
2015 /* and De-Activate again */
2016 f_TC_pcu_deact_req(0, 0, 7);
2017}
2018
2019/* Attempt to deactivate a PDCH on a non-PDCH timeslot */
2020testcase TC_pcu_deact_req_wrong_ts() runs on test_CT {
2021 f_init();
2022 f_TC_pcu_deact_req(0, 0, 1);
2023}
2024
2025/* Test the PCU->BTS Version and BTS->PCU SI13 handshake */
2026testcase TC_pcu_ver_si13() runs on test_CT {
2027 const octetstring si13 := '00010203040506070909'O;
2028 var PCUIF_send_data sd;
2029 timer T:= 3.0;
2030 f_init();
2031
2032 /* Set SI13 via RSL */
2033 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, si13);
2034 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, "BTS_Test v23")));
2035 T.start;
2036 alt {
2037 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_DATA_IND(0, 0, 0, ?, PCU_IF_SAPI_BCCH))) -> value sd {
2038 if (substr(sd.data.u.data_ind.data, 0, lengthof(si13)) == si13) {
2039 setverdict(pass);
2040 } else {
2041 repeat;
2042 }
2043 }
2044 [] PCU.receive { repeat; }
2045 [] T.timeout {
2046 setverdict(fail, "Timeout waiting for SI13");
2047 self.stop;
2048 }
2049 }
2050}
2051
2052private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O;
2053
2054/* helper function to send a PCU DATA.req */
2055private function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
2056 uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data)
2057runs on test_CT
2058{
2059 PCU.send(t_SD_PCUIF(g_pcu_conn_id,
2060 ts_PCUIF_DATA_REQ(bts_nr, trx_nr, ts_nr, block_nr, fn, sapi, data)));
2061}
2062
2063/* helper function to wait for RTS.ind for given SAPI on given BTS/TRX/TS and then send */
2064private function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
2065 PCUIF_Sapi sapi, octetstring data)
2066runs on test_CT
2067{
2068 var PCUIF_send_data sd;
2069
2070 timer T := 3.0;
2071 T.start;
2072 alt {
2073 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
2074 tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr, sapi))) -> value sd {
2075 f_pcu_data_req(bts_nr, trx_nr, ts_nr, sd.data.u.rts_req.block_nr,
2076 sd.data.u.rts_req.fn, sapi, data);
2077 }
2078 [] PCU.receive { repeat; }
2079 [] T.timeout {
2080 setverdict(fail, "Timeout waiting for RTS.ind");
2081 }
2082 }
2083}
2084
2085/* Send DATA.req on invalid BTS */
2086testcase TC_pcu_data_req_wrong_bts() runs on test_CT {
2087 f_init();
2088 f_TC_pcu_act_req(0, 0, 7, true);
2089 f_pcu_data_req(23, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2090 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2091 f_sleep(10.0);
2092}
2093
2094/* Send DATA.req on invalid TRX */
2095testcase TC_pcu_data_req_wrong_trx() runs on test_CT {
2096 f_init();
2097 f_TC_pcu_act_req(0, 0, 7, true);
2098 f_pcu_data_req(0, 100, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2099 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2100 f_sleep(10.0);
2101}
2102
2103/* Send DATA.req on invalid timeslot */
2104testcase TC_pcu_data_req_wrong_ts() runs on test_CT {
2105 f_init();
2106 f_TC_pcu_act_req(0, 0, 7, true);
2107 f_pcu_data_req(0, 0, 70, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2108 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2109 f_sleep(10.0);
2110}
2111
2112/* Send DATA.req on timeslot that hasn't been activated */
2113testcase TC_pcu_data_req_ts_inactive() runs on test_CT {
2114 f_init();
2115 f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2116 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2117 f_sleep(2.0);
2118}
2119
2120testcase TC_pcu_data_req_pdtch() runs on test_CT {
2121 f_init();
2122 f_TC_pcu_act_req(0, 0, 7, true);
2123 f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2124 /* FIXME: how to check this was actually sent */
2125 f_sleep(2.0);
2126}
2127
2128testcase TC_pcu_data_req_ptcch() runs on test_CT {
2129 f_init();
2130 f_TC_pcu_act_req(0, 0, 7, true);
2131 f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, c_PCU_DATA);
2132 /* FIXME: how to check this was actually sent */
2133 f_sleep(2.0);
2134}
2135
2136/* Send AGCH from PCU; check it appears on Um side */
2137testcase TC_pcu_data_req_agch() runs on test_CT {
2138 timer T := 3.0;
2139 f_init();
2140 f_init_l1ctl();
2141 f_l1_tune(L1CTL);
2142
2143 f_TC_pcu_act_req(0, 0, 7, true);
2144 f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_AGCH, c_PCU_DATA);
2145
2146 T.start;
2147 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01002148 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) {
Harald Welte883340c2018-02-28 18:59:29 +01002149 setverdict(pass);
2150 }
2151 [] L1CTL.receive { repeat; }
2152 [] T.timeout {
2153 setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
2154 }
2155 }
2156}
2157
2158/* Send IMM.ASS from PCU for PCH; check it appears on Um side */
2159testcase TC_pcu_data_req_imm_ass_pch() runs on test_CT {
2160 var octetstring imm_ass := f_rnd_octstring(23);
2161 f_init();
2162 f_init_l1ctl();
2163 f_l1_tune(L1CTL);
2164
2165 /* append 3 last imsi digits so BTS can compute pagng group */
2166 var uint32_t fn := f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H);
2167
2168 timer T := 0.5;
2169 T.start;
2170 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01002171 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, imm_ass)) {
Harald Welte883340c2018-02-28 18:59:29 +01002172 /* TODO: verify paging group */
2173 setverdict(pass);
2174 }
2175 [] L1CTL.receive { repeat; }
2176 [] T.timeout {
2177 setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
2178 }
2179 }
2180}
2181
2182/* Send RACH from Um side, expect it to show up on PCU socket */
2183testcase TC_pcu_rach_content() runs on test_CT {
2184 f_init();
2185 f_init_l1ctl();
2186 f_l1_tune(L1CTL);
2187
2188 var GsmFrameNumber fn_last := 0;
2189 for (var integer i := 0; i < 1000; i := i+1) {
2190 var OCT1 ra := f_rnd_ra_ps();
2191 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
2192 if (fn == fn_last) {
2193 setverdict(fail, "Two RACH in same FN?!?");
2194 self.stop;
2195 }
2196 fn_last := fn;
2197
2198 timer T := 2.0;
2199 T.start;
2200 alt {
2201 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND(0, oct2int(ra), 0, ?, fn))) {
2202 T.stop;
2203 }
2204 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) {
2205 setverdict(fail, "Unexpected RACH IND");
2206 self.stop;
2207 }
2208 [] PCU.receive { repeat; }
2209 [] T.timeout {
2210 setverdict(fail, "Timeout waiting for RACH IND");
2211 self.stop;
2212 }
2213 }
2214 }
2215 setverdict(pass);
2216}
2217
2218private function f_pad_oct(octetstring str, integer len, OCT1 pad) return octetstring {
2219 var integer strlen := lengthof(str);
2220 for (var integer i := 0; i < len-strlen; i := i+1) {
2221 str := str & pad;
2222 }
2223 return str;
2224}
2225
2226/* Send PAGING via RSL, expect it to shw up on PCU socket */
2227testcase TC_pcu_paging_from_rsl() runs on test_CT {
2228 f_init();
2229
2230 for (var integer i := 0; i < 100; i := i+1) {
2231 var MobileL3_CommonIE_Types.MobileIdentityLV mi;
2232 timer T := 3.0;
2233 if (i < 50) {
2234 mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4)));
2235 } else {
2236 mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i)));
2237 }
2238 var octetstring mi_enc_lv := enc_MobileIdentityLV(mi);
2239 var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1);
2240 var octetstring t_mi_lv := f_pad_oct(mi_enc_lv, 9, '00'O);
2241
2242 /* Send RSL PAGING COMMAND */
2243 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4)));
2244 T.start;
2245 alt {
2246 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ(0, t_mi_lv))) {
2247 }
2248 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ)) {
2249 setverdict(fail, "Unexpected PAGING REQ");
2250 self.stop;
2251 }
2252 [] PCU.receive { repeat; }
2253 [] T.timeout {
2254 setverdict(fail, "Timeout waiting for PAGING REQ");
2255 self.stop;
2256 }
2257 }
2258 }
2259 setverdict(pass);
2260}
2261
2262
Harald Welte68e495b2018-02-25 00:05:57 +01002263/* TODO Areas:
2264
2265* channel activation
2266** with BS_Power / MS_Power, bypassing power control loop
2267** on primary vs. secondary TRX
2268** with encryption from initial activation on
2269** with timing advance from initial activation on
2270* mode modify
2271** encryption
2272** multirate
2273* check DEACTIVATE SACCH
2274* encryption command / intricate logic about tx-only/tx+rx/...
2275** unsupported algorithm
2276* handover detection
2277* MS Power Control
2278* BS Power Control
2279* Physical Context
2280* SACCH info modify
Harald Welte68e495b2018-02-25 00:05:57 +01002281* CCCH Load Indication for PCH and RACH
2282* Delete Indication on AGCH overflow
2283* SMS Broadcast Req / Cmd / CBCH LOad Ind
2284* RF resource ind
Harald Welte68e495b2018-02-25 00:05:57 +01002285* error handling
2286* discriminator error
2287** type error
2288** sequence error
2289** IE duplicated?
Harald Welte883340c2018-02-28 18:59:29 +01002290* PCU interface
2291** TIME_IND from BTS->PCU
2292** DATA_IND from BTS->PCU
2293** verification of PCU-originated DATA_REQ arrival on Um/MS side
Harald Welte68e495b2018-02-25 00:05:57 +01002294
2295*/
Harald Welte70767382018-02-21 12:16:40 +01002296
2297control {
2298 execute( TC_chan_act_stress() );
2299 execute( TC_chan_act_react() );
2300 execute( TC_chan_deact_not_active() );
2301 execute( TC_chan_act_wrong_nr() );
Harald Welte8c24c2b2018-02-26 08:31:31 +01002302 execute( TC_rach_content() );
2303 execute( TC_rach_count() );
Harald Welte54a2a2d2018-02-26 09:14:05 +01002304 execute( TC_rach_max_ta() );
Harald Welte70767382018-02-21 12:16:40 +01002305 execute( TC_meas_res_sign_tchf() );
2306 execute( TC_meas_res_sign_tchh() );
2307 execute( TC_meas_res_sign_sdcch4() );
2308 execute( TC_meas_res_sign_sdcch8() );
Harald Welte685d5982018-02-27 20:42:05 +01002309 execute( TC_meas_res_sign_tchh_toa256() );
Harald Welte70767382018-02-21 12:16:40 +01002310 execute( TC_conn_fail_crit() );
Harald Welte68e495b2018-02-25 00:05:57 +01002311 execute( TC_paging_imsi_80percent() );
2312 execute( TC_paging_tmsi_80percent() );
2313 execute( TC_paging_imsi_200percent() );
2314 execute( TC_paging_tmsi_200percent() );
Harald Welte01d982c2018-02-25 01:31:40 +01002315 execute( TC_rsl_protocol_error() );
2316 execute( TC_rsl_mand_ie_error() );
2317 execute( TC_rsl_ie_content_error() );
Harald Welte48494ca2018-02-25 16:59:50 +01002318 execute( TC_si_sched_default() );
Harald Welte0cae4552018-03-09 22:20:26 +01002319 execute( TC_si_sched_1() );
Harald Welte48494ca2018-02-25 16:59:50 +01002320 execute( TC_si_sched_2bis() );
2321 execute( TC_si_sched_2ter() );
2322 execute( TC_si_sched_2ter_2bis() );
2323 execute( TC_si_sched_2quater() );
2324 execute( TC_si_sched_13() );
2325 execute( TC_si_sched_13_2bis_2ter_2quater() );
Harald Weltea871a382018-02-25 02:03:14 +01002326 execute( TC_ipa_dlcx_not_active() );
Harald Weltea3f1df92018-02-25 12:49:55 +01002327 execute( TC_ipa_crcx_twice_not_active() );
2328 execute( TC_ipa_crcx_mdcx_dlcx_not_active() );
Harald Welte3ae11da2018-02-25 13:36:06 +01002329 execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() );
Harald Welte9912eb52018-02-25 13:30:15 +01002330 execute( TC_ipa_crcx_sdcch_not_active() );
Harald Welte883340c2018-02-28 18:59:29 +01002331
2332 execute( TC_pcu_act_req() );
2333 execute( TC_pcu_act_req_wrong_ts() );
2334 execute( TC_pcu_act_req_wrong_bts() );
2335 execute( TC_pcu_act_req_wrong_trx() );
2336 execute( TC_pcu_deact_req() );
2337 execute( TC_pcu_deact_req_wrong_ts() );
2338 execute( TC_pcu_ver_si13() );
2339 execute( TC_pcu_data_req_wrong_bts() );
2340 execute( TC_pcu_data_req_wrong_trx() );
2341 execute( TC_pcu_data_req_wrong_ts() );
2342 execute( TC_pcu_data_req_ts_inactive() );
2343 execute( TC_pcu_data_req_pdtch() );
2344 execute( TC_pcu_data_req_ptcch() );
2345 execute( TC_pcu_data_req_agch() );
2346 execute( TC_pcu_data_req_imm_ass_pch() );
2347 execute( TC_pcu_rach_content() );
2348 execute( TC_pcu_paging_from_rsl() );
Harald Welte70767382018-02-21 12:16:40 +01002349}
2350
2351
2352}