blob: a345d75d7e83fa361e0440e697033a08a93ea79c [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 Welte294b0a22018-03-10 23:26:48 +0100283function f_shutdown() runs on test_CT {
284 /* shut down all "externally interfaced" components first to avoid unclean shutdown */
285 vc_IPA.stop;
286 vc_RSL.stop;
287}
288
Harald Welte68e495b2018-02-25 00:05:57 +0100289/* Attach L1CTL to master test_CT (classic tests, non-handler mode) */
290function f_init_l1ctl() runs on test_CT {
291 map(self:L1CTL, system:L1CTL);
292 f_connect_reset(L1CTL);
293}
294
Harald Welte70767382018-02-21 12:16:40 +0100295type function void_fn(charstring id) runs on ConnHdlr;
296
297/* create a new test component */
298function f_start_handler(void_fn fn, ConnHdlrPars pars)
299runs on test_CT return ConnHdlr {
300 var charstring id := testcasename();
301 var ConnHdlr vc_conn;
302
303 vc_conn := ConnHdlr.create(id);
304 /* connect to RSL Emulation main component */
305 connect(vc_conn:RSL, vc_RSL:CLIENT_PT);
306 connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC);
307
308 vc_conn.start(f_handler_init(fn, id, pars));
309 return vc_conn;
310}
311
Harald Welte7484fc42018-02-24 14:09:45 +0100312template ASP_RSL_Unitdata ts_RSL_UD(template RSL_Message rsl, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
313 streamId := sid,
314 rsl := rsl
315}
316
317template ASP_RSL_Unitdata tr_RSL_UD(template RSL_Message rsl,
318 template IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
319 streamId := sid,
320 rsl := rsl
321}
322
Harald Welte70767382018-02-21 12:16:40 +0100323private altstep as_Tguard() runs on ConnHdlr {
324 [] g_Tguard.timeout {
325 setverdict(fail, "Tguard timeout");
326 self.stop;
327 }
328}
329
Harald Welte68e495b2018-02-25 00:05:57 +0100330private function f_l1_tune(L1CTL_PT L1CTL) {
Harald Welte70767382018-02-21 12:16:40 +0100331 f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, CCCH_MODE_COMBINED);
332}
333
334private function f_trxc_connect() runs on ConnHdlr {
335 map(self:BB_TRXC, system:BB_TRXC);
336 var Result res;
Harald Weltea4d8f352018-03-01 15:47:20 +0100337 res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
338 "", -1, -1, {udp:={}}, {});
Harald Welte70767382018-02-21 12:16:40 +0100339 g_bb_trxc_conn_id := res.connId;
340}
341
342private function f_trxc_fake_rssi(uint8_t rssi) runs on ConnHdlr {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100343 var TrxcMessage ret;
344 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_RSSI(rssi)));
Harald Welte70767382018-02-21 12:16:40 +0100345}
346
347private function f_trx_fake_toffs256(int16_t toffs256) runs on ConnHdlr {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100348 var TrxcMessage ret;
349 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256)));
Harald Welte70767382018-02-21 12:16:40 +0100350}
351
352/* first function started in ConnHdlr component */
353private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars)
354runs on ConnHdlr {
355 g_pars := pars;
356 g_chan_nr := pars.chan_nr;
357
358 map(self:L1CTL, system:L1CTL);
359 f_connect_reset(L1CTL);
360
Harald Welte84271622018-03-10 17:21:03 +0100361 if (mp_bb_trxc_port != -1) {
362 f_trxc_connect();
363 }
Harald Welte70767382018-02-21 12:16:40 +0100364
365 g_Tguard.start(pars.t_guard);
366 activate(as_Tguard());
367
368 f_rslem_register(0, pars.chan_nr);
369
370 /* call the user-supplied test case function */
371 fn.apply(id);
372}
373
Harald Welte1eba3742018-02-25 12:48:14 +0100374function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, charstring id)
375runs on ConnHdlr {
376 timer T := 3.0;
377 RSL.send(tx);
378 T.start;
Harald Welte70767382018-02-21 12:16:40 +0100379 alt {
Harald Welte1eba3742018-02-25 12:48:14 +0100380 [] RSL.receive(exp_rx) {
381 T.stop;
382 setverdict(pass);
Harald Welte70767382018-02-21 12:16:40 +0100383 }
Harald Welte1eba3742018-02-25 12:48:14 +0100384 [] T.timeout {
385 setverdict(fail, "Timeout expecting " & id);
386 self.stop;
387 }
Harald Welte3c0a0f82018-03-10 23:01:33 +0100388 [] as_l1_sacch();
389 [] as_meas_res();
390 [] as_l1_dcch();
Harald Welte1eba3742018-02-25 12:48:14 +0100391 [] RSL.receive {
392 setverdict(fail, "Unexpected RSL message received");
Harald Welte70767382018-02-21 12:16:40 +0100393 }
394 }
395}
396
Harald Welte1eba3742018-02-25 12:48:14 +0100397function f_rsl_chan_act(RSL_IE_ChannelMode mode) runs on ConnHdlr {
398 f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr),
399 "RSL CHAN ACT");
400}
401
Harald Welte70767382018-02-21 12:16:40 +0100402function f_rsl_chan_deact() runs on ConnHdlr {
Harald Welte1eba3742018-02-25 12:48:14 +0100403 f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr),
404 "RF CHAN REL");
Harald Welte70767382018-02-21 12:16:40 +0100405}
406
Harald Welte70767382018-02-21 12:16:40 +0100407private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr,
408 template RSL_IE_ChannelMode chan_mode,
409 float t_guard := 20.0) := {
410 chan_nr := valueof(chan_nr),
411 chan_mode := valueof(chan_mode),
412 t_guard := t_guard,
413 l1_pars := {
414 dtx_enabled := false,
Harald Welte685d5982018-02-27 20:42:05 +0100415 toa256_enabled := false,
Harald Welte70767382018-02-21 12:16:40 +0100416 meas_ul := {
417 full := {
418 rxlev := dbm2rxlev(-53),
419 rxqual := 0
420 },
421 sub := {
422 rxlev := dbm2rxlev(-53),
423 rxqual := 0
424 }
425 },
426 timing_offset_256syms := 0,
427 bs_power_level := 0,
428 ms_power_level := 0,
429 ms_actual_ta := 0
430 }
431}
432
Harald Welte93640c62018-02-25 16:59:33 +0100433/***********************************************************************
434 * Channel Activation / Deactivation
435 ***********************************************************************/
436
Harald Welte70767382018-02-21 12:16:40 +0100437/* Stress test: Do 500 channel activations/deactivations in rapid succession */
438function f_TC_chan_act_stress(charstring id) runs on ConnHdlr {
439 for (var integer i := 0; i < 500; i := i+1) {
440 f_rsl_chan_act(g_pars.chan_mode);
441 f_rsl_chan_deact();
442 }
443 setverdict(pass);
444}
445testcase TC_chan_act_stress() runs on test_CT {
446 var ConnHdlr vc_conn;
447 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
448 f_init(testcasename());
449 vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars);
450 vc_conn.done;
Harald Welte294b0a22018-03-10 23:26:48 +0100451 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100452}
453
454/* Test if re-activation of an already active channel fails as expected */
455function f_TC_chan_act_react(charstring id) runs on ConnHdlr {
456 f_rsl_chan_act(g_pars.chan_mode);
457 /* attempt to activate the same lchan again -> expect reject */
458 RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
459 alt {
460 [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
461 setverdict(fail, "Unexpected CHAN ACT ACK on double activation");
462 }
463 [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
464 setverdict(pass);
465 }
466 }
467 f_rsl_chan_deact();
468}
469testcase TC_chan_act_react() runs on test_CT {
470 var ConnHdlr vc_conn;
471 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
Harald Welte294b0a22018-03-10 23:26:48 +0100472 f_init();
Harald Welte70767382018-02-21 12:16:40 +0100473 vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars);
474 vc_conn.done;
Harald Welte294b0a22018-03-10 23:26:48 +0100475 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100476}
477
478/* Attempt to de-activate a channel that's not active */
479function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr {
480 timer T := 3.0;
481 RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr));
482 T.start;
483 alt {
484 [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) {
485 setverdict(pass);
486 }
487 [] T.timeout {
488 setverdict(fail, "Timeout expecting RF_CHAN_REL_ACK");
489 }
490 }
491}
492testcase TC_chan_deact_not_active() runs on test_CT {
493 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
Harald Welte294b0a22018-03-10 23:26:48 +0100494 f_init();
Harald Welte70767382018-02-21 12:16:40 +0100495 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars);
496 vc_conn.done;
Harald Welte294b0a22018-03-10 23:26:48 +0100497 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100498}
499
500/* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */
501function f_TC_chan_act_wrong_nr(charstring id) runs on ConnHdlr {
502 RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode));
503 alt {
504 [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) {
505 setverdict(fail, "Unexpected CHAN ACT ACK");
506 }
507 [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) {
508 setverdict(pass);
509 }
510 }
511}
512private type record WrongChanNrCase {
513 RslChannelNr chan_nr,
514 charstring description
515}
516private type record of WrongChanNrCase WrongChanNrCases;
517private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := {
518 chan_nr := chan_nr,
519 description := desc
520}
521
522testcase TC_chan_act_wrong_nr() runs on test_CT {
523 var ConnHdlr vc_conn;
524 var ConnHdlrPars pars;
525
Harald Welte294b0a22018-03-10 23:26:48 +0100526 f_init();
Harald Welte70767382018-02-21 12:16:40 +0100527
528 var WrongChanNrCases wrong := {
529 valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")),
530 valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")),
531 valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")),
532 valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")),
533 valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")),
534 valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")),
535 valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")),
536 valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")),
537 valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")),
538 valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")),
539 valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")),
540 valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")),
541 valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H"))
542 };
543
544 for (var integer i := 0; i < sizeof(wrong); i := i+1) {
545 pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN));
546 vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars);
547 vc_conn.done;
548 }
Harald Welte294b0a22018-03-10 23:26:48 +0100549 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100550}
551
Harald Welte93640c62018-02-25 16:59:33 +0100552/***********************************************************************
553 * RACH Handling
554 ***********************************************************************/
555
Harald Welte8c24c2b2018-02-26 08:31:31 +0100556/* like L1SAP_IS_PACKET_RACH */
557private function ra_is_ps(OCT1 ra) return boolean {
Harald Welte56c05802018-02-28 21:39:35 +0100558 if ((ra and4b 'F0'O == '70'O) and (ra and4b '0F'O != '0F'O)) {
Harald Welte8c24c2b2018-02-26 08:31:31 +0100559 return true;
560 }
561 return false;
562}
563
564/* generate a random RACH for circuit-switched */
565private function f_rnd_ra_cs() return OCT1 {
566 var OCT1 ra;
567 do {
568 ra := f_rnd_octstring(1);
569 } while (ra_is_ps(ra));
570 return ra;
571}
572
Harald Welte883340c2018-02-28 18:59:29 +0100573/* generate a random RACH for packet-switched */
574private function f_rnd_ra_ps() return OCT1 {
575 var OCT1 ra;
576 do {
577 ra := f_rnd_octstring(1);
578 } while (not ra_is_ps(ra));
579 return ra;
580}
581
Harald Welte8c24c2b2018-02-26 08:31:31 +0100582/* Send 1000 RACH requests and check their RA+FN on the RSL side */
583testcase TC_rach_content() runs on test_CT {
584 f_init(testcasename());
585 f_init_l1ctl();
Harald Welte68e495b2018-02-25 00:05:57 +0100586 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +0100587
Harald Welte8c24c2b2018-02-26 08:31:31 +0100588 var GsmFrameNumber fn_last := 0;
589 for (var integer i := 0; i < 1000; i := i+1) {
590 var OCT1 ra := f_rnd_ra_cs();
591 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
592 if (fn == fn_last) {
593 setverdict(fail, "Two RACH in same FN?!?");
594 self.stop;
595 }
596 fn_last := fn;
597
598 timer T := 5.0;
Harald Welte56c05802018-02-28 21:39:35 +0100599 T.start;
Harald Welte8c24c2b2018-02-26 08:31:31 +0100600 alt {
601 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, ?))) {
602 T.stop;
603 }
604 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?))) {
605 setverdict(fail, "Unexpected CHAN RQD");
606 self.stop;
607 }
608 [] RSL_CCHAN.receive { repeat; }
609 [] T.timeout {
610 setverdict(fail, "Timeout waiting for CHAN RQD");
611 self.stop;
612 }
613 }
614 }
615 setverdict(pass);
Harald Welte294b0a22018-03-10 23:26:48 +0100616 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100617}
Harald Welte8c24c2b2018-02-26 08:31:31 +0100618
619/* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */
620testcase TC_rach_count() runs on test_CT {
Harald Welte294b0a22018-03-10 23:26:48 +0100621 f_init();
Harald Welte8c24c2b2018-02-26 08:31:31 +0100622 f_init_l1ctl();
Harald Welte294b0a22018-03-10 23:26:48 +0100623 f_sleep(1.0);
Harald Welte8c24c2b2018-02-26 08:31:31 +0100624 f_l1_tune(L1CTL);
625
626 var GsmFrameNumber fn_last := 0;
627 for (var integer i := 0; i < 1000; i := i+1) {
628 var OCT1 ra := f_rnd_ra_cs();
629 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
630 if (fn == fn_last) {
631 setverdict(fail, "Two RACH in same FN?!?");
632 self.stop;
633 }
634 fn_last := fn;
635 }
636 var integer rsl_chrqd := 0;
637 timer T := 3.0;
Harald Welte56c05802018-02-28 21:39:35 +0100638 T.start;
Harald Welte8c24c2b2018-02-26 08:31:31 +0100639 alt {
640 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(?,?))) {
641 rsl_chrqd := rsl_chrqd + 1;
Harald Weltec3a3f452018-02-26 17:37:47 +0100642 f_timer_safe_restart(T);
Harald Welte8c24c2b2018-02-26 08:31:31 +0100643 repeat;
644 }
645 [] RSL_CCHAN.receive { repeat; }
646 [] T.timeout { }
647 }
648 if (rsl_chrqd == 1000) {
649 setverdict(pass);
650 } else {
651 setverdict(fail, "Received only ", rsl_chrqd, " out of 1000 RACH");
652 }
Harald Welte294b0a22018-03-10 23:26:48 +0100653 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100654}
655
Harald Welte54a2a2d2018-02-26 09:14:05 +0100656private function f_main_trxc_connect() runs on test_CT {
657 map(self:BB_TRXC, system:BB_TRXC);
658 var Result res;
Harald Welted3a88a62018-03-01 16:04:52 +0100659 res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BB_TRXC, mp_bb_trxc_ip, mp_bb_trxc_port,
660 "", -1, -1, {udp:={}}, {});
Harald Welte54a2a2d2018-02-26 09:14:05 +0100661 g_bb_trxc_conn_id := res.connId;
662}
663
664private function f_rach_toffs(int16_t toffs256, boolean expect_pass) runs on test_CT {
Harald Weltef8df4cb2018-03-10 15:15:08 +0100665 var TrxcMessage ret;
Harald Welte54a2a2d2018-02-26 09:14:05 +0100666 /* tell fake_trx to use a given timing offset for all bursts */
Harald Weltef8df4cb2018-03-10 15:15:08 +0100667 ret := f_TRXC_transceive(BB_TRXC, g_bb_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256)));
Harald Welte54a2a2d2018-02-26 09:14:05 +0100668 f_sleep(0.5);
669
670 /* Transmit RACH request + wait for confirmation */
671 var OCT1 ra := f_rnd_ra_cs();
672 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
673
674 /* Check for expected result */
675 timer T := 1.5;
676 T.start;
677 alt {
678 [expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
679 setverdict(pass);
680 }
681 [not expect_pass] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) {
Harald Welteb3e30942018-03-02 10:33:42 +0100682 setverdict(fail, "RACH passed but was expected to be dropped: ", toffs256);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100683 }
684 [] RSL_CCHAN.receive { repeat; }
685 [not expect_pass] T.timeout {
686 setverdict(pass);
687 }
688 [expect_pass] T.timeout {
689 setverdict(fail, "Timeout waiting for CHAN RQD");
690 }
691 }
692}
693
694/* Test if dropping of RACH Based on NM_ATT_MAX_TA works */
695testcase TC_rach_max_ta() runs on test_CT {
696 f_init(testcasename());
697 f_init_l1ctl();
698 f_l1_tune(L1CTL);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100699 f_sleep(1.0);
700
701 /* default max-ta is 63 (full range of GSM timing advance */
702
Vadim Yanitskiyc81d6e42018-03-05 22:39:01 +0700703 /* We allow early arrival up to 2 symbols */
704 f_rach_toffs(-1*256, true);
705 f_rach_toffs(-2*256, true);
Harald Welte54a2a2d2018-02-26 09:14:05 +0100706 f_rach_toffs(-10*256, false);
707
708 /* 0 / 32 / 63 bits is legal / permitted */
709 f_rach_toffs(0, true);
710 f_rach_toffs(32*256, true);
711 f_rach_toffs(63*256, true);
712
713 /* more than 63 bits is not legal / permitted */
714 f_rach_toffs(64*256, false);
715 f_rach_toffs(127*256, false);
Harald Welte294b0a22018-03-10 23:26:48 +0100716 f_shutdown();
Harald Welte54a2a2d2018-02-26 09:14:05 +0100717}
Harald Welte8c24c2b2018-02-26 08:31:31 +0100718
Harald Welte93640c62018-02-25 16:59:33 +0100719/***********************************************************************
720 * Measurement Processing / Reporting
721 ***********************************************************************/
722
Harald Welte70767382018-02-21 12:16:40 +0100723template LapdmAddressField ts_LapdmAddr(LapdmSapi sapi, boolean c_r) := {
724 spare := '0'B,
725 lpd := 0,
726 sapi := sapi,
727 c_r := c_r,
728 ea := true
729}
730
731template LapdmFrameB ts_LAPDm_B(LapdmSapi sapi, boolean c_r, boolean p, octetstring pl) := {
732 addr := ts_LapdmAddr(sapi, c_r),
733 ctrl := t_LapdmCtrlUI(p),
734 len := 0, /* overwritten */
735 m := false,
736 el := 1,
737 payload := pl
738}
739
740/* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */
741altstep as_l1_sacch() runs on ConnHdlr {
742 var L1ctlDlMessage l1_dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100743 [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl {
Harald Welte70767382018-02-21 12:16:40 +0100744 log("SACCH received: ", l1_dl.payload.data_ind.payload);
745 var GsmRrL3Message meas_rep := valueof(ts_MEAS_REP(true, 23, 23, 0, 0, omit));
746 var LapdmFrameB lb := valueof(ts_LAPDm_B(0, false, false, enc_GsmRrL3Message(meas_rep)));
747 log("LAPDm: ", lb);
748 var octetstring pl := '0000'O & enc_LapdmFrameB(lb);
Harald Weltef8df4cb2018-03-10 15:15:08 +0100749 L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_SACCH(0), pl));
Harald Welte70767382018-02-21 12:16:40 +0100750 repeat;
751 }
752}
753
754altstep as_l1_dcch() runs on ConnHdlr {
755 var L1ctlDlMessage l1_dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100756 [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value l1_dl {
Harald Welte70767382018-02-21 12:16:40 +0100757 log("DCCH received: ", l1_dl.payload.data_ind.payload);
758 var octetstring pl := '010301'O;
Harald Weltef8df4cb2018-03-10 15:15:08 +0100759 L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), pl));
Harald Welte70767382018-02-21 12:16:40 +0100760 repeat;
761 }
762}
763
764type record MeasElem {
765 uint6_t rxlev,
766 uint3_t rxqual
767}
768
769type record MeasElemFS {
770 MeasElem full,
771 MeasElem sub
772}
773
774type record ConnL1Pars {
775 boolean dtx_enabled,
Harald Welte685d5982018-02-27 20:42:05 +0100776 boolean toa256_enabled,
Harald Welte70767382018-02-21 12:16:40 +0100777 MeasElemFS meas_ul,
778 int16_t timing_offset_256syms,
779 uint5_t bs_power_level,
780 uint5_t ms_power_level,
781 uint8_t ms_actual_ta
782}
783
784/* Convert tiing offset from 1/256th symbol to RSL Timing Offset */
785private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t {
786 return 63 + (toffs256s/256);
787}
788
Harald Welted5684392018-03-10 18:22:04 +0100789private function f_max(integer a, integer b) return integer {
790 if (a > b) {
791 return a;
792 } else {
793 return b;
794 }
795}
796
797private function f_min(integer a, integer b) return integer {
798 if (a < b) {
799 return a;
800 } else {
801 return b;
802 }
803}
804
805/* compute negative tolerance val-tolerance, ensure >= min */
806private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer {
807 val := val - tolerance;
808 return f_max(val, min);
809}
810
811/* compute positive tolerance val+tolerance, ensure <= max */
812private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer {
813 val := val + tolerance;
814 return f_min(val, max);
815}
816
817/* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */
818private function f_tolerance(integer val, integer min, integer max, integer tolerance)
819return template integer {
820 var template integer ret;
821 ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance));
822 return ret;
823}
824
825
Harald Welte70767382018-02-21 12:16:40 +0100826/* build a template for matching measurement results against */
827private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message {
828 var ConnL1Pars l1p := g_pars.l1_pars;
829 var template RSL_IE_UplinkMeas ul_meas := {
830 len := 3,
831 rfu := '0'B,
832 dtx_d := l1p.dtx_enabled,
Harald Welted5684392018-03-10 18:22:04 +0100833 rxlev_f_u := f_tolerance(l1p.meas_ul.full.rxlev, 0, 63, mp_tolerance_rxlev),
Harald Welte70767382018-02-21 12:16:40 +0100834 reserved1 := '00'B,
Harald Welted5684392018-03-10 18:22:04 +0100835 rxlev_s_u := f_tolerance(l1p.meas_ul.sub.rxlev, 0, 63, mp_tolerance_rxlev),
Harald Welte70767382018-02-21 12:16:40 +0100836 reserved2 := '00'B,
Harald Welted5684392018-03-10 18:22:04 +0100837 rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual),
838 rxq_s_u := f_tolerance(l1p.meas_ul.sub.rxqual, 0, 7, mp_tolerance_rxqual),
Harald Welte70767382018-02-21 12:16:40 +0100839 supp_meas_info := omit
840 };
Harald Welte685d5982018-02-27 20:42:05 +0100841 if (l1p.toa256_enabled) {
842 ul_meas.len := 5;
843 ul_meas.supp_meas_info := int2oct(l1p.timing_offset_256syms, 2);
844 }
Harald Welte70767382018-02-21 12:16:40 +0100845 /* HACK HACK HACK FIXME HACK HACK HACK see https://osmocom.org/issues/2988 */
846 ul_meas.rxlev_f_u := ?;
847 ul_meas.rxlev_s_u := ?;
848 ul_meas.rxq_f_u := ?;
849 ul_meas.rxq_s_u := ?;
850 var template RSL_IE_BS_Power bs_power := {
851 reserved := 0,
852 epc := false,
853 fpc := false,
854 power_level := l1p.bs_power_level
855 };
856 var template RSL_IE_L1Info l1_info := {
857 ms_power_lvl := l1p.ms_power_level,
858 fpc := false,
859 reserved := 0,
860 actual_ta := l1p.ms_actual_ta
861 };
862 var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms);
863 var template uint8_t t_toffs := (offs-1 .. offs+1); /* some tolerance */
864 return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info,
865 ?, t_toffs);
866}
867
868/* verify we regularly receive measurement reports with incrementing numbers */
869altstep as_meas_res() runs on ConnHdlr {
870 var RSL_Message rsl;
871 [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl {
872 /* increment counter of next to-be-expected meas rep */
873 g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
874 /* Re-start the timer expecting the next MEAS RES */
Harald Weltec3a3f452018-02-26 17:37:47 +0100875 f_timer_safe_restart(g_Tmeas_exp);
Harald Welte70767382018-02-21 12:16:40 +0100876 repeat;
877 }
878 [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl {
Harald Weltefa45e9e2018-03-10 18:59:03 +0100879 /* increment counter of next to-be-expected meas rep */
880 g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256;
881 if (g_first_meas_res) {
882 g_first_meas_res := false;
883 repeat;
884 } else {
885 setverdict(fail, "Received unspecific MEAS RES ", rsl);
886 self.stop;
887 }
Harald Welte70767382018-02-21 12:16:40 +0100888 }
889 [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl {
890 setverdict(fail, "Received unexpected MEAS RES ", rsl);
891 self.stop;
892 }
893 [] g_Tmeas_exp.timeout {
894 setverdict(fail, "Didn't receive expected measurement result")
895 self.stop;
896 }
897}
898
899/* Establish dedicated channel: L1CTL + RSL side */
900private function f_est_dchan() runs on ConnHdlr {
901 var GsmFrameNumber fn;
902 var ImmediateAssignment imm_ass;
903 var integer ra := 23;
904
905 fn := f_L1CTL_RACH(L1CTL, ra);
906 /* This arrives on CCHAN, so we cannot test for receiving CHAN RQDhere */
907 //RSL.receive(tr_RSL_CHAN_RQD(int2oct(23,1)));
908
909 /* Activate channel on BTS side */
910 f_rsl_chan_act(g_pars.chan_mode);
911
912 /* Send IMM.ASS via CCHAN */
913 var ChannelDescription ch_desc := {
914 chan_nr := g_pars.chan_nr,
915 tsc := 7,
916 h := false,
917 arfcn := mp_trx0_arfcn,
918 maio_hsn := omit
919 };
920 var MobileAllocation ma := {
921 len := 0,
922 ma := ''B
923 };
924 var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, ma));
925 RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg)));
926
927 /* receive IMM.ASS on MS side */
928 var ImmediateAssignment ia_um;
929 ia_um := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn);
930 /* enable dedicated mode */
931 f_L1CTL_DM_EST_REQ_IA(L1CTL, ia_um);
Harald Weltefa45e9e2018-03-10 18:59:03 +0100932
933 g_first_meas_res := true;
Harald Welte70767382018-02-21 12:16:40 +0100934}
935
936/* establish DChan, verify existance + contents of measurement reports */
937function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr {
Harald Welte68e495b2018-02-25 00:05:57 +0100938 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +0100939 RSL.clear;
940
Harald Welte5398d5e2018-03-10 19:00:24 +0100941 if (mp_bb_trxc_port != -1) {
942 g_pars.l1_pars.meas_ul.full.rxlev := dbm2rxlev(-100);
943 f_trxc_fake_rssi(100);
Harald Welte70767382018-02-21 12:16:40 +0100944
Harald Welte5398d5e2018-03-10 19:00:24 +0100945 g_pars.l1_pars.timing_offset_256syms := 512; /* 2 symbols */
946 f_trx_fake_toffs256(g_pars.l1_pars.timing_offset_256syms);
947 } else {
948 g_pars.l1_pars.timing_offset_256syms := 0; /* FIXME */
949 g_pars.l1_pars.meas_ul.full.rxlev := dbm2rxlev(-55); /* FIXME */
950 }
951 g_pars.l1_pars.meas_ul.sub.rxlev := g_pars.l1_pars.meas_ul.full.rxlev;
Harald Welte70767382018-02-21 12:16:40 +0100952
953 f_est_dchan();
954
955 /* run for a number of seconds, send SACCH + FACCH from MS side and verify
956 * RSL measurement reports on Abis side */
957 timer T := 8.0;
958 T.start;
959 alt {
960 [] as_l1_sacch();
961 [] as_meas_res();
962 [] as_l1_dcch();
963 [] L1CTL.receive { repeat; }
964 [g_Tmeas_exp.running] T.timeout {
965 /* as_meas_res() would have done setverdict(fail) / self.stop in case
966 * of any earlier errors, so if we reach this timeout, we're good */
967 setverdict(pass);
968 }
969 [] T.timeout {
970 setverdict(fail, "No MEAS RES received at all");
971 }
972 }
973 f_rsl_chan_deact();
Harald Welte3dc20462018-03-10 23:03:38 +0100974 f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr);
Harald Welte70767382018-02-21 12:16:40 +0100975}
976testcase TC_meas_res_sign_tchf() runs on test_CT {
977 var ConnHdlr vc_conn;
978 var ConnHdlrPars pars;
979 f_init(testcasename());
980 for (var integer tn := 1; tn <= 4; tn := tn+1) {
981 pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN));
982 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
983 vc_conn.done;
984 }
Harald Welte294b0a22018-03-10 23:26:48 +0100985 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100986}
987testcase TC_meas_res_sign_tchh() runs on test_CT {
988 var ConnHdlr vc_conn;
989 var ConnHdlrPars pars;
990 f_init(testcasename());
991 for (var integer ss := 0; ss <= 1; ss := ss+1) {
992 pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
993 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
994 vc_conn.done;
995 }
Harald Welte294b0a22018-03-10 23:26:48 +0100996 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +0100997}
998testcase TC_meas_res_sign_sdcch4() runs on test_CT {
999 var ConnHdlr vc_conn;
1000 var ConnHdlrPars pars;
1001 f_init(testcasename());
1002 for (var integer ss := 0; ss <= 3; ss := ss+1) {
1003 pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN));
1004 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
1005 vc_conn.done;
1006 }
Harald Welte294b0a22018-03-10 23:26:48 +01001007 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +01001008}
1009testcase TC_meas_res_sign_sdcch8() runs on test_CT {
1010 var ConnHdlr vc_conn;
1011 var ConnHdlrPars pars;
1012 f_init(testcasename());
1013 for (var integer ss := 0; ss <= 7; ss := ss+1) {
1014 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN));
1015 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
1016 vc_conn.done;
1017 }
Harald Welte294b0a22018-03-10 23:26:48 +01001018 f_shutdown();
Harald Welte70767382018-02-21 12:16:40 +01001019}
Harald Welte685d5982018-02-27 20:42:05 +01001020testcase TC_meas_res_sign_tchh_toa256() runs on test_CT {
1021 var ConnHdlr vc_conn;
1022 var ConnHdlrPars pars;
1023 f_init(testcasename());
1024 f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256");
1025 for (var integer ss := 0; ss <= 1; ss := ss+1) {
1026 pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN));
1027 pars.l1_pars.toa256_enabled := true;
1028 vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars);
1029 vc_conn.done;
1030 }
Harald Welte294b0a22018-03-10 23:26:48 +01001031 f_shutdown();
Harald Welte685d5982018-02-27 20:42:05 +01001032}
1033
Harald Welte70767382018-02-21 12:16:40 +01001034
1035/* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND */
1036private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr {
Harald Welte68e495b2018-02-25 00:05:57 +01001037 f_l1_tune(L1CTL);
Harald Welte70767382018-02-21 12:16:40 +01001038 RSL.clear;
1039
1040 f_est_dchan();
1041 f_sleep(2.0);
Harald Weltef8df4cb2018-03-10 15:15:08 +01001042 L1CTL.send(ts_L1CTL_DM_REL_REQ(g_chan_nr));
Harald Welte70767382018-02-21 12:16:40 +01001043
1044 timer T := 40.0;
1045 T.start;
1046 alt {
1047 [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) {
1048 setverdict(pass)
1049 }
1050 [] RSL.receive { repeat };
1051 [] T.timeout {
1052 setverdict(fail, "No CONN FAIL IND received");
1053 }
1054 }
1055 f_rsl_chan_deact();
1056}
1057testcase TC_conn_fail_crit() runs on test_CT {
1058 var ConnHdlr vc_conn;
1059 var ConnHdlrPars pars;
1060 f_init(testcasename());
1061 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN));
1062 pars.t_guard := 60.0;
1063 vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars);
1064 vc_conn.done;
1065}
1066
Harald Welte93640c62018-02-25 16:59:33 +01001067/***********************************************************************
1068 * Paging
1069 ***********************************************************************/
1070
Harald Welte68e495b2018-02-25 00:05:57 +01001071function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean {
1072 if (tmsi == 'FFFFFFFF'O) {
1073 return true;
1074 } else {
1075 return false;
1076 }
1077}
Harald Welte70767382018-02-21 12:16:40 +01001078
Harald Welte68e495b2018-02-25 00:05:57 +01001079altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, inout integer num_paging_rcv_ids)
1080runs on test_CT {
1081 var L1ctlDlMessage dl;
Harald Weltef8df4cb2018-03-10 15:15:08 +01001082 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_DummyUI)) {
Harald Welte68e495b2018-02-25 00:05:57 +01001083 repeat;
1084 }
Harald Weltef8df4cb2018-03-10 15:15:08 +01001085 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl {
Harald Welte68e495b2018-02-25 00:05:57 +01001086 var octetstring without_plen :=
1087 substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1);
1088 var PDU_ML3_NW_MS rr := dec_PDU_ML3_NW_MS(without_plen);
1089 if (match(rr, tr_PAGING_REQ1)) {
1090 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1091 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1092 if (isvalue(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) {
1093 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1094 }
1095 } else if (match(rr, tr_PAGING_REQ2)) {
1096 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1097 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) {
1098 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1099 }
1100 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) {
1101 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1102 }
1103 if (isvalue(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) {
1104 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1105 }
1106 } else if (match(rr, tr_PAGING_REQ3)) {
1107 num_paging_rcv_msgs := num_paging_rcv_msgs + 1;
1108 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) {
1109 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1110 }
1111 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) {
1112 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1113 }
1114 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) {
1115 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1116 }
1117 if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) {
1118 num_paging_rcv_ids := num_paging_rcv_ids + 1;
1119 }
1120 }
1121 repeat;
1122 }
1123}
1124
1125type record PagingTestCfg {
1126 boolean combined_ccch,
1127 integer bs_ag_blks_res,
1128 float load_factor,
1129 boolean exp_load_ind,
1130 boolean exp_overload,
1131 boolean use_tmsi
1132}
1133
1134type record PagingTestState {
1135 integer num_paging_sent,
1136 integer num_paging_rcv_msgs,
1137 integer num_paging_rcv_ids,
1138 integer num_overload
1139}
1140
1141/* receive + ignore RSL RF RES IND */
1142altstep as_rsl_res_ind() runs on test_CT {
1143 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_RF_RES_IND)) {
1144 repeat;
1145 }
1146}
1147
1148/* Helper function for paging related testing */
1149private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState {
1150 f_init(testcasename());
1151 f_init_l1ctl();
1152 f_l1_tune(L1CTL);
1153
1154 var PagingTestState st := {
1155 num_paging_sent := 0,
1156 num_paging_rcv_msgs := 0,
1157 num_paging_rcv_ids := 0,
1158 num_overload := 0
1159 };
1160
1161 var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res);
1162 var float max_pch_imsi_per_sec;
1163 if (cfg.use_tmsi) {
1164 max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */
1165 } else {
1166 max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */
1167 }
1168 var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor;
1169 var float interval := 1.0 / pch_blocks_per_sec;
1170 log("pch_blocks_per_sec=", pch_blocks_per_sec, " interval=", interval);
1171
1172 for (var integer i := 0; i < float2int(20.0/interval); i := i+1) {
1173 /* build mobile Identity */
1174 var MobileL3_CommonIE_Types.MobileIdentityLV mi;
1175 if (cfg.use_tmsi) {
1176 mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4)));
1177 } else {
1178 mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i)));
1179 }
1180 var octetstring mi_enc_lv := enc_MobileIdentityLV(mi);
1181 var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1);
1182
1183 /* Send RSL PAGING COMMAND */
1184 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4)));
1185 st.num_paging_sent := st.num_paging_sent + 1;
1186
1187 /* Wait for interval to next PAGING COMMAND */
1188 timer T_itv := interval;
1189 T_itv.start;
1190 alt {
1191 /* check for presence of CCCH LOAD IND (paging load) */
1192 [cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) {
1193 st.num_overload := st.num_overload + 1;
1194 repeat;
1195 }
1196 [not cfg.exp_overload] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) {
1197 setverdict(fail, "Unexpected PCH Overload");
1198 }
1199 [cfg.exp_load_ind] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) {
1200 log("Rx LOAD_IND");
1201 /* FIXME: analyze/verify interval + contents */
1202 repeat;
1203 }
1204 /* check if paging requests arrive on Um side */
1205 [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids);
1206 [] L1CTL.receive { repeat; }
1207 [] T_itv.timeout { }
1208 [] as_rsl_res_ind();
1209 }
1210 }
1211
1212 /* wait for max 18s for paging queue to drain (size: 200, ~ 13 per s -> 15s) */
1213 timer T_wait := 18.0;
1214 T_wait.start;
1215 alt {
1216 [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids);
1217 [] L1CTL.receive { repeat; }
1218 /* 65535 == empty paging queue, we can terminate*/
1219 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { }
1220 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; }
1221 [] T_wait.timeout {
1222 setverdict(fail, "Waiting for empty paging queue");
1223 }
1224 [] as_rsl_res_ind();
1225 }
1226
Harald Welte294b0a22018-03-10 23:26:48 +01001227 f_shutdown();
1228
Harald Welte68e495b2018-02-25 00:05:57 +01001229 log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs,
1230 " rcvd_ids=", st.num_paging_rcv_ids);
1231 return st;
1232}
1233
1234/* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that
1235 * - the number of Mobile Identities on Um PCH match the number of pages on RSL
1236 * - that CCCH LOAD IND (PCH) are being generated
1237 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1238testcase TC_paging_imsi_80percent() runs on test_CT {
1239 var PagingTestCfg cfg := {
1240 combined_ccch := true,
1241 bs_ag_blks_res := 1,
1242 load_factor := 0.8,
1243 exp_load_ind := true,
1244 exp_overload := false,
1245 use_tmsi := false
1246 };
1247 var PagingTestState st := f_TC_paging(cfg);
1248 if (st.num_paging_sent != st.num_paging_rcv_ids) {
1249 setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
1250 st.num_paging_rcv_ids);
1251 } else {
1252 setverdict(pass);
1253 }
1254}
1255
1256/* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that
1257 * - the number of Mobile Identities on Um PCH match the number of pages on RSL
1258 * - that CCCH LOAD IND (PCH) are being generated
1259 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1260testcase TC_paging_tmsi_80percent() runs on test_CT {
1261 var PagingTestCfg cfg := {
1262 combined_ccch := true,
1263 bs_ag_blks_res := 1,
1264 load_factor := 0.8,
1265 exp_load_ind := true,
1266 exp_overload := false,
1267 use_tmsi := true
1268 };
1269 var PagingTestState st := f_TC_paging(cfg);
1270 if (st.num_paging_sent != st.num_paging_rcv_ids) {
1271 setverdict(fail, "Expected ", st.num_paging_sent, " pagings but have ",
1272 st.num_paging_rcv_ids);
1273 } else {
1274 setverdict(pass);
1275 }
1276}
1277
1278/* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that
1279 * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL
1280 * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point
1281 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1282testcase TC_paging_imsi_200percent() runs on test_CT {
1283 var PagingTestCfg cfg := {
1284 combined_ccch := true,
1285 bs_ag_blks_res := 1,
1286 load_factor := 2.0,
1287 exp_load_ind := true,
1288 exp_overload := true,
1289 use_tmsi := false
1290 };
1291 var PagingTestState st := f_TC_paging(cfg);
1292 /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200
1293 * slots and will fully drain that buffer before returning */
1294 var template integer tpl := (st.num_paging_sent*80/100 .. st.num_paging_sent *85/100);
1295 if (not match(st.num_paging_rcv_ids, tpl)) {
1296 setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
1297 } else {
1298 setverdict(pass);
1299 }
1300}
1301
1302/* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that
1303 * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL
1304 * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point
1305 * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */
1306testcase TC_paging_tmsi_200percent() runs on test_CT {
1307 var PagingTestCfg cfg := {
1308 combined_ccch := true,
1309 bs_ag_blks_res := 1,
1310 load_factor := 2.0,
1311 exp_load_ind := true,
1312 exp_overload := true,
1313 use_tmsi := true
1314 };
1315 var PagingTestState st := f_TC_paging(cfg);
1316 /* We expect about 70% to pass, given that we can fill the paging buffer of 200
1317 * slots and will fully drain that buffer before returning */
1318 var template integer tpl := (st.num_paging_sent*68/100 .. st.num_paging_sent *72/100);
1319 if (not match(st.num_paging_rcv_ids, tpl)) {
1320 setverdict(fail, "Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids);
1321 } else {
1322 setverdict(pass);
1323 }
1324}
1325
1326
Harald Welte93640c62018-02-25 16:59:33 +01001327/***********************************************************************
1328 * Immediate Assignment / AGCH
1329 ***********************************************************************/
1330
Harald Welte68e495b2018-02-25 00:05:57 +01001331testcase TC_imm_ass() runs on test_CT {
1332 f_init(testcasename());
1333 for (var integer i := 0; i < 1000; i := i+1) {
1334 var octetstring ia_enc := f_rnd_octstring(8);
1335 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_IMM_ASSIGN(ia_enc, 0)));
1336 f_sleep(0.02);
1337 }
1338 /* FIXME: check if imm.ass arrive on Um side */
1339 /* FIXME: check for DELETE INDICATION */
1340 f_sleep(100.0);
Harald Welte294b0a22018-03-10 23:26:48 +01001341 f_shutdown();
Harald Welte68e495b2018-02-25 00:05:57 +01001342}
1343
Harald Welte48494ca2018-02-25 16:59:50 +01001344/***********************************************************************
1345 * BCCH
1346 ***********************************************************************/
1347
1348/* tuple of Frame Number + decoded SI */
1349type record SystemInformationFn {
1350 GsmFrameNumber frame_number,
1351 SystemInformation si
1352}
1353
1354/* an arbitrary-length vector of decoded SI + gsmtap header */
1355type record of SystemInformationFn SystemInformationVector;
1356
1357/* an array of SI-vectors indexed by TC value */
1358type SystemInformationVector SystemInformationVectorPerTc[8];
1359
1360/* determine if a given SI vector contains given SI type at least once */
1361function f_si_vecslot_contains(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean {
1362 for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
1363 var integer fn_mod51 := arr[i].frame_number mod 51;
1364 if (not bcch_ext and fn_mod51 == 2 or
1365 bcch_ext and fn_mod51 == 6) {
1366 if (arr[i].si.header.message_type == key) {
1367 return true;
1368 }
1369 }
1370 }
1371 return false;
1372}
1373
1374/* ensure a given TC slot of the SI vector contains given SI type at least once at TC */
1375function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
1376 if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) {
1377 setverdict(fail, "No ", key, " in TC=", tc, "!");
1378 }
1379}
1380
1381/* check if a given SI vector contains given SI type at least once on any TC */
1382function f_si_vec_contains(SystemInformationVectorPerTc arr, RrMessageType key) return boolean {
1383 for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) {
1384 if (f_si_vecslot_contains(arr[tc], key) or
1385 f_si_vecslot_contains(arr[tc], key, true)) {
1386 return true;
1387 }
1388 }
1389 return false;
1390}
1391
1392/* determine if a given SI vector contains given SI type at least N of M times */
1393function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false, integer n := 1, integer m := 4) return boolean {
1394 var integer count := 0;
1395 if (sizeof(arr) < m) {
1396 setverdict(fail, "Error: Insufficient SI in array");
1397 self.stop;
1398 }
1399 for (var integer i:= 0; i < m; i := i + 1) {
1400 var integer fn_mod51 := arr[i].frame_number mod 51;
1401 if (not bcch_ext and fn_mod51 == 2 or
1402 bcch_ext and fn_mod51 == 6) {
1403 if (arr[i].si.header.message_type == key) {
1404 count := count + 1;
1405 }
1406 }
1407 }
1408 if (count >= n) {
1409 return true;
1410 } else {
1411 return false;
1412 }
1413}
1414
1415/* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */
1416function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false, integer n, integer m) {
1417 if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) {
1418 setverdict(fail, "Not ", n, "/", m, " of ", key, " in TC=", tc, "!");
1419 }
1420}
1421
1422/* determine if a given SI vector contains given SI type at least once */
1423function f_si_vecslot_contains_only(SystemInformationVector arr, RrMessageType key, boolean bcch_ext := false) return boolean {
1424 for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
1425 var integer fn_mod51 := arr[i].frame_number mod 51;
1426 if (not bcch_ext and fn_mod51 == 2 or
1427 bcch_ext and fn_mod51 == 6) {
1428 if (arr[i].si.header.message_type != key) {
1429 return false;
1430 }
1431 }
1432 }
1433 return true;
1434}
1435
1436/* ensure a given TC slot of the SI vector contains only given SI type */
1437function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, integer tc, RrMessageType key, boolean ext_bcch := false) {
1438 if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) {
1439 setverdict(fail, "Not all ", key, " in TC=", tc, "!");
1440 }
1441}
1442
1443/* SI configuration of cell, against which we validate actual SI messages */
1444type set SystemInformationConfig {
1445 boolean bcch_extended,
1446 boolean si1_present,
1447 boolean si2bis_present,
1448 boolean si2ter_present,
1449 boolean si2quater_present,
1450 boolean si7_present,
1451 boolean si8_present,
1452 boolean si9_present,
1453 boolean si13_present,
1454 boolean si13alt_present,
1455 boolean si15_present,
1456 boolean si16_present,
1457 boolean si17_present,
1458 boolean si2n_present,
1459 boolean si21_present,
1460 boolean si22_present
1461}
1462
1463/* validate the SI scheduling according to TS 45.002 version 14.1.0 Release 14, Section 6.3.1.3 */
1464function f_validate_si_scheduling(SystemInformationConfig cfg, SystemInformationVectorPerTc si_per_tc) {
1465 var integer i;
1466 for (i := 0; i < sizeof(si_per_tc); i := i + 1) {
1467 if (sizeof(si_per_tc[i]) == 0) {
Harald Welte544565a2018-03-02 10:34:08 +01001468 setverdict(fail, "No SI messages for TC=", i);
Harald Welte48494ca2018-02-25 16:59:50 +01001469 }
1470 }
1471 if (cfg.si1_present) {
1472 /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or
1473 * when the NCH is present in a cell. If the MS finds another message on BCCH Norm
1474 * when TC = 0, it can assume that System Information Type 1 is not in use. */
1475 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1);
1476 /* make sure *ALL* contain SI1 */
1477 f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1);
1478 }
1479 f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2);
1480 /* iii) A SI 2 message will be sent at least every time TC = 1 */
1481 f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3);
1482 f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3);
1483 f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4);
1484 f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4);
1485
1486 /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the
1487 * system operator. If only one of them is needed, it is sent when TC = 5. If both are
1488 * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4
1489 * consecutive occurrences of TC = 4. */
1490 if (cfg.si2bis_present and not cfg.si2ter_present) {
1491 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis);
1492 } else if (cfg.si2ter_present and not cfg.si2bis_present) {
1493 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter);
1494 } else if (cfg.si2ter_present and cfg.si2bis_present) {
1495 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis);
1496 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4);
1497 }
1498
1499 if (cfg.si7_present or cfg.si8_present) {
1500 /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary
1501 * if System Information type 4 does not contain all information needed for cell
1502 * selection and reselection. */
1503 if (not cfg.bcch_extended) {
1504 testcase.stop("Error: SI7/SI8 require BCCH Extd.");
1505 }
1506 if (cfg.si7_present) {
1507 f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true);
1508 }
1509 if (cfg.si8_present) {
1510 f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true);
1511 }
1512 }
1513
1514 if (cfg.si2quater_present) {
1515 /* iii) System information type 2 quater is sent if needed, as determined by the system
1516 * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis
1517 * and 2ter are used, otherwise it shall be sent at least once within any of 4
1518 * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once
1519 * within any of 4 consecutive occurrences of TC = 5. */
1520 if (not (cfg.bcch_extended)) {
1521 if (not (cfg.si2bis_present or cfg.si2ter_present)) {
1522 f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater);
1523 } else {
1524 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4);
1525 }
1526 } else {
1527 f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4);
1528 }
1529 }
1530 if (cfg.si9_present) {
1531 /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified
1532 * in system information type 3 as defined in 3GPP TS 44.018. */
1533 f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3
1534 }
1535 if (cfg.si13_present) {
1536 /* vii) System Information type 13 is only related to the GPRS service. System Information
1537 * Type 13 need only be sent if GPRS support is indicated in one or more of System
1538 * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the
1539 * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext.
1540 * In the case that the message is sent on the BCCH Norm, it is sent at least once
1541 * within any of 4 consecutive occurrences of TC=4. */
1542 if (not cfg.bcch_extended) {
1543 log("not-bccch-extended");
1544 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4);
1545 } else {
1546 log("bccch-extended");
1547 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true);
1548 }
1549 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) {
1550 setverdict(fail, "Cannot have SI13alt and SI13");
1551 }
1552 }
1553 if (cfg.si16_present or cfg.si17_present) {
1554 /* viii) System Information type 16 and 17 are only related to the SoLSA service. They
1555 * should not be sent in a cell where network sharing is used (see rule xv). */
1556 if (cfg.si22_present) {
1557 testcase.stop("Error: Cannot have SI16/SI17 and SI22!");
1558 }
1559 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) {
1560 setverdict(fail, "Cannot have SI16/SI17 and SI22!");
1561 }
1562 if (not cfg.bcch_extended) {
1563 testcase.stop("Error: SI16/SI17 requires BCCH Extd!");
1564 }
1565 if (cfg.si16_present) {
1566 f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true);
1567 }
1568 if (cfg.si17_present) {
1569 f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true);
1570 }
1571 }
1572
1573 /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM
1574 * broadcast information. The frequency with which they are sent is determined by the
1575 * system operator. System Information type 9 identifies the scheduling of System
1576 * Information type 18 and 20 messages. */
1577
1578 /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System
1579 * Information Type 19 is present, then its scheduling shall be indicated in System
1580 * Information Type 9. */
1581
1582 if (cfg.si15_present) {
1583 /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the
1584 * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive
1585 * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of
1586 * 4 consecutive occurrences of TC = 1. */
1587 if (not cfg.bcch_extended) {
1588 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4);
1589 } else {
1590 f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4);
1591 }
1592 }
1593 if (cfg.si13alt_present) {
1594 /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System
1595 * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in
1596 * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not
1597 * broadcast. These messages also indicate if the message is sent on the BCCH Norm or
1598 * if the message is transmitted on the BCCH Ext. In the case that the message is sent
1599 * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences
1600 * of TC = 4. */
1601 if (cfg.si13_present) {
1602 testcase.stop("Error: Cannot have SI13alt and SI13");
1603 }
1604 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) {
1605 setverdict(fail, "Cannot have SI13alt and SI13");
1606 }
1607 if (not cfg.bcch_extended) {
1608 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4);
1609 } else {
1610 f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true);
1611 }
1612 }
1613 if (cfg.si2n_present) {
1614 /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed,
1615 * as determined by the system operator. In the case that the message is sent on the
1616 * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC =
1617 * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2
1618 * consecutive occurrences of TC = 4. */
1619 if (not cfg.bcch_extended) {
1620 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4);
1621 } else {
1622 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4);
1623 }
1624 }
1625 if (cfg.si21_present) {
1626 /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as
1627 * determined by the system operator. If Extended Access Barring is in use in the cell
1628 * then this message is sent at least once within any of 4 consecutive occurrences of
1629 * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a
1630 * cell then this message shall only be sent on BCCH Ext. */
1631 if (not cfg.bcch_extended) {
1632 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4);
1633 } else {
1634 f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4);
1635 if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) {
1636 setverdict(fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!");
1637 }
1638 }
1639 }
1640 if (cfg.si22_present) {
1641 /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It
1642 * should not be sent in a cell where SoLSA is used (see rule viii). System
1643 * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC
1644 * =2 and TC=6. */
1645 if (cfg.si16_present or cfg.si17_present) {
1646 testcase.stop("Error: Cannot have SI16/SI17 and SI22!");
1647 }
1648 if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or
1649 f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) {
1650 setverdict(fail, "Cannot have SI16/SI17 and SI22!");
1651 }
1652 if (not cfg.bcch_extended) {
1653 testcase.stop("Error: SI22 requires BCCH Extd!");
1654 } else {
1655 f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true);
1656 f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true);
1657 }
1658 }
1659}
1660
1661/* sample Systme Information for specified duration via L1CTL */
1662function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) return SystemInformationVectorPerTc {
1663 timer T := duration;
1664 var SystemInformationVectorPerTc si_per_tc;
1665 var L1ctlDlMessage l1_dl;
1666
1667 /* initialize all per-TC vectors empty */
1668 for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) {
1669 si_per_tc[i] := {};
1670 }
1671
1672 /* flush all previous L1 queued msgs */
1673 pt.clear;
1674
1675 T.start;
1676 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01001677 [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl {
Harald Welte48494ca2018-02-25 16:59:50 +01001678 /* somehow dec_SystemInformation will try to decode even non-RR as SI */
1679 if (not (l1_dl.payload.data_ind.payload[1] == '06'O)) {
1680 log("Ignoring non-RR SI ", l1_dl);
1681 repeat;
1682 }
1683 var SystemInformationFn sig := {
1684 frame_number := l1_dl.dl_info.frame_nr,
1685 si := dec_SystemInformation(l1_dl.payload.data_ind.payload)
1686 }
1687 var integer tc := f_gsm_compute_tc(sig.frame_number);
1688 log("SI received at TC=", tc, ": ", sig.si);
1689 /* append to the per-TC bucket */
1690 si_per_tc[tc] := si_per_tc[tc] & { sig };
1691 repeat;
1692 }
1693 [] pt.receive { repeat; }
1694 [] T.timeout { }
1695 }
1696
1697 for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) {
1698 log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i]));
1699 }
1700 log("si_per_tc=", si_per_tc);
1701 return si_per_tc;
1702}
1703
1704/* helper function: Set given SI via RSL + validate scheduling.
1705 * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */
1706function f_TC_si_sched() runs on test_CT {
1707 var SystemInformationVectorPerTc si_per_tc;
1708 f_init_l1ctl();
1709 f_l1_tune(L1CTL);
1710
1711 /* Sample + Validate Scheduling */
1712 si_per_tc := f_l1_sample_si(L1CTL);
1713 f_validate_si_scheduling(si_cfg, si_per_tc);
1714
1715 setverdict(pass);
1716}
1717
1718testcase TC_si_sched_default() runs on test_CT {
1719 f_init();
Harald Welte0cae4552018-03-09 22:20:26 +01001720 /* 2+3+4 are mandatory and set in f_init() */
1721 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001722 f_shutdown();
Harald Welte0cae4552018-03-09 22:20:26 +01001723}
1724
1725testcase TC_si_sched_1() runs on test_CT {
1726 f_init();
1727 si_cfg.si1_present := true;
1728 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O);
Harald Welte48494ca2018-02-25 16:59:50 +01001729 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001730 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001731}
1732
1733testcase TC_si_sched_2bis() runs on test_CT {
1734 f_init();
1735 si_cfg.si2bis_present := true;
1736 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1737 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001738 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001739}
1740
1741testcase TC_si_sched_2ter() runs on test_CT {
1742 f_init();
1743 si_cfg.si2ter_present := true;
1744 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1745 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001746 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001747}
1748
1749testcase TC_si_sched_2ter_2bis() runs on test_CT {
1750 f_init();
1751 si_cfg.si2bis_present := true;
1752 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1753 si_cfg.si2ter_present := true;
1754 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1755 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001756 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001757}
1758
1759testcase TC_si_sched_2quater() runs on test_CT {
1760 f_init();
1761 si_cfg.si2quater_present := true;
1762 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
1763 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001764 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001765}
1766
1767testcase TC_si_sched_13() runs on test_CT {
1768 f_init();
1769 si_cfg.si13_present := true;
1770 //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
1771 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001772 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001773}
1774
1775testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT {
1776 f_init();
1777 si_cfg.si2bis_present := true;
1778 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O);
1779 si_cfg.si2ter_present := true;
1780 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O);
1781 si_cfg.si2quater_present := true;
1782 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O);
1783 si_cfg.si13_present := true;
1784 //f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, fixme);
1785 f_TC_si_sched();
Harald Welte294b0a22018-03-10 23:26:48 +01001786 f_shutdown();
Harald Welte48494ca2018-02-25 16:59:50 +01001787}
1788
1789
Harald Welte68e495b2018-02-25 00:05:57 +01001790testcase TC_bcch_info() runs on test_CT {
1791 f_init(testcasename());
1792 /* FIXME: enable / disable individual BCCH info */
1793 //ts_RSL_BCCH_INFO(si_type, info);
1794 /* expect no ERROR REPORT after either of them *
1795 /* negative test: ensure ERROR REPORT on unsupported types */
Harald Welte294b0a22018-03-10 23:26:48 +01001796 f_shutdown();
Harald Welte68e495b2018-02-25 00:05:57 +01001797}
1798
Harald Welte93640c62018-02-25 16:59:33 +01001799/***********************************************************************
1800 * Low-Level Protocol Errors / ERROR REPORT
1801 ***********************************************************************/
1802
Harald Welte01d982c2018-02-25 01:31:40 +01001803private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT {
1804 timer T := 5.0;
1805 T.start;
1806 alt {
1807 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(cause))) {
1808 setverdict(pass);
1809 }
1810 [] RSL_CCHAN.receive(tr_RSL_UD(tr_RSL_ERROR_REPORT(?))) {
1811 setverdict(fail, "Wrong cause in RSL ERR REP");
1812 }
1813 [] RSL_CCHAN.receive {
1814 repeat;
1815 }
1816 [] T.timeout {
1817 setverdict(fail, "Timeout waiting for RSL ERR REP");
1818 }
1819 }
1820}
1821
1822/* Provoke a protocol error (message too short) and match on ERROR REPORT */
1823testcase TC_rsl_protocol_error() runs on test_CT {
1824 f_init(testcasename());
1825 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1826 rsl.ies := omit;
1827 RSL_CCHAN.send(ts_RSL_UD(rsl));
1828
1829 f_exp_err_rep(RSL_ERR_PROTO);
1830}
1831
1832/* Provoke a mandatory IE error and match on ERROR REPORT */
1833testcase TC_rsl_mand_ie_error() runs on test_CT {
1834 f_init(testcasename());
1835
1836 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1837 rsl.ies := { rsl.ies[0] };
1838 RSL_CCHAN.send(ts_RSL_UD(rsl));
1839
1840 f_exp_err_rep(RSL_ERR_MAND_IE_ERROR);
1841}
1842
1843/* Provoke an IE content error and match on ERROR REPORT */
1844testcase TC_rsl_ie_content_error() runs on test_CT {
1845 f_init(testcasename());
1846 var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O));
1847 rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5;
1848 RSL_CCHAN.send(ts_RSL_UD(rsl));
1849
1850 f_exp_err_rep(RSL_ERR_IE_CONTENT);
1851}
1852
Harald Welte93640c62018-02-25 16:59:33 +01001853/***********************************************************************
1854 * IPA CRCX/MDCX/DLCS media stream handling
1855 ***********************************************************************/
1856
Harald Weltea871a382018-02-25 02:03:14 +01001857/* Send IPA DLCX to inactive lchan */
1858function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr {
Harald Welte1eba3742018-02-25 12:48:14 +01001859 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1860 "IPA DLCX ACK");
Harald Weltea871a382018-02-25 02:03:14 +01001861}
1862testcase TC_ipa_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_dlcx_not_active), pars);
1866 vc_conn.done;
1867}
Harald Welte68e495b2018-02-25 00:05:57 +01001868
Harald Weltea3f1df92018-02-25 12:49:55 +01001869/* Send IPA CRCX twice to inactive lchan */
1870function f_TC_ipa_crcx_twice_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 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL),
1874 "IPA CRCX NACK");
1875}
1876testcase TC_ipa_crcx_twice_not_active() runs on test_CT {
1877 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1878 f_init(testcasename());
1879 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars);
1880 vc_conn.done;
1881}
1882
1883/* Regular sequence of CRCX/MDCX/DLCX */
1884function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
1885 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
1886 "IPA CRCX ACK");
1887 var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
1888 var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
1889 var uint7_t rtp_pt2 := f_rnd_int(127);
1890 var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
1891 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1892 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1893 "IPA MDCX ACK");
1894 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1895 "IPA DLCX ACK");
1896}
1897testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT {
1898 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1899 f_init(testcasename());
1900 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars);
1901 vc_conn.done;
1902}
1903
Harald Welte3ae11da2018-02-25 13:36:06 +01001904/* Sequence of CRCX, 2x MDCX, DLCX */
1905function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr {
1906 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?),
1907 "IPA CRCX ACK");
1908 var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX);
1909 var uint16_t remote_port := f_rnd_int(c_UINT16_MAX);
1910 var uint7_t rtp_pt2 := f_rnd_int(127);
1911 var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */
1912 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1913 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1914 "IPA MDCX ACK");
1915 /* Second MDCX */
1916 remote_ip := f_rnd_int(c_UINT32_MAX);
1917 remote_port := f_rnd_int(c_UINT16_MAX);
1918 f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2),
1919 tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2),
1920 "IPA MDCX ACK");
1921 f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?),
1922 "IPA DLCX ACK");
1923}
1924testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT {
1925 var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN));
1926 f_init(testcasename());
1927 var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars);
1928 vc_conn.done;
1929}
1930
Harald Welte9912eb52018-02-25 13:30:15 +01001931/* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */
1932function f_TC_ipa_crcx_sdcch_not_active(charstring id) runs on ConnHdlr {
1933 f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?),
1934 "IPA CRCX NACK");
1935}
1936testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT {
1937 var ConnHdlrPars pars;
1938 var ConnHdlr vc_conn;
1939 f_init(testcasename());
1940
1941 pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN));
1942 vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars);
1943 vc_conn.done;
1944
1945 pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN));
1946 vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars);
1947 vc_conn.done;
1948}
1949
Harald Weltea3f1df92018-02-25 12:49:55 +01001950
Harald Welte883340c2018-02-28 18:59:29 +01001951/***********************************************************************
1952 * PCU Socket related tests
1953 ***********************************************************************/
1954
1955private function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success)
1956runs on test_CT {
1957 timer T := 3.0;
1958
1959 /* we don't expect any RTS.req before PDCH are active */
1960 T.start;
1961 alt {
1962 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr))) {
1963 setverdict(fail, "PCU RTS.req before PDCH active?");
1964 self.stop;
1965 }
1966 [] PCU.receive { repeat; }
1967 [] T.timeout { }
1968 }
1969
1970 /* Send PDCH activate request for known PDCH timeslot */
1971 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, ts_nr)));
1972
1973 /* we now expect RTS.req for this timeslot (only) */
1974 T.start;
1975 alt {
1976 [exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
1977 setverdict(pass);
1978 }
1979 [not exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
1980 tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
1981 setverdict(fail, "Unexpected RTS.req for supposedly failing activation");
1982 self.stop;
1983 }
1984 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) {
1985 setverdict(fail, "RTS.req for wrong TRX/TS");
1986 self.stop;
1987 }
1988 [] PCU.receive { repeat; }
1989 [exp_success] T.timeout {
1990 setverdict(fail, "Timeout waiting for PCU RTS.req");
1991 }
1992 [not exp_success] T.timeout {
1993 setverdict(pass);
1994 }
1995 }
1996}
1997
1998private function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr)
1999runs on test_CT {
2000 timer T := 3.0;
2001
2002 /* Send PDCH activate request for known PDCH timeslot */
2003 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, ts_nr)));
2004
2005 PCU.clear;
2006 /* we now expect no RTS.req for this timeslot */
2007 T.start;
2008 alt {
2009 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) {
2010 setverdict(fail, "Received unexpected PCU RTS.req");
2011 self.stop;
2012 }
2013 [] PCU.receive { repeat; }
2014 [] T.timeout {
2015 setverdict(pass);
2016 }
2017 }
2018}
2019
2020/* PDCH activation via PCU socket; check for presence of RTS.req */
2021testcase TC_pcu_act_req() runs on test_CT {
2022 f_init();
2023 f_TC_pcu_act_req(0, 0, 7, true);
2024}
2025
2026/* PDCH activation via PCU socket on non-PDCU timeslot */
2027testcase TC_pcu_act_req_wrong_ts() runs on test_CT {
2028 f_init();
2029 f_TC_pcu_act_req(0, 0, 1, false);
2030}
2031
2032/* PDCH activation via PCU socket on wrong BTS */
2033testcase TC_pcu_act_req_wrong_bts() runs on test_CT {
2034 f_init();
2035 f_TC_pcu_act_req(23, 0, 7, false);
2036}
2037
2038/* PDCH activation via PCU socket on wrong TRX */
2039testcase TC_pcu_act_req_wrong_trx() runs on test_CT {
2040 f_init();
2041 f_TC_pcu_act_req(0, 23, 7, false);
2042}
2043
2044/* PDCH deactivation via PCU socket; check for absence of RTS.req */
2045testcase TC_pcu_deact_req() runs on test_CT {
2046 f_init();
2047 /* Activate PDCH */
2048 f_TC_pcu_act_req(0, 0, 7, true);
2049 f_sleep(1.0);
2050 /* and De-Activate again */
2051 f_TC_pcu_deact_req(0, 0, 7);
2052}
2053
2054/* Attempt to deactivate a PDCH on a non-PDCH timeslot */
2055testcase TC_pcu_deact_req_wrong_ts() runs on test_CT {
2056 f_init();
2057 f_TC_pcu_deact_req(0, 0, 1);
2058}
2059
2060/* Test the PCU->BTS Version and BTS->PCU SI13 handshake */
2061testcase TC_pcu_ver_si13() runs on test_CT {
2062 const octetstring si13 := '00010203040506070909'O;
2063 var PCUIF_send_data sd;
2064 timer T:= 3.0;
2065 f_init();
2066
2067 /* Set SI13 via RSL */
2068 f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, si13);
2069 PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, "BTS_Test v23")));
2070 T.start;
2071 alt {
2072 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_DATA_IND(0, 0, 0, ?, PCU_IF_SAPI_BCCH))) -> value sd {
2073 if (substr(sd.data.u.data_ind.data, 0, lengthof(si13)) == si13) {
2074 setverdict(pass);
2075 } else {
2076 repeat;
2077 }
2078 }
2079 [] PCU.receive { repeat; }
2080 [] T.timeout {
2081 setverdict(fail, "Timeout waiting for SI13");
2082 self.stop;
2083 }
2084 }
2085}
2086
2087private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O;
2088
2089/* helper function to send a PCU DATA.req */
2090private function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
2091 uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data)
2092runs on test_CT
2093{
2094 PCU.send(t_SD_PCUIF(g_pcu_conn_id,
2095 ts_PCUIF_DATA_REQ(bts_nr, trx_nr, ts_nr, block_nr, fn, sapi, data)));
2096}
2097
2098/* helper function to wait for RTS.ind for given SAPI on given BTS/TRX/TS and then send */
2099private function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr,
2100 PCUIF_Sapi sapi, octetstring data)
2101runs on test_CT
2102{
2103 var PCUIF_send_data sd;
2104
2105 timer T := 3.0;
2106 T.start;
2107 alt {
2108 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id,
2109 tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr, sapi))) -> value sd {
2110 f_pcu_data_req(bts_nr, trx_nr, ts_nr, sd.data.u.rts_req.block_nr,
2111 sd.data.u.rts_req.fn, sapi, data);
2112 }
2113 [] PCU.receive { repeat; }
2114 [] T.timeout {
2115 setverdict(fail, "Timeout waiting for RTS.ind");
2116 }
2117 }
2118}
2119
2120/* Send DATA.req on invalid BTS */
2121testcase TC_pcu_data_req_wrong_bts() runs on test_CT {
2122 f_init();
2123 f_TC_pcu_act_req(0, 0, 7, true);
2124 f_pcu_data_req(23, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2125 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2126 f_sleep(10.0);
2127}
2128
2129/* Send DATA.req on invalid TRX */
2130testcase TC_pcu_data_req_wrong_trx() runs on test_CT {
2131 f_init();
2132 f_TC_pcu_act_req(0, 0, 7, true);
2133 f_pcu_data_req(0, 100, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2134 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2135 f_sleep(10.0);
2136}
2137
2138/* Send DATA.req on invalid timeslot */
2139testcase TC_pcu_data_req_wrong_ts() runs on test_CT {
2140 f_init();
2141 f_TC_pcu_act_req(0, 0, 7, true);
2142 f_pcu_data_req(0, 0, 70, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2143 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2144 f_sleep(10.0);
2145}
2146
2147/* Send DATA.req on timeslot that hasn't been activated */
2148testcase TC_pcu_data_req_ts_inactive() runs on test_CT {
2149 f_init();
2150 f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2151 /* FIXME: how to check this wasn't actually sent and didn't crash BTS? */
2152 f_sleep(2.0);
2153}
2154
2155testcase TC_pcu_data_req_pdtch() runs on test_CT {
2156 f_init();
2157 f_TC_pcu_act_req(0, 0, 7, true);
2158 f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PDTCH, c_PCU_DATA);
2159 /* FIXME: how to check this was actually sent */
2160 f_sleep(2.0);
2161}
2162
2163testcase TC_pcu_data_req_ptcch() runs on test_CT {
2164 f_init();
2165 f_TC_pcu_act_req(0, 0, 7, true);
2166 f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, c_PCU_DATA);
2167 /* FIXME: how to check this was actually sent */
2168 f_sleep(2.0);
2169}
2170
2171/* Send AGCH from PCU; check it appears on Um side */
2172testcase TC_pcu_data_req_agch() runs on test_CT {
2173 timer T := 3.0;
2174 f_init();
2175 f_init_l1ctl();
2176 f_l1_tune(L1CTL);
2177
2178 f_TC_pcu_act_req(0, 0, 7, true);
2179 f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_AGCH, c_PCU_DATA);
2180
2181 T.start;
2182 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01002183 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) {
Harald Welte883340c2018-02-28 18:59:29 +01002184 setverdict(pass);
2185 }
2186 [] L1CTL.receive { repeat; }
2187 [] T.timeout {
2188 setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
2189 }
2190 }
2191}
2192
2193/* Send IMM.ASS from PCU for PCH; check it appears on Um side */
2194testcase TC_pcu_data_req_imm_ass_pch() runs on test_CT {
2195 var octetstring imm_ass := f_rnd_octstring(23);
2196 f_init();
2197 f_init_l1ctl();
2198 f_l1_tune(L1CTL);
2199
2200 /* append 3 last imsi digits so BTS can compute pagng group */
2201 var uint32_t fn := f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H);
2202
2203 timer T := 0.5;
2204 T.start;
2205 alt {
Harald Weltef8df4cb2018-03-10 15:15:08 +01002206 [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, imm_ass)) {
Harald Welte883340c2018-02-28 18:59:29 +01002207 /* TODO: verify paging group */
2208 setverdict(pass);
2209 }
2210 [] L1CTL.receive { repeat; }
2211 [] T.timeout {
2212 setverdict(fail, "Timeout waiting for PCU-originated AGCH block on Um");
2213 }
2214 }
2215}
2216
2217/* Send RACH from Um side, expect it to show up on PCU socket */
2218testcase TC_pcu_rach_content() runs on test_CT {
2219 f_init();
2220 f_init_l1ctl();
2221 f_l1_tune(L1CTL);
2222
2223 var GsmFrameNumber fn_last := 0;
2224 for (var integer i := 0; i < 1000; i := i+1) {
2225 var OCT1 ra := f_rnd_ra_ps();
2226 var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra));
2227 if (fn == fn_last) {
2228 setverdict(fail, "Two RACH in same FN?!?");
2229 self.stop;
2230 }
2231 fn_last := fn;
2232
2233 timer T := 2.0;
2234 T.start;
2235 alt {
2236 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND(0, oct2int(ra), 0, ?, fn))) {
2237 T.stop;
2238 }
2239 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) {
2240 setverdict(fail, "Unexpected RACH IND");
2241 self.stop;
2242 }
2243 [] PCU.receive { repeat; }
2244 [] T.timeout {
2245 setverdict(fail, "Timeout waiting for RACH IND");
2246 self.stop;
2247 }
2248 }
2249 }
2250 setverdict(pass);
2251}
2252
2253private function f_pad_oct(octetstring str, integer len, OCT1 pad) return octetstring {
2254 var integer strlen := lengthof(str);
2255 for (var integer i := 0; i < len-strlen; i := i+1) {
2256 str := str & pad;
2257 }
2258 return str;
2259}
2260
2261/* Send PAGING via RSL, expect it to shw up on PCU socket */
2262testcase TC_pcu_paging_from_rsl() runs on test_CT {
2263 f_init();
2264
2265 for (var integer i := 0; i < 100; i := i+1) {
2266 var MobileL3_CommonIE_Types.MobileIdentityLV mi;
2267 timer T := 3.0;
2268 if (i < 50) {
2269 mi := valueof(ts_MI_TMSI_LV(f_rnd_octstring(4)));
2270 } else {
2271 mi := valueof(ts_MI_IMSI_LV(f_gen_imsi(i)));
2272 }
2273 var octetstring mi_enc_lv := enc_MobileIdentityLV(mi);
2274 var octetstring mi_enc := substr(mi_enc_lv, 1, lengthof(mi_enc_lv)-1);
2275 var octetstring t_mi_lv := f_pad_oct(mi_enc_lv, 9, '00'O);
2276
2277 /* Send RSL PAGING COMMAND */
2278 RSL_CCHAN.send(ts_RSL_UD(ts_RSL_PAGING_CMD(mi_enc, i mod 4)));
2279 T.start;
2280 alt {
2281 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ(0, t_mi_lv))) {
2282 }
2283 [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ)) {
2284 setverdict(fail, "Unexpected PAGING REQ");
2285 self.stop;
2286 }
2287 [] PCU.receive { repeat; }
2288 [] T.timeout {
2289 setverdict(fail, "Timeout waiting for PAGING REQ");
2290 self.stop;
2291 }
2292 }
2293 }
2294 setverdict(pass);
2295}
2296
2297
Harald Welte68e495b2018-02-25 00:05:57 +01002298/* TODO Areas:
2299
2300* channel activation
2301** with BS_Power / MS_Power, bypassing power control loop
2302** on primary vs. secondary TRX
2303** with encryption from initial activation on
2304** with timing advance from initial activation on
2305* mode modify
2306** encryption
2307** multirate
2308* check DEACTIVATE SACCH
2309* encryption command / intricate logic about tx-only/tx+rx/...
2310** unsupported algorithm
2311* handover detection
2312* MS Power Control
2313* BS Power Control
2314* Physical Context
2315* SACCH info modify
Harald Welte68e495b2018-02-25 00:05:57 +01002316* CCCH Load Indication for PCH and RACH
2317* Delete Indication on AGCH overflow
2318* SMS Broadcast Req / Cmd / CBCH LOad Ind
2319* RF resource ind
Harald Welte68e495b2018-02-25 00:05:57 +01002320* error handling
2321* discriminator error
2322** type error
2323** sequence error
2324** IE duplicated?
Harald Welte883340c2018-02-28 18:59:29 +01002325* PCU interface
2326** TIME_IND from BTS->PCU
2327** DATA_IND from BTS->PCU
2328** verification of PCU-originated DATA_REQ arrival on Um/MS side
Harald Welte68e495b2018-02-25 00:05:57 +01002329
2330*/
Harald Welte70767382018-02-21 12:16:40 +01002331
2332control {
2333 execute( TC_chan_act_stress() );
2334 execute( TC_chan_act_react() );
2335 execute( TC_chan_deact_not_active() );
2336 execute( TC_chan_act_wrong_nr() );
Harald Welte8c24c2b2018-02-26 08:31:31 +01002337 execute( TC_rach_content() );
2338 execute( TC_rach_count() );
Harald Welte54a2a2d2018-02-26 09:14:05 +01002339 execute( TC_rach_max_ta() );
Harald Welte70767382018-02-21 12:16:40 +01002340 execute( TC_meas_res_sign_tchf() );
2341 execute( TC_meas_res_sign_tchh() );
2342 execute( TC_meas_res_sign_sdcch4() );
2343 execute( TC_meas_res_sign_sdcch8() );
Harald Welte685d5982018-02-27 20:42:05 +01002344 execute( TC_meas_res_sign_tchh_toa256() );
Harald Welte70767382018-02-21 12:16:40 +01002345 execute( TC_conn_fail_crit() );
Harald Welte68e495b2018-02-25 00:05:57 +01002346 execute( TC_paging_imsi_80percent() );
2347 execute( TC_paging_tmsi_80percent() );
2348 execute( TC_paging_imsi_200percent() );
2349 execute( TC_paging_tmsi_200percent() );
Harald Welte01d982c2018-02-25 01:31:40 +01002350 execute( TC_rsl_protocol_error() );
2351 execute( TC_rsl_mand_ie_error() );
2352 execute( TC_rsl_ie_content_error() );
Harald Welte48494ca2018-02-25 16:59:50 +01002353 execute( TC_si_sched_default() );
Harald Welte0cae4552018-03-09 22:20:26 +01002354 execute( TC_si_sched_1() );
Harald Welte48494ca2018-02-25 16:59:50 +01002355 execute( TC_si_sched_2bis() );
2356 execute( TC_si_sched_2ter() );
2357 execute( TC_si_sched_2ter_2bis() );
2358 execute( TC_si_sched_2quater() );
2359 execute( TC_si_sched_13() );
2360 execute( TC_si_sched_13_2bis_2ter_2quater() );
Harald Weltea871a382018-02-25 02:03:14 +01002361 execute( TC_ipa_dlcx_not_active() );
Harald Weltea3f1df92018-02-25 12:49:55 +01002362 execute( TC_ipa_crcx_twice_not_active() );
2363 execute( TC_ipa_crcx_mdcx_dlcx_not_active() );
Harald Welte3ae11da2018-02-25 13:36:06 +01002364 execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() );
Harald Welte9912eb52018-02-25 13:30:15 +01002365 execute( TC_ipa_crcx_sdcch_not_active() );
Harald Welte883340c2018-02-28 18:59:29 +01002366
2367 execute( TC_pcu_act_req() );
2368 execute( TC_pcu_act_req_wrong_ts() );
2369 execute( TC_pcu_act_req_wrong_bts() );
2370 execute( TC_pcu_act_req_wrong_trx() );
2371 execute( TC_pcu_deact_req() );
2372 execute( TC_pcu_deact_req_wrong_ts() );
2373 execute( TC_pcu_ver_si13() );
2374 execute( TC_pcu_data_req_wrong_bts() );
2375 execute( TC_pcu_data_req_wrong_trx() );
2376 execute( TC_pcu_data_req_wrong_ts() );
2377 execute( TC_pcu_data_req_ts_inactive() );
2378 execute( TC_pcu_data_req_pdtch() );
2379 execute( TC_pcu_data_req_ptcch() );
2380 execute( TC_pcu_data_req_agch() );
2381 execute( TC_pcu_data_req_imm_ass_pch() );
2382 execute( TC_pcu_rach_content() );
2383 execute( TC_pcu_paging_from_rsl() );
Harald Welte70767382018-02-21 12:16:40 +01002384}
2385
2386
2387}