Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1 | module BTS_Tests { |
| 2 | |
Harald Welte | 1490695 | 2019-05-27 09:19:49 +0200 | [diff] [blame] | 3 | /* Integration Tests for OsmoBTS |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 4 | * (C) 2018-2019 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 1490695 | 2019-05-27 09:19:49 +0200 | [diff] [blame] | 5 | * contributions by Vadim Yanitskiy and sysmocom - s.f.m.c. GmbH |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Released under the terms of GNU General Public License, Version 2 or |
| 9 | * (at your option) any later version. |
| 10 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 12 | * |
Harald Welte | 1490695 | 2019-05-27 09:19:49 +0200 | [diff] [blame] | 13 | * This test suite tests OsmoBTS by attaching to the external interfaces |
| 14 | * such as Abis RSL, PCU, VTY as well as by attaching to a MS L1 implementation |
| 15 | * using the L1CTL protocol/interface. |
| 16 | * |
| 17 | * You can run the tests with |
| 18 | * a) osmo-bts-trx + trxcon + fake_trx (without any hardware) |
| 19 | * b) any osmo-bts-* + OsmocomBB layer1 + osmocon (with real BTS hardware) |
| 20 | * c) osmo-bts-virtual + virt_phy (without any hardware) |
| 21 | * |
| 22 | * Some of the tests will only run on a subset of those three configurations |
| 23 | * due to limitations in the respective L1. |
| 24 | */ |
| 25 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 26 | import from Misc_Helpers all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 27 | import from General_Types all; |
| 28 | import from GSM_Types all; |
| 29 | import from GSM_RR_Types all; |
| 30 | import from Osmocom_Types all; |
| 31 | import from GSM_Types all; |
Vadim Yanitskiy | 5d2cf44 | 2020-05-02 16:49:17 +0700 | [diff] [blame] | 32 | import from GSM_RestOctets all; |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 33 | import from GSM_SystemInformation all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 34 | import from L1CTL_PortType all; |
| 35 | import from L1CTL_Types all; |
| 36 | import from LAPDm_Types all; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 37 | import from LAPDm_RAW_PT all; |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 38 | import from Native_Functions all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 39 | import from Osmocom_CTRL_Adapter all; |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 40 | import from Osmocom_CTRL_Functions all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 41 | |
| 42 | import from RSL_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 43 | import from IPA_Types all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 44 | import from IPA_Emulation all; |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 45 | import from IPA_Testing all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 46 | import from RSL_Emulation all; |
| 47 | |
| 48 | import from IPL4asp_Types all; |
| 49 | import from TRXC_Types all; |
| 50 | import from TRXC_CodecPort all; |
| 51 | import from TRXC_CodecPort_CtrlFunct all; |
| 52 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 53 | import from PCUIF_Types all; |
| 54 | import from PCUIF_CodecPort all; |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 55 | import from UD_Types all; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 56 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 57 | import from MobileL3_CommonIE_Types all; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 58 | import from MobileL3_RRM_Types all; |
| 59 | import from MobileL3_Types all; |
| 60 | import from L3_Templates all; |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 61 | import from L3_Common all; |
| 62 | import from MobileL3_GMM_SM_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 63 | |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 64 | import from Osmocom_VTY_Functions all; |
| 65 | import from TELNETasp_PortType all; |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 66 | import from BTS_Tests_LAPDm all; |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 67 | |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 68 | friend module BTS_Tests_SMSCB; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 69 | friend module BTS_Tests_virtphy; |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 70 | friend module BTS_Tests_LAPDm; |
Pau Espin Pedrol | 5a012ee | 2020-02-06 19:33:22 +0100 | [diff] [blame] | 71 | friend module BTS_Tests_perf; |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 72 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 73 | /* The tests assume a BTS with the following timeslot configuration: |
| 74 | * TS0 : Combined CCCH + SDCCH/4 |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 75 | * TS1 : TCH/F |
| 76 | * TS2 : TCH/F |
| 77 | * TS3 : TCH/F_PDCH (IPA Style) |
| 78 | * TS4 : TCH/F_TCH/H_PDCH (Osmocom Style) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 79 | * TS5 : TCH/H |
| 80 | * TS6 : SDCCH/8 |
| 81 | * TS7 : PDCH |
| 82 | */ |
| 83 | |
| 84 | modulepar { |
| 85 | charstring mp_rsl_ip := "127.0.0.2"; |
| 86 | integer mp_rsl_port := 3003; |
| 87 | integer mp_trx0_arfcn := 871; |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 88 | integer mp_trx1_arfcn := 873; |
| 89 | integer mp_trx2_arfcn := 875; |
| 90 | integer mp_trx3_arfcn := 877; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 91 | charstring mp_bts_trxc_ip := "127.0.0.1"; |
| 92 | integer mp_bts_trxc_port := 5701; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 93 | charstring mp_pcu_socket := PCU_SOCK_DEFAULT; |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 94 | charstring mp_ctrl_ip := "127.0.0.1"; |
| 95 | integer mp_ctrl_port := 4238; |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 96 | charstring mp_bsc_ctrl_ip := "127.0.0.1"; |
| 97 | integer mp_bsc_ctrl_port := 4249; |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 98 | integer mp_tolerance_rxqual := 1; |
| 99 | integer mp_tolerance_rxlev := 3; |
| 100 | integer mp_tolerance_timing_offset_256syms := 0; |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 101 | integer mp_rxlev_exp := 57; |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 102 | integer mp_ul_rxlev_exp := 10; |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 103 | integer mp_ms_power_level_exp := 7; |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 104 | integer mp_bts_tx_nom_pwr_exp := 50; /* Expected Tx Nominal Output Power of the BTS, in dBm */ |
| 105 | integer mp_bts_tx_pwr_att_exp := 20; /* Expected Tx Power attenuation wrt to Tx Nominal Output Power, in dB */ |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 106 | integer mp_ms_actual_ta_exp := 0; |
| 107 | integer mp_timing_offset_256syms_exp := 512; |
Pau Espin Pedrol | 315e471 | 2018-11-01 16:27:07 +0100 | [diff] [blame] | 108 | /* Time to wait for RSL conn from BTS during startup of test */ |
Philipp Maier | 12567e4 | 2019-04-17 14:10:05 +0200 | [diff] [blame] | 109 | float mp_ipa_up_timeout := 15.0; |
Philipp Maier | e63229e | 2019-04-26 12:21:37 +0200 | [diff] [blame] | 110 | float mp_ipa_up_delay := 0.0; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 111 | /* false for now, as only virtphy supports it, not calypso-l1 nor trxcon */ |
| 112 | boolean mp_l1_supports_gprs := false; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 113 | /* how many transceivers do we expect to connect */ |
| 114 | integer mp_transceiver_num := 1; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 115 | /* frequency hopping status */ |
| 116 | boolean mp_freq_hop_enabled := false; |
| 117 | /* frequency hopping parameters */ |
| 118 | FreqHopConfig mp_fh_config; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 119 | } |
| 120 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 121 | type record of RslChannelNr ChannelNrs; |
| 122 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 123 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 124 | /* IPA Emulation component underneath RSL */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 125 | var IPA_Emulation_CT vc_IPA; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 126 | /* RSL Emulation component (for ConnHdlr tests) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 127 | var RSL_Emulation_CT vc_RSL; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 128 | /* Direct RSL_CCHAN_PT */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 129 | port RSL_CCHAN_PT RSL_CCHAN; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 130 | |
| 131 | /* L1CTL port (for classic tests) */ |
| 132 | port L1CTL_PT L1CTL; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 133 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 134 | /* Optional TRXC connection to FakeTRX (BTS side) */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 135 | port TRXC_CODEC_PT BTS_TRXC; |
| 136 | var integer g_bts_trxc_conn_id; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 137 | |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 138 | /* VTY connections to both BTS and BSC */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 139 | port TELNETasp_PT BTSVTY; |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 140 | port TELNETasp_PT BSCVTY; |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 141 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 142 | /* PCU Interface of BTS */ |
| 143 | port PCUIF_CODEC_PT PCU; |
| 144 | var integer g_pcu_conn_id; |
| 145 | /* Last PCU INFO IND we received */ |
| 146 | var PCUIF_Message g_pcu_last_info; |
| 147 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 148 | /* SI configuration */ |
| 149 | var SystemInformationConfig si_cfg := { |
| 150 | bcch_extended := false, |
| 151 | si1_present := false, |
| 152 | si2bis_present := false, |
| 153 | si2ter_present := false, |
| 154 | si2quater_present := false, |
| 155 | si7_present := false, |
| 156 | si8_present := false, |
| 157 | si9_present := false, |
| 158 | si13_present := false, |
| 159 | si13alt_present := false, |
| 160 | si15_present := false, |
| 161 | si16_present := false, |
| 162 | si17_present := false, |
| 163 | si2n_present := false, |
| 164 | si21_present := false, |
| 165 | si22_present := false |
| 166 | }; |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 167 | |
| 168 | /* all logical channels available on the BTS */ |
| 169 | var ChannelNrs g_AllChannels; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 170 | var ChannelNrs g_AllChanTypes; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | /* an individual call / channel */ |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 174 | type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 175 | port L1CTL_PT L1CTL; |
| 176 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 177 | /* Optional TRXC connection to FakeTRX (BTS side) */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 178 | port TRXC_CODEC_PT BTS_TRXC; |
| 179 | var integer g_bts_trxc_conn_id; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 180 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 181 | /* port to be initialized optionally to access BSC VTY */ |
| 182 | port TELNETasp_PT BSCVTY; |
| 183 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 184 | timer g_Tguard; |
| 185 | timer g_Tmeas_exp := 2.0; /* >= 103 SACCH multiframe ~ 500ms */ |
| 186 | |
| 187 | var ConnHdlrPars g_pars; |
| 188 | var uint8_t g_next_meas_res_nr := 0; |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 189 | var boolean g_first_meas_res := true; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 190 | |
| 191 | /* PCU Interface of BTS */ |
| 192 | port PCUIF_CODEC_PT PCU; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 193 | } |
| 194 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 195 | private function f_init_rsl(charstring id) runs on test_CT { |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 196 | var bitstring trx_mask := '00000000'B; |
| 197 | var integer trx_count := 0; |
| 198 | var RSLEm_Event ev; |
| 199 | timer T; |
| 200 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 201 | vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA"); |
| 202 | vc_RSL := RSL_Emulation_CT.create(id & "-RSL"); |
| 203 | |
| 204 | map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 205 | connect(vc_IPA:IPA_RSL_PORT, vc_RSL:IPA_PT); |
| 206 | connect(self:RSL_CCHAN, vc_RSL:CCHAN_PT); |
| 207 | |
| 208 | vc_IPA.start(IPA_Emulation.main_server(mp_rsl_ip, mp_rsl_port)); |
| 209 | vc_RSL.start(RSL_Emulation.main(false)); |
Vadim Yanitskiy | c9c9e29 | 2020-05-18 23:31:40 +0700 | [diff] [blame] | 210 | |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 211 | /* We expect (N = mp_transceiver_num) IPA/RSL transceiver connections here. |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 212 | * See https://gerrit.osmocom.org/q/Ib5ad31388ae25399ad09739aac3fdcb0b3a1f78b. */ |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 213 | T.start(mp_ipa_up_timeout); |
| 214 | alt { |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 215 | /* These events are sent by the RSL_Emulation_CT */ |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 216 | [] RSL_CCHAN.receive(tr_RSLEm_EV(RSLEM_EV_TRX_UP, ?)) -> value ev { |
| 217 | /* Make sure that all transceivers use unique stream ID */ |
| 218 | if (trx_mask[enum2int(ev.sid)] == '1'B) { |
| 219 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 220 | log2str("Duplicate RSL stream ID (", ev.sid, ")")); |
| 221 | } |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 222 | |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 223 | /* This message (RF RESource INDication) is sent by the IUT itself */ |
| 224 | RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND, ev.sid)); |
| 225 | trx_mask[enum2int(ev.sid)] := '1'B; |
| 226 | trx_count := trx_count + 1; |
| 227 | |
| 228 | log(trx_count, "/", mp_transceiver_num, " transceiver(s) connected"); |
| 229 | if (trx_count < mp_transceiver_num) { repeat; } |
| 230 | } |
| 231 | /* osmo-bts may send us CCCH LOAD INDication or whatever else */ |
| 232 | [] RSL_CCHAN.receive(ASP_RSL_Unitdata:?) { repeat; } |
| 233 | [] T.timeout { |
| 234 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 235 | "Timeout waiting for RSL bring up"); |
| 236 | } |
| 237 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 238 | } |
| 239 | |
| 240 | type record ConnHdlrPars { |
| 241 | RslChannelNr chan_nr, |
| 242 | RSL_IE_ChannelMode chan_mode, |
| 243 | float t_guard, |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 244 | ConnL1Pars l1_pars, |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 245 | TestSpecUnion spec optional, |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 246 | RSL_IE_EncryptionInfo encr optional, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 247 | BtsBand bts0_band optional, |
| 248 | |
| 249 | /* Frequency hopping parameters (disabled if absent) */ |
| 250 | MaioHsn maio_hsn optional, |
| 251 | /* MA bitmap to be indicated in RR Immediate Assignment */ |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 252 | MobileAllocationLV ma_map, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 253 | /* The actual Mobile Allocation (ARFCN list) to be used */ |
| 254 | L1ctlMA ma |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | /* Test-specific parameters */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 258 | private type union TestSpecUnion { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 259 | RllTestCase rll |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 260 | } |
| 261 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 262 | private template (value) RachControlParameters ts_RachCtrl_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 263 | max_retrans := RACH_MAX_RETRANS_7, |
| 264 | tx_integer := '1001'B, /* 12 slots */ |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 265 | cell_barr_access := false, |
| 266 | re_not_allowed := true, |
Harald Welte | b9585f8 | 2018-03-10 17:18:47 +0100 | [diff] [blame] | 267 | acc := '0000010000000000'B |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 268 | }; |
| 269 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 270 | private template (value) CellSelectionParameters ts_CellSelPar_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 271 | cell_resel_hyst_2dB := 2, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 272 | ms_txpwr_max_cch := mp_ms_power_level_exp, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 273 | acs := '0'B, |
| 274 | neci := true, |
| 275 | rxlev_access_min := 0 |
| 276 | } |
| 277 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 278 | private template (value) LocationAreaIdentification ts_LAI_default := { |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 279 | mcc_mnc := '262F42'H, |
| 280 | lac := 42 |
| 281 | } |
| 282 | |
Vadim Yanitskiy | 12cf3d9 | 2020-05-05 00:19:50 +0700 | [diff] [blame] | 283 | private template (value) GPRSIndicator ts_GPRSIndicator_def := { |
| 284 | ra_colour := 0, |
| 285 | si13_pos := '0'B |
| 286 | } |
| 287 | |
| 288 | private template (value) SI3RestOctets ts_SI3RestOctets_def |
| 289 | modifies ts_SI3RestOctets := { |
| 290 | gprs_ind := { |
| 291 | presence := CSN1_H, |
| 292 | ind := ts_GPRSIndicator_def |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | private template (value) SI4RestOctets ts_SI4RestOctets_def |
| 297 | modifies ts_SI4RestOctets := { |
| 298 | gprs_ind := { |
Vadim Yanitskiy | ab5363f | 2020-05-05 00:30:22 +0700 | [diff] [blame] | 299 | presence := CSN1_H, |
| 300 | ind := ts_GPRSIndicator_def |
Vadim Yanitskiy | 12cf3d9 | 2020-05-05 00:19:50 +0700 | [diff] [blame] | 301 | } |
| 302 | } |
| 303 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 304 | /* Default SYSTEM INFORMATION 3 */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 305 | private template (value) SystemInformation ts_SI3_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 306 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_3, 18), |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 307 | payload := { |
| 308 | si3 := { |
| 309 | cell_id := 23, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 310 | lai := ts_LAI_default, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 311 | ctrl_chan_desc := { |
| 312 | msc_r99 := true, |
| 313 | att := true, |
| 314 | bs_ag_blks_res := 1, |
| 315 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 316 | si22ind := false, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 317 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 318 | spare := '00'B, |
| 319 | bs_pa_mfrms := 0, /* 2 multiframes */ |
| 320 | t3212 := 1 /* 6 minutes */ |
| 321 | }, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 322 | cell_options := { |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 323 | dn_ind := false, |
| 324 | pwrc := false, |
| 325 | dtx := MS_MAY_USE_UL_DTX, |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 326 | radio_link_tout_div4 := (32/4)-1 |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 327 | }, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 328 | cell_sel_par := ts_CellSelPar_default, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 329 | rach_control := ts_RachCtrl_default, |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 330 | rest_octets := valueof(ts_SI3RestOctets_def) |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 331 | } |
| 332 | } |
| 333 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 334 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 335 | private template (value) SystemInformation ts_SI2_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 336 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_2, 22), |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 337 | payload := { |
| 338 | si2 := { |
| 339 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 340 | ncc_permitted := '11111111'B, |
| 341 | rach_control := ts_RachCtrl_default |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 346 | private template (value) SystemInformation ts_SI4_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 347 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_4, 12), /* no CBCH / restoct */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 348 | payload := { |
| 349 | si4 := { |
| 350 | lai := ts_LAI_default, |
| 351 | cell_sel_par := ts_CellSelPar_default, |
| 352 | rach_control := ts_RachCtrl_default, |
| 353 | cbch_chan_desc := omit, |
| 354 | cbch_mobile_alloc := omit, |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 355 | rest_octets := valueof(ts_SI4RestOctets_def) |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 356 | } |
| 357 | } |
| 358 | } |
| 359 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 360 | private function f_rsl_bcch_fill_raw(RSL_IE_SysinfoType rsl_si_type, octetstring si_enc) |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 361 | runs on test_CT { |
| 362 | log("Setting ", rsl_si_type, ": ", si_enc); |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 363 | RSL_CCHAN.send(ts_ASP_RSL_UD(ts_RSL_BCCH_INFO(rsl_si_type, si_enc))); |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 364 | } |
| 365 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 366 | private function f_rsl_bcch_fill(RSL_IE_SysinfoType rsl_si_type, template (value) SystemInformation si_dec) |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 367 | runs on test_CT { |
| 368 | var octetstring si_enc := enc_SystemInformation(valueof(si_dec)); |
| 369 | log("Setting ", rsl_si_type, ": ", si_dec); |
| 370 | f_rsl_bcch_fill_raw(rsl_si_type, si_enc); |
| 371 | } |
| 372 | |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 373 | friend function f_init_vty(charstring id) runs on test_CT { |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 374 | map(self:BTSVTY, system:BTSVTY); |
| 375 | f_vty_set_prompts(BTSVTY); |
| 376 | f_vty_transceive(BTSVTY, "enable"); |
| 377 | } |
| 378 | |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 379 | friend function f_init_vty_bsc() runs on test_CT { |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 380 | map(self:BSCVTY, system:BSCVTY); |
| 381 | f_vty_set_prompts(BSCVTY, "OsmoBSC"); |
| 382 | f_vty_transceive(BSCVTY, "enable"); |
| 383 | } |
| 384 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 385 | friend function f_connhdlr_init_vty_bsc() runs on ConnHdlr { |
| 386 | map(self:BSCVTY, system:BSCVTY); |
| 387 | f_vty_set_prompts(BSCVTY, "OsmoBSC"); |
| 388 | f_vty_transceive(BSCVTY, "enable"); |
| 389 | } |
| 390 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 391 | /* PCU socket may at any time receive a new INFO.ind */ |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 392 | private altstep as_pcu_info_ind(PCUIF_CODEC_PT pt, integer pcu_conn_id, |
| 393 | out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 394 | var PCUIF_send_data sd; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 395 | [] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(0, ?))) -> value sd { |
| 396 | pcu_last_info := sd.data; |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 397 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 398 | [] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(?, ?, ?))) -> value sd { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 399 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Invalid PCU Version/BTS Number received"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 400 | } |
| 401 | } |
| 402 | |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 403 | private function f_init_pcu(PCUIF_CODEC_PT pt, charstring id, |
| 404 | out integer pcu_conn_id, out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 405 | timer T := 2.0; |
| 406 | var PCUIF_send_data sd; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 407 | if (mp_pcu_socket == "") { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 408 | pcu_conn_id := -1; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 409 | return; |
| 410 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 411 | pcu_conn_id := f_pcuif_connect(pt, mp_pcu_socket); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 412 | |
| 413 | T.start; |
| 414 | alt { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 415 | [] as_pcu_info_ind(pt, pcu_conn_id, pcu_last_info); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 416 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 417 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU INFO_IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 422 | private function f_init_trxc(TRXC_CODEC_PT pt, charstring id, |
| 423 | out integer trxc_conn_id) { |
| 424 | var Result res; |
| 425 | |
| 426 | res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(pt, mp_bts_trxc_ip, mp_bts_trxc_port, |
| 427 | "", -1, -1, { udp := {} }, {}); |
| 428 | if (not ispresent(res.connId)) { |
| 429 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 430 | "Could not connect to the control (TRXC) interface " & |
| 431 | "of FakeTRX, check your configuration"); |
| 432 | } |
| 433 | trxc_conn_id := res.connId; |
| 434 | } |
| 435 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 436 | /* global init function */ |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 437 | friend function f_init() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 438 | var charstring id := testcasename(); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 439 | g_AllChannels := { |
| 440 | /* TS 1..4: TCH/F */ |
| 441 | valueof(ts_RslChanNr_Bm(1)), valueof(ts_RslChanNr_Bm(2)), |
| 442 | valueof(ts_RslChanNr_Bm(3)), valueof(ts_RslChanNr_Bm(4)), |
| 443 | /* TS 5: TCH/H */ |
| 444 | valueof(ts_RslChanNr_Lm(5,0)), valueof(ts_RslChanNr_Lm(5,1)), |
| 445 | /* TS 0: SDCCH/4 */ |
| 446 | valueof(ts_RslChanNr_SDCCH4(0,0)), valueof(ts_RslChanNr_SDCCH4(0,1)), |
| 447 | valueof(ts_RslChanNr_SDCCH4(0,2)), valueof(ts_RslChanNr_SDCCH4(0,3)), |
| 448 | /* TS 6: SDCCH/8 */ |
| 449 | valueof(ts_RslChanNr_SDCCH8(6,0)), valueof(ts_RslChanNr_SDCCH8(6,1)), |
| 450 | valueof(ts_RslChanNr_SDCCH8(6,2)), valueof(ts_RslChanNr_SDCCH8(6,3)), |
| 451 | valueof(ts_RslChanNr_SDCCH8(6,4)), valueof(ts_RslChanNr_SDCCH8(6,5)), |
| 452 | valueof(ts_RslChanNr_SDCCH8(6,6)), valueof(ts_RslChanNr_SDCCH8(6,7)) |
| 453 | }; |
| 454 | |
Pau Espin Pedrol | 3dcf38f | 2018-10-22 14:07:54 +0200 | [diff] [blame] | 455 | /* FIXME: FACCH/H is unreliable with calypso firmware, see OS#3653 */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 456 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | 3dcf38f | 2018-10-22 14:07:54 +0200 | [diff] [blame] | 457 | g_AllChanTypes := { |
| 458 | /* TS 1..4: TCH/F */ |
| 459 | valueof(ts_RslChanNr_Bm(1)), |
| 460 | /* TS 5: TCH/H */ |
| 461 | valueof(ts_RslChanNr_Lm(5,1)), |
| 462 | /* TS 0: SDCCH/4 */ |
| 463 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 464 | /* TS 6: SDCCH/8 */ |
| 465 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 466 | }; |
| 467 | } else { |
| 468 | g_AllChanTypes := { |
| 469 | /* TS 1..4: TCH/F */ |
| 470 | valueof(ts_RslChanNr_Bm(1)), |
| 471 | /* TS 0: SDCCH/4 */ |
| 472 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 473 | /* TS 6: SDCCH/8 */ |
| 474 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 475 | }; |
| 476 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 477 | f_init_rsl(id); |
Harald Welte | 2d14259 | 2018-02-25 13:19:44 +0100 | [diff] [blame] | 478 | f_sleep(0.5); /* workaround for OS#3000 */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 479 | f_init_vty(id); |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 480 | f_ipa_ctrl_start(mp_ctrl_ip, mp_ctrl_port); |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 481 | |
| 482 | /* Send SI3 to the BTS, it is needed for various computations */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 483 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default); |
| 484 | /* SI2 + SI4 are required for SI testing as they are mandatory defaults */ |
| 485 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default); |
| 486 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
Harald Welte | 57fe823 | 2018-02-26 17:52:50 +0100 | [diff] [blame] | 487 | |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 488 | map(self:PCU, system:PCU); |
| 489 | f_init_pcu(PCU, id, g_pcu_conn_id, g_pcu_last_info); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 490 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 491 | if (mp_bts_trxc_port != -1) { |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 492 | var TrxcMessage ret; |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 493 | |
| 494 | /* Init TRXC interface to FakeTRX */ |
| 495 | map(self:BTS_TRXC, system:BTS_TRXC); |
| 496 | f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id); |
| 497 | |
Vadim Yanitskiy | 10d7246 | 2019-06-04 22:27:52 +0700 | [diff] [blame] | 498 | /* Start with a default moderate timing offset equalling TA=2, and RSSI=-60 */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 499 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(2*256))); |
Vadim Yanitskiy | 10d7246 | 2019-06-04 22:27:52 +0700 | [diff] [blame] | 500 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_RSSI(-60))); |
Vadim Yanitskiy | de535e0 | 2019-07-26 16:29:27 +0700 | [diff] [blame] | 501 | /* OsmoBTS may have different AB / NB threshold (see MIN_QUAL_NORM, MIN_QUAL_RACH) */ |
| 502 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_CI(60))); |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 503 | } |
Philipp Maier | d95f340 | 2019-04-18 17:50:52 +0200 | [diff] [blame] | 504 | |
| 505 | /* Wait some extra time to make sure the BTS emits a stable carrier. |
| 506 | * (this is only relevant when running the tests with a physical BTS.) */ |
| 507 | f_sleep(mp_ipa_up_delay); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 508 | } |
| 509 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 510 | /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */ |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 511 | friend function f_init_l1ctl() runs on test_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 512 | map(self:L1CTL, system:L1CTL); |
| 513 | f_connect_reset(L1CTL); |
| 514 | } |
| 515 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 516 | private type function void_fn(charstring id) runs on ConnHdlr; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 517 | |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 518 | private type record length(8) of FreqHopGroups FreqHopConfig; |
| 519 | |
| 520 | private type record of FreqHopGroup FreqHopGroups; |
| 521 | private type record FreqHopGroup { |
| 522 | uint6_t hsn, |
| 523 | FreqHopGroupItems trx_maio |
| 524 | }; |
| 525 | |
| 526 | private type record of FreqHopGroupItem FreqHopGroupItems; |
| 527 | private type record FreqHopGroupItem { |
| 528 | uint8_t trx_nr, |
| 529 | uint6_t maio |
| 530 | }; |
| 531 | |
| 532 | friend function f_resolve_fh_params(inout ConnHdlrPars pars, uint8_t trx_nr := 0) |
| 533 | { |
| 534 | var FreqHopGroups groups := mp_fh_config[pars.chan_nr.tn]; |
| 535 | var integer i, j; |
| 536 | |
| 537 | for (i := 0; i < lengthof(groups); i := i + 1) { |
| 538 | var FreqHopGroup g := groups[i]; |
| 539 | for (j := 0; j < lengthof(g.trx_maio); j := j + 1) { |
| 540 | var FreqHopGroupItem gi := g.trx_maio[j]; |
| 541 | if (gi.trx_nr == trx_nr) { |
| 542 | pars.maio_hsn := valueof(ts_HsnMaio(g.hsn, gi.maio)); |
| 543 | pars.ma := { }; /* to be composed below */ |
| 544 | break; |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | if (ispresent(pars.maio_hsn)) { |
Vadim Yanitskiy | 4fa7425 | 2020-08-03 15:51:58 +0700 | [diff] [blame] | 549 | /* Prepare the Mobile Allocation bitmask (length & padding) */ |
| 550 | pars.ma_map.len := mp_transceiver_num / 8; |
| 551 | if (mp_transceiver_num mod 8 > 0) |
| 552 | { pars.ma_map.len := pars.ma_map.len + 1; } |
| 553 | pars.ma_map.ma := f_pad_bit('0'B, pars.ma_map.len * 8, '0'B); |
| 554 | |
| 555 | /* Compose the actual Mobile Allocation and the bitmask */ |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 556 | for (j := 0; j < lengthof(g.trx_maio); j := j + 1) { |
| 557 | var FreqHopGroupItem gi := g.trx_maio[j]; |
| 558 | pars.ma := pars.ma & { l1ctl_ma_def[gi.trx_nr] }; |
Vadim Yanitskiy | 4fa7425 | 2020-08-03 15:51:58 +0700 | [diff] [blame] | 559 | pars.ma_map.ma[gi.trx_nr] := '1'B; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 560 | } |
| 561 | |
Vadim Yanitskiy | 4fa7425 | 2020-08-03 15:51:58 +0700 | [diff] [blame] | 562 | log("Freq. hopping parameters: maio_hsn := ", pars.maio_hsn, |
| 563 | ", ma := ", pars.ma, ", ma_map := ", pars.ma_map); |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 564 | break; /* We're done */ |
| 565 | } |
| 566 | } |
| 567 | } |
| 568 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 569 | /* create a new test component */ |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 570 | friend function f_start_handler(void_fn fn, ConnHdlrPars pars, |
| 571 | boolean pcu_comp := false, |
| 572 | boolean trxc_comp := false) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 573 | runs on test_CT return ConnHdlr { |
| 574 | var charstring id := testcasename(); |
| 575 | var ConnHdlr vc_conn; |
| 576 | |
| 577 | vc_conn := ConnHdlr.create(id); |
| 578 | /* connect to RSL Emulation main component */ |
| 579 | connect(vc_conn:RSL, vc_RSL:CLIENT_PT); |
| 580 | connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 581 | |
| 582 | /* The ConnHdlr component may want to talk to some ports directly, |
| 583 | * so we disconnect it from the test_CT and connect it to the component. |
| 584 | * This obviously only works for one component, i.e. no concurrency. */ |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 585 | if (pcu_comp) { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 586 | unmap(self:PCU, system:PCU); |
| 587 | map(vc_conn:PCU, system:PCU); |
| 588 | } |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 589 | if (trxc_comp) { |
| 590 | unmap(self:BTS_TRXC, system:BTS_TRXC); |
| 591 | map(vc_conn:BTS_TRXC, system:BTS_TRXC); |
| 592 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 593 | |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 594 | /* Obtain frequency hopping parameters for a given timeslot */ |
| 595 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) { |
| 596 | f_resolve_fh_params(pars); |
| 597 | } |
| 598 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 599 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 600 | return vc_conn; |
| 601 | } |
| 602 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 603 | private altstep as_Tguard() runs on ConnHdlr { |
| 604 | [] g_Tguard.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 605 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 606 | } |
| 607 | } |
| 608 | |
Harald Welte | 990a361 | 2019-05-27 14:02:13 +0200 | [diff] [blame] | 609 | friend function f_l1_tune(L1CTL_PT L1CTL, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED) { |
| 610 | f_L1CTL_FBSB(L1CTL, { false, mp_trx0_arfcn }, ccch_mode, mp_rxlev_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 611 | } |
| 612 | |
Vadim Yanitskiy | 2f01fbd | 2019-06-01 01:32:48 +0700 | [diff] [blame] | 613 | private function f_trxc_fake_rssi(TRXC_RSSI rssi) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 614 | var TrxcMessage ret; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 615 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_RSSI(rssi))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 616 | } |
| 617 | |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 618 | private function f_trxc_fake_toffs256(int16_t toffs256) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 619 | var TrxcMessage ret; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 620 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | /* first function started in ConnHdlr component */ |
| 624 | private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars) |
| 625 | runs on ConnHdlr { |
| 626 | g_pars := pars; |
| 627 | g_chan_nr := pars.chan_nr; |
| 628 | |
| 629 | map(self:L1CTL, system:L1CTL); |
| 630 | f_connect_reset(L1CTL); |
| 631 | |
Harald Welte | d48c0c7 | 2019-06-05 10:01:15 +0200 | [diff] [blame] | 632 | if (mp_bts_trxc_port != -1 and BTS_TRXC.checkstate("Mapped")) { |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 633 | f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id); |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 634 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 635 | |
| 636 | g_Tguard.start(pars.t_guard); |
| 637 | activate(as_Tguard()); |
| 638 | |
| 639 | f_rslem_register(0, pars.chan_nr); |
| 640 | |
| 641 | /* call the user-supplied test case function */ |
| 642 | fn.apply(id); |
| 643 | } |
| 644 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 645 | private function f_rsl_transceive_ret(template RSL_Message tx, template RSL_Message exp_rx, |
| 646 | charstring id, boolean ignore_other := false) |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 647 | runs on ConnHdlr return RSL_Message { |
| 648 | var RSL_Message rx; |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 649 | timer T := 3.0; |
| 650 | RSL.send(tx); |
| 651 | T.start; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 652 | alt { |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 653 | [] RSL.receive(exp_rx) -> value rx { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 654 | T.stop; |
| 655 | setverdict(pass); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 656 | } |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 657 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 658 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting " & id); |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 659 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 660 | [not ignore_other] as_l1_sacch(); |
| 661 | [not ignore_other] as_meas_res(); |
| 662 | [not ignore_other] as_l1_dcch(); |
| 663 | [not ignore_other] RSL.receive { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 664 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 665 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 666 | [ignore_other] RSL.receive { repeat; } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 667 | } |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 668 | return rx; |
| 669 | } |
| 670 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 671 | friend function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, |
| 672 | charstring id, boolean ignore_other := false) |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 673 | runs on ConnHdlr { |
| 674 | var RSL_Message rx := f_rsl_transceive_ret(tx, exp_rx, id, ignore_other); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 675 | } |
| 676 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 677 | friend function f_rsl_chan_act(RSL_IE_ChannelMode mode, |
| 678 | boolean encr_enable := false, |
| 679 | RSL_IE_List more_ies := {}, |
| 680 | RSL_IE_ActivationType act_type := t_RSL_IE_ActType_IA) |
| 681 | runs on ConnHdlr { |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 682 | var RSL_Message ch_act := valueof(ts_RSL_CHAN_ACT(g_chan_nr, mode, act_type)); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 683 | if (encr_enable) { |
| 684 | /* append encryption related IEs, if requested */ |
| 685 | var RSL_IE_EncryptionInfo encr_info; |
| 686 | encr_info := valueof(ts_RSL_IE_EncrInfo(g_pars.encr.alg_id, g_pars.encr.key)); |
| 687 | ch_act.ies := ch_act.ies & { valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info := |
| 688 | encr_info})) }; |
| 689 | } |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 690 | ch_act.ies := ch_act.ies & more_ies; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 691 | f_rsl_transceive(ch_act, tr_RSL_CHAN_ACT_ACK(g_chan_nr), "RSL CHAN ACT"); |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 692 | } |
| 693 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 694 | friend function f_rsl_chan_deact() runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 695 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 696 | "RF CHAN REL", true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 697 | } |
| 698 | |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 699 | /* Default Mobile Allocation to be used for frequency hopping */ |
| 700 | private const L1ctlMA l1ctl_ma_def := { { false, mp_trx0_arfcn }, { false, mp_trx1_arfcn }, |
| 701 | { false, mp_trx2_arfcn }, { false, mp_trx3_arfcn } }; |
| 702 | |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 703 | friend template ConnHdlrPars t_Pars(template RslChannelNr chan_nr, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 704 | template RSL_IE_ChannelMode chan_mode, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 705 | template (omit) MaioHsn maio_hsn := omit, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 706 | float t_guard := 20.0) := { |
| 707 | chan_nr := valueof(chan_nr), |
| 708 | chan_mode := valueof(chan_mode), |
| 709 | t_guard := t_guard, |
| 710 | l1_pars := { |
| 711 | dtx_enabled := false, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 712 | toa256_enabled := false, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 713 | meas_ul := { |
| 714 | full := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 715 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 716 | rxqual := 0 |
| 717 | }, |
| 718 | sub := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 719 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 720 | rxqual := 0 |
| 721 | } |
| 722 | }, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 723 | timing_offset_256syms := mp_timing_offset_256syms_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 724 | bs_power_level := 0, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 725 | ms_power_level := mp_ms_power_level_exp, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 726 | ms_actual_ta := mp_ms_actual_ta_exp |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 727 | }, |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 728 | spec := omit, |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 729 | encr := omit, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 730 | bts0_band := omit, |
| 731 | maio_hsn := maio_hsn, |
| 732 | ma_map := c_MA_null, |
| 733 | ma := l1ctl_ma_def |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 734 | } |
| 735 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 736 | /*********************************************************************** |
| 737 | * Channel Activation / Deactivation |
| 738 | ***********************************************************************/ |
| 739 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 740 | /* Stress test: Do 500 channel activations/deactivations in rapid succession */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 741 | private function f_TC_chan_act_stress(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 742 | for (var integer i := 0; i < 500; i := i+1) { |
| 743 | f_rsl_chan_act(g_pars.chan_mode); |
| 744 | f_rsl_chan_deact(); |
| 745 | } |
| 746 | setverdict(pass); |
| 747 | } |
| 748 | testcase TC_chan_act_stress() runs on test_CT { |
| 749 | var ConnHdlr vc_conn; |
| 750 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 751 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 752 | vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars); |
| 753 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 754 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | /* Test if re-activation of an already active channel fails as expected */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 758 | private function f_TC_chan_act_react(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 759 | f_rsl_chan_act(g_pars.chan_mode); |
| 760 | /* attempt to activate the same lchan again -> expect reject */ |
| 761 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 762 | alt { |
| 763 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 764 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK on double activation"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 765 | } |
| 766 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 767 | setverdict(pass); |
| 768 | } |
| 769 | } |
| 770 | f_rsl_chan_deact(); |
| 771 | } |
| 772 | testcase TC_chan_act_react() runs on test_CT { |
| 773 | var ConnHdlr vc_conn; |
| 774 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 775 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 776 | vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars); |
| 777 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 778 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 779 | } |
| 780 | |
| 781 | /* Attempt to de-activate a channel that's not active */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 782 | private function f_TC_chan_deact_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 783 | timer T := 3.0; |
| 784 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 785 | T.start; |
| 786 | alt { |
| 787 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 788 | setverdict(pass); |
| 789 | } |
| 790 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 791 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting RF_CHAN_REL_ACK"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 792 | } |
| 793 | } |
| 794 | } |
| 795 | testcase TC_chan_deact_not_active() runs on test_CT { |
| 796 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 797 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 798 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars); |
| 799 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 800 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 801 | } |
| 802 | |
| 803 | /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 804 | private function f_TC_chan_act_wrong_nr(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 805 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 806 | alt { |
| 807 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 808 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 809 | } |
| 810 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 811 | setverdict(pass); |
| 812 | } |
| 813 | } |
| 814 | } |
| 815 | private type record WrongChanNrCase { |
| 816 | RslChannelNr chan_nr, |
| 817 | charstring description |
| 818 | } |
| 819 | private type record of WrongChanNrCase WrongChanNrCases; |
| 820 | private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := { |
| 821 | chan_nr := chan_nr, |
| 822 | description := desc |
| 823 | } |
| 824 | |
| 825 | testcase TC_chan_act_wrong_nr() runs on test_CT { |
| 826 | var ConnHdlr vc_conn; |
| 827 | var ConnHdlrPars pars; |
| 828 | |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 829 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 830 | |
| 831 | var WrongChanNrCases wrong := { |
| 832 | valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")), |
| 833 | valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")), |
| 834 | valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")), |
| 835 | valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")), |
| 836 | valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")), |
| 837 | valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")), |
| 838 | valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")), |
| 839 | valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")), |
| 840 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")), |
| 841 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")), |
| 842 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")), |
| 843 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")), |
| 844 | valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H")) |
| 845 | }; |
| 846 | |
| 847 | for (var integer i := 0; i < sizeof(wrong); i := i+1) { |
| 848 | pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN)); |
| 849 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars); |
| 850 | vc_conn.done; |
| 851 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 852 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 853 | } |
| 854 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 855 | /* execute the same callback function on a variety of logical channels */ |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 856 | friend function f_testmatrix_each_chan(ConnHdlrPars pars, void_fn fn) runs on test_CT { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 857 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 858 | f_init(); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 859 | |
| 860 | /* test on each of the channels we have */ |
| 861 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 862 | pars.chan_nr := valueof(g_AllChanTypes[i]); |
| 863 | |
| 864 | log(testcasename(), ": XXX Starting on ", g_AllChanTypes[i]); |
| 865 | vc_conn := f_start_handler(fn, pars); |
| 866 | vc_conn.done; |
| 867 | } |
| 868 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 869 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 870 | } |
| 871 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 872 | /*********************************************************************** |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 873 | * SACCH handling |
| 874 | ***********************************************************************/ |
| 875 | |
| 876 | private function f_exp_sacch(boolean exp) runs on ConnHdlr { |
| 877 | timer T_sacch := 3.0; |
| 878 | T_sacch.start; |
| 879 | alt { |
| 880 | [not exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 881 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received SACCH when not expecting it"); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 882 | } |
| 883 | [not exp] T_sacch.timeout { |
| 884 | setverdict(pass); |
| 885 | } |
| 886 | [exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) { |
| 887 | setverdict(pass); |
| 888 | } |
| 889 | [exp] T_sacch.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 890 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH on ", g_chan_nr)); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 891 | } |
| 892 | [] L1CTL.receive { repeat; } |
| 893 | [] RSL.receive { repeat; } |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | /* Test if DEACTIVATE SACCH actualy deactivates its transmission (TS 48.058 4.6) */ |
| 898 | private function f_TC_deact_sacch(charstring id) runs on ConnHdlr { |
| 899 | f_l1_tune(L1CTL); |
| 900 | RSL.clear; |
| 901 | |
| 902 | /* activate the logical channel */ |
| 903 | f_est_dchan(); |
| 904 | L1CTL.clear; |
| 905 | |
| 906 | /* check that SACCH actually are received as expected */ |
| 907 | f_exp_sacch(true); |
| 908 | |
| 909 | /* deactivate SACCH on the logical channel */ |
| 910 | RSL.send(ts_RSL_DEACT_SACCH(g_chan_nr)); |
| 911 | f_sleep(1.0); |
| 912 | L1CTL.clear; |
| 913 | |
| 914 | /* check that no SACCH are received anymore */ |
| 915 | f_exp_sacch(false); |
| 916 | |
| 917 | /* release the channel */ |
| 918 | f_rsl_chan_deact(); |
| 919 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 920 | } |
| 921 | testcase TC_deact_sacch() runs on test_CT { |
| 922 | var ConnHdlr vc_conn; |
| 923 | var ConnHdlrPars pars; |
| 924 | f_init(); |
| 925 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 926 | //for (var integer i := 0; i < 1; i := i+1) { |
| 927 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 928 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 929 | vc_conn := f_start_handler(refers(f_TC_deact_sacch), pars); |
| 930 | vc_conn.done; |
| 931 | } |
| 932 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 933 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 934 | } |
| 935 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 936 | /* verify that given SACCH payload is present */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 937 | private function f_sacch_present(template octetstring l3_exp) runs on ConnHdlr { |
| 938 | var L1ctlDlMessage dl; |
| 939 | /* check that the specified SI5 value is actually sent */ |
| 940 | timer T_sacch := 3.0; |
| 941 | L1CTL.clear; |
| 942 | T_sacch.start; |
| 943 | alt { |
| 944 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 945 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 946 | if (match(l3, l3_exp)) { |
| 947 | setverdict(pass); |
| 948 | } else { |
| 949 | repeat; |
| 950 | } |
| 951 | } |
| 952 | [] L1CTL.receive { repeat; } |
| 953 | [] T_sacch.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 954 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for SACCH ", l3_exp)); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 955 | } |
| 956 | } |
| 957 | } |
| 958 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 959 | /* verify that given SACCH payload is not present */ |
| 960 | private function f_sacch_missing(template octetstring l3_exp) runs on ConnHdlr { |
| 961 | var L1ctlDlMessage dl; |
| 962 | /* check that the specified SI5 value is actually sent */ |
| 963 | timer T_sacch := 3.0; |
| 964 | L1CTL.clear; |
| 965 | T_sacch.start; |
| 966 | alt { |
| 967 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 968 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 969 | if (match(l3, l3_exp)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 970 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected SACCH ", dl)); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 971 | } else { |
| 972 | repeat; |
| 973 | } |
| 974 | } |
| 975 | [] L1CTL.receive { repeat; } |
| 976 | [] T_sacch.timeout { |
| 977 | setverdict(pass); |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 982 | /* Test for default SACCH FILL transmitted in DL SACCH (all channel types) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 983 | private function f_TC_sacch_filling(charstring id) runs on ConnHdlr { |
| 984 | /* Set a known default SACCH filling for SI5 */ |
| 985 | var octetstring si5 := f_rnd_octstring(19); |
| 986 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 987 | |
| 988 | f_l1_tune(L1CTL); |
| 989 | RSL.clear; |
| 990 | |
| 991 | /* activate the logical channel */ |
| 992 | f_est_dchan(); |
| 993 | |
| 994 | /* check that the specified SI5 value is actually sent */ |
| 995 | f_sacch_present(si5); |
| 996 | |
| 997 | /* release the channel */ |
| 998 | RSL.clear; |
| 999 | f_rsl_chan_deact(); |
| 1000 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1001 | } |
| 1002 | testcase TC_sacch_filling() runs on test_CT { |
| 1003 | var ConnHdlr vc_conn; |
| 1004 | var ConnHdlrPars pars; |
| 1005 | f_init(); |
| 1006 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1007 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1008 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1009 | vc_conn := f_start_handler(refers(f_TC_sacch_filling), pars); |
| 1010 | vc_conn.done; |
| 1011 | } |
| 1012 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1013 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1014 | } |
| 1015 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1016 | /* Test for lchan-specific SACCH INFO MODIFY (TS 48.058 4.12) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1017 | private function f_TC_sacch_info_mod(charstring id) runs on ConnHdlr { |
| 1018 | /* Set a known default SACCH filling for SI5 */ |
| 1019 | var octetstring si5 := f_rnd_octstring(19); |
| 1020 | var octetstring si5_diff := f_rnd_octstring(19); |
| 1021 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1022 | |
| 1023 | f_l1_tune(L1CTL); |
| 1024 | RSL.clear; |
| 1025 | |
| 1026 | log("Activating channel, expecting standard SI5"); |
| 1027 | /* activate the logical channel */ |
| 1028 | f_est_dchan(); |
| 1029 | /* check that the specified SI5 value is actually sent */ |
| 1030 | f_sacch_present(si5); |
| 1031 | |
| 1032 | /* set channel-specific different SI5 */ |
| 1033 | log("Setting channel specific SACCH INFO, expecting it"); |
| 1034 | RSL.send(ts_RSL_SACCH_INF_MOD(g_chan_nr, RSL_SYSTEM_INFO_5, si5_diff)) |
| 1035 | /* check that the specified lchan-specific value is now used */ |
| 1036 | f_sacch_present(si5_diff); |
| 1037 | |
| 1038 | /* deactivate the channel and re-activate it, this should result in default SI5 */ |
| 1039 | log("De-activating and re-activating channel, expecting standard SI5"); |
| 1040 | f_rsl_chan_deact(); |
| 1041 | f_rsl_chan_act(valueof(ts_RSL_ChanMode_SIGN)); |
| 1042 | /* Verify that the TRX-wide default SACCH filling is present again */ |
| 1043 | f_sacch_present(si5); |
| 1044 | |
| 1045 | /* release the channel */ |
| 1046 | RSL.clear; |
| 1047 | f_rsl_chan_deact(); |
| 1048 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1049 | } |
| 1050 | testcase TC_sacch_info_mod() runs on test_CT { |
| 1051 | var ConnHdlr vc_conn; |
| 1052 | var ConnHdlrPars pars; |
| 1053 | f_init(); |
| 1054 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1055 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1056 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1057 | vc_conn := f_start_handler(refers(f_TC_sacch_info_mod), pars); |
| 1058 | vc_conn.done; |
| 1059 | } |
| 1060 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1061 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1062 | } |
| 1063 | |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 1064 | /* Test SACCH scheduling of multiple different SI message types */ |
| 1065 | private function f_TC_sacch_multi(charstring id) runs on ConnHdlr { |
| 1066 | var octetstring si5 := f_rnd_octstring(19); |
| 1067 | var octetstring si5bis := f_rnd_octstring(19); |
| 1068 | var octetstring si5ter := f_rnd_octstring(19); |
| 1069 | var octetstring si6 := f_rnd_octstring(19); |
| 1070 | |
| 1071 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1072 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5bis, si5bis)); |
| 1073 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5ter, si5ter)); |
| 1074 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1075 | |
| 1076 | f_l1_tune(L1CTL); |
| 1077 | RSL.clear; |
| 1078 | |
| 1079 | /* activate the logical channel */ |
| 1080 | f_est_dchan(); |
| 1081 | L1CTL.clear; |
| 1082 | |
| 1083 | /* check that SACCH actually are received as expected */ |
| 1084 | f_sacch_present(si5); |
| 1085 | f_sacch_present(si5bis); |
| 1086 | f_sacch_present(si5ter); |
| 1087 | f_sacch_present(si6); |
| 1088 | |
| 1089 | /* release the channel */ |
| 1090 | f_rsl_chan_deact(); |
| 1091 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1092 | } |
| 1093 | testcase TC_sacch_multi() runs on test_CT { |
| 1094 | var ConnHdlr vc_conn; |
| 1095 | var ConnHdlrPars pars; |
| 1096 | f_init(); |
| 1097 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1098 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1099 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1100 | vc_conn := f_start_handler(refers(f_TC_sacch_multi), pars); |
| 1101 | vc_conn.done; |
| 1102 | } |
| 1103 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1104 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 1105 | } |
| 1106 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1107 | /* Test if SACH information is modified as expected */ |
| 1108 | private function f_TC_sacch_multi_chg(charstring id) runs on ConnHdlr { |
| 1109 | var octetstring si5 := f_rnd_octstring(19); |
| 1110 | var octetstring si6 := f_rnd_octstring(19); |
| 1111 | |
| 1112 | /* First, configure both SI5 and SI6 to be transmitted */ |
| 1113 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1114 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1115 | |
| 1116 | f_l1_tune(L1CTL); |
| 1117 | RSL.clear; |
| 1118 | |
| 1119 | /* activate the logical channel */ |
| 1120 | f_est_dchan(); |
| 1121 | L1CTL.clear; |
| 1122 | |
| 1123 | /* check that SACCH actually are received as expected */ |
| 1124 | f_sacch_present(si5); |
| 1125 | f_sacch_present(si6); |
| 1126 | |
| 1127 | /* disable SI6 */ |
| 1128 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, ''O)); |
| 1129 | |
| 1130 | /* check that SI5 is still transmitted */ |
| 1131 | f_sacch_present(si5); |
| 1132 | /* check if SI6 is now gone */ |
| 1133 | f_sacch_missing(si6); |
| 1134 | |
| 1135 | /* release the channel */ |
| 1136 | f_rsl_chan_deact(); |
| 1137 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1138 | } |
| 1139 | testcase TC_sacch_multi_chg() runs on test_CT { |
| 1140 | var ConnHdlr vc_conn; |
| 1141 | var ConnHdlrPars pars; |
| 1142 | f_init(); |
| 1143 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1144 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1145 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1146 | vc_conn := f_start_handler(refers(f_TC_sacch_multi_chg), pars); |
| 1147 | vc_conn.done; |
| 1148 | } |
| 1149 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1150 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1151 | } |
| 1152 | |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 1153 | /* Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */ |
| 1154 | private function f_TC_sacch_chan_act(charstring id) runs on ConnHdlr { |
| 1155 | var octetstring si5 := f_rnd_octstring(19); |
| 1156 | var octetstring si6 := f_rnd_octstring(19); |
| 1157 | var octetstring si5_specific := f_rnd_octstring(19); |
| 1158 | var octetstring si6_specific := f_rnd_octstring(19); |
| 1159 | |
| 1160 | /* First, configure both SI5 and SI6 to be transmitted */ |
| 1161 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1162 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1163 | |
| 1164 | f_l1_tune(L1CTL); |
| 1165 | RSL.clear; |
| 1166 | |
| 1167 | /* activate channel with different SACCH filling */ |
| 1168 | var RSL_SacchInfo sacch_info := valueof(ts_RSL_SacchInfo({ |
| 1169 | ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_5, si5_specific), |
| 1170 | ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_6, si6_specific) |
| 1171 | })); |
| 1172 | var RSL_IE_List addl_ies := { valueof(t_RSL_IE(RSL_IE_SACCH_INFO, |
| 1173 | RSL_IE_Body:{sacch_info := sacch_info})) }; |
| 1174 | f_est_dchan(more_ies := addl_ies); |
| 1175 | |
| 1176 | /* check that SACCH actually are received as expected */ |
| 1177 | f_sacch_present(si5_specific); |
| 1178 | f_sacch_present(si6_specific); |
| 1179 | |
| 1180 | /* release the channel */ |
| 1181 | f_rsl_chan_deact(); |
| 1182 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1183 | } |
| 1184 | testcase TC_sacch_chan_act() runs on test_CT { |
| 1185 | var ConnHdlr vc_conn; |
| 1186 | var ConnHdlrPars pars; |
| 1187 | f_init(); |
| 1188 | |
| 1189 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1190 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1191 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1192 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act), pars); |
| 1193 | vc_conn.done; |
| 1194 | } |
| 1195 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1196 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1197 | } |
| 1198 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1199 | /* verify that SACCH DL transmission is started only if MS power IE present |
| 1200 | * see section 4.1.3 of 3GPP TS 48.058 */ |
| 1201 | private function f_TC_sacch_chan_act_ho_async(charstring id) runs on ConnHdlr { |
| 1202 | var octetstring si5 := f_rnd_octstring(19); |
| 1203 | |
| 1204 | f_l1_tune(L1CTL); |
| 1205 | RSL.clear; |
| 1206 | |
| 1207 | /* Step 1: Activate ASYNC HO channel without MS power IE */ |
| 1208 | |
| 1209 | /* Activate channel on BTS side */ |
| 1210 | f_rsl_chan_act(g_pars.chan_mode, act_type := t_RSL_IE_ActType_HO_ASYNC); |
| 1211 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1212 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1213 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1214 | |
| 1215 | /* Verify that no DL SACCH is being received */ |
| 1216 | f_sacch_missing(?); |
| 1217 | |
| 1218 | f_rsl_chan_deact(); |
| 1219 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1220 | |
| 1221 | |
| 1222 | /* Step 2: Activate ASYNC HO channel with MS power IE */ |
| 1223 | |
| 1224 | /* Activate channel on BTS side */ |
| 1225 | var RSL_IE_List addl_ies := { |
| 1226 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1227 | }; |
| 1228 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_ASYNC); |
| 1229 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1230 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1231 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1232 | |
| 1233 | /* Verify that DL SACCH is being received */ |
| 1234 | f_sacch_present(si5); |
| 1235 | |
| 1236 | f_rsl_chan_deact(); |
| 1237 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1238 | } |
| 1239 | testcase TC_sacch_chan_act_ho_async() runs on test_CT { |
| 1240 | var ConnHdlr vc_conn; |
| 1241 | var ConnHdlrPars pars; |
| 1242 | f_init(); |
| 1243 | |
| 1244 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1245 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1246 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1247 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act_ho_async), pars); |
| 1248 | vc_conn.done; |
| 1249 | } |
| 1250 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1251 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1252 | } |
| 1253 | |
| 1254 | /* verify that SACCH DL transmission is started only if TA + MS power IEs present, |
| 1255 | * see section 4.1.4 of 3GPP TS 48.058 */ |
| 1256 | private function f_TC_sacch_chan_act_ho_sync(charstring id) runs on ConnHdlr { |
| 1257 | var octetstring si5 := f_rnd_octstring(19); |
| 1258 | var RSL_IE_List addl_ies; |
| 1259 | |
| 1260 | f_l1_tune(L1CTL); |
| 1261 | RSL.clear; |
| 1262 | |
| 1263 | /* Step 1: Activate SYNC HO channel without MS power IE */ |
| 1264 | |
| 1265 | /* Activate channel on BTS side */ |
| 1266 | f_rsl_chan_act(g_pars.chan_mode, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1267 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1268 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1269 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1270 | |
| 1271 | /* Verify that no DL SACCH is being received */ |
| 1272 | f_sacch_missing(?); |
| 1273 | |
| 1274 | f_rsl_chan_deact(); |
| 1275 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1276 | |
| 1277 | |
| 1278 | /* Step 2a: Activate SYNC HO channel with only MS power IE */ |
| 1279 | |
| 1280 | /* Activate channel on BTS side */ |
| 1281 | addl_ies := { |
| 1282 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1283 | }; |
| 1284 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1285 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1286 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1287 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1288 | |
| 1289 | /* Verify that no DL SACCH is being received */ |
| 1290 | f_sacch_missing(?); |
| 1291 | |
| 1292 | f_rsl_chan_deact(); |
| 1293 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1294 | |
| 1295 | |
| 1296 | /* Step 2b: Activate SYNC HO channel with TA IE */ |
| 1297 | |
| 1298 | /* Activate channel on BTS side */ |
| 1299 | addl_ies := { |
| 1300 | valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := 0})) |
| 1301 | }; |
| 1302 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1303 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1304 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1305 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1306 | |
| 1307 | /* Verify that no DL SACCH is being received */ |
| 1308 | f_sacch_missing(?); |
| 1309 | |
| 1310 | f_rsl_chan_deact(); |
| 1311 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1312 | |
| 1313 | |
| 1314 | /* Step 3: Activate SYNC HO channel with MS power IE and TA IE */ |
| 1315 | |
| 1316 | /* Activate channel on BTS side */ |
| 1317 | addl_ies := { |
| 1318 | valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := 0})), |
| 1319 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1320 | }; |
| 1321 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1322 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1323 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1324 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1325 | |
| 1326 | /* Verify that DL SACCH is being received */ |
| 1327 | f_sacch_present(si5); |
| 1328 | |
| 1329 | f_rsl_chan_deact(); |
| 1330 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1331 | } |
| 1332 | testcase TC_sacch_chan_act_ho_sync() runs on test_CT { |
| 1333 | var ConnHdlr vc_conn; |
| 1334 | var ConnHdlrPars pars; |
| 1335 | f_init(); |
| 1336 | |
| 1337 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1338 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1339 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1340 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act_ho_sync), pars); |
| 1341 | vc_conn.done; |
| 1342 | } |
| 1343 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1344 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1345 | } |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1346 | |
| 1347 | |
| 1348 | /*********************************************************************** |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1349 | * RACH Handling |
| 1350 | ***********************************************************************/ |
| 1351 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1352 | /* Send 1000 RACH requests and check their RA+FN on the RSL side */ |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 1353 | private function f_TC_rach_content(boolean emerg) runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 1354 | f_init(); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1355 | f_init_l1ctl(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1356 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1357 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1358 | var GsmFrameNumber fn_last := 0; |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1359 | var boolean test_failed := false; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1360 | for (var integer i := 0; i < 1000; i := i+1) { |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 1361 | var OCT1 ra := f_rnd_ra_emerg(); |
| 1362 | if (emerg == true) { |
| 1363 | ra := f_rnd_ra_emerg(); |
| 1364 | } else { |
| 1365 | ra := f_rnd_ra_cs(); |
| 1366 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1367 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1368 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1369 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1370 | } |
| 1371 | fn_last := fn; |
| 1372 | |
| 1373 | timer T := 5.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1374 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1375 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1376 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(ra, fn, t_RslChanNr_RACH(0)))) { |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1377 | T.stop; |
| 1378 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1379 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?, ?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1380 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN RQD"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1381 | } |
| 1382 | [] RSL_CCHAN.receive { repeat; } |
| 1383 | [] T.timeout { |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1384 | test_failed := true; |
| 1385 | log("[", i, "] Timeout waiting for CHAN RQD FN=", fn, " RA=", ra); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1386 | } |
| 1387 | } |
| 1388 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1389 | if (test_failed) { |
| 1390 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Some out of 1000 RACH requests timed out")); |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1391 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1392 | setverdict(pass); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1393 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1394 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1395 | |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 1396 | /* Normal variant */ |
| 1397 | testcase TC_rach_content() runs on test_CT { |
| 1398 | f_TC_rach_content(emerg := false); |
| 1399 | } |
| 1400 | |
| 1401 | /* Emergency call variant */ |
| 1402 | testcase TC_rach_content_emerg() runs on test_CT { |
| 1403 | f_TC_rach_content(emerg := true); |
| 1404 | } |
| 1405 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1406 | /* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */ |
| 1407 | testcase TC_rach_count() runs on test_CT { |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1408 | f_init(); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1409 | f_init_l1ctl(); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1410 | f_sleep(1.0); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1411 | f_l1_tune(L1CTL); |
| 1412 | |
| 1413 | var GsmFrameNumber fn_last := 0; |
| 1414 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1415 | var OCT1 ra := f_rnd_ra_cs(); |
| 1416 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1417 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1418 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1419 | } |
| 1420 | fn_last := fn; |
| 1421 | } |
| 1422 | var integer rsl_chrqd := 0; |
| 1423 | timer T := 3.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1424 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1425 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1426 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(?,?))) { |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1427 | rsl_chrqd := rsl_chrqd + 1; |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 1428 | f_timer_safe_restart(T); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1429 | repeat; |
| 1430 | } |
| 1431 | [] RSL_CCHAN.receive { repeat; } |
| 1432 | [] T.timeout { } |
| 1433 | } |
| 1434 | if (rsl_chrqd == 1000) { |
| 1435 | setverdict(pass); |
| 1436 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1437 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received only ", rsl_chrqd, " out of 1000 RACH")); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1438 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1439 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1440 | } |
| 1441 | |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1442 | private function f_vty_load_ind_thresh(integer period := 10, integer bts_nr := 0) runs on test_CT { |
| 1443 | var charstring bts_str := "bts " & int2str(bts_nr); |
| 1444 | f_vty_config2(BSCVTY, {"network", bts_str}, "ccch load-indication-threshold " & int2str(period)); |
| 1445 | } |
| 1446 | |
| 1447 | /* empirical value: Number of RACH slots per reporting interval (1s) on combined CCCH */ |
| 1448 | private template integer tr_rach_slots_per_interval := (90 .. 130); |
| 1449 | |
| 1450 | /* Expect 0 RACH load on an idle BTS that has just started up */ |
| 1451 | testcase TC_rach_load_idle_thresh0() runs on test_CT { |
| 1452 | var ASP_RSL_Unitdata rx_ud; |
| 1453 | |
| 1454 | f_init_vty_bsc(); |
| 1455 | /* send load indications even at 0% load */ |
| 1456 | f_vty_load_ind_thresh(0); |
| 1457 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 1458 | f_sleep(2.0); |
| 1459 | |
| 1460 | f_init(); |
| 1461 | |
| 1462 | timer T := 5.0; |
| 1463 | T.start; |
| 1464 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1465 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(tr_rach_slots_per_interval, 0, 0))) { |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1466 | setverdict(pass); |
| 1467 | repeat; |
| 1468 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1469 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(?, ?, ?))) -> value rx_ud { |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1470 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1471 | repeat; |
| 1472 | } |
| 1473 | [] RSL_CCHAN.receive { |
| 1474 | repeat; |
| 1475 | } |
| 1476 | [] T.timeout { } |
| 1477 | } |
| 1478 | |
| 1479 | f_vty_load_ind_thresh(10); |
| 1480 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1481 | } |
| 1482 | |
| 1483 | /* Expect no RACH load indications on an idle BTS that has just started up (default threshold 10%) */ |
| 1484 | testcase TC_rach_load_idle_below_thresh() runs on test_CT { |
| 1485 | var ASP_RSL_Unitdata rx_ud; |
| 1486 | |
| 1487 | f_init_vty_bsc(); |
| 1488 | f_init(); |
| 1489 | |
| 1490 | timer T := 5.0; |
| 1491 | T.start; |
| 1492 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1493 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(?, ?, ?))) -> value rx_ud { |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1494 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1495 | repeat; |
| 1496 | } |
| 1497 | [] RSL_CCHAN.receive { |
| 1498 | repeat; |
| 1499 | } |
| 1500 | [] T.timeout { |
| 1501 | setverdict(pass); |
| 1502 | } |
| 1503 | } |
| 1504 | |
| 1505 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1506 | } |
| 1507 | |
| 1508 | /* Expect 0 RACH load on an idle BTS that has just started up */ |
| 1509 | testcase TC_rach_load_count() runs on test_CT { |
| 1510 | var ASP_RSL_Unitdata rx_ud; |
| 1511 | var integer load_access_count := 0; |
| 1512 | |
| 1513 | f_init_vty_bsc(); |
| 1514 | /* send load indications even at 0% load */ |
| 1515 | f_vty_load_ind_thresh(0); |
| 1516 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 1517 | f_sleep(2.0); |
| 1518 | f_init(); |
| 1519 | |
| 1520 | f_init_l1ctl(); |
| 1521 | f_sleep(1.0); |
| 1522 | f_l1_tune(L1CTL); |
| 1523 | |
| 1524 | var GsmFrameNumber fn_last := 0; |
| 1525 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1526 | var OCT1 ra := f_rnd_ra_cs(); |
| 1527 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1528 | if (fn == fn_last) { |
| 1529 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
| 1530 | } |
| 1531 | fn_last := fn; |
| 1532 | } |
| 1533 | |
| 1534 | timer T := 5.0; |
| 1535 | T.start; |
| 1536 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1537 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(tr_rach_slots_per_interval, ?, ?))) |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1538 | -> value rx_ud { |
| 1539 | var RSL_IE_Body ie; |
| 1540 | f_rsl_find_ie(rx_ud.rsl, RSL_IE_RACH_LOAD, ie); |
| 1541 | load_access_count := load_access_count + ie.rach_load.access_count; |
| 1542 | if (ie.rach_load.busy_count < ie.rach_load.access_count) { |
| 1543 | setverdict(fail, "Access count cannot be < Busy count"); |
| 1544 | } |
| 1545 | repeat; |
| 1546 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1547 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(?, ?, ?))) -> value rx_ud { |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1548 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1549 | repeat; |
| 1550 | } |
| 1551 | [] RSL_CCHAN.receive { |
| 1552 | repeat; |
| 1553 | } |
| 1554 | [] T.timeout { } |
| 1555 | } |
| 1556 | if (load_access_count == 1000) { |
| 1557 | setverdict(pass); |
| 1558 | } else { |
| 1559 | setverdict(fail, "Load reports state ", load_access_count, " RACH, but we sent 1000"); |
| 1560 | } |
| 1561 | |
| 1562 | f_vty_load_ind_thresh(10); |
| 1563 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1564 | } |
| 1565 | |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1566 | private function f_rach_toffs(int16_t toffs256, boolean expect_pass) runs on test_CT { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1567 | var TrxcMessage ret; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1568 | /* tell fake_trx to use a given timing offset for all bursts */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 1569 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, valueof(ts_TRXC_FAKE_TIMING(toffs256))); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1570 | f_sleep(0.5); |
| 1571 | |
| 1572 | /* Transmit RACH request + wait for confirmation */ |
| 1573 | var OCT1 ra := f_rnd_ra_cs(); |
| 1574 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1575 | |
| 1576 | /* Check for expected result */ |
| 1577 | timer T := 1.5; |
| 1578 | T.start; |
| 1579 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1580 | [expect_pass] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) { |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1581 | setverdict(pass); |
| 1582 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1583 | [not expect_pass] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(ra, fn))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1584 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("RACH passed but was expected to be dropped: ", toffs256)); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1585 | } |
| 1586 | [] RSL_CCHAN.receive { repeat; } |
| 1587 | [not expect_pass] T.timeout { |
| 1588 | setverdict(pass); |
| 1589 | } |
| 1590 | [expect_pass] T.timeout { |
Max | 6e05304 | 2019-03-14 16:34:22 +0100 | [diff] [blame] | 1591 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for CHAN RQD: FN=", fn, " RA=", ra)); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1592 | } |
| 1593 | } |
| 1594 | } |
| 1595 | |
| 1596 | /* Test if dropping of RACH Based on NM_ATT_MAX_TA works */ |
| 1597 | testcase TC_rach_max_ta() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 1598 | f_init(); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1599 | f_init_l1ctl(); |
| 1600 | f_l1_tune(L1CTL); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1601 | f_sleep(1.0); |
| 1602 | |
| 1603 | /* default max-ta is 63 (full range of GSM timing advance */ |
| 1604 | |
Vadim Yanitskiy | c81d6e4 | 2018-03-05 22:39:01 +0700 | [diff] [blame] | 1605 | /* We allow early arrival up to 2 symbols */ |
| 1606 | f_rach_toffs(-1*256, true); |
| 1607 | f_rach_toffs(-2*256, true); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1608 | f_rach_toffs(-10*256, false); |
| 1609 | |
| 1610 | /* 0 / 32 / 63 bits is legal / permitted */ |
| 1611 | f_rach_toffs(0, true); |
| 1612 | f_rach_toffs(32*256, true); |
| 1613 | f_rach_toffs(63*256, true); |
| 1614 | |
| 1615 | /* more than 63 bits is not legal / permitted */ |
| 1616 | f_rach_toffs(64*256, false); |
| 1617 | f_rach_toffs(127*256, false); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1618 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1619 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1620 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1621 | private function f_TC_ho_rach(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 1622 | var GsmFrameNumber fn; |
| 1623 | var RSL_Message rm; |
| 1624 | |
| 1625 | f_l1_tune(L1CTL); |
| 1626 | RSL.clear; |
| 1627 | |
| 1628 | /* Generate a random Handover Reference */ |
| 1629 | var integer ho_ref := oct2int(f_rnd_octstring(1)); |
| 1630 | |
| 1631 | /* Handover Reference IE (see 3GPP TS 48.058, 9.3.9) */ |
| 1632 | var RSL_IE ho_ref_ie := valueof(t_RSL_IE(RSL_IE_HANDO_REF, |
| 1633 | RSL_IE_Body:{ handover_ref := ho_ref })); |
| 1634 | |
| 1635 | /* Activate a channel on the BTS side (no encryption) */ |
| 1636 | f_rsl_chan_act(g_pars.chan_mode, more_ies := { ho_ref_ie }, |
| 1637 | act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1638 | |
| 1639 | /* Switch the MS side (e.g. trxcon) to a dedicated channel without |
| 1640 | * waiting for Immediate Assignment and sending Access Burst */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1641 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 1642 | |
| 1643 | /* Send handover Access Burst */ |
| 1644 | fn := f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1645 | |
| 1646 | /* TODO: test mismatching Handover Reference, and missing IE */ |
| 1647 | |
| 1648 | /* Wait for handover detection */ |
| 1649 | timer T := 3.0; |
| 1650 | T.start; |
| 1651 | alt { |
| 1652 | [] RSL.receive(tr_RSL_HANDO_DET(g_pars.chan_nr)) -> value rm { |
| 1653 | log("Handover RACH has been detected: ", rm); |
| 1654 | setverdict(pass); |
| 1655 | } |
| 1656 | [] RSL.receive(tr_RSL_CHAN_RQD(?, ?, ?, ?)) -> value rm { |
| 1657 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1658 | log2str("RSL_CHAN_RQD was not expected: ", rm)); |
| 1659 | } |
| 1660 | [] RSL.receive { repeat; } |
| 1661 | [] T.timeout { |
| 1662 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 1663 | log2str("Timeout waiting for handover RACH: FN=", fn, " RA=", ho_ref)); |
| 1664 | } |
| 1665 | } |
| 1666 | |
| 1667 | /* Release the channel */ |
| 1668 | f_rsl_chan_deact(); |
| 1669 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1670 | } |
| 1671 | |
| 1672 | /* Test handover RACH detection */ |
| 1673 | testcase TC_ho_rach() runs on test_CT { |
| 1674 | var ConnHdlrPars pars; |
| 1675 | var ConnHdlr vc_conn; |
| 1676 | |
| 1677 | f_init(); |
| 1678 | |
| 1679 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
| 1680 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1681 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1682 | vc_conn := f_start_handler(refers(f_TC_ho_rach), pars); |
| 1683 | vc_conn.done; |
| 1684 | } |
| 1685 | |
| 1686 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1687 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1688 | } |
| 1689 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1690 | /*********************************************************************** |
| 1691 | * Measurement Processing / Reporting |
| 1692 | ***********************************************************************/ |
| 1693 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1694 | private template LapdmAddressField ts_LapdmAddr(LapdmSapi sapi, boolean c_r) := { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1695 | spare := '0'B, |
| 1696 | lpd := 0, |
| 1697 | sapi := sapi, |
| 1698 | c_r := c_r, |
| 1699 | ea := true |
| 1700 | } |
| 1701 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1702 | private template LapdmFrameAB ts_LAPDm_AB(LapdmSapi sapi, boolean c_r, boolean p, octetstring pl) := { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1703 | addr := ts_LapdmAddr(sapi, c_r), |
Harald Welte | d879bd9 | 2018-03-12 15:01:23 +0100 | [diff] [blame] | 1704 | ctrl := ts_LapdmCtrlUI(p), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1705 | len := 0, /* overwritten */ |
| 1706 | m := false, |
| 1707 | el := 1, |
| 1708 | payload := pl |
| 1709 | } |
| 1710 | |
| 1711 | /* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1712 | private altstep as_l1_sacch() runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1713 | var L1ctlDlMessage l1_dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1714 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1715 | log("SACCH received: ", l1_dl.payload.data_ind.payload); |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 1716 | var GsmRrL3Message meas_rep := valueof(ts_MEAS_REP(true, mp_rxlev_exp, mp_rxlev_exp, 0, 0, omit)); |
Harald Welte | d879bd9 | 2018-03-12 15:01:23 +0100 | [diff] [blame] | 1717 | var LapdmFrameAB lb := valueof(ts_LAPDm_AB(0, false, false, enc_GsmRrL3Message(meas_rep))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1718 | log("LAPDm: ", lb); |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 1719 | |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 1720 | var template (value) SacchL1Header l1h := ts_SacchL1Header( |
| 1721 | g_pars.l1_pars.ms_power_level, false, |
| 1722 | g_pars.l1_pars.ms_actual_ta); |
| 1723 | |
| 1724 | /* TODO: we can use an extension of TTCN-3 for that, i.e. PADDING('2B'O) */ |
| 1725 | var octetstring l2 := f_pad_oct(enc_LapdmFrameAB(lb), 21, '2B'O); |
| 1726 | |
| 1727 | log("Sending Measurement Report: ", l1h, l2); |
| 1728 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(g_chan_nr, ts_RslLinkID_SACCH(0), l1h, l2)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1729 | repeat; |
| 1730 | } |
| 1731 | } |
| 1732 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1733 | private altstep as_l1_dcch() runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1734 | var L1ctlDlMessage l1_dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 1735 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value l1_dl { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1736 | log("DCCH received: ", l1_dl.payload.data_ind.payload); |
| 1737 | var octetstring pl := '010301'O; |
Vadim Yanitskiy | 31e7c67 | 2018-07-27 02:23:16 +0700 | [diff] [blame] | 1738 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), |
| 1739 | f_pad_oct(pl, 23, '2B'O))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1740 | repeat; |
| 1741 | } |
| 1742 | } |
| 1743 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1744 | private type record MeasElem { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1745 | uint6_t rxlev, |
| 1746 | uint3_t rxqual |
| 1747 | } |
| 1748 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1749 | private type record MeasElemFS { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1750 | MeasElem full, |
| 1751 | MeasElem sub |
| 1752 | } |
| 1753 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1754 | private type record ConnL1Pars { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1755 | boolean dtx_enabled, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1756 | boolean toa256_enabled, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1757 | MeasElemFS meas_ul, |
| 1758 | int16_t timing_offset_256syms, |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 1759 | uint4_t bs_power_level, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1760 | uint5_t ms_power_level, |
| 1761 | uint8_t ms_actual_ta |
| 1762 | } |
| 1763 | |
| 1764 | /* Convert tiing offset from 1/256th symbol to RSL Timing Offset */ |
| 1765 | private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t { |
| 1766 | return 63 + (toffs256s/256); |
| 1767 | } |
| 1768 | |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1769 | private function f_max(integer a, integer b) return integer { |
| 1770 | if (a > b) { |
| 1771 | return a; |
| 1772 | } else { |
| 1773 | return b; |
| 1774 | } |
| 1775 | } |
| 1776 | |
| 1777 | private function f_min(integer a, integer b) return integer { |
| 1778 | if (a < b) { |
| 1779 | return a; |
| 1780 | } else { |
| 1781 | return b; |
| 1782 | } |
| 1783 | } |
| 1784 | |
| 1785 | /* compute negative tolerance val-tolerance, ensure >= min */ |
| 1786 | private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer { |
| 1787 | val := val - tolerance; |
| 1788 | return f_max(val, min); |
| 1789 | } |
| 1790 | |
| 1791 | /* compute positive tolerance val+tolerance, ensure <= max */ |
| 1792 | private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer { |
| 1793 | val := val + tolerance; |
| 1794 | return f_min(val, max); |
| 1795 | } |
| 1796 | |
| 1797 | /* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */ |
| 1798 | private function f_tolerance(integer val, integer min, integer max, integer tolerance) |
| 1799 | return template integer { |
| 1800 | var template integer ret; |
| 1801 | ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance)); |
| 1802 | return ret; |
| 1803 | } |
| 1804 | |
| 1805 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1806 | /* build a template for matching measurement results against */ |
| 1807 | private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message { |
| 1808 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 1809 | var template RSL_IE_UplinkMeas ul_meas := { |
| 1810 | len := 3, |
| 1811 | rfu := '0'B, |
| 1812 | dtx_d := l1p.dtx_enabled, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1813 | rxlev_f_u := f_tolerance(l1p.meas_ul.full.rxlev, 0, 63, mp_tolerance_rxlev), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1814 | reserved1 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1815 | rxlev_s_u := f_tolerance(l1p.meas_ul.sub.rxlev, 0, 63, mp_tolerance_rxlev), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1816 | reserved2 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 1817 | rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual), |
| 1818 | rxq_s_u := f_tolerance(l1p.meas_ul.sub.rxqual, 0, 7, mp_tolerance_rxqual), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1819 | supp_meas_info := omit |
| 1820 | }; |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1821 | if (l1p.toa256_enabled) { |
Harald Welte | 15de8ba | 2018-06-29 08:51:42 +0200 | [diff] [blame] | 1822 | ul_meas.len := (3+8); |
| 1823 | ul_meas.supp_meas_info := { |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1824 | toa256_mean := f_tolerance(l1p.timing_offset_256syms, -63*256, 192*256, mp_tolerance_timing_offset_256syms), |
Harald Welte | 15de8ba | 2018-06-29 08:51:42 +0200 | [diff] [blame] | 1825 | toa256_min := ?, |
| 1826 | toa256_max := ?, |
| 1827 | toa256_std_dev := ? |
| 1828 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 1829 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1830 | var template RSL_IE_BS_Power bs_power := { |
| 1831 | reserved := 0, |
| 1832 | epc := false, |
| 1833 | fpc := false, |
| 1834 | power_level := l1p.bs_power_level |
| 1835 | }; |
| 1836 | var template RSL_IE_L1Info l1_info := { |
| 1837 | ms_power_lvl := l1p.ms_power_level, |
| 1838 | fpc := false, |
| 1839 | reserved := 0, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1840 | actual_ta := f_tolerance(l1p.ms_actual_ta, 0, 63, mp_tolerance_timing_offset_256syms/256) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1841 | }; |
| 1842 | var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 1843 | var template uint8_t t_toffs := f_tolerance(offs, 0, 255, mp_tolerance_timing_offset_256syms/256); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1844 | return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info, |
| 1845 | ?, t_toffs); |
| 1846 | } |
| 1847 | |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 1848 | /* build a template for matching measurement results that do not contain any |
| 1849 | * MS related measurement (l1_info, l3_info and ms timing offset). */ |
| 1850 | private function f_build_meas_res_tmpl_empty() runs on ConnHdlr return template RSL_Message { |
| 1851 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 1852 | var template RSL_IE_UplinkMeas ul_meas := { |
| 1853 | len := 3, |
| 1854 | rfu := '0'B, |
| 1855 | dtx_d := l1p.dtx_enabled, |
| 1856 | rxlev_f_u := ?, |
| 1857 | reserved1 := '00'B, |
| 1858 | rxlev_s_u := ?, |
| 1859 | reserved2 := '00'B, |
| 1860 | rxq_f_u := ?, |
| 1861 | rxq_s_u := ?, |
| 1862 | supp_meas_info := omit |
| 1863 | }; |
| 1864 | if (l1p.toa256_enabled) { |
| 1865 | ul_meas.len := (3+8); |
| 1866 | ul_meas.supp_meas_info := { |
| 1867 | toa256_mean := f_tolerance(l1p.timing_offset_256syms, -63*256, 192*256, mp_tolerance_timing_offset_256syms), |
| 1868 | toa256_min := ?, |
| 1869 | toa256_max := ?, |
| 1870 | toa256_std_dev := ? |
| 1871 | } |
| 1872 | } |
| 1873 | var template RSL_IE_BS_Power bs_power := { |
| 1874 | reserved := 0, |
| 1875 | epc := false, |
| 1876 | fpc := false, |
| 1877 | power_level := l1p.bs_power_level |
| 1878 | }; |
| 1879 | |
| 1880 | return tr_RSL_MEAS_RES_EMPTY(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power); |
| 1881 | } |
| 1882 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1883 | /* verify we regularly receive measurement reports with incrementing numbers */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 1884 | private altstep as_meas_res(boolean verify_meas := true) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1885 | var RSL_Message rsl; |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 1886 | var boolean chan_est := false; |
| 1887 | |
Vadim Yanitskiy | 41baf00 | 2018-10-04 17:44:50 +0700 | [diff] [blame] | 1888 | [not verify_meas] RSL.receive(tr_RSL_MEAS_RES(?)) { repeat; } |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 1889 | |
| 1890 | /* Receive osmocom specific measurement reports. This is the normal |
| 1891 | * case. Here we verify that the measurement reports we sent are |
| 1892 | * comming back as we expect them. */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1893 | [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl { |
| 1894 | /* increment counter of next to-be-expected meas rep */ |
| 1895 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 1896 | /* Re-start the timer expecting the next MEAS RES */ |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 1897 | f_timer_safe_restart(g_Tmeas_exp); |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 1898 | |
| 1899 | /* The following two cases may only happen in the beginning |
| 1900 | * of the channel establishment phase. Once we have received |
| 1901 | * the "our" measurement report the first time, the channel |
| 1902 | * is established and empty or hardcoded TRXCON reports must |
| 1903 | * not occur anymore. */ |
| 1904 | chan_est := true; |
| 1905 | |
| 1906 | repeat; |
| 1907 | } |
| 1908 | |
| 1909 | /* When the BTS has established the channel, the MS might need slightly |
| 1910 | * more time to establish the channel and actually start sending. The |
| 1911 | * result is then a measurement report that just lacks the measurement |
| 1912 | * information of the MS. This is normal and we tolerate this behavior. */ |
| 1913 | [chan_est == false] RSL.receive(f_build_meas_res_tmpl_empty()) -> value rsl { |
| 1914 | /* increment counter of next to-be-expected meas rep */ |
| 1915 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 1916 | /* Re-start the timer expecting the next MEAS RES */ |
| 1917 | f_timer_safe_restart(g_Tmeas_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1918 | repeat; |
| 1919 | } |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 1920 | |
| 1921 | /* Due to the TDMA nature of GSM, TRXCON implements a way to emit dummy |
| 1922 | * measurements if the TTCN3 side does not supply measurement input in |
| 1923 | * time. In those cases TRXCON will either use a cached measurement |
| 1924 | * report or a hardcoded one. If TRXCON picks the hardcoded measurement |
| 1925 | * report the templates above will not match. We tolerate this |
| 1926 | * behavior, but only once. */ |
| 1927 | [chan_est == false] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, g_next_meas_res_nr)) -> value rsl { |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 1928 | /* increment counter of next to-be-expected meas rep */ |
| 1929 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 1930 | if (g_first_meas_res) { |
| 1931 | g_first_meas_res := false; |
| 1932 | repeat; |
| 1933 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1934 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unspecific MEAS RES ", rsl)); |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 1935 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1936 | } |
| 1937 | [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1938 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received unexpected MEAS RES ", rsl)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1939 | } |
Pau Espin Pedrol | 425b62f | 2018-07-06 16:11:43 +0200 | [diff] [blame] | 1940 | [g_Tmeas_exp.running] g_Tmeas_exp.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1941 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Didn't receive expected measurement result") |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1942 | } |
| 1943 | } |
| 1944 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1945 | private function f_alg_id_to_l1ctl(RSL_AlgId rsl_alg_id) return uint8_t { |
| 1946 | select (rsl_alg_id) { |
| 1947 | case (RSL_ALG_ID_A5_0) { return 0; } |
| 1948 | case (RSL_ALG_ID_A5_1) { return 1; } |
| 1949 | case (RSL_ALG_ID_A5_2) { return 2; } |
| 1950 | case (RSL_ALG_ID_A5_3) { return 3; } |
| 1951 | case (RSL_ALG_ID_A5_4) { return 4; } |
| 1952 | case (RSL_ALG_ID_A5_5) { return 5; } |
| 1953 | case (RSL_ALG_ID_A5_6) { return 6; } |
| 1954 | case (RSL_ALG_ID_A5_7) { return 7; } |
| 1955 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1956 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 1957 | /* Make compiler happy by calling mtc.stop here. It is already |
| 1958 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 1959 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1960 | } |
| 1961 | } |
| 1962 | } |
| 1963 | |
| 1964 | private function f_alg_id_to_l3(RSL_AlgId rsl_alg_id) return BIT3 { |
| 1965 | select (rsl_alg_id) { |
| 1966 | case (RSL_ALG_ID_A5_1) { return '000'B; } |
| 1967 | case (RSL_ALG_ID_A5_2) { return '001'B; } |
| 1968 | case (RSL_ALG_ID_A5_3) { return '010'B; } |
| 1969 | case (RSL_ALG_ID_A5_4) { return '011'B; } |
| 1970 | case (RSL_ALG_ID_A5_5) { return '100'B; } |
| 1971 | case (RSL_ALG_ID_A5_6) { return '101'B; } |
| 1972 | case (RSL_ALG_ID_A5_7) { return '110'B; } |
| 1973 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1974 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 1975 | /* Make compiler happy by calling mtc.stop here. It is already |
| 1976 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 1977 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1978 | } |
| 1979 | } |
| 1980 | } |
| 1981 | |
Pau Espin Pedrol | 6451b04 | 2018-10-24 20:36:16 +0200 | [diff] [blame] | 1982 | /* Send RACH request through l1CTL and wait for ChanReq on RSL BST->BSC */ |
| 1983 | private function f_rach_req_wait_chan_rqd(integer ra) runs on ConnHdlr return GsmFrameNumber { |
| 1984 | var GsmFrameNumber fn; |
| 1985 | timer T := 8.0; |
| 1986 | |
| 1987 | /* advertise to RSL Emulation that we expect to receive confirmation from RACH */ |
| 1988 | RSL.send(ts_RSLDC_ChanRqd_anyFN(int2oct(ra,1))); |
| 1989 | |
| 1990 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, g_pars.l1_pars.ms_power_level); |
| 1991 | /* Send the actual RACH */ |
| 1992 | fn := f_L1CTL_RACH(L1CTL, ra); |
| 1993 | |
| 1994 | T.start; |
| 1995 | alt { |
| 1996 | [] RSL.receive(tr_RSL_CHAN_RQD(int2oct(ra,1), fn)) { setverdict(pass, "Received CHAN-RQD from RACH REQ") } |
| 1997 | [] T.timeout { |
| 1998 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for CHAN-RQD from RACH REQ <", ra, ", ", fn, ">")); |
| 1999 | } |
| 2000 | } |
| 2001 | T.stop |
| 2002 | return fn; |
| 2003 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2004 | |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 2005 | /* Tune to a dedicated channel: L1CTL only */ |
| 2006 | private function f_l1ctl_est_dchan(L1CTL_PT pt, ConnHdlrPars pars) { |
| 2007 | if (not ispresent(pars.maio_hsn)) { |
| 2008 | pt.send(ts_L1CTL_DM_EST_REQ_H0(pars.chan_nr, |
| 2009 | 7 /* TODO: mp_tsc */, |
| 2010 | mp_trx0_arfcn)); |
| 2011 | } else { |
| 2012 | pt.send(ts_L1CTL_DM_EST_REQ_H1(pars.chan_nr, |
| 2013 | 7 /* TODO: mp_tsc */, |
| 2014 | pars.maio_hsn.hsn, |
| 2015 | pars.maio_hsn.maio, |
| 2016 | pars.ma)); |
| 2017 | } |
| 2018 | } |
| 2019 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2020 | /* Establish dedicated channel: L1CTL + RSL side */ |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 2021 | private function f_est_dchan(boolean encr_enable := false, RSL_IE_List more_ies := {}) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2022 | var GsmFrameNumber fn; |
| 2023 | var ImmediateAssignment imm_ass; |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2024 | var ChannelDescription ch_desc; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2025 | var integer ra := 23; |
| 2026 | |
Pau Espin Pedrol | 6451b04 | 2018-10-24 20:36:16 +0200 | [diff] [blame] | 2027 | /* Send RACH request and wait for ChanReq */ |
| 2028 | fn := f_rach_req_wait_chan_rqd(ra); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2029 | |
| 2030 | /* Activate channel on BTS side */ |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 2031 | f_rsl_chan_act(g_pars.chan_mode, encr_enable, more_ies); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2032 | |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2033 | /* Craft channel description (with or without frequency hopping parameters) */ |
| 2034 | if (ispresent(g_pars.maio_hsn)) { |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 2035 | ch_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, g_pars.maio_hsn)); |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2036 | } else { |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 2037 | ch_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, mp_trx0_arfcn)); |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2038 | } |
| 2039 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2040 | /* Send IMM.ASS via CCHAN */ |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2041 | var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, g_pars.ma_map)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2042 | RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg))); |
| 2043 | |
| 2044 | /* receive IMM.ASS on MS side */ |
| 2045 | var ImmediateAssignment ia_um; |
| 2046 | ia_um := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn); |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2047 | |
| 2048 | /* Make sure that IMM.ASS contains hopping parameters (if enabled) */ |
| 2049 | if (ch_desc.h != ia_um.chan_desc.h) { |
| 2050 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Hopping parameters mismatch"); |
| 2051 | } |
| 2052 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2053 | /* enable dedicated mode */ |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2054 | f_L1CTL_DM_EST_REQ_IA(L1CTL, ia_um, ma := g_pars.ma); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2055 | /* enable encryption, if requested */ |
| 2056 | if (encr_enable) { |
| 2057 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 2058 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 2059 | } |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 2060 | |
| 2061 | g_first_meas_res := true; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2062 | } |
| 2063 | |
| 2064 | /* establish DChan, verify existance + contents of measurement reports */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2065 | private function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2066 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2067 | RSL.clear; |
| 2068 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 2069 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 2070 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 2071 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 2072 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2073 | |
| 2074 | f_est_dchan(); |
| 2075 | |
| 2076 | /* run for a number of seconds, send SACCH + FACCH from MS side and verify |
| 2077 | * RSL measurement reports on Abis side */ |
| 2078 | timer T := 8.0; |
| 2079 | T.start; |
| 2080 | alt { |
| 2081 | [] as_l1_sacch(); |
| 2082 | [] as_meas_res(); |
| 2083 | [] as_l1_dcch(); |
| 2084 | [] L1CTL.receive { repeat; } |
| 2085 | [g_Tmeas_exp.running] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2086 | /* as_meas_res() would have done Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail) in case |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2087 | * of any earlier errors, so if we reach this timeout, we're good */ |
| 2088 | setverdict(pass); |
| 2089 | } |
| 2090 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2091 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No MEAS RES received at all"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2092 | } |
| 2093 | } |
| 2094 | f_rsl_chan_deact(); |
Harald Welte | 3dc2046 | 2018-03-10 23:03:38 +0100 | [diff] [blame] | 2095 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2096 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 2097 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2098 | /* Wait until the BTS has reached full tx power (nominal tx power minus configured attenuation) */ |
| 2099 | private function f_wait_ramp_up() runs on ConnHdlr return integer { |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2100 | var L1ctlDlMessage l1_dl; |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2101 | var integer max_rx_lvl := mp_bts_tx_nom_pwr_exp - mp_bts_tx_pwr_att_exp; |
| 2102 | timer Tup := 10.0; |
| 2103 | Tup.start; |
| 2104 | alt { |
| 2105 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2106 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2107 | log("Received rx_level=", rx_lvl); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2108 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2109 | if (rx_lvl != max_rx_lvl) { |
| 2110 | repeat; |
| 2111 | } |
| 2112 | Tup.stop; |
| 2113 | } |
| 2114 | [] L1CTL.receive { repeat; } |
| 2115 | [] Tup.timeout { |
| 2116 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2117 | log2str("Didn't reach full power ", max_rx_lvl)); |
| 2118 | } |
| 2119 | } |
| 2120 | return max_rx_lvl; |
| 2121 | } |
| 2122 | |
| 2123 | /* verify BTS ramps power up to full tx power (nominal tx power minus configured attenuation) */ |
| 2124 | private function f_verify_ramp_up() runs on ConnHdlr { |
| 2125 | var L1ctlDlMessage l1_dl; |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2126 | var integer initial_rx_lvl := -1; |
| 2127 | var integer last_rx_lvl := -1; |
| 2128 | var integer max_rx_lvl := mp_bts_tx_nom_pwr_exp - mp_bts_tx_pwr_att_exp; |
| 2129 | |
| 2130 | timer T := 2.0; |
| 2131 | alt { |
| 2132 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2133 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2134 | log("Received rx_level=", rx_lvl); |
| 2135 | if (initial_rx_lvl == -1) { |
| 2136 | initial_rx_lvl := rx_lvl; |
| 2137 | last_rx_lvl := rx_lvl; |
| 2138 | |
| 2139 | /* Expect a somehow low value during first received messages */ |
| 2140 | if (initial_rx_lvl >= max_rx_lvl / 2) { |
| 2141 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2142 | log2str("Detected high initial tx power during ramp up: ", |
| 2143 | initial_rx_lvl , ", full power is", max_rx_lvl)); |
| 2144 | } |
| 2145 | } |
| 2146 | |
| 2147 | /* received Rx level bigger than maximum allowed power by CN */ |
| 2148 | if (rx_lvl > max_rx_lvl) { |
| 2149 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2150 | log2str("Detected Tx power higher than full power: ", |
| 2151 | rx_lvl , " > ", max_rx_lvl)); |
| 2152 | } |
| 2153 | |
| 2154 | /* Make sure it never decreases, since we are rumping up */ |
| 2155 | if (last_rx_lvl > rx_lvl) { |
| 2156 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2157 | log2str("Detected Tx power decrease during ramp up: ", |
| 2158 | last_rx_lvl , " -> ", rx_lvl)); |
| 2159 | } |
| 2160 | |
| 2161 | if (rx_lvl == max_rx_lvl and not T.running) { |
| 2162 | /* We reached the maximum power, start timer and receive |
| 2163 | /* a few more to make sure we don't surpass it */ |
| 2164 | log("Reached full power, wating a bit more until success"); |
| 2165 | T.start; |
| 2166 | } |
| 2167 | |
| 2168 | last_rx_lvl := rx_lvl; |
| 2169 | repeat; |
| 2170 | } |
| 2171 | [] L1CTL.receive { repeat; } |
| 2172 | [] T.timeout { } |
| 2173 | } |
| 2174 | |
| 2175 | /* We didn't increase tx power during ramp up */ |
| 2176 | if (initial_rx_lvl < last_rx_lvl) { |
| 2177 | log("Tx power increased during ramp up: ", initial_rx_lvl , " -> ", last_rx_lvl); |
| 2178 | } else { |
| 2179 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2180 | log2str("No Tx power increase during whole ramp up: ", |
| 2181 | initial_rx_lvl , " -> ", last_rx_lvl)); |
| 2182 | } |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2183 | } |
| 2184 | |
| 2185 | /* verify BTS ramps power down to rx_level 0 */ |
| 2186 | private function f_verify_ramp_down(integer max_rx_lvl) runs on ConnHdlr { |
| 2187 | var L1ctlDlMessage l1_dl; |
| 2188 | var integer last_rx_lvl := max_rx_lvl; |
| 2189 | |
| 2190 | timer Tdown := 5.0; |
| 2191 | Tdown.start; |
| 2192 | alt { |
| 2193 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2194 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2195 | log("Received rx_level=", rx_lvl); |
| 2196 | |
| 2197 | /* received Rx level bigger than maximum allowed power by CN */ |
| 2198 | if (rx_lvl > max_rx_lvl) { |
| 2199 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2200 | log2str("Detected Tx power higher than full power: ", |
| 2201 | rx_lvl , " > ", max_rx_lvl)); |
| 2202 | } |
| 2203 | |
| 2204 | /* Make sure it never increases, since we are rumping down */ |
| 2205 | if (last_rx_lvl < rx_lvl) { |
| 2206 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2207 | log2str("Detected Tx power increase during ramp up: ", |
| 2208 | last_rx_lvl , " -> ", rx_lvl)); |
| 2209 | } |
| 2210 | |
| 2211 | last_rx_lvl := rx_lvl; |
| 2212 | if (last_rx_lvl != 0) { |
| 2213 | repeat; |
| 2214 | } |
| 2215 | /* we reached power level 0, we are done */ |
| 2216 | Tdown.stop; |
| 2217 | } |
| 2218 | [] L1CTL.receive { repeat; } |
| 2219 | [] Tdown.timeout { } |
| 2220 | } |
| 2221 | |
| 2222 | /* We didn't increase tx power during ramp down */ |
| 2223 | if (max_rx_lvl > last_rx_lvl) { |
| 2224 | log("Tx power decreased during ramp down: ", max_rx_lvl , " -> ", last_rx_lvl); |
| 2225 | } else { |
| 2226 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2227 | log2str("No Tx power decrease during whole ramp down: ", |
| 2228 | max_rx_lvl , " -> ", last_rx_lvl)); |
| 2229 | } |
| 2230 | } |
| 2231 | |
| 2232 | /* Verify Tx power reduction and ramping up during BTS bring up */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2233 | private function f_TC_tx_power_start_ramp_up_bcch(charstring id) runs on ConnHdlr { |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2234 | f_l1_tune(L1CTL); |
| 2235 | RSL.clear; |
| 2236 | |
| 2237 | f_verify_ramp_up(); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2238 | |
| 2239 | setverdict(pass); |
| 2240 | } |
| 2241 | testcase TC_tx_power_start_ramp_up_bcch() runs on test_CT { |
| 2242 | var ConnHdlr vc_conn; |
| 2243 | var ConnHdlrPars pars; |
| 2244 | f_init(); |
| 2245 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
| 2246 | vc_conn := f_start_handler(refers(f_TC_tx_power_start_ramp_up_bcch), pars, |
| 2247 | pcu_comp := false, trxc_comp := true); |
| 2248 | vc_conn.done; |
| 2249 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2250 | } |
| 2251 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2252 | /* Verify Tx power reduction and ramping downd uring BTS bring shutdown due to Abis link failure */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2253 | private function f_TC_tx_power_start_ramp_down_bcch(charstring id) runs on ConnHdlr { |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2254 | f_connhdlr_init_vty_bsc(); |
| 2255 | |
| 2256 | f_l1_tune(L1CTL); |
| 2257 | RSL.clear; |
| 2258 | |
| 2259 | /* Wait until BTS is started and at full power */ |
| 2260 | var integer max_rx_lvl := f_wait_ramp_up(); |
| 2261 | log("Reached nominal level ", max_rx_lvl, ", shutting down OML link"); |
| 2262 | |
| 2263 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2264 | f_verify_ramp_down(max_rx_lvl); |
| 2265 | |
| 2266 | setverdict(pass); |
| 2267 | } |
| 2268 | testcase TC_tx_power_start_ramp_down_bcch() runs on test_CT { |
| 2269 | var ConnHdlr vc_conn; |
| 2270 | var ConnHdlrPars pars; |
| 2271 | f_init(); |
| 2272 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
| 2273 | vc_conn := f_start_handler(refers(f_TC_tx_power_start_ramp_down_bcch), pars, |
| 2274 | pcu_comp := false, trxc_comp := true); |
| 2275 | vc_conn.done; |
| 2276 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2277 | } |
| 2278 | |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 2279 | /* Verify Tx power: |
| 2280 | * + ramping down during ADM state UNLOCKED->LOCKED |
| 2281 | * + ramping up during ADM state LOCKED->UNLOCKED |
| 2282 | */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2283 | private function f_TC_tx_power_ramp_adm_state_change(charstring id) runs on ConnHdlr { |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 2284 | var L1ctlDlMessage l1_dl; |
| 2285 | var integer last_rx_lvl; |
| 2286 | |
| 2287 | f_connhdlr_init_vty_bsc(); |
| 2288 | |
| 2289 | f_l1_tune(L1CTL); |
| 2290 | RSL.clear; |
| 2291 | |
| 2292 | /* Wait until BTS is started and at full power */ |
| 2293 | var integer max_rx_lvl := f_wait_ramp_up(); |
| 2294 | log("Reached nominal level ", max_rx_lvl, ", changing ADM state to LOCKED"); |
| 2295 | |
| 2296 | log("ADM STATE UNLOCKED->LOCKED"); |
| 2297 | f_vty_enter_cfg_trx(BSCVTY); |
| 2298 | f_vty_transceive(BSCVTY, "rf_locked 1"); |
| 2299 | last_rx_lvl := max_rx_lvl; |
| 2300 | f_verify_ramp_down(max_rx_lvl); |
| 2301 | |
| 2302 | /* Let some time after we received 0dBm, then check we don't receive BCCH |
| 2303 | * anymore because scheduler has stopped after ramping down */ |
| 2304 | f_sleep(2.0); |
| 2305 | L1CTL.clear; |
| 2306 | timer Tlocked := 2.0; |
| 2307 | Tlocked.start; |
| 2308 | alt { |
| 2309 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2310 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2311 | log2str("Received data_ind during rf_locked: ", l1_dl)); |
| 2312 | } |
| 2313 | [] L1CTL.receive { repeat; } |
| 2314 | [] Tlocked.timeout { setverdict(pass, "Didn't receive data_ind while in rf_locked state."); } |
| 2315 | } |
| 2316 | |
| 2317 | log("ADM STATE LOCKED->UNLOCKED"); |
| 2318 | f_vty_transceive(BSCVTY, "rf_locked 0"); |
| 2319 | f_verify_ramp_up(); |
| 2320 | setverdict(pass); |
| 2321 | } |
| 2322 | testcase TC_tx_power_ramp_adm_state_change() runs on test_CT { |
| 2323 | var ConnHdlr vc_conn; |
| 2324 | var ConnHdlrPars pars; |
| 2325 | f_init(); |
| 2326 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
| 2327 | vc_conn := f_start_handler(refers(f_TC_tx_power_ramp_adm_state_change), pars, |
| 2328 | pcu_comp := false, trxc_comp := true); |
| 2329 | vc_conn.done; |
| 2330 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2331 | } |
| 2332 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2333 | private function f_check_meas_bs_power_level(integer level) runs on ConnHdlr { |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 2334 | timer T := 8.0; |
| 2335 | T.start; |
| 2336 | var RSL_Message rsl; |
| 2337 | alt { |
| 2338 | [] as_l1_sacch(); |
| 2339 | [] L1CTL.receive { repeat; } |
| 2340 | [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, ?, ?, ?)) -> value rsl { |
| 2341 | if (rsl.ies[3].body.bs_power.power_level == level) { |
| 2342 | setverdict(pass) |
| 2343 | } else { |
| 2344 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received wrong BS power level in MEAS RES ", rsl)); |
| 2345 | } |
| 2346 | } |
| 2347 | [] T.timeout { |
| 2348 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No MEAS RES received at all"); |
| 2349 | } |
| 2350 | } |
| 2351 | } |
| 2352 | |
| 2353 | /* see if the rsl meas res contains our expeced bs power level |
| 2354 | bs power set during assignment */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2355 | private function f_TC_rsl_bs_pwr_static_ass(charstring id) runs on ConnHdlr { |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 2356 | f_l1_tune(L1CTL); |
| 2357 | RSL.clear; |
| 2358 | |
| 2359 | if (mp_bts_trxc_port != -1) { |
| 2360 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
| 2361 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 2362 | } |
| 2363 | |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 2364 | var uint4_t pwr_var := 1; |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 2365 | var template (value) RSL_IE_BS_Power bs_power := ts_RSL_IE_BS_Power(pwr_var); |
| 2366 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_BS_POWER, RSL_IE_Body:{bs_power := bs_power}); |
| 2367 | |
| 2368 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 2369 | |
| 2370 | f_check_meas_bs_power_level(pwr_var); |
| 2371 | |
| 2372 | f_rsl_chan_deact(); |
| 2373 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2374 | } |
| 2375 | |
| 2376 | /* see if the rsl meas res contains our expeced bs power level |
| 2377 | bs power set after assignment */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2378 | private function f_TC_rsl_bs_pwr_static_power_control(charstring id) runs on ConnHdlr { |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 2379 | f_l1_tune(L1CTL); |
| 2380 | RSL.clear; |
| 2381 | |
| 2382 | if (mp_bts_trxc_port != -1) { |
| 2383 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
| 2384 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 2385 | } |
| 2386 | |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 2387 | var uint4_t pwr_var := 1; |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 2388 | var template (value) RSL_IE_BS_Power bs_power := ts_RSL_IE_BS_Power(pwr_var); |
| 2389 | |
| 2390 | f_est_dchan(); |
| 2391 | |
| 2392 | RSL.send(ts_RSL_BS_PWR_CTRL(g_chan_nr, bs_power)); |
| 2393 | |
| 2394 | f_check_meas_bs_power_level(pwr_var); |
| 2395 | |
| 2396 | f_rsl_chan_deact(); |
| 2397 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2398 | } |
| 2399 | |
| 2400 | testcase TC_rsl_bs_pwr_static_ass() runs on test_CT { |
| 2401 | var ConnHdlr vc_conn; |
| 2402 | var ConnHdlrPars pars; |
| 2403 | f_init(); |
| 2404 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 2405 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2406 | vc_conn := f_start_handler(refers(f_TC_rsl_bs_pwr_static_ass), pars, |
| 2407 | pcu_comp := false, trxc_comp := true); |
| 2408 | vc_conn.done; |
| 2409 | } |
| 2410 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2411 | } |
| 2412 | |
| 2413 | testcase TC_rsl_bs_pwr_static_power_control() runs on test_CT { |
| 2414 | var ConnHdlr vc_conn; |
| 2415 | var ConnHdlrPars pars; |
| 2416 | f_init(); |
| 2417 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 2418 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2419 | vc_conn := f_start_handler(refers(f_TC_rsl_bs_pwr_static_power_control), pars, |
| 2420 | pcu_comp := false, trxc_comp := true); |
| 2421 | vc_conn.done; |
| 2422 | } |
| 2423 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2424 | } |
| 2425 | |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2426 | /* target level -100, first rssi -90, ms power 7, expected increase to 7+6 within 6 seconds, |
| 2427 | second rssi -110, ms power 7+6, expected decrease to 7 within 6 seconds, |
| 2428 | These power levels are valid for all bands and require no special handling */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2429 | private function f_TC_rsl_ms_pwr_dyn_ass_updown(charstring id) runs on ConnHdlr { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2430 | var uint5_t pwr_var := 7; |
| 2431 | var L1ctlDlMessage l1_dl; |
| 2432 | |
| 2433 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 2434 | f_l1_tune(L1CTL); |
| 2435 | RSL.clear; |
| 2436 | |
| 2437 | var RSL_IE_List addl_ies; |
| 2438 | var template (value) RSL_IE_MS_Power_Parameters pp := (ts_RSL_IE_MS_Power_Parameters(''O)); |
| 2439 | |
| 2440 | addl_ies := { |
| 2441 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(pwr_var)})), |
| 2442 | valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ms_power_params := pp})) |
| 2443 | }; |
| 2444 | |
| 2445 | /* establish with power parameters */ |
| 2446 | f_est_dchan(more_ies := addl_ies); |
| 2447 | |
| 2448 | /* set a high value to ensure L1 power control level increases */ |
| 2449 | f_trxc_fake_rssi(rxlev2dbm(20)); |
| 2450 | |
| 2451 | timer T2 := 6.0; |
| 2452 | T2.start; |
| 2453 | alt { |
| 2454 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2455 | /* Update sent MS power to follow what BTS requests */ |
| 2456 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, oct2int(l1_dl.payload.data_ind.payload[0])); |
| 2457 | if (oct2int(l1_dl.payload.data_ind.payload[0]) < (pwr_var + 6)) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2458 | repeat; |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2459 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2460 | T2.stop; |
| 2461 | } |
| 2462 | [] L1CTL.receive { repeat; } |
| 2463 | [] T2.timeout { |
| 2464 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2465 | "Power Level in L1 header has not increased sufficiently"); |
| 2466 | } |
| 2467 | } |
| 2468 | |
| 2469 | /* set a low value to ensure L1 power control level decreases */ |
| 2470 | f_trxc_fake_rssi(rxlev2dbm(0)); |
| 2471 | |
| 2472 | timer T4 := 6.0; |
| 2473 | T4.start; |
| 2474 | alt { |
| 2475 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2476 | /* Update sent MS power to follow what BTS requests */ |
| 2477 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, oct2int(l1_dl.payload.data_ind.payload[0])); |
| 2478 | if (oct2int(l1_dl.payload.data_ind.payload[0]) > pwr_var) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2479 | repeat; |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2480 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2481 | T4.stop; |
| 2482 | setverdict(pass, "Power level in L1 decreased/increased as expected"); |
| 2483 | } |
| 2484 | [] L1CTL.receive { repeat; } |
| 2485 | [] T4.timeout { |
| 2486 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2487 | "Power Level in L1 header has not decreased sufficiently"); |
| 2488 | } |
| 2489 | } |
| 2490 | |
| 2491 | f_rsl_chan_deact(); |
| 2492 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2493 | |
| 2494 | } |
| 2495 | |
| 2496 | /* check that we do not exceed the max power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2497 | private function f_TC_rsl_ms_pwr_dyn_max(charstring id) runs on ConnHdlr { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2498 | var uint5_t pwr_var := 7; |
| 2499 | var L1ctlDlMessage l1_dl; |
| 2500 | |
| 2501 | /* set a low value to ensure power increases */ |
| 2502 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 2503 | f_l1_tune(L1CTL); |
| 2504 | RSL.clear; |
| 2505 | |
| 2506 | var RSL_IE_List addl_ies; |
| 2507 | var template (value) RSL_IE_MS_Power_Parameters pp := (ts_RSL_IE_MS_Power_Parameters(''O)); |
| 2508 | |
| 2509 | addl_ies := { |
| 2510 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(pwr_var)})), |
| 2511 | valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ms_power_params := pp})) |
| 2512 | }; |
| 2513 | |
| 2514 | /* establish with power parameters */ |
| 2515 | f_est_dchan(more_ies := addl_ies); |
| 2516 | |
| 2517 | timer T1 := 10.0; |
| 2518 | T1.start; |
| 2519 | alt { |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2520 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2521 | /* Update sent MS power to follow what BTS requests */ |
| 2522 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, oct2int(l1_dl.payload.data_ind.payload[0])); |
| 2523 | repeat; |
| 2524 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2525 | [] L1CTL.receive { repeat; } |
| 2526 | [] T1.timeout { |
| 2527 | if( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var){ |
| 2528 | setverdict(fail, "Power level in L1 header should not have changed"); |
| 2529 | } |
| 2530 | } |
| 2531 | } |
| 2532 | |
| 2533 | f_rsl_chan_deact(); |
| 2534 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2535 | |
| 2536 | } |
| 2537 | |
| 2538 | /* see if we reach the band max power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2539 | private function f_TC_rsl_ms_pwr_dyn_up(charstring id) runs on ConnHdlr { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2540 | var L1ctlDlMessage l1_dl; |
| 2541 | var uint5_t pwr_var := 15; |
| 2542 | var uint5_t pwr_max_var := f_get_max_power_from_band(); |
| 2543 | |
| 2544 | /* set a low value to ensure power increases */ |
| 2545 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 2546 | f_l1_tune(L1CTL); |
| 2547 | RSL.clear; |
| 2548 | |
| 2549 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 2550 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 2551 | |
| 2552 | /* establish with fixed power level */ |
| 2553 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 2554 | |
| 2555 | /* check our initial power level */ |
| 2556 | f_wait_for_l1_power_level(pwr_var); |
| 2557 | |
| 2558 | /* update power param to enable power loop |
| 2559 | 48.058 The maximum power to be used is indicated in the BS and MS Power elements respectively. */ |
| 2560 | RSL.send(ts_RSL_MS_PWR_CTRL_with_pp(g_chan_nr, pwr_max_var)); |
| 2561 | |
| 2562 | /* wait, then check that our power level was reduced */ |
| 2563 | timer T1 := 10.0; |
| 2564 | T1.start; |
| 2565 | alt { |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2566 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2567 | /* Update sent MS power to follow what BTS requests */ |
| 2568 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, oct2int(l1_dl.payload.data_ind.payload[0])); |
| 2569 | repeat; |
| 2570 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2571 | [] L1CTL.receive { repeat; } |
| 2572 | [] T1.timeout { |
| 2573 | var int8_t rcv := oct2int(l1_dl.payload.data_ind.payload[0]); |
| 2574 | if( f_power_level_is_highest_dbm(rcv) ){ |
| 2575 | setverdict(pass, "Power level in L1 header reduced as expected"); |
| 2576 | } else { |
| 2577 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2578 | log2str("Power Level in L1 header did not reach the expected value, e:",pwr_max_var," r:",rcv)); |
| 2579 | } |
| 2580 | } |
| 2581 | } |
| 2582 | |
| 2583 | f_rsl_chan_deact(); |
| 2584 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2585 | |
| 2586 | } |
| 2587 | |
| 2588 | /* see if we reach the band min power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2589 | private function f_TC_rsl_ms_pwr_dyn_down(charstring id) runs on ConnHdlr { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2590 | var L1ctlDlMessage l1_dl; |
| 2591 | |
| 2592 | /* set a high value to ensure power decreases */ |
| 2593 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 2594 | f_l1_tune(L1CTL); |
| 2595 | RSL.clear; |
| 2596 | |
| 2597 | var uint5_t pwr_var := 5; |
| 2598 | var uint5_t pwr_target_val := 15; |
| 2599 | |
| 2600 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 2601 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 2602 | |
| 2603 | /* establish with fixed power level */ |
| 2604 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 2605 | |
| 2606 | /* check our initial power level */ |
| 2607 | f_wait_for_l1_power_level(pwr_var); |
| 2608 | |
| 2609 | /* update power param to enable power loop |
| 2610 | as per spec the supplied ms power IE should set the max allowed power...*/ |
Pau Espin Pedrol | 61122c8 | 2019-11-05 13:50:27 +0100 | [diff] [blame] | 2611 | RSL.send(ts_RSL_MS_PWR_CTRL_with_pp(g_chan_nr, pwr_target_val)); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2612 | |
| 2613 | /* wait, then check that our power level was increased */ |
| 2614 | timer T1 := 10.0; |
| 2615 | T1.start; |
| 2616 | alt { |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 2617 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2618 | /* Update sent MS power to follow what BTS requests */ |
| 2619 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, oct2int(l1_dl.payload.data_ind.payload[0])); |
| 2620 | repeat; |
| 2621 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2622 | [] L1CTL.receive { repeat; } |
| 2623 | [] T1.timeout { |
| 2624 | if( f_power_level_is_lowest_dbm(oct2int(l1_dl.payload.data_ind.payload[0])) ){ |
| 2625 | setverdict(pass, "Power level in L1 header increased to lowest power value"); |
| 2626 | } else { |
| 2627 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2628 | "Power level in L1 header NOT increased to lowest power value"); |
| 2629 | } |
| 2630 | } |
| 2631 | } |
| 2632 | |
| 2633 | f_rsl_chan_deact(); |
| 2634 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2635 | |
| 2636 | } |
| 2637 | |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 2638 | /* see if we change the power level without receiving power parameters, which should not happen |
| 2639 | rsl chan act WITHOUT power parameters */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2640 | private function f_TC_rsl_ms_pwr_dyn_active(charstring id) runs on ConnHdlr { |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 2641 | var L1ctlDlMessage l1_dl; |
| 2642 | |
| 2643 | /* set a high value to ensure power decreases */ |
| 2644 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 2645 | f_l1_tune(L1CTL); |
| 2646 | RSL.clear; |
| 2647 | |
| 2648 | var uint5_t pwr_var := 5; |
| 2649 | |
| 2650 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 2651 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 2652 | |
| 2653 | /* establish with fixed power level */ |
| 2654 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 2655 | |
| 2656 | /* check our initial power level */ |
| 2657 | f_wait_for_l1_power_level(pwr_var); |
| 2658 | |
| 2659 | /* wait, then check that our power level did not change */ |
| 2660 | timer T1 := 10.0; |
| 2661 | T1.start; |
| 2662 | alt { |
| 2663 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2664 | if ( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var) { |
| 2665 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2666 | "BS power control should not be active unless we receive a power parameters IE!"); |
| 2667 | } |
| 2668 | repeat; |
| 2669 | } |
| 2670 | [] L1CTL.receive { repeat; } |
| 2671 | [] T1.timeout { setverdict(pass); } |
| 2672 | } |
| 2673 | |
| 2674 | f_rsl_chan_deact(); |
| 2675 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2676 | |
| 2677 | } |
| 2678 | |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 2679 | /* see if we change the power level without receiving power parameters, which should not happen |
| 2680 | ms power control WITHOUT power parameters */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2681 | private function f_TC_rsl_ms_pwr_dyn_active2(charstring id) runs on ConnHdlr { |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 2682 | var L1ctlDlMessage l1_dl; |
| 2683 | |
| 2684 | /* set a high value to ensure power decreases */ |
| 2685 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 2686 | f_l1_tune(L1CTL); |
| 2687 | RSL.clear; |
| 2688 | |
| 2689 | var uint5_t pwr_var := 5; |
| 2690 | |
| 2691 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 2692 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 2693 | |
| 2694 | /* establish with fixed power level */ |
| 2695 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 2696 | |
| 2697 | /* check our initial power level */ |
| 2698 | f_wait_for_l1_power_level(pwr_var); |
| 2699 | |
| 2700 | /* pwr control without power params IE, should NOT activate MS power control*/ |
| 2701 | RSL.send(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 2702 | |
| 2703 | /* wait, then check that our power level did not change */ |
| 2704 | timer T1 := 10.0; |
| 2705 | T1.start; |
| 2706 | alt { |
| 2707 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2708 | if ( oct2int(l1_dl.payload.data_ind.payload[0]) != pwr_var) { |
| 2709 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2710 | "BS power control should not be active unless we receive a power parameters IE!"); |
| 2711 | } |
| 2712 | repeat; |
| 2713 | } |
| 2714 | [] L1CTL.receive { repeat; } |
| 2715 | [] T1.timeout { setverdict(pass); } |
| 2716 | } |
| 2717 | |
| 2718 | f_rsl_chan_deact(); |
| 2719 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2720 | |
| 2721 | } |
| 2722 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2723 | private function f_wait_for_l1_power_level(integer level) runs on ConnHdlr { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2724 | var L1ctlDlMessage l1_dl; |
| 2725 | timer T0 := 10.0; |
| 2726 | T0.start; |
| 2727 | alt { |
| 2728 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2729 | if (not (l1_dl.payload.data_ind.payload[0] == int2oct(level, 1))) { |
| 2730 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2731 | "Power level in L1 header != signaled (RSL) power level."); |
| 2732 | } |
| 2733 | } |
| 2734 | [] L1CTL.receive { repeat; } |
| 2735 | [] T0.timeout { |
| 2736 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2737 | "Timeout waiting for initial power level"); |
| 2738 | } |
| 2739 | } |
| 2740 | T0.stop; |
| 2741 | } |
| 2742 | |
| 2743 | private function f_power_level_is_lowest_dbm(integer level) runs on ConnHdlr return boolean { |
| 2744 | var IntegerRecord min_dbm_level; |
| 2745 | var IntegerRecord max_dbm_level; |
| 2746 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 2747 | |
| 2748 | for (var integer i := 0; i < sizeof(min_dbm_level); i := i+1) { |
| 2749 | if (min_dbm_level[i] == level) { |
| 2750 | return true; |
| 2751 | } |
| 2752 | } |
| 2753 | return false; |
| 2754 | } |
| 2755 | |
| 2756 | private function f_power_level_is_highest_dbm(integer level) runs on ConnHdlr return boolean { |
| 2757 | var IntegerRecord min_dbm_level; |
| 2758 | var IntegerRecord max_dbm_level; |
| 2759 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 2760 | |
| 2761 | for (var integer i := 0; i < sizeof(max_dbm_level); i := i+1) { |
| 2762 | if (max_dbm_level[i] == level) { |
| 2763 | return true; |
| 2764 | } |
| 2765 | } |
| 2766 | return false; |
| 2767 | } |
| 2768 | |
| 2769 | private function f_get_max_power_from_band() runs on ConnHdlr return integer { |
| 2770 | var IntegerRecord min_dbm_level; |
| 2771 | var IntegerRecord max_dbm_level; |
| 2772 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 2773 | return max_dbm_level[0]; |
| 2774 | } |
| 2775 | |
| 2776 | type charstring BtsBand ("GSM450","GSM480","GSM750","GSM810","GSM850","GSM900","DCS1800","PCS1900"); |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2777 | private template charstring BtsBand_allGSM := pattern "GSM???"; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 2778 | private function f_power_from_band(in BtsBand band, out IntegerRecord min_dbm_level, out IntegerRecord max_dbm_level) return IntegerRecord { |
| 2779 | // 45.005 4.1.1 |
| 2780 | var IntegerRecord gsm_power :={31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, |
| 2781 | 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, |
| 2782 | 2, 1, 0}; |
| 2783 | var IntegerRecord dcs_power :={28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, |
| 2784 | 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30, 29}; |
| 2785 | var IntegerRecord pcs_power :={15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30}; |
| 2786 | var IntegerRecord rv; |
| 2787 | |
| 2788 | select(band){ |
| 2789 | case (BtsBand_allGSM){ |
| 2790 | rv := gsm_power; |
| 2791 | min_dbm_level := {31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19} ; |
| 2792 | max_dbm_level := {2, 1, 0}; |
| 2793 | } |
| 2794 | case("DCS1800"){ |
| 2795 | rv := dcs_power; |
| 2796 | min_dbm_level := {28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15}; |
| 2797 | max_dbm_level := {0, 29}; // let's cheat here, assume MS_TXPWR_MAX_CCH might be being broadcast, so maybe no 29,30,31 |
| 2798 | } |
| 2799 | case("PCS1900"){ |
| 2800 | rv := pcs_power; |
| 2801 | min_dbm_level := {15}; |
| 2802 | max_dbm_level := {30}; |
| 2803 | } |
| 2804 | } |
| 2805 | |
| 2806 | return rv; |
| 2807 | } |
| 2808 | |
| 2809 | private function f_vty_get_bts0_band() runs on test_CT return BtsBand { |
| 2810 | return f_vty_transceive_match_regex(BTSVTY, "show bts 0", "BTS 0 is of \w+ type in band (\w+),*", 0); |
| 2811 | } |
| 2812 | |
| 2813 | testcase TC_rsl_ms_pwr_dyn_ass_updown() runs on test_CT { |
| 2814 | var ConnHdlr vc_conn; |
| 2815 | var ConnHdlrPars pars; |
| 2816 | f_init(); |
| 2817 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 2818 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2819 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2820 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2821 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_ass_updown), pars, trxc_comp := true); |
| 2822 | vc_conn.done; |
| 2823 | } |
| 2824 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2825 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2826 | } |
| 2827 | |
| 2828 | testcase TC_rsl_ms_pwr_dyn_up() runs on test_CT { |
| 2829 | var ConnHdlr vc_conn; |
| 2830 | var ConnHdlrPars pars; |
| 2831 | f_init(); |
| 2832 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -10"); |
| 2833 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2834 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2835 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2836 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_up), pars, trxc_comp := true); |
| 2837 | vc_conn.done; |
| 2838 | } |
| 2839 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2840 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2841 | } |
| 2842 | |
| 2843 | testcase TC_rsl_ms_pwr_dyn_max() runs on test_CT { |
| 2844 | var ConnHdlr vc_conn; |
| 2845 | var ConnHdlrPars pars; |
| 2846 | f_init(); |
| 2847 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -10"); |
| 2848 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2849 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2850 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2851 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_max), pars, trxc_comp := true); |
| 2852 | vc_conn.done; |
| 2853 | } |
| 2854 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2855 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2856 | } |
| 2857 | |
| 2858 | testcase TC_rsl_ms_pwr_dyn_down() runs on test_CT { |
| 2859 | var ConnHdlr vc_conn; |
| 2860 | var ConnHdlrPars pars; |
| 2861 | f_init(); |
| 2862 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 2863 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2864 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2865 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2866 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_down), pars, trxc_comp := true); |
| 2867 | vc_conn.done; |
| 2868 | } |
| 2869 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2870 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2871 | } |
| 2872 | |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 2873 | testcase TC_rsl_ms_pwr_dyn_active() runs on test_CT { |
| 2874 | var ConnHdlr vc_conn; |
| 2875 | var ConnHdlrPars pars; |
| 2876 | f_init(); |
| 2877 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 2878 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2879 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2880 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2881 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_active), pars, trxc_comp := true); |
| 2882 | vc_conn.done; |
| 2883 | } |
| 2884 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2885 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2886 | } |
| 2887 | |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 2888 | testcase TC_rsl_ms_pwr_dyn_active2() runs on test_CT { |
| 2889 | var ConnHdlr vc_conn; |
| 2890 | var ConnHdlrPars pars; |
| 2891 | f_init(); |
| 2892 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 2893 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 2894 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 2895 | pars.bts0_band := f_vty_get_bts0_band(); |
| 2896 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_active2), pars, trxc_comp := true); |
| 2897 | vc_conn.done; |
| 2898 | } |
| 2899 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 2900 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2901 | } |
| 2902 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2903 | testcase TC_meas_res_sign_tchf() runs on test_CT { |
| 2904 | var ConnHdlr vc_conn; |
| 2905 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 2906 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2907 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 2908 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 2909 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 2910 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2911 | vc_conn.done; |
| 2912 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2913 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2914 | } |
| 2915 | testcase TC_meas_res_sign_tchh() runs on test_CT { |
| 2916 | var ConnHdlr vc_conn; |
| 2917 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 2918 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2919 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
| 2920 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN)); |
Eric Wild | 5b9ef14 | 2019-07-11 19:28:02 +0200 | [diff] [blame] | 2921 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 2922 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2923 | vc_conn.done; |
| 2924 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2925 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2926 | } |
| 2927 | testcase TC_meas_res_sign_sdcch4() runs on test_CT { |
| 2928 | var ConnHdlr vc_conn; |
| 2929 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 2930 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2931 | for (var integer ss := 0; ss <= 3; ss := ss+1) { |
| 2932 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0, ss), ts_RSL_ChanMode_SIGN)); |
Eric Wild | 5b9ef14 | 2019-07-11 19:28:02 +0200 | [diff] [blame] | 2933 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 2934 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2935 | vc_conn.done; |
| 2936 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2937 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2938 | } |
| 2939 | testcase TC_meas_res_sign_sdcch8() runs on test_CT { |
| 2940 | var ConnHdlr vc_conn; |
| 2941 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 2942 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2943 | for (var integer ss := 0; ss <= 7; ss := ss+1) { |
| 2944 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, ss), ts_RSL_ChanMode_SIGN)); |
Eric Wild | 5b9ef14 | 2019-07-11 19:28:02 +0200 | [diff] [blame] | 2945 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 2946 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2947 | vc_conn.done; |
| 2948 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2949 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2950 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2951 | testcase TC_meas_res_sign_tchh_toa256() runs on test_CT { |
| 2952 | var ConnHdlr vc_conn; |
| 2953 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 2954 | f_init(); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2955 | f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256"); |
| 2956 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
| 2957 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN)); |
| 2958 | pars.l1_pars.toa256_enabled := true; |
| 2959 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars); |
| 2960 | vc_conn.done; |
| 2961 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2962 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2963 | } |
| 2964 | |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 2965 | /* establish DChan, and send MS POWER CONTROL messages via RSL, verify that |
| 2966 | * the BTS is forwarding those values to the MS via the SACCH L1 header. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2967 | private function f_tc_rsl_ms_pwr_ctrl(charstring id) runs on ConnHdlr { |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 2968 | var L1ctlDlMessage l1_dl; |
| 2969 | var RSL_IE_MS_Power ms_power; |
| 2970 | var RSL_Message rsl; |
| 2971 | var uint5_t power_level := 0; |
| 2972 | |
| 2973 | f_l1_tune(L1CTL); |
| 2974 | RSL.clear; |
| 2975 | |
| 2976 | f_est_dchan(); |
| 2977 | |
| 2978 | ms_power.reserved := 0; |
| 2979 | ms_power.fpc_epc := false; |
| 2980 | |
| 2981 | /* Send the first power control command. This will disable any BTS/TRX |
| 2982 | * internal power control and switch the MS (which is not in scope of |
| 2983 | * this test) to a constant power level. We start with a power level |
| 2984 | * of 0 */ |
| 2985 | ms_power.power_level := power_level; |
| 2986 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 2987 | RSL.send(rsl); |
| 2988 | |
| 2989 | alt { |
| 2990 | |
| 2991 | /* Pick all SACCH blocks for checking */ |
| 2992 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2993 | |
| 2994 | /* The first byte of the L1 header contains the power level. |
| 2995 | * The reserved bits and the fpc bit is set to 0, so we may |
| 2996 | * compare directly. */ |
| 2997 | if (not (l1_dl.payload.data_ind.payload[0] == int2oct(power_level, 1))) { |
| 2998 | setverdict(fail, "Power level in L1 header does not match the signaled (RSL) power level."); |
| 2999 | } |
| 3000 | |
| 3001 | /* Signal a new power level via RSL for the next turn. */ |
| 3002 | if (power_level < 31) { |
| 3003 | power_level := power_level + 1; |
| 3004 | ms_power.power_level := power_level; |
| 3005 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 3006 | RSL.send(rsl); |
| 3007 | repeat; |
| 3008 | } |
| 3009 | |
| 3010 | } |
| 3011 | |
| 3012 | /* Ignore all other blocks */ |
| 3013 | [] L1CTL.receive { repeat; } |
| 3014 | |
| 3015 | } |
| 3016 | |
| 3017 | f_rsl_chan_deact(); |
| 3018 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3019 | |
| 3020 | setverdict(pass); |
| 3021 | } |
| 3022 | |
| 3023 | testcase TC_rsl_ms_pwr_ctrl() runs on test_CT { |
| 3024 | var ConnHdlr vc_conn; |
| 3025 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3026 | f_init(); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 3027 | |
| 3028 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 3029 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3030 | vc_conn := f_start_handler(refers(f_tc_rsl_ms_pwr_ctrl), pars); |
| 3031 | vc_conn.done; |
| 3032 | } |
| 3033 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3034 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3035 | |
Pau Espin Pedrol | 188bfd2 | 2020-06-03 20:32:45 +0200 | [diff] [blame] | 3036 | /* establish DChan, verify that the BTS sets the TA in the first SACCH L1 header. |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3037 | TA for the IMM ASS messages is still controlled by g_pars.l1_pars.ms_actual_ta! */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3038 | private function f_tc_rsl_chan_initial_ta(charstring id) runs on ConnHdlr { |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3039 | var L1ctlDlMessage l1_dl; |
| 3040 | var uint5_t ta_to_test := 16; |
| 3041 | |
| 3042 | |
| 3043 | f_l1_tune(L1CTL); |
| 3044 | RSL.clear; |
| 3045 | |
| 3046 | /* tell fake_trx to use a given timing offset for all bursts */ |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 3047 | f_trxc_fake_toffs256(ta_to_test*256); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3048 | |
| 3049 | f_est_dchan(more_ies :={valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := ta_to_test}))} ); |
| 3050 | |
| 3051 | |
| 3052 | alt { |
| 3053 | |
| 3054 | /* Pick all SACCH blocks for checking */ |
| 3055 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 3056 | |
| 3057 | /* The second byte of the L1 header contains the TA. */ |
| 3058 | if (not (l1_dl.payload.data_ind.payload[1] == int2oct(ta_to_test, 1))) { |
| 3059 | setverdict(fail, "TA in L1 header does not match the signaled (RSL) TA."); |
| 3060 | } |
| 3061 | |
| 3062 | } |
| 3063 | |
| 3064 | /* Ignore all other blocks */ |
| 3065 | [] L1CTL.receive { repeat; } |
| 3066 | |
| 3067 | } |
| 3068 | |
| 3069 | f_rsl_chan_deact(); |
| 3070 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3071 | |
| 3072 | setverdict(pass); |
| 3073 | } |
| 3074 | |
| 3075 | testcase TC_rsl_chan_initial_ta() runs on test_CT { |
| 3076 | var ConnHdlr vc_conn; |
| 3077 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3078 | f_init(); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3079 | pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 3080 | vc_conn := f_start_handler(refers(f_tc_rsl_chan_initial_ta), pars, |
| 3081 | pcu_comp := false, trxc_comp := true); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3082 | vc_conn.done; |
| 3083 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3084 | } |
| 3085 | |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 3086 | /* establish DChan, verify that the BTS sets MS power in the first SACCH L1 header. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3087 | private function f_tc_rsl_chan_initial_ms_pwr(charstring id) runs on ConnHdlr { |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 3088 | var L1ctlDlMessage l1_dl; |
| 3089 | var uint5_t ms_power_level := 7; |
| 3090 | |
| 3091 | var RSL_IE_MS_Power ms_power; |
| 3092 | ms_power.reserved := 0; |
| 3093 | ms_power.fpc_epc := false; |
| 3094 | ms_power.power_level := ms_power_level; |
| 3095 | |
| 3096 | f_l1_tune(L1CTL); |
| 3097 | RSL.clear; |
| 3098 | |
| 3099 | f_est_dchan(more_ies :={valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}))} ); |
| 3100 | |
| 3101 | timer T := 1.0; |
| 3102 | T.start; |
| 3103 | alt { |
| 3104 | /* Pick all SACCH blocks for checking */ |
| 3105 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 3106 | /* The first byte of the L1 header contains the power level.. */ |
| 3107 | if (not (l1_dl.payload.data_ind.payload[0] == int2oct(ms_power_level, 1))) { |
| 3108 | setverdict(fail, "Power Level in L1 header does not match the signaled (RSL) MS Power Level."); |
| 3109 | } |
| 3110 | } |
| 3111 | /* Ignore all other blocks */ |
| 3112 | [] L1CTL.receive { repeat; } |
| 3113 | [] T.timeout { |
| 3114 | setverdict(fail, "Power Level in L1 header does not match the signaled (RSL) MS Power Level."); |
| 3115 | } |
| 3116 | } |
| 3117 | |
| 3118 | f_rsl_chan_deact(); |
| 3119 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3120 | setverdict(pass); |
| 3121 | } |
| 3122 | |
| 3123 | testcase TC_rsl_chan_initial_ms_pwr() runs on test_CT { |
| 3124 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 3125 | f_testmatrix_each_chan(pars, refers(f_tc_rsl_chan_initial_ms_pwr)); |
| 3126 | } |
| 3127 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 3128 | /* Test if a channel without valid uplink bursts generates RSL CONN FAIL IND (TS 48.058 4.10) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3129 | private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3130 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3131 | RSL.clear; |
| 3132 | |
| 3133 | f_est_dchan(); |
| 3134 | f_sleep(2.0); |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 3135 | L1CTL.send(ts_L1CTL_DM_REL_REQ(g_chan_nr)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3136 | |
| 3137 | timer T := 40.0; |
| 3138 | T.start; |
| 3139 | alt { |
| 3140 | [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) { |
| 3141 | setverdict(pass) |
| 3142 | } |
| 3143 | [] RSL.receive { repeat }; |
| 3144 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3145 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No CONN FAIL IND received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3146 | } |
| 3147 | } |
| 3148 | f_rsl_chan_deact(); |
| 3149 | } |
| 3150 | testcase TC_conn_fail_crit() runs on test_CT { |
| 3151 | var ConnHdlr vc_conn; |
| 3152 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3153 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3154 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN)); |
| 3155 | pars.t_guard := 60.0; |
| 3156 | vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars); |
| 3157 | vc_conn.done; |
| 3158 | } |
| 3159 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 3160 | /*********************************************************************** |
| 3161 | * Paging |
| 3162 | ***********************************************************************/ |
| 3163 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3164 | private function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3165 | if (tmsi == 'FFFFFFFF'O) { |
| 3166 | return true; |
| 3167 | } else { |
| 3168 | return false; |
| 3169 | } |
| 3170 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3171 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3172 | private type record allowedFn { integer frame_nr } |
| 3173 | private template allowedFn bs_ag_blks_res_0 := { frame_nr := (6, 12, 16, 22, 26, 32, 36, 42, 46) } |
| 3174 | private template allowedFn bs_ag_blks_res_1 := { frame_nr := (12, 16, 22, 26, 32, 36, 42, 46) } |
| 3175 | private template allowedFn bs_ag_blks_res_2 := { frame_nr := (16, 22, 26, 32, 36, 42, 46) } |
| 3176 | private template allowedFn bs_ag_blks_res_3 := { frame_nr := (22, 26, 32, 36, 42, 46) } |
| 3177 | private template allowedFn bs_ag_blks_res_4 := { frame_nr := (26, 32, 36, 42, 46) } |
| 3178 | private template allowedFn bs_ag_blks_res_5 := { frame_nr := (32, 36, 42, 46) } |
| 3179 | private template allowedFn bs_ag_blks_res_6 := { frame_nr := (36, 42, 46) } |
| 3180 | private template allowedFn bs_ag_blks_res_7 := { frame_nr := (42, 46) } |
| 3181 | private function check_pch_fn(integer frame_nr, integer bs_ag_blks_res) runs on test_CT |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3182 | { |
| 3183 | var integer frame_nr_51; |
| 3184 | frame_nr_51 := frame_nr mod 51 |
| 3185 | |
| 3186 | var allowedFn fn_check; |
| 3187 | fn_check.frame_nr := frame_nr_51; |
| 3188 | |
| 3189 | if (bs_ag_blks_res < 0 or bs_ag_blks_res > 7) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3190 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "bs_ag_blks_res out of valid range (0..7)"); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3191 | return; |
| 3192 | } |
| 3193 | |
| 3194 | if (bs_ag_blks_res == 0 and match(fn_check, bs_ag_blks_res_0)) { |
| 3195 | return; |
| 3196 | } |
| 3197 | if (bs_ag_blks_res == 1 and match(fn_check, bs_ag_blks_res_1)) { |
| 3198 | return; |
| 3199 | } |
| 3200 | if (bs_ag_blks_res == 2 and match(fn_check, bs_ag_blks_res_2)) { |
| 3201 | return; |
| 3202 | } |
| 3203 | if (bs_ag_blks_res == 3 and match(fn_check, bs_ag_blks_res_3)) { |
| 3204 | return; |
| 3205 | } |
| 3206 | if (bs_ag_blks_res == 4 and match(fn_check, bs_ag_blks_res_4)) { |
| 3207 | return; |
| 3208 | } |
| 3209 | if (bs_ag_blks_res == 5 and match(fn_check, bs_ag_blks_res_5)) { |
| 3210 | return; |
| 3211 | } |
| 3212 | if (bs_ag_blks_res == 6 and match(fn_check, bs_ag_blks_res_6)) { |
| 3213 | return; |
| 3214 | } |
| 3215 | if (bs_ag_blks_res == 7 and match(fn_check, bs_ag_blks_res_7)) { |
| 3216 | return; |
| 3217 | } |
| 3218 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3219 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "received paging on AGCH"); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3220 | return; |
| 3221 | } |
| 3222 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3223 | private altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, |
| 3224 | inout integer num_paging_rcv_ids, |
| 3225 | PagingTestCfg cfg) |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3226 | runs on test_CT { |
| 3227 | var L1ctlDlMessage dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 3228 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_DummyUI)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3229 | repeat; |
| 3230 | } |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 3231 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3232 | var octetstring without_plen := |
| 3233 | substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1); |
| 3234 | var PDU_ML3_NW_MS rr := dec_PDU_ML3_NW_MS(without_plen); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3235 | |
| 3236 | check_pch_fn(dl.dl_info.frame_nr, cfg.bs_ag_blks_res); |
| 3237 | |
Vadim Yanitskiy | 36aa07c | 2020-03-31 14:33:43 +0700 | [diff] [blame] | 3238 | if (match(rr, tr_PAGING_REQ1(tr_MI_LV(t_MI_NoIdentity(?))))) { |
| 3239 | /* Ignore empty RR Paging Request (PCH filling) messages. |
| 3240 | * TODO: does it make sense to count them? */ |
| 3241 | } else if (match(rr, tr_PAGING_REQ1)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3242 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 3243 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
Vadim Yanitskiy | d665c23 | 2020-03-30 14:40:41 +0700 | [diff] [blame] | 3244 | if (ispresent(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3245 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3246 | } |
| 3247 | } else if (match(rr, tr_PAGING_REQ2)) { |
| 3248 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 3249 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) { |
| 3250 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3251 | } |
| 3252 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) { |
| 3253 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3254 | } |
Vadim Yanitskiy | d665c23 | 2020-03-30 14:40:41 +0700 | [diff] [blame] | 3255 | if (ispresent(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3256 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3257 | } |
| 3258 | } else if (match(rr, tr_PAGING_REQ3)) { |
| 3259 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 3260 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) { |
| 3261 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3262 | } |
| 3263 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) { |
| 3264 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3265 | } |
| 3266 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) { |
| 3267 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3268 | } |
| 3269 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) { |
| 3270 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 3271 | } |
| 3272 | } |
| 3273 | repeat; |
| 3274 | } |
| 3275 | } |
| 3276 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3277 | private type record PagingTestCfg { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3278 | boolean combined_ccch, |
| 3279 | integer bs_ag_blks_res, |
| 3280 | float load_factor, |
| 3281 | boolean exp_load_ind, |
| 3282 | boolean exp_overload, |
| 3283 | boolean use_tmsi |
| 3284 | } |
| 3285 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3286 | private type record PagingTestState { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3287 | integer num_paging_sent, |
| 3288 | integer num_paging_rcv_msgs, |
| 3289 | integer num_paging_rcv_ids, |
| 3290 | integer num_overload |
| 3291 | } |
| 3292 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3293 | /* Helper function for paging related testing */ |
| 3294 | private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3295 | f_init(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3296 | f_init_l1ctl(); |
| 3297 | f_l1_tune(L1CTL); |
| 3298 | |
| 3299 | var PagingTestState st := { |
| 3300 | num_paging_sent := 0, |
| 3301 | num_paging_rcv_msgs := 0, |
| 3302 | num_paging_rcv_ids := 0, |
| 3303 | num_overload := 0 |
| 3304 | }; |
| 3305 | |
| 3306 | var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res); |
| 3307 | var float max_pch_imsi_per_sec; |
| 3308 | if (cfg.use_tmsi) { |
| 3309 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */ |
| 3310 | } else { |
| 3311 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */ |
| 3312 | } |
| 3313 | var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor; |
| 3314 | var float interval := 1.0 / pch_blocks_per_sec; |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3315 | var float time_total := 20.0; |
| 3316 | var integer pkt_total := float2int(time_total * pch_blocks_per_sec); |
| 3317 | log("pch_blocks_total=", pkt_total," pch_blocks_per_sec=", pch_blocks_per_sec, " interval=", interval); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3318 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3319 | timer T_total := 300.0; /* big value (far bigger than time_total), used to count elapsed time */ |
| 3320 | T_total.start; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3321 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3322 | timer T_itv := 0.0; |
| 3323 | T_itv.start; |
| 3324 | while (st.num_paging_sent < pkt_total) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3325 | alt { |
| 3326 | /* check for presence of CCCH LOAD IND (paging load) */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3327 | [cfg.exp_overload] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3328 | st.num_overload := st.num_overload + 1; |
| 3329 | repeat; |
| 3330 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3331 | [not cfg.exp_overload] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND(0))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3332 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PCH Overload"); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3333 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3334 | [cfg.exp_load_ind] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3335 | log("Rx LOAD_IND"); |
| 3336 | /* FIXME: analyze/verify interval + contents */ |
| 3337 | repeat; |
| 3338 | } |
| 3339 | /* check if paging requests arrive on Um side */ |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3340 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids, cfg); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3341 | [] L1CTL.receive { repeat; } |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3342 | [] T_itv.timeout { |
| 3343 | /* Send paging cmds based on elapsed time */ |
| 3344 | var integer new_sent := f_min(pkt_total, float2int(T_total.read * pch_blocks_per_sec) + 1); |
| 3345 | while (st.num_paging_sent < new_sent) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3346 | var MobileIdentityV mi; |
| 3347 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3348 | /* build mobile Identity */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3349 | if (cfg.use_tmsi) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3350 | mi := valueof(t_MI_TMSI(f_rnd_octstring(4))); |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3351 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3352 | mi := valueof(ts_MI_IMSI(f_gen_imsi(st.num_paging_sent))); |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3353 | } |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3354 | |
| 3355 | /* Send RSL PAGING COMMAND */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3356 | RSL_CCHAN.send(ts_ASP_RSL_UD(ts_RSL_PAGING_CMD(mi, st.num_paging_sent mod 4))); |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3357 | |
| 3358 | st.num_paging_sent := st.num_paging_sent + 1; |
| 3359 | } |
| 3360 | if (st.num_paging_sent < pkt_total) { |
| 3361 | /* Wait for interval to next PAGING COMMAND */ |
| 3362 | var float time_now := T_total.read; |
| 3363 | var float next_sched := int2float(st.num_paging_sent)*interval; |
| 3364 | if (next_sched > time_now) { |
| 3365 | T_itv.start(next_sched - time_now); |
| 3366 | } else { |
| 3367 | T_itv.start(0.0); |
| 3368 | } |
| 3369 | } else { |
| 3370 | /* We are done, no need to keep counting */ |
| 3371 | T_total.stop; |
| 3372 | } |
| 3373 | } |
| 3374 | [] T_total.timeout { } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3375 | } |
| 3376 | } |
| 3377 | |
| 3378 | /* wait for max 18s for paging queue to drain (size: 200, ~ 13 per s -> 15s) */ |
| 3379 | timer T_wait := 18.0; |
| 3380 | T_wait.start; |
| 3381 | alt { |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 3382 | [] as_l1_count_paging(st.num_paging_rcv_msgs, st.num_paging_rcv_ids, cfg); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3383 | [] L1CTL.receive { repeat; } |
| 3384 | /* 65535 == empty paging queue, we can terminate*/ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3385 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { } |
| 3386 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND)) { repeat; } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3387 | [] T_wait.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3388 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Waiting for empty paging queue"); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3389 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3390 | } |
| 3391 | |
| 3392 | log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs, |
| 3393 | " rcvd_ids=", st.num_paging_rcv_ids); |
| 3394 | return st; |
| 3395 | } |
| 3396 | |
| 3397 | /* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that |
| 3398 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 3399 | * - that CCCH LOAD IND (PCH) are being generated |
| 3400 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 3401 | testcase TC_paging_imsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3402 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3403 | var PagingTestCfg cfg := { |
| 3404 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3405 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3406 | load_factor := 0.8, |
| 3407 | exp_load_ind := true, |
| 3408 | exp_overload := false, |
| 3409 | use_tmsi := false |
| 3410 | }; |
| 3411 | var PagingTestState st := f_TC_paging(cfg); |
| 3412 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3413 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 3414 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3415 | } else { |
| 3416 | setverdict(pass); |
| 3417 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3418 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3419 | } |
| 3420 | |
| 3421 | /* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that |
| 3422 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 3423 | * - that CCCH LOAD IND (PCH) are being generated |
| 3424 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 3425 | testcase TC_paging_tmsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3426 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3427 | var PagingTestCfg cfg := { |
| 3428 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3429 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3430 | load_factor := 0.8, |
| 3431 | exp_load_ind := true, |
| 3432 | exp_overload := false, |
| 3433 | use_tmsi := true |
| 3434 | }; |
| 3435 | var PagingTestState st := f_TC_paging(cfg); |
| 3436 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3437 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 3438 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3439 | } else { |
| 3440 | setverdict(pass); |
| 3441 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3442 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3443 | } |
| 3444 | |
| 3445 | /* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that |
| 3446 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 3447 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 3448 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 3449 | testcase TC_paging_imsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3450 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3451 | var PagingTestCfg cfg := { |
| 3452 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3453 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3454 | load_factor := 2.0, |
| 3455 | exp_load_ind := true, |
| 3456 | exp_overload := true, |
| 3457 | use_tmsi := false |
| 3458 | }; |
| 3459 | var PagingTestState st := f_TC_paging(cfg); |
| 3460 | /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200 |
| 3461 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3462 | var template integer tpl := (st.num_paging_sent*78/100 .. st.num_paging_sent *85/100); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3463 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3464 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3465 | } else { |
| 3466 | setverdict(pass); |
| 3467 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3468 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3469 | } |
| 3470 | |
| 3471 | /* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that |
| 3472 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 3473 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 3474 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 3475 | testcase TC_paging_tmsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3476 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3477 | var PagingTestCfg cfg := { |
| 3478 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 3479 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3480 | load_factor := 2.0, |
| 3481 | exp_load_ind := true, |
| 3482 | exp_overload := true, |
| 3483 | use_tmsi := true |
| 3484 | }; |
| 3485 | var PagingTestState st := f_TC_paging(cfg); |
| 3486 | /* We expect about 70% to pass, given that we can fill the paging buffer of 200 |
| 3487 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 3488 | var template integer tpl := (st.num_paging_sent*64/100 .. st.num_paging_sent *72/100); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3489 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3490 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3491 | } else { |
| 3492 | setverdict(pass); |
| 3493 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3494 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3495 | } |
| 3496 | |
| 3497 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 3498 | /*********************************************************************** |
| 3499 | * Immediate Assignment / AGCH |
| 3500 | ***********************************************************************/ |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 3501 | private const MobileAllocationLV c_MA_null := { |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3502 | len := 0, |
| 3503 | ma := ''B |
| 3504 | } |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 3505 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3506 | private function f_fmt_ia_stats(integer num_tx, integer num_rx, integer num_del) return charstring { |
| 3507 | return int2str(num_tx) & " sent, " |
| 3508 | & int2str(num_rx) & " received, " |
| 3509 | & int2str(num_del) & " deleted"; |
| 3510 | } |
| 3511 | |
| 3512 | private function f_TC_imm_ass(integer num_total, float sleep_s, float exp_pass) runs on test_CT { |
| 3513 | var L1ctlDlMessage l1_dl; |
| 3514 | timer T := 10.0; |
| 3515 | var integer num_tx := 0; |
| 3516 | var integer num_rx := 0; |
| 3517 | var integer num_del := 0; |
| 3518 | var charstring res_str; |
| 3519 | var float rx_ratio; |
| 3520 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3521 | f_init(); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3522 | f_init_l1ctl(); |
| 3523 | f_l1_tune(L1CTL); |
| 3524 | |
| 3525 | for (var integer i := 0; i < num_total; i := i+1) { |
Vadim Yanitskiy | f7181ed | 2020-07-14 20:12:02 +0700 | [diff] [blame] | 3526 | var ChannelDescription ch_desc := valueof(ts_ChanDescH0(t_RslChanNr_SDCCH4(0, 0), mp_trx0_arfcn)); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3527 | var GsmRrMessage ia := valueof(ts_IMM_ASS(42, i, 5, ch_desc, c_MA_null)); |
| 3528 | var octetstring ia_enc := enc_GsmRrMessage(ia); |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3529 | RSL_CCHAN.send(ts_ASP_RSL_UD(ts_RSL_IMM_ASSIGN(ia_enc, 0))); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3530 | num_tx := num_tx+1; |
| 3531 | f_sleep(sleep_s); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3532 | } |
| 3533 | /* FIXME: check if imm.ass arrive on Um side */ |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3534 | T.start; |
| 3535 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 3536 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_DELETE_IND(?, 0))) { |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3537 | num_del := num_del+1; |
| 3538 | repeat; |
| 3539 | } |
| 3540 | [] RSL_CCHAN.receive { |
| 3541 | repeat; |
| 3542 | } |
| 3543 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?)) -> value l1_dl { |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3544 | var GsmRrMessage rr := dec_GsmRrMessage(l1_dl.payload.data_ind.payload); |
| 3545 | if (not match(rr, tr_IMM_ASS(42, ?, 5, ?, ?))) { |
| 3546 | /* FIXME: Why are we seeing paging requests on PCH/AGCH? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3547 | //Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected IMM-ASS values on AGCH: ", rr)); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3548 | } else { |
| 3549 | num_rx := num_rx+1; |
| 3550 | } |
| 3551 | repeat; |
| 3552 | } |
| 3553 | [] L1CTL.receive { repeat; } |
| 3554 | [] T.timeout { } |
| 3555 | } |
| 3556 | res_str := f_fmt_ia_stats(num_tx, num_rx, num_del); |
| 3557 | log("AGCH test: " & res_str); |
| 3558 | if (num_rx + num_del != num_tx) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3559 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX + DEL != TX ?!?: " & res_str); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3560 | } |
| 3561 | rx_ratio := int2float(num_rx) / int2float(num_tx); |
| 3562 | if (rx_ratio < exp_pass*0.8 or rx_ratio > exp_pass*1.2) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3563 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX ratio ("&float2str(rx_ratio)&") far from expected ("&float2str(exp_pass)&") " & res_str); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3564 | } else { |
| 3565 | setverdict(pass); |
| 3566 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3567 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 3568 | } |
| 3569 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 3570 | /* send a long burst of 1000 IMM.ASS with 20ms spacing (50 per s); expect 75% of them to be deleted */ |
| 3571 | testcase TC_imm_ass_1000_20ms() runs on test_CT { |
| 3572 | f_TC_imm_ass(1000, 0.02, 0.25); |
| 3573 | } |
| 3574 | |
| 3575 | /* send a short burst of 200 IMM.ASS without any spacing; expect 95% of them to be deleted */ |
| 3576 | testcase TC_imm_ass_200_0ms() runs on test_CT { |
| 3577 | f_TC_imm_ass(200, 0.0, 0.05); |
| 3578 | } |
| 3579 | |
| 3580 | /* send 150 IMM.ASS at rate of 13/s; expect none of them to be deleted */ |
| 3581 | testcase TC_imm_ass_200_76ms() runs on test_CT { |
| 3582 | f_TC_imm_ass(150, 0.076, 1.00); |
| 3583 | } |
| 3584 | |
| 3585 | |
| 3586 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3587 | /*********************************************************************** |
| 3588 | * BCCH |
| 3589 | ***********************************************************************/ |
| 3590 | |
| 3591 | /* tuple of Frame Number + decoded SI */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3592 | private type record SystemInformationFn { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3593 | GsmFrameNumber frame_number, |
| 3594 | SystemInformation si |
| 3595 | } |
| 3596 | |
| 3597 | /* an arbitrary-length vector of decoded SI + gsmtap header */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3598 | private type record of SystemInformationFn SystemInformationVector; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3599 | |
| 3600 | /* an array of SI-vectors indexed by TC value */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3601 | private type SystemInformationVector SystemInformationVectorPerTc[8]; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3602 | |
| 3603 | /* determine if a given SI vector contains given SI type at least once */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3604 | private function f_si_vecslot_contains(SystemInformationVector arr, |
| 3605 | RrMessageType key, |
| 3606 | boolean bcch_ext := false) |
| 3607 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3608 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 3609 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 3610 | if (not bcch_ext and fn_mod51 == 2 or |
| 3611 | bcch_ext and fn_mod51 == 6) { |
| 3612 | if (arr[i].si.header.message_type == key) { |
| 3613 | return true; |
| 3614 | } |
| 3615 | } |
| 3616 | } |
| 3617 | return false; |
| 3618 | } |
| 3619 | |
| 3620 | /* ensure a given TC slot of the SI vector contains given SI type at least once at TC */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3621 | private function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, |
| 3622 | integer tc, RrMessageType key, |
| 3623 | boolean ext_bcch := false) |
| 3624 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3625 | if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3626 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3627 | } |
| 3628 | } |
| 3629 | |
| 3630 | /* check if a given SI vector contains given SI type at least once on any TC */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3631 | private function f_si_vec_contains(SystemInformationVectorPerTc arr, |
| 3632 | RrMessageType key) |
| 3633 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3634 | for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) { |
| 3635 | if (f_si_vecslot_contains(arr[tc], key) or |
| 3636 | f_si_vecslot_contains(arr[tc], key, true)) { |
| 3637 | return true; |
| 3638 | } |
| 3639 | } |
| 3640 | return false; |
| 3641 | } |
| 3642 | |
| 3643 | /* determine if a given SI vector contains given SI type at least N of M times */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3644 | private function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, |
| 3645 | RrMessageType key, |
| 3646 | boolean bcch_ext := false, |
| 3647 | integer n := 1, integer m := 4) |
| 3648 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3649 | var integer count := 0; |
| 3650 | if (sizeof(arr) < m) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3651 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Error: Insufficient SI in array"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3652 | } |
| 3653 | for (var integer i:= 0; i < m; i := i + 1) { |
| 3654 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 3655 | if (not bcch_ext and fn_mod51 == 2 or |
| 3656 | bcch_ext and fn_mod51 == 6) { |
| 3657 | if (arr[i].si.header.message_type == key) { |
| 3658 | count := count + 1; |
| 3659 | } |
| 3660 | } |
| 3661 | } |
| 3662 | if (count >= n) { |
| 3663 | return true; |
| 3664 | } else { |
| 3665 | return false; |
| 3666 | } |
| 3667 | } |
| 3668 | |
| 3669 | /* ensure a given TC slot of the SI vector contains given SI type at least N out of M times at TC */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3670 | private function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, |
| 3671 | integer tc, RrMessageType key, |
| 3672 | boolean ext_bcch := false, |
| 3673 | integer n, integer m) |
| 3674 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3675 | if (not f_si_vecslot_contains_n_of_m(arr[tc], key, ext_bcch, n, m)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3676 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not ", n, "/", m, " of ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3677 | } |
| 3678 | } |
| 3679 | |
| 3680 | /* determine if a given SI vector contains given SI type at least once */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3681 | private function f_si_vecslot_contains_only(SystemInformationVector arr, |
| 3682 | RrMessageType key, |
| 3683 | boolean bcch_ext := false) |
| 3684 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3685 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 3686 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 3687 | if (not bcch_ext and fn_mod51 == 2 or |
| 3688 | bcch_ext and fn_mod51 == 6) { |
| 3689 | if (arr[i].si.header.message_type != key) { |
| 3690 | return false; |
| 3691 | } |
| 3692 | } |
| 3693 | } |
| 3694 | return true; |
| 3695 | } |
| 3696 | |
| 3697 | /* ensure a given TC slot of the SI vector contains only given SI type */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3698 | private function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, |
| 3699 | integer tc, RrMessageType key, |
| 3700 | boolean ext_bcch := false) |
| 3701 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3702 | if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3703 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Not all ", key, " in TC=", tc, "!")); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3704 | } |
| 3705 | } |
| 3706 | |
| 3707 | /* SI configuration of cell, against which we validate actual SI messages */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3708 | private type set SystemInformationConfig { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3709 | boolean bcch_extended, |
| 3710 | boolean si1_present, |
| 3711 | boolean si2bis_present, |
| 3712 | boolean si2ter_present, |
| 3713 | boolean si2quater_present, |
| 3714 | boolean si7_present, |
| 3715 | boolean si8_present, |
| 3716 | boolean si9_present, |
| 3717 | boolean si13_present, |
| 3718 | boolean si13alt_present, |
| 3719 | boolean si15_present, |
| 3720 | boolean si16_present, |
| 3721 | boolean si17_present, |
| 3722 | boolean si2n_present, |
| 3723 | boolean si21_present, |
| 3724 | boolean si22_present |
| 3725 | } |
| 3726 | |
| 3727 | /* validate the SI scheduling according to TS 45.002 version 14.1.0 Release 14, Section 6.3.1.3 */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3728 | private function f_validate_si_scheduling(SystemInformationConfig cfg, |
| 3729 | SystemInformationVectorPerTc si_per_tc) |
| 3730 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3731 | var integer i; |
| 3732 | for (i := 0; i < sizeof(si_per_tc); i := i + 1) { |
| 3733 | if (sizeof(si_per_tc[i]) == 0) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3734 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("No SI messages for TC=", i)); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3735 | } |
| 3736 | } |
| 3737 | if (cfg.si1_present) { |
| 3738 | /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or |
| 3739 | * when the NCH is present in a cell. If the MS finds another message on BCCH Norm |
| 3740 | * when TC = 0, it can assume that System Information Type 1 is not in use. */ |
| 3741 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 3742 | /* make sure *ALL* contain SI1 */ |
| 3743 | f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 3744 | } |
| 3745 | f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2); |
| 3746 | /* iii) A SI 2 message will be sent at least every time TC = 1 */ |
| 3747 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3); |
| 3748 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3); |
| 3749 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4); |
| 3750 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4); |
| 3751 | |
| 3752 | /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the |
| 3753 | * system operator. If only one of them is needed, it is sent when TC = 5. If both are |
| 3754 | * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4 |
| 3755 | * consecutive occurrences of TC = 4. */ |
| 3756 | if (cfg.si2bis_present and not cfg.si2ter_present) { |
| 3757 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 3758 | } else if (cfg.si2ter_present and not cfg.si2bis_present) { |
| 3759 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter); |
| 3760 | } else if (cfg.si2ter_present and cfg.si2bis_present) { |
| 3761 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 3762 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4); |
| 3763 | } |
| 3764 | |
| 3765 | if (cfg.si7_present or cfg.si8_present) { |
| 3766 | /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary |
| 3767 | * if System Information type 4 does not contain all information needed for cell |
| 3768 | * selection and reselection. */ |
| 3769 | if (not cfg.bcch_extended) { |
| 3770 | testcase.stop("Error: SI7/SI8 require BCCH Extd."); |
| 3771 | } |
| 3772 | if (cfg.si7_present) { |
| 3773 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true); |
| 3774 | } |
| 3775 | if (cfg.si8_present) { |
| 3776 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true); |
| 3777 | } |
| 3778 | } |
| 3779 | |
| 3780 | if (cfg.si2quater_present) { |
| 3781 | /* iii) System information type 2 quater is sent if needed, as determined by the system |
| 3782 | * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis |
| 3783 | * and 2ter are used, otherwise it shall be sent at least once within any of 4 |
| 3784 | * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once |
| 3785 | * within any of 4 consecutive occurrences of TC = 5. */ |
| 3786 | if (not (cfg.bcch_extended)) { |
| 3787 | if (not (cfg.si2bis_present or cfg.si2ter_present)) { |
| 3788 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater); |
| 3789 | } else { |
| 3790 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4); |
| 3791 | } |
| 3792 | } else { |
| 3793 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4); |
| 3794 | } |
| 3795 | } |
| 3796 | if (cfg.si9_present) { |
| 3797 | /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified |
| 3798 | * in system information type 3 as defined in 3GPP TS 44.018. */ |
| 3799 | f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3 |
| 3800 | } |
| 3801 | if (cfg.si13_present) { |
| 3802 | /* vii) System Information type 13 is only related to the GPRS service. System Information |
| 3803 | * Type 13 need only be sent if GPRS support is indicated in one or more of System |
| 3804 | * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the |
| 3805 | * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext. |
| 3806 | * In the case that the message is sent on the BCCH Norm, it is sent at least once |
| 3807 | * within any of 4 consecutive occurrences of TC=4. */ |
| 3808 | if (not cfg.bcch_extended) { |
| 3809 | log("not-bccch-extended"); |
| 3810 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4); |
| 3811 | } else { |
| 3812 | log("bccch-extended"); |
| 3813 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true); |
| 3814 | } |
| 3815 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3816 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3817 | } |
| 3818 | } |
| 3819 | if (cfg.si16_present or cfg.si17_present) { |
| 3820 | /* viii) System Information type 16 and 17 are only related to the SoLSA service. They |
| 3821 | * should not be sent in a cell where network sharing is used (see rule xv). */ |
| 3822 | if (cfg.si22_present) { |
| 3823 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 3824 | } |
| 3825 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3826 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3827 | } |
| 3828 | if (not cfg.bcch_extended) { |
| 3829 | testcase.stop("Error: SI16/SI17 requires BCCH Extd!"); |
| 3830 | } |
| 3831 | if (cfg.si16_present) { |
| 3832 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true); |
| 3833 | } |
| 3834 | if (cfg.si17_present) { |
| 3835 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true); |
| 3836 | } |
| 3837 | } |
| 3838 | |
| 3839 | /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM |
| 3840 | * broadcast information. The frequency with which they are sent is determined by the |
| 3841 | * system operator. System Information type 9 identifies the scheduling of System |
| 3842 | * Information type 18 and 20 messages. */ |
| 3843 | |
| 3844 | /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System |
| 3845 | * Information Type 19 is present, then its scheduling shall be indicated in System |
| 3846 | * Information Type 9. */ |
| 3847 | |
| 3848 | if (cfg.si15_present) { |
| 3849 | /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the |
| 3850 | * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive |
| 3851 | * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of |
| 3852 | * 4 consecutive occurrences of TC = 1. */ |
| 3853 | if (not cfg.bcch_extended) { |
| 3854 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4); |
| 3855 | } else { |
| 3856 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4); |
| 3857 | } |
| 3858 | } |
| 3859 | if (cfg.si13alt_present) { |
| 3860 | /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System |
| 3861 | * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in |
| 3862 | * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not |
| 3863 | * broadcast. These messages also indicate if the message is sent on the BCCH Norm or |
| 3864 | * if the message is transmitted on the BCCH Ext. In the case that the message is sent |
| 3865 | * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences |
| 3866 | * of TC = 4. */ |
| 3867 | if (cfg.si13_present) { |
| 3868 | testcase.stop("Error: Cannot have SI13alt and SI13"); |
| 3869 | } |
| 3870 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3871 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3872 | } |
| 3873 | if (not cfg.bcch_extended) { |
| 3874 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4); |
| 3875 | } else { |
| 3876 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true); |
| 3877 | } |
| 3878 | } |
| 3879 | if (cfg.si2n_present) { |
| 3880 | /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed, |
| 3881 | * as determined by the system operator. In the case that the message is sent on the |
| 3882 | * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC = |
| 3883 | * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2 |
| 3884 | * consecutive occurrences of TC = 4. */ |
| 3885 | if (not cfg.bcch_extended) { |
| 3886 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4); |
| 3887 | } else { |
| 3888 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4); |
| 3889 | } |
| 3890 | } |
| 3891 | if (cfg.si21_present) { |
| 3892 | /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as |
| 3893 | * determined by the system operator. If Extended Access Barring is in use in the cell |
| 3894 | * then this message is sent at least once within any of 4 consecutive occurrences of |
| 3895 | * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a |
| 3896 | * cell then this message shall only be sent on BCCH Ext. */ |
| 3897 | if (not cfg.bcch_extended) { |
| 3898 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4); |
| 3899 | } else { |
| 3900 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4); |
| 3901 | if (f_si_vecslot_contains(si_per_tc[4], SYSTEM_INFORMATION_TYPE_21)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3902 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI21 on BCCH Norm if BCCH Extd enabled!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3903 | } |
| 3904 | } |
| 3905 | } |
| 3906 | if (cfg.si22_present) { |
| 3907 | /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It |
| 3908 | * should not be sent in a cell where SoLSA is used (see rule viii). System |
| 3909 | * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC |
| 3910 | * =2 and TC=6. */ |
| 3911 | if (cfg.si16_present or cfg.si17_present) { |
| 3912 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 3913 | } |
| 3914 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or |
| 3915 | f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3916 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI16/SI17 and SI22!"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3917 | } |
| 3918 | if (not cfg.bcch_extended) { |
| 3919 | testcase.stop("Error: SI22 requires BCCH Extd!"); |
| 3920 | } else { |
| 3921 | f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true); |
| 3922 | f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true); |
| 3923 | } |
| 3924 | } |
| 3925 | } |
| 3926 | |
| 3927 | /* sample Systme Information for specified duration via L1CTL */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3928 | private function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) |
| 3929 | return SystemInformationVectorPerTc { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3930 | timer T := duration; |
| 3931 | var SystemInformationVectorPerTc si_per_tc; |
| 3932 | var L1ctlDlMessage l1_dl; |
| 3933 | |
| 3934 | /* initialize all per-TC vectors empty */ |
| 3935 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 3936 | si_per_tc[i] := {}; |
| 3937 | } |
| 3938 | |
| 3939 | /* flush all previous L1 queued msgs */ |
| 3940 | pt.clear; |
| 3941 | |
| 3942 | T.start; |
| 3943 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 3944 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 3945 | var SystemInformationFn sig := { frame_number := l1_dl.dl_info.frame_nr }; |
| 3946 | if (dec_SystemInformationSafe(l1_dl.payload.data_ind.payload, sig.si) != 0) { |
| 3947 | log("Ignoring non-RR or invalid SI ", l1_dl); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3948 | repeat; |
| 3949 | } |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 3950 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3951 | var integer tc := f_gsm_compute_tc(sig.frame_number); |
| 3952 | log("SI received at TC=", tc, ": ", sig.si); |
| 3953 | /* append to the per-TC bucket */ |
| 3954 | si_per_tc[tc] := si_per_tc[tc] & { sig }; |
| 3955 | repeat; |
| 3956 | } |
| 3957 | [] pt.receive { repeat; } |
| 3958 | [] T.timeout { } |
| 3959 | } |
| 3960 | |
| 3961 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 3962 | log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i])); |
| 3963 | } |
| 3964 | log("si_per_tc=", si_per_tc); |
| 3965 | return si_per_tc; |
| 3966 | } |
| 3967 | |
| 3968 | /* helper function: Set given SI via RSL + validate scheduling. |
| 3969 | * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3970 | private function f_TC_si_sched() runs on test_CT { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3971 | var SystemInformationVectorPerTc si_per_tc; |
| 3972 | f_init_l1ctl(); |
| 3973 | f_l1_tune(L1CTL); |
| 3974 | |
| 3975 | /* Sample + Validate Scheduling */ |
| 3976 | si_per_tc := f_l1_sample_si(L1CTL); |
| 3977 | f_validate_si_scheduling(si_cfg, si_per_tc); |
| 3978 | |
| 3979 | setverdict(pass); |
| 3980 | } |
| 3981 | |
| 3982 | testcase TC_si_sched_default() runs on test_CT { |
| 3983 | f_init(); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 3984 | /* 2+3+4 are mandatory and set in f_init() */ |
| 3985 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3986 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 3987 | } |
| 3988 | |
| 3989 | testcase TC_si_sched_1() runs on test_CT { |
| 3990 | f_init(); |
| 3991 | si_cfg.si1_present := true; |
| 3992 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3993 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3994 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 3995 | } |
| 3996 | |
| 3997 | testcase TC_si_sched_2bis() runs on test_CT { |
| 3998 | f_init(); |
| 3999 | si_cfg.si2bis_present := true; |
| 4000 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 4001 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4002 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4003 | } |
| 4004 | |
| 4005 | testcase TC_si_sched_2ter() runs on test_CT { |
| 4006 | f_init(); |
| 4007 | si_cfg.si2ter_present := true; |
| 4008 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 4009 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4010 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4011 | } |
| 4012 | |
| 4013 | testcase TC_si_sched_2ter_2bis() runs on test_CT { |
| 4014 | f_init(); |
| 4015 | si_cfg.si2bis_present := true; |
| 4016 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 4017 | si_cfg.si2ter_present := true; |
| 4018 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 4019 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4020 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4021 | } |
| 4022 | |
| 4023 | testcase TC_si_sched_2quater() runs on test_CT { |
| 4024 | f_init(); |
| 4025 | si_cfg.si2quater_present := true; |
| 4026 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 4027 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4028 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4029 | } |
| 4030 | |
| 4031 | testcase TC_si_sched_13() runs on test_CT { |
| 4032 | f_init(); |
| 4033 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 4034 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4035 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4036 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4037 | } |
| 4038 | |
| 4039 | testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT { |
| 4040 | f_init(); |
| 4041 | si_cfg.si2bis_present := true; |
| 4042 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 4043 | si_cfg.si2ter_present := true; |
| 4044 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 4045 | si_cfg.si2quater_present := true; |
| 4046 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607a8a0364aa698d72ff424feee0506d5e7fff02043'O); |
| 4047 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 4048 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4049 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4050 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4051 | } |
| 4052 | |
| 4053 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4054 | testcase TC_bcch_info() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4055 | f_init(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4056 | /* FIXME: enable / disable individual BCCH info */ |
| 4057 | //ts_RSL_BCCH_INFO(si_type, info); |
| 4058 | /* expect no ERROR REPORT after either of them * |
| 4059 | /* negative test: ensure ERROR REPORT on unsupported types */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4060 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4061 | } |
| 4062 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 4063 | /*********************************************************************** |
| 4064 | * Low-Level Protocol Errors / ERROR REPORT |
| 4065 | ***********************************************************************/ |
| 4066 | |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4067 | private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT { |
| 4068 | timer T := 5.0; |
| 4069 | T.start; |
| 4070 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4071 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_ERROR_REPORT(cause))) { |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4072 | setverdict(pass); |
| 4073 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4074 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_ERROR_REPORT(?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4075 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Wrong cause in RSL ERR REP"); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4076 | } |
| 4077 | [] RSL_CCHAN.receive { |
| 4078 | repeat; |
| 4079 | } |
| 4080 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4081 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RSL ERR REP"); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4082 | } |
| 4083 | } |
| 4084 | } |
| 4085 | |
| 4086 | /* Provoke a protocol error (message too short) and match on ERROR REPORT */ |
| 4087 | testcase TC_rsl_protocol_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4088 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4089 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 4090 | rsl.ies := omit; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4091 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4092 | |
| 4093 | f_exp_err_rep(RSL_ERR_PROTO); |
| 4094 | } |
| 4095 | |
| 4096 | /* Provoke a mandatory IE error and match on ERROR REPORT */ |
| 4097 | testcase TC_rsl_mand_ie_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4098 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4099 | |
| 4100 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 4101 | rsl.ies := { rsl.ies[0] }; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4102 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4103 | |
| 4104 | f_exp_err_rep(RSL_ERR_MAND_IE_ERROR); |
| 4105 | } |
| 4106 | |
| 4107 | /* Provoke an IE content error and match on ERROR REPORT */ |
| 4108 | testcase TC_rsl_ie_content_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4109 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4110 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 4111 | rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4112 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 4113 | |
| 4114 | f_exp_err_rep(RSL_ERR_IE_CONTENT); |
| 4115 | } |
| 4116 | |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4117 | /* attempt to activate channel with wrong RSL Message Discriminator IE */ |
| 4118 | function f_TC_chan_act_wrong_mdisc(charstring id) runs on ConnHdlr { |
| 4119 | var template RSL_Message rsl := ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode); |
| 4120 | rsl.msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RESERVED, false); |
| 4121 | RSL.send(rsl); |
| 4122 | f_rslem_unregister(0, g_chan_nr); |
| 4123 | } |
| 4124 | testcase TC_err_rep_wrong_mdisc() runs on test_CT { |
| 4125 | var ConnHdlr vc_conn; |
| 4126 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 4127 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4128 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4129 | |
| 4130 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_mdisc), pars); |
| 4131 | vc_conn.done; |
| 4132 | f_exp_err_rep(RSL_ERR_MSG_DISCR); |
| 4133 | |
| 4134 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 4135 | } |
| 4136 | |
| 4137 | /* Send messages with wrong message type */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4138 | private function f_TC_wrong_msg_type_dchan(charstring id) runs on ConnHdlr { |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4139 | var template (value) RSL_Message rsl_tx; |
| 4140 | rsl_tx := ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode); |
| 4141 | rsl_tx.msg_type := RSL_MT_NOT_CMD; |
| 4142 | RSL.send(rsl_tx); |
| 4143 | f_rslem_unregister(0, g_chan_nr); |
| 4144 | } |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4145 | private function f_TC_wrong_msg_type_rll(charstring id) runs on ConnHdlr { |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4146 | var template (value) RSL_Message rsl_tx; |
| 4147 | /* we first have to activate the dedicated channel */ |
| 4148 | f_rsl_chan_act(g_pars.chan_mode); |
| 4149 | /* ... to then send an invalid RLL message */ |
| 4150 | rsl_tx := ts_RSL_UNITDATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), '0102'O); |
| 4151 | rsl_tx.msg_type := RSL_MT_CBCH_LOAD_IND; |
| 4152 | RSL.send(rsl_tx); |
| 4153 | f_rslem_unregister(0, g_chan_nr); |
| 4154 | } |
| 4155 | testcase TC_err_rep_wrong_msg_type() runs on test_CT { |
| 4156 | var ConnHdlr vc_conn; |
| 4157 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 4158 | var template (value) RSL_Message rsl_tx; |
| 4159 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4160 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4161 | |
| 4162 | /* Common Channel with wrong message type */ |
| 4163 | RSL_CCHAN.clear; |
| 4164 | rsl_tx := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 4165 | rsl_tx.msg_type := RSL_MT_LOCATION_INFO; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4166 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl_tx)); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4167 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 4168 | |
| 4169 | /* TRX Management */ |
| 4170 | RSL_CCHAN.clear; |
| 4171 | rsl_tx := ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, ''O); |
| 4172 | rsl_tx.msg_type := RSL_MT_UNIT_DATA_IND; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4173 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl_tx)); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4174 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 4175 | |
| 4176 | /* Dedicated Channel */ |
| 4177 | RSL_CCHAN.clear; |
| 4178 | vc_conn := f_start_handler(refers(f_TC_wrong_msg_type_dchan), pars); |
| 4179 | vc_conn.done; |
| 4180 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 4181 | |
| 4182 | /* RLL */ |
| 4183 | RSL_CCHAN.clear; |
| 4184 | vc_conn := f_start_handler(refers(f_TC_wrong_msg_type_rll), pars); |
| 4185 | vc_conn.done; |
| 4186 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 4187 | } |
| 4188 | |
| 4189 | /* Send messages in wrong sequence (RLL to an inactive lchan) */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4190 | private function f_TC_err_rep_wrong_sequence(charstring id) runs on ConnHdlr { |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4191 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), '0102'O)); |
| 4192 | f_rslem_unregister(0, g_chan_nr); |
| 4193 | } |
| 4194 | testcase TC_err_rep_wrong_sequence() runs on test_CT { |
| 4195 | var ConnHdlr vc_conn; |
| 4196 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 4197 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4198 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 4199 | |
| 4200 | RSL_CCHAN.clear; |
| 4201 | vc_conn := f_start_handler(refers(f_TC_err_rep_wrong_sequence), pars); |
| 4202 | vc_conn.done; |
| 4203 | f_exp_err_rep(RSL_ERR_MSG_SEQ); |
| 4204 | } |
| 4205 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 4206 | /*********************************************************************** |
| 4207 | * IPA CRCX/MDCX/DLCS media stream handling |
| 4208 | ***********************************************************************/ |
| 4209 | |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 4210 | /* Send IPA DLCX to inactive lchan */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4211 | private function f_TC_ipa_dlcx_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 4212 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 4213 | "IPA DLCX ACK"); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 4214 | } |
| 4215 | testcase TC_ipa_dlcx_not_active() runs on test_CT { |
| 4216 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4217 | f_init(); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 4218 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_dlcx_not_active), pars); |
| 4219 | vc_conn.done; |
| 4220 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4221 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4222 | /* Send IPA CRCX twice to inactive lchan */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4223 | private function f_TC_ipa_crcx_twice_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4224 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 4225 | "IPA CRCX ACK"); |
| 4226 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL), |
| 4227 | "IPA CRCX NACK"); |
| 4228 | } |
| 4229 | testcase TC_ipa_crcx_twice_not_active() runs on test_CT { |
| 4230 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4231 | f_init(); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4232 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars); |
| 4233 | vc_conn.done; |
| 4234 | } |
| 4235 | |
| 4236 | /* Regular sequence of CRCX/MDCX/DLCX */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4237 | private function f_TC_ipa_crcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4238 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 4239 | "IPA CRCX ACK"); |
| 4240 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 4241 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 4242 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 4243 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 4244 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 4245 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 4246 | "IPA MDCX ACK"); |
| 4247 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 4248 | "IPA DLCX ACK"); |
| 4249 | } |
| 4250 | testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT { |
| 4251 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4252 | f_init(); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4253 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars); |
| 4254 | vc_conn.done; |
| 4255 | } |
| 4256 | |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 4257 | /* Sequence of CRCX, 2x MDCX, DLCX */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4258 | private function f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 4259 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 4260 | "IPA CRCX ACK"); |
| 4261 | var uint32_t remote_ip := f_rnd_int(c_UINT32_MAX); |
| 4262 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 4263 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 4264 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 4265 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 4266 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 4267 | "IPA MDCX ACK"); |
| 4268 | /* Second MDCX */ |
| 4269 | remote_ip := f_rnd_int(c_UINT32_MAX); |
| 4270 | remote_port := f_rnd_int(c_UINT16_MAX); |
| 4271 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 4272 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 4273 | "IPA MDCX ACK"); |
| 4274 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 4275 | "IPA DLCX ACK"); |
| 4276 | } |
| 4277 | testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT { |
| 4278 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4279 | f_init(); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 4280 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars); |
| 4281 | vc_conn.done; |
| 4282 | } |
| 4283 | |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 4284 | /* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 4285 | private function f_TC_ipa_crcx_sdcch_not_active(charstring id) runs on ConnHdlr { |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 4286 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?), |
| 4287 | "IPA CRCX NACK"); |
| 4288 | } |
| 4289 | testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT { |
| 4290 | var ConnHdlrPars pars; |
| 4291 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4292 | f_init(); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 4293 | |
| 4294 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN)); |
| 4295 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 4296 | vc_conn.done; |
| 4297 | |
| 4298 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN)); |
| 4299 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 4300 | vc_conn.done; |
| 4301 | } |
| 4302 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 4303 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4304 | /*********************************************************************** |
| 4305 | * PCU Socket related tests |
| 4306 | ***********************************************************************/ |
| 4307 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 4308 | /* Verify no RTS before ACT_REQ; verify RTS after ACT_REQ */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4309 | friend function f_TC_pcu_act_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, boolean exp_success) |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4310 | runs on test_CT { |
| 4311 | timer T := 3.0; |
| 4312 | |
| 4313 | /* we don't expect any RTS.req before PDCH are active */ |
| 4314 | T.start; |
| 4315 | alt { |
| 4316 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4317 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "PCU RTS.req before PDCH active?"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4318 | } |
| 4319 | [] PCU.receive { repeat; } |
| 4320 | [] T.timeout { } |
| 4321 | } |
| 4322 | |
| 4323 | /* Send PDCH activate request for known PDCH timeslot */ |
| 4324 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, ts_nr))); |
| 4325 | |
| 4326 | /* we now expect RTS.req for this timeslot (only) */ |
| 4327 | T.start; |
| 4328 | alt { |
| 4329 | [exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
| 4330 | setverdict(pass); |
| 4331 | } |
| 4332 | [not exp_success] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, |
| 4333 | tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4334 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RTS.req for supposedly failing activation"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4335 | } |
| 4336 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4337 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RTS.req for wrong TRX/TS"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4338 | } |
| 4339 | [] PCU.receive { repeat; } |
| 4340 | [exp_success] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4341 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU RTS.req"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4342 | } |
| 4343 | [not exp_success] T.timeout { |
| 4344 | setverdict(pass); |
| 4345 | } |
| 4346 | } |
| 4347 | } |
| 4348 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 4349 | /* verify no more RTS after DEACT_REQ */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4350 | friend function f_TC_pcu_deact_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4351 | runs on test_CT { |
| 4352 | timer T := 3.0; |
| 4353 | |
| 4354 | /* Send PDCH activate request for known PDCH timeslot */ |
| 4355 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, ts_nr))); |
| 4356 | |
| 4357 | PCU.clear; |
| 4358 | /* we now expect no RTS.req for this timeslot */ |
| 4359 | T.start; |
| 4360 | alt { |
| 4361 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4362 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected PCU RTS.req"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4363 | } |
| 4364 | [] PCU.receive { repeat; } |
| 4365 | [] T.timeout { |
| 4366 | setverdict(pass); |
| 4367 | } |
| 4368 | } |
| 4369 | } |
| 4370 | |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4371 | friend function f_init_pcu_test() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4372 | f_init(); |
| 4373 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename()))); |
| 4374 | } |
| 4375 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4376 | /* PDCH activation via PCU socket; check for presence of RTS.req */ |
| 4377 | testcase TC_pcu_act_req() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4378 | f_init_pcu_test(); |
| 4379 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4380 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4381 | } |
| 4382 | |
| 4383 | /* PDCH activation via PCU socket on non-PDCU timeslot */ |
| 4384 | testcase TC_pcu_act_req_wrong_ts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4385 | f_init_pcu_test(); |
| 4386 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4387 | f_TC_pcu_act_req(0, 0, 1, false); |
| 4388 | } |
| 4389 | |
| 4390 | /* PDCH activation via PCU socket on wrong BTS */ |
| 4391 | testcase TC_pcu_act_req_wrong_bts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4392 | f_init_pcu_test(); |
| 4393 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4394 | f_TC_pcu_act_req(23, 0, 7, false); |
| 4395 | } |
| 4396 | |
| 4397 | /* PDCH activation via PCU socket on wrong TRX */ |
| 4398 | testcase TC_pcu_act_req_wrong_trx() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4399 | f_init_pcu_test(); |
| 4400 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4401 | f_TC_pcu_act_req(0, 23, 7, false); |
| 4402 | } |
| 4403 | |
| 4404 | /* PDCH deactivation via PCU socket; check for absence of RTS.req */ |
| 4405 | testcase TC_pcu_deact_req() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4406 | f_init_pcu_test(); |
| 4407 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4408 | /* Activate PDCH */ |
| 4409 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4410 | f_sleep(1.0); |
| 4411 | /* and De-Activate again */ |
| 4412 | f_TC_pcu_deact_req(0, 0, 7); |
| 4413 | } |
| 4414 | |
| 4415 | /* Attempt to deactivate a PDCH on a non-PDCH timeslot */ |
| 4416 | testcase TC_pcu_deact_req_wrong_ts() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4417 | f_init_pcu_test(); |
| 4418 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4419 | f_TC_pcu_deact_req(0, 0, 1); |
| 4420 | } |
| 4421 | |
| 4422 | /* Test the PCU->BTS Version and BTS->PCU SI13 handshake */ |
| 4423 | testcase TC_pcu_ver_si13() runs on test_CT { |
| 4424 | const octetstring si13 := '00010203040506070909'O; |
| 4425 | var PCUIF_send_data sd; |
| 4426 | timer T:= 3.0; |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4427 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4428 | |
| 4429 | /* Set SI13 via RSL */ |
| 4430 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, si13); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4431 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4432 | T.start; |
| 4433 | alt { |
| 4434 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_DATA_IND(0, 0, 0, ?, PCU_IF_SAPI_BCCH))) -> value sd { |
| 4435 | if (substr(sd.data.u.data_ind.data, 0, lengthof(si13)) == si13) { |
| 4436 | setverdict(pass); |
| 4437 | } else { |
| 4438 | repeat; |
| 4439 | } |
| 4440 | } |
| 4441 | [] PCU.receive { repeat; } |
| 4442 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4443 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SI13"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4444 | } |
| 4445 | } |
| 4446 | } |
| 4447 | |
| 4448 | private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O; |
| 4449 | |
| 4450 | /* helper function to send a PCU DATA.req */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4451 | friend function f_pcu_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4452 | uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data) |
| 4453 | runs on test_CT |
| 4454 | { |
| 4455 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, |
| 4456 | ts_PCUIF_DATA_REQ(bts_nr, trx_nr, ts_nr, block_nr, fn, sapi, data))); |
| 4457 | } |
| 4458 | |
| 4459 | /* helper function to wait for RTS.ind for given SAPI on given BTS/TRX/TS and then send */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4460 | friend function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 4461 | PCUIF_Sapi sapi, octetstring data) |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4462 | runs on test_CT |
| 4463 | { |
| 4464 | var PCUIF_send_data sd; |
| 4465 | |
| 4466 | timer T := 3.0; |
| 4467 | T.start; |
| 4468 | alt { |
| 4469 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, |
| 4470 | tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr, sapi))) -> value sd { |
| 4471 | f_pcu_data_req(bts_nr, trx_nr, ts_nr, sd.data.u.rts_req.block_nr, |
| 4472 | sd.data.u.rts_req.fn, sapi, data); |
| 4473 | } |
| 4474 | [] PCU.receive { repeat; } |
| 4475 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4476 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RTS.ind"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4477 | } |
| 4478 | } |
| 4479 | } |
| 4480 | |
| 4481 | /* Send DATA.req on invalid BTS */ |
| 4482 | testcase TC_pcu_data_req_wrong_bts() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4483 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4484 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 4485 | |
| 4486 | f_virtphy_common(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4487 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4488 | f_TC_pcu_act_req(0, 0, 7, true); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4489 | f_TfiUsfArrSet(tua, 7, 0); |
| 4490 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4491 | f_sleep(1.0); |
| 4492 | |
| 4493 | f_pcu_to_l1(23, 0, 7, PCU_IF_SAPI_PDTCH, data, false, false); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4494 | } |
| 4495 | |
| 4496 | /* Send DATA.req on invalid TRX */ |
| 4497 | testcase TC_pcu_data_req_wrong_trx() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4498 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4499 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 4500 | |
| 4501 | f_virtphy_common(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4502 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4503 | f_TC_pcu_act_req(0, 0, 7, true); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4504 | f_TfiUsfArrSet(tua, 7, 0); |
| 4505 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4506 | f_sleep(1.0); |
| 4507 | |
| 4508 | f_pcu_to_l1(0, 100, 7, PCU_IF_SAPI_PDTCH, data, false, false); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4509 | } |
| 4510 | |
| 4511 | /* Send DATA.req on invalid timeslot */ |
| 4512 | testcase TC_pcu_data_req_wrong_ts() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4513 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4514 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 4515 | |
| 4516 | f_virtphy_common(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4517 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4518 | f_TC_pcu_act_req(0, 0, 7, true); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4519 | f_TfiUsfArrSet(tua, 7, 0); |
| 4520 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4521 | f_sleep(1.0); |
| 4522 | |
| 4523 | f_pcu_to_l1(0, 0, 70, PCU_IF_SAPI_PDTCH, data, false, false); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4524 | } |
| 4525 | |
| 4526 | /* Send DATA.req on timeslot that hasn't been activated */ |
| 4527 | testcase TC_pcu_data_req_ts_inactive() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4528 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4529 | var octetstring data := '0000'O & f_rnd_octstring(21); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4530 | |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4531 | f_virtphy_common(); |
| 4532 | |
| 4533 | f_TfiUsfArrSet(tua, 7, 0); |
| 4534 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4535 | f_sleep(1.0); |
| 4536 | |
| 4537 | f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PDTCH, data, false, false); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4538 | } |
| 4539 | |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4540 | private function f_pcu_to_l1(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4541 | PCUIF_Sapi sapi, octetstring data, boolean expect_data := true, |
| 4542 | boolean wait_rts := true) |
| 4543 | runs on test_CT { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4544 | timer T := 5.0; |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4545 | var L1ctlDlMessage rx_dl; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4546 | |
| 4547 | PCU.clear; |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4548 | if (wait_rts) { |
| 4549 | f_pcu_wait_rts_and_data_req(bts_nr, trx_nr, ts_nr, sapi, data); |
| 4550 | } else { |
| 4551 | f_pcu_data_req(bts_nr, trx_nr, ts_nr, 0, 0, sapi, data); |
| 4552 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4553 | |
| 4554 | T.start; |
| 4555 | alt { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4556 | [expect_data] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PDCH(ts_nr), ?, data)) { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4557 | /* FIXME: why is fn of DATA_IND different to fn of RTS / DATA_REQ above? */ |
| 4558 | setverdict(pass); |
| 4559 | } |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4560 | [not expect_data] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PDCH(ts_nr), ?, data)) -> value rx_dl { |
| 4561 | setverdict(fail, "Received unexpected ", rx_dl); |
| 4562 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4563 | [] L1CTL.receive { |
| 4564 | repeat; |
| 4565 | } |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4566 | [expect_data] T.timeout { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4567 | setverdict(fail, "Timeout waiting for ", data); |
| 4568 | } |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 4569 | [not expect_data] T.timeout { |
| 4570 | setverdict(pass); |
| 4571 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4572 | } |
| 4573 | } |
| 4574 | |
| 4575 | private function f_disable_dynamic_ts() runs on test_CT |
| 4576 | { |
| 4577 | f_init_vty_bsc(); |
| 4578 | /* I'm not quite sure why we need this with osmo-bts-virtual. Somehow it deosn't seem to |
| 4579 | * support dynamic timeslots? But it uses the same scheduler as osmo-bts-trx ?!? */ |
| 4580 | f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 3"}, "phys_chan_config TCH/F"); |
| 4581 | f_vty_config2(BSCVTY, {"network", "bts 0", "trx 0", "timeslot 4"}, "phys_chan_config TCH/F"); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4582 | f_init_pcu_test(); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4583 | } |
| 4584 | |
| 4585 | private function f_virtphy_common() runs on test_CT { |
| 4586 | f_disable_dynamic_ts(); |
| 4587 | f_init_l1ctl(); |
| 4588 | f_l1_tune(L1CTL); |
| 4589 | } |
| 4590 | |
| 4591 | testcase TC_pcu_data_req_pdtch() runs on test_CT { |
| 4592 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4593 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 4594 | |
| 4595 | f_virtphy_common(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4596 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4597 | f_TC_pcu_act_req(0, 0, 7, true); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4598 | f_TfiUsfArrSet(tua, 7, 0); |
| 4599 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4600 | f_sleep(1.0); |
| 4601 | |
| 4602 | f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PDTCH, data); //c_PCU_DATA); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4603 | } |
| 4604 | |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 4605 | /* FIXME: PTTCH has nothing to do with TBFs */ |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4606 | testcase TC_pcu_data_req_ptcch() runs on test_CT { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4607 | var TfiUsfArr tua := f_TfiUsfArrInit(); |
| 4608 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 4609 | |
| 4610 | f_virtphy_common(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4611 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4612 | f_TC_pcu_act_req(0, 0, 7, true); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 4613 | f_TfiUsfArrSet(tua, 7, 0); |
| 4614 | f_L1CTL_TBF_CFG(L1CTL, false, tua); |
| 4615 | f_sleep(1.0); |
| 4616 | |
| 4617 | f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PTCCH, data); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4618 | } |
| 4619 | |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 4620 | private function f_TC_pcu_ptcch_ul(uint16_t ra) |
| 4621 | runs on test_CT { |
| 4622 | var template PCUIF_Message pcu_rach_ind; |
| 4623 | var PCUIF_send_data sd; |
| 4624 | var GsmFrameNumber fn; |
| 4625 | timer T; |
| 4626 | |
| 4627 | /* Send an Access Burst on PTCCH/U over the Um-interface */ |
| 4628 | fn := f_L1CTL_RACH(L1CTL, ra := ra, combined := 0, offset := 0, |
| 4629 | chan_nr := ts_RslChanNr_PDCH(7), |
| 4630 | link_id := ts_RslLinkID_OSMO_PTCCH(0)); |
| 4631 | |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 4632 | pcu_rach_ind := tr_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 4633 | ra := ra, fn := fn, sapi := PCU_IF_SAPI_PTCCH); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 4634 | |
| 4635 | /* Expect a RACH.ind on the PCU interface (timeout is one multi-frame) */ |
| 4636 | T.start(52.0 * 4.615 / 1000.0); |
| 4637 | alt { |
| 4638 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, pcu_rach_ind)) -> value sd { |
| 4639 | log("Rx an Access Burst on the PCU interface: ", sd.data); |
| 4640 | setverdict(pass); |
| 4641 | T.stop; |
| 4642 | } |
| 4643 | [] PCU.receive { repeat; } |
| 4644 | [] T.timeout { |
| 4645 | setverdict(fail, "Timeout waiting for RACH.ind on the PCU interface"); |
| 4646 | /* Keep going, that's not the end of the world */ |
| 4647 | } |
| 4648 | } |
| 4649 | } |
| 4650 | |
| 4651 | testcase TC_pcu_ptcch() runs on test_CT { |
| 4652 | var L1ctlDlMessage dl; |
| 4653 | var octetstring data; |
| 4654 | timer T; |
| 4655 | |
| 4656 | f_init_pcu_test(); |
| 4657 | f_init_l1ctl(); |
| 4658 | f_l1_tune(L1CTL); |
| 4659 | |
| 4660 | /* Activate PDCH channel on TS7 */ |
| 4661 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4662 | |
| 4663 | /* Tune trxcon to that PDCH channel */ |
Vadim Yanitskiy | 1d55dee | 2020-07-14 21:19:09 +0700 | [diff] [blame] | 4664 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_PDCH(7), ts_RSL_ChanMode_SIGN)); |
Vadim Yanitskiy | 13a29d5 | 2020-07-15 14:41:54 +0700 | [diff] [blame] | 4665 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) |
| 4666 | { f_resolve_fh_params(pars); } |
Vadim Yanitskiy | 1d55dee | 2020-07-14 21:19:09 +0700 | [diff] [blame] | 4667 | f_l1ctl_est_dchan(L1CTL, pars); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 4668 | |
| 4669 | /* Verify PTCCH/U: send several access bursts, make sure they're received */ |
| 4670 | for (var integer i := 0; i < 16; i := i + 1) { |
| 4671 | log("Sending an Access Burst towards the L1CTL interface"); |
| 4672 | f_TC_pcu_ptcch_ul(oct2int(f_rnd_ra_ps())); |
| 4673 | } |
| 4674 | |
| 4675 | /* Generate a random payload for PTCCH/D (23 octets, CS-1) */ |
| 4676 | data := f_rnd_octstring(23); |
| 4677 | |
| 4678 | /* Verify PTCCH/D: send a random data block, make sure it's received */ |
| 4679 | log("Sending a PTCCH/D block towards the PCU interface: ", data); |
| 4680 | f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, data); |
| 4681 | |
| 4682 | /* PTCCH/D period is 2 multi-frames (2 * 52 * 4.615 ms), but |
| 4683 | * let's give it more time in case if we miss the beginning. */ |
| 4684 | T.start(2.0 * 2.0 * 52.0 * 4.615 / 1000.0); |
| 4685 | alt { |
| 4686 | /* PDCH is considered as traffic in trxcon => expect TRAFFIC.ind */ |
| 4687 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(chan_nr := t_RslChanNr_PDCH(7), |
| 4688 | link_id := tr_RslLinkID_OSMO_PTCCH(?), |
| 4689 | frame := data)) -> value dl { |
| 4690 | log("Rx PTCCH/D data (traffic) block on L1CTL: ", dl); |
| 4691 | setverdict(pass); |
| 4692 | T.stop; |
| 4693 | } |
| 4694 | /* Other PHYs (e.g. virt_phy) may consider PDCH as data => expect DATA.ind */ |
| 4695 | [] L1CTL.receive(tr_L1CTL_DATA_IND(chan_nr := t_RslChanNr_PDCH(7), |
| 4696 | link_id := tr_RslLinkID_OSMO_PTCCH(?), |
| 4697 | l2_data := data)) -> value dl { |
| 4698 | log("Rx PTCCH/D data block on L1CTL: ", dl); |
| 4699 | setverdict(pass); |
| 4700 | T.stop; |
| 4701 | } |
| 4702 | [] L1CTL.receive { repeat; } |
| 4703 | [] T.timeout { |
| 4704 | setverdict(fail, "Timeout waiting for DATA.ind on L1CTL"); |
| 4705 | } |
| 4706 | } |
| 4707 | } |
| 4708 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4709 | /* Send AGCH from PCU; check it appears on Um side */ |
| 4710 | testcase TC_pcu_data_req_agch() runs on test_CT { |
| 4711 | timer T := 3.0; |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4712 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4713 | f_init_l1ctl(); |
| 4714 | f_l1_tune(L1CTL); |
| 4715 | |
| 4716 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4717 | f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_AGCH, c_PCU_DATA); |
| 4718 | |
| 4719 | T.start; |
| 4720 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 4721 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4722 | setverdict(pass); |
| 4723 | } |
| 4724 | [] L1CTL.receive { repeat; } |
| 4725 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4726 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4727 | } |
| 4728 | } |
| 4729 | } |
| 4730 | |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 4731 | /* Send AGCH from PCU; check it appears on Um side */ |
| 4732 | testcase TC_pcu_data_req_pch() runs on test_CT { |
| 4733 | timer T := 3.0; |
| 4734 | f_init_pcu_test(); |
| 4735 | f_init_l1ctl(); |
| 4736 | f_l1_tune(L1CTL); |
| 4737 | |
| 4738 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4739 | /* three characters prefix: last 3 digits of IMSI as ASCII */ |
| 4740 | f_pcu_data_req(0, 0, 7, 0, 0, PCU_IF_SAPI_PCH, '313233'O & c_PCU_DATA); |
| 4741 | |
| 4742 | T.start; |
| 4743 | alt { |
| 4744 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) { |
| 4745 | setverdict(pass); |
| 4746 | } |
| 4747 | [] L1CTL.receive { repeat; } |
| 4748 | [] T.timeout { |
| 4749 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated PCH block on Um"); |
| 4750 | } |
| 4751 | } |
| 4752 | } |
| 4753 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4754 | /* Send IMM.ASS from PCU for PCH; check it appears on Um side */ |
| 4755 | testcase TC_pcu_data_req_imm_ass_pch() runs on test_CT { |
| 4756 | var octetstring imm_ass := f_rnd_octstring(23); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4757 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4758 | f_init_l1ctl(); |
| 4759 | f_l1_tune(L1CTL); |
| 4760 | |
| 4761 | /* append 3 last imsi digits so BTS can compute pagng group */ |
| 4762 | var uint32_t fn := f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H); |
| 4763 | |
| 4764 | timer T := 0.5; |
| 4765 | T.start; |
| 4766 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 4767 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, imm_ass)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4768 | /* TODO: verify paging group */ |
| 4769 | setverdict(pass); |
| 4770 | } |
| 4771 | [] L1CTL.receive { repeat; } |
| 4772 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4773 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated AGCH block on Um"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4774 | } |
| 4775 | } |
| 4776 | } |
| 4777 | |
| 4778 | /* Send RACH from Um side, expect it to show up on PCU socket */ |
| 4779 | testcase TC_pcu_rach_content() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4780 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4781 | f_init_l1ctl(); |
| 4782 | f_l1_tune(L1CTL); |
| 4783 | |
| 4784 | var GsmFrameNumber fn_last := 0; |
| 4785 | for (var integer i := 0; i < 1000; i := i+1) { |
| 4786 | var OCT1 ra := f_rnd_ra_ps(); |
| 4787 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 4788 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4789 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4790 | } |
| 4791 | fn_last := fn; |
| 4792 | |
| 4793 | timer T := 2.0; |
| 4794 | T.start; |
| 4795 | alt { |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 4796 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND(0, 0, 0, oct2int(ra), 0, ?, fn))) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4797 | T.stop; |
| 4798 | } |
| 4799 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4800 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4801 | } |
| 4802 | [] PCU.receive { repeat; } |
| 4803 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4804 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4805 | } |
| 4806 | } |
| 4807 | } |
| 4808 | setverdict(pass); |
| 4809 | } |
| 4810 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 4811 | /* Send extended (11-bit, TS1 & TS2) RACH bursts from the Um side, |
| 4812 | * expect them to show up on PCU socket (with proper BURST_TYPE_*). */ |
| 4813 | testcase TC_pcu_ext_rach_content() runs on test_CT { |
| 4814 | var template PCUIF_Message pcu_rach_ind; |
| 4815 | var GsmFrameNumber fn_last := 0; |
| 4816 | var L1ctlRachSynchSeq synch_seq; |
| 4817 | var PCUIF_BurstType pcu_bt; |
| 4818 | var GsmFrameNumber fn; |
| 4819 | var BIT11 ra11; |
| 4820 | |
| 4821 | f_init_pcu_test(); |
| 4822 | f_init_l1ctl(); |
| 4823 | f_l1_tune(L1CTL); |
| 4824 | |
| 4825 | for (var integer i := 0; i < 1000; i := i+1) { |
| 4826 | /* We need to test both TS1 & TS2 */ |
| 4827 | if (i rem 2 == 0) { |
| 4828 | synch_seq := RACH_SYNCH_SEQ_TS1; |
| 4829 | pcu_bt := BURST_TYPE_1; |
| 4830 | } else { |
| 4831 | synch_seq := RACH_SYNCH_SEQ_TS2; |
| 4832 | pcu_bt := BURST_TYPE_2; |
| 4833 | } |
| 4834 | |
| 4835 | ra11 := f_rnd_ra11_ps(); |
| 4836 | fn := f_L1CTL_EXT_RACH(L1CTL, bit2int(ra11), synch_seq); |
| 4837 | if (fn == fn_last) { |
| 4838 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 4839 | "Two RACH in same FN?!?"); |
| 4840 | } |
| 4841 | fn_last := fn; |
| 4842 | |
| 4843 | /* Compose the expected message */ |
| 4844 | pcu_rach_ind := tr_PCUIF_RACH_IND( |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 4845 | bts_nr := 0, trx_nr := 0, ts_nr := 0, |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 4846 | ra := bit2int(ra11), |
| 4847 | is_11bit := 1, |
| 4848 | burst_type := pcu_bt, |
| 4849 | fn := fn); |
| 4850 | |
| 4851 | timer T := 2.0; |
| 4852 | T.start; |
| 4853 | alt { |
| 4854 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, pcu_rach_ind)) { |
| 4855 | T.stop; |
| 4856 | } |
| 4857 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RACH_IND)) { |
| 4858 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
| 4859 | } |
| 4860 | [] PCU.receive { repeat; } |
| 4861 | [] T.timeout { |
| 4862 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
| 4863 | } |
| 4864 | } |
| 4865 | } |
| 4866 | setverdict(pass); |
| 4867 | } |
| 4868 | |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 4869 | private function f_TC_pcu_data_ind_lqual_cb(int16_t lqual_cb_exp, int16_t thresh) |
| 4870 | runs on test_CT { |
| 4871 | var template PCUIF_send_data sdt; |
| 4872 | var PCUIF_send_data sd; |
| 4873 | var int16_t lqual_cb; |
| 4874 | timer T := 1.0; |
| 4875 | |
| 4876 | /* PCUIF_DATA.ind is encapsulated into a supplementary record */ |
| 4877 | sdt := t_SD_PCUIF_MSGT(g_pcu_conn_id, PCU_IF_MSG_DATA_IND); |
| 4878 | |
| 4879 | /* Send a random PDTCH frame over Um */ |
| 4880 | L1CTL.send(ts_L1CTL_TRAFFIC_REQ(ts_RslChanNr_PDCH(7), ts_RslLinkID_DCCH(0), |
| 4881 | '0000'O & f_rnd_octstring(21))); |
| 4882 | |
| 4883 | T.start; |
| 4884 | alt { |
| 4885 | /* If expected link quality is above the threshold */ |
| 4886 | [lqual_cb_exp >= thresh] PCU.receive(sdt) -> value sd { |
| 4887 | lqual_cb := sd.data.u.data_ind.lqual_cb; |
| 4888 | log("Rx PCUIF_DATA.ind (lqual_cb=", lqual_cb, ")"); |
| 4889 | |
| 4890 | /* Make sure the actual link quality matches the expected value */ |
| 4891 | if (not match(lqual_cb, lqual_cb_exp)) { |
| 4892 | setverdict(fail, log2str("Link quality ", lqual_cb, " does not match ", |
| 4893 | "expected value ", lqual_cb_exp)); |
| 4894 | } else { |
| 4895 | setverdict(pass); |
| 4896 | } |
| 4897 | } |
| 4898 | /* If expected link quality is below the threshold */ |
| 4899 | [lqual_cb_exp < thresh] PCU.receive(sdt) -> value sd { |
| 4900 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 4901 | log2str("Rx unexpected PCUIF_DATA.ind: ", sd.data)); |
| 4902 | } |
| 4903 | /* Ignore PCUIF_RTS.req and PCUIF_TIME.ind */ |
| 4904 | [] PCU.receive { repeat; } |
| 4905 | [lqual_cb_exp < thresh] T.timeout { |
| 4906 | log("Rx nothing, as expected"); |
| 4907 | setverdict(pass); |
| 4908 | } |
| 4909 | [lqual_cb_exp >= thresh] T.timeout { |
| 4910 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 4911 | "Timeout waiting for PCUIF_DATA.ind"); |
| 4912 | } |
| 4913 | } |
| 4914 | } |
| 4915 | |
| 4916 | /* Verify C/I (Carrier-to-Interference ratio) processing of PDTCH frames */ |
| 4917 | testcase TC_pcu_data_ind_lqual_cb() runs on test_CT { |
| 4918 | f_init_pcu_test(); |
| 4919 | PCU.clear; |
| 4920 | |
| 4921 | f_init_l1ctl(); |
| 4922 | f_l1_tune(L1CTL); |
| 4923 | |
| 4924 | /* Activate a PDCH channel on TS7 */ |
| 4925 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4926 | |
| 4927 | /* Tune trxcon to that PDCH channel on TS7 */ |
Vadim Yanitskiy | 1d55dee | 2020-07-14 21:19:09 +0700 | [diff] [blame] | 4928 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_PDCH(7), ts_RSL_ChanMode_SIGN)); |
Vadim Yanitskiy | 13a29d5 | 2020-07-15 14:41:54 +0700 | [diff] [blame] | 4929 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) |
| 4930 | { f_resolve_fh_params(pars); } |
Vadim Yanitskiy | 1d55dee | 2020-07-14 21:19:09 +0700 | [diff] [blame] | 4931 | f_l1ctl_est_dchan(L1CTL, pars); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 4932 | |
| 4933 | /* C/I in centiBels, test range: -256 .. +1280, step 128 */ |
| 4934 | for (var int16_t i := -256; i <= 1280; i := i + 128) { |
| 4935 | var TrxcMessage ret; |
| 4936 | |
| 4937 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, |
| 4938 | valueof(ts_TRXC_FAKE_CI(i))); |
| 4939 | |
| 4940 | /* FIXME: OsmoBTS may have different threshold (see MIN_QUAL_NORM) */ |
| 4941 | f_TC_pcu_data_ind_lqual_cb(i, thresh := 0); |
| 4942 | } |
| 4943 | } |
| 4944 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4945 | /* Send PAGING via RSL, expect it to shw up on PCU socket */ |
| 4946 | testcase TC_pcu_paging_from_rsl() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 4947 | f_init_pcu_test(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4948 | |
| 4949 | for (var integer i := 0; i < 100; i := i+1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4950 | var MobileIdentityLV mi_lv; |
| 4951 | var octetstring mi_lv_enc; |
| 4952 | var MobileIdentityV mi; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4953 | timer T := 3.0; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4954 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4955 | if (i < 50) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4956 | mi := valueof(t_MI_TMSI(f_rnd_octstring(4))); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4957 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4958 | mi := valueof(ts_MI_IMSI(f_gen_imsi(i))); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4959 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4960 | |
| 4961 | /* Fancy encoding for PCUIF */ |
| 4962 | mi_lv := valueof(ts_MI_LV(mi)); |
| 4963 | mi_lv_enc := enc_MobileIdentityLV(mi_lv); |
| 4964 | mi_lv_enc := f_pad_oct(mi_lv_enc, 9, '00'O); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4965 | |
| 4966 | /* Send RSL PAGING COMMAND */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4967 | RSL_CCHAN.send(ts_ASP_RSL_UD(ts_RSL_PAGING_CMD(mi, i mod 4))); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4968 | T.start; |
| 4969 | alt { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4970 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ(0, mi_lv_enc))) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4971 | } |
| 4972 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_PAG_REQ)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4973 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4974 | } |
| 4975 | [] PCU.receive { repeat; } |
| 4976 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4977 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 4978 | } |
| 4979 | } |
| 4980 | } |
| 4981 | setverdict(pass); |
| 4982 | } |
| 4983 | |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 4984 | /* test for periodic TIME_IND; check number of FN expired and number of TIME_IND within frames */ |
| 4985 | testcase TC_pcu_time_ind() runs on test_CT { |
| 4986 | var PCUIF_send_data pcu_sd; |
| 4987 | var integer num_time_ind := 0; |
| 4988 | var integer first_fn, last_fn; |
| 4989 | var float test_duration := 5.0; |
| 4990 | timer T; |
| 4991 | |
| 4992 | f_init_pcu_test(); |
| 4993 | f_TC_pcu_act_req(0, 0, 7, true); |
| 4994 | |
| 4995 | PCU.clear; |
| 4996 | T.start(test_duration); |
| 4997 | alt { |
| 4998 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_TIME_IND(0, ?))) -> value pcu_sd { |
| 4999 | num_time_ind := num_time_ind + 1; |
| 5000 | if (not isbound(first_fn)) { |
| 5001 | first_fn := pcu_sd.data.u.time_ind.fn; |
| 5002 | } |
| 5003 | last_fn := pcu_sd.data.u.time_ind.fn; |
| 5004 | repeat; |
| 5005 | } |
| 5006 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_TIME_IND(?, ?))) -> value pcu_sd { |
| 5007 | setverdict(fail, "Received unexpected PCUIF_TIME_IND: ", pcu_sd.data); |
| 5008 | repeat; |
| 5009 | } |
| 5010 | [] PCU.receive { |
| 5011 | repeat; |
| 5012 | } |
| 5013 | [] T.timeout {} |
| 5014 | } |
| 5015 | var integer fn_expired := last_fn - first_fn; |
| 5016 | log(fn_expired, " fn expired with ", num_time_ind, " PCU_TIME.ind"); |
| 5017 | |
| 5018 | /* verify the number of frames expired matches our expectation */ |
| 5019 | const float c_GSM_FN_DURATION_MS := 4.61538; |
| 5020 | var float fn_expected := test_duration * 1000.0 / c_GSM_FN_DURATION_MS; |
Harald Welte | c761c54 | 2019-05-28 11:59:57 +0200 | [diff] [blame] | 5021 | var template integer t_fn_expected := f_tolerance(float2int(fn_expected), 1, 100000, 20); |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 5022 | if (not match(fn_expired, t_fn_expected)) { |
| 5023 | setverdict(fail, "Number of TDMA Frames (", fn_expired, ") not matching ", t_fn_expected); |
| 5024 | } |
| 5025 | |
| 5026 | /* There are three TIME.ind in every fn MOD 13 */ |
| 5027 | var float time_ind_expected := int2float(fn_expired) * 3.0 / 13.0; |
| 5028 | /* Add some tolerance */ |
| 5029 | var template integer t_time_ind_exp := f_tolerance(float2int(time_ind_expected), 1, 100000, 5); |
| 5030 | if (not match(num_time_ind, t_time_ind_exp)) { |
| 5031 | setverdict(fail, "Number of TIME.ind (", num_time_ind, ") not matching ", t_time_ind_exp); |
| 5032 | } |
| 5033 | |
| 5034 | setverdict(pass); |
| 5035 | } |
| 5036 | |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 5037 | /* test for periodic RTS_REQ; check number of FN expired and number of RTS_IND per SAPI */ |
| 5038 | testcase TC_pcu_rts_req() runs on test_CT { |
| 5039 | var PCUIF_send_data pcu_sd; |
| 5040 | var integer first_fn, last_fn; |
| 5041 | var integer num_rts_pdtch := 0; |
| 5042 | var integer num_rts_ptcch := 0; |
| 5043 | var float test_duration := 5.0; |
| 5044 | timer T; |
| 5045 | |
| 5046 | f_init_pcu_test(); |
| 5047 | f_TC_pcu_act_req(0, 0, 7, true); |
| 5048 | |
| 5049 | PCU.clear; |
| 5050 | T.start(test_duration); |
| 5051 | alt { |
| 5052 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PDTCH, ?, ?))) |
| 5053 | -> value pcu_sd { |
| 5054 | num_rts_pdtch := num_rts_pdtch + 1; |
| 5055 | if (not isbound(first_fn)) { |
| 5056 | first_fn := pcu_sd.data.u.rts_req.fn; |
| 5057 | } |
| 5058 | last_fn := pcu_sd.data.u.rts_req.fn; |
| 5059 | repeat; |
| 5060 | } |
| 5061 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PTCCH, ?, ?))) |
| 5062 | -> value pcu_sd { |
| 5063 | num_rts_ptcch := num_rts_ptcch + 1; |
| 5064 | if (not isbound(first_fn)) { |
| 5065 | first_fn := pcu_sd.data.u.rts_req.fn; |
| 5066 | } |
| 5067 | last_fn := pcu_sd.data.u.rts_req.fn; |
| 5068 | repeat; |
| 5069 | } |
| 5070 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_RTS_REQ)) -> value pcu_sd { |
| 5071 | setverdict(fail, "Received unexpected PCUIF_RTS_REQ: ", pcu_sd.data); |
| 5072 | repeat; |
| 5073 | } |
| 5074 | [] PCU.receive { |
| 5075 | repeat; |
| 5076 | } |
| 5077 | [] T.timeout {} |
| 5078 | } |
| 5079 | var integer fn_expired := last_fn - first_fn; |
| 5080 | log(fn_expired, " fn expired with num_rts_pdtch=", num_rts_pdtch, |
| 5081 | ", num_rts_ptcch=", num_rts_ptcch); |
| 5082 | |
| 5083 | /* verify the number of frames expired matches our expectation */ |
| 5084 | const float c_GSM_FN_DURATION_MS := 4.61538; |
| 5085 | var float fn_expected := test_duration * 1000.0 / c_GSM_FN_DURATION_MS; |
Harald Welte | c761c54 | 2019-05-28 11:59:57 +0200 | [diff] [blame] | 5086 | var template integer t_fn_expected := f_tolerance(float2int(fn_expected), 1, 100000, 20); |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 5087 | if (not match(fn_expired, t_fn_expected)) { |
| 5088 | setverdict(fail, "Number of TDMA Frames (", fn_expired, ") not matching ", t_fn_expected); |
| 5089 | } |
| 5090 | |
| 5091 | /* PTCCH is in pos. 12 + 38 of 52-multiframe, but four slots/bursts required per block */ |
| 5092 | var float ptcch_expected := int2float(fn_expired) / 52.0 * 0.5; |
| 5093 | var template integer t_ptcch_exp := f_tolerance(float2int(ptcch_expected), 1, 100000, 1); |
| 5094 | if (not match(num_rts_ptcch, t_ptcch_exp)) { |
| 5095 | setverdict(fail, "Number of RTS.ind for PTCCH (", num_rts_ptcch, ") not matching ", |
| 5096 | t_ptcch_exp); |
| 5097 | } |
| 5098 | |
| 5099 | /* We have 12 PDTCH blocks every 52-multiframe */ |
| 5100 | var float pdtch_expected := int2float(fn_expired) / 52.0 * 12.0; |
| 5101 | var template integer t_pdtch_exp := f_tolerance(float2int(pdtch_expected), 1, 100000, 2); |
| 5102 | if (not match(num_rts_pdtch, t_pdtch_exp)) { |
| 5103 | setverdict(fail, "Number of RTS.ind for PDTCH (", num_rts_pdtch, ") not matching ", |
| 5104 | t_pdtch_exp); |
| 5105 | } |
| 5106 | |
| 5107 | setverdict(pass); |
| 5108 | } |
| 5109 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 5110 | /* test for generating Abis side OML ALERT from the PCU */ |
| 5111 | testcase TC_pcu_oml_alert() runs on test_CT { |
| 5112 | var PCUIF_send_data pcu_sd; |
| 5113 | var integer num_time_ind := 0; |
| 5114 | var integer first_fn, last_fn; |
| 5115 | var float test_duration := 5.0; |
| 5116 | timer T; |
| 5117 | |
| 5118 | f_init_pcu_test(); |
| 5119 | f_TC_pcu_act_req(0, 0, 7, true); |
| 5120 | |
| 5121 | /* re-connect CTRL port from BTS to BSC */ |
| 5122 | f_ipa_ctrl_stop(); |
| 5123 | f_ipa_ctrl_start(mp_bsc_ctrl_ip, mp_bsc_ctrl_port); |
| 5124 | |
| 5125 | /* Send that OML Alert */ |
| 5126 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_OML_ALERT, testcasename()))); |
| 5127 | |
| 5128 | /* This requires https://gerrit.osmocom.org/#/c/osmo-bsc/+/14177 to be merged */ |
| 5129 | f_ctrl_exp_trap(IPA_CTRL, "bts.0.oml_failure_report", ?); |
| 5130 | setverdict(pass); |
| 5131 | } |
| 5132 | |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 5133 | /* test for forwarding of RR SUSPEND from CS lchan to PCU via PCU socket */ |
| 5134 | private function f_TC_rr_suspend_req(charstring id) runs on ConnHdlr { |
| 5135 | var PCUIF_Message first_info; |
| 5136 | var integer pcu_conn_id := -1; |
| 5137 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 5138 | var RoutingAreaIdentificationV rai := f_RAI('262'H, '42F'H, '2342'O, '55'O); |
| 5139 | var OCT4 tlli := '01020304'O; |
| 5140 | var OCT1 cause := '23'O; |
| 5141 | timer T := 5.0; |
| 5142 | |
| 5143 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5144 | |
| 5145 | f_l1_tune(L1CTL); |
| 5146 | RSL.clear; |
| 5147 | |
| 5148 | f_est_dchan(); |
| 5149 | L1CTL.clear; |
| 5150 | |
| 5151 | f_est_rll_mo(link_id.sapi, link_id, '23420815'O); |
| 5152 | |
| 5153 | var PDU_ML3_MS_NW susp_req := valueof(ts_RRM_GprsSuspReq(tlli, rai, cause)); |
| 5154 | var octetstring l3 := enc_PDU_ML3_MS_NW(susp_req); |
| 5155 | f_tx_lapdm(ts_LAPDm_I(link_id.sapi, cr_MO_CMD, true, 1, 0, l3), link_id); |
| 5156 | |
| 5157 | /* ConnHdlr has terminated after sending the RR SUSP REQ over a dedicaed channel */ |
| 5158 | T.start; |
| 5159 | alt { |
| 5160 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_SUSP_REQ(0, tlli, ?, oct2int(cause)))) { |
| 5161 | setverdict(pass); |
| 5162 | } |
| 5163 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_SUSP_REQ(?, ?, ?, ?))) { |
| 5164 | setverdict(fail, "Received unexpected PCUIF SUSPE REQ: "); |
| 5165 | } |
| 5166 | [] PCU.receive { |
| 5167 | repeat; |
| 5168 | } |
| 5169 | [] T.timeout { |
| 5170 | setverdict(fail, "Timeout waiting for SUSP REQ on PCUIF"); |
| 5171 | } |
| 5172 | } |
Alexander Couzens | a063483 | 2019-06-07 00:28:56 +0200 | [diff] [blame] | 5173 | |
| 5174 | /* release the channel */ |
| 5175 | f_rsl_chan_deact(); |
| 5176 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 5177 | f_rslem_unregister(0, g_chan_nr); |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 5178 | } |
| 5179 | testcase TC_pcu_rr_suspend() runs on test_CT { |
| 5180 | var ConnHdlrPars pars; |
| 5181 | var ConnHdlr vc_conn; |
| 5182 | |
| 5183 | f_init(); |
| 5184 | |
| 5185 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,3), ts_RSL_ChanMode_SIGN)); |
| 5186 | vc_conn := f_start_handler(refers(f_TC_rr_suspend_req), pars, true); |
| 5187 | vc_conn.done; |
| 5188 | } |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 5189 | |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 5190 | /* Ensure that PCUIF socket can accept only a single connection */ |
| 5191 | testcase TC_pcu_socket_connect_multi() runs on test_CT { |
| 5192 | timer T := 5.0; |
| 5193 | |
| 5194 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
| 5195 | f_init(); |
| 5196 | |
| 5197 | /* try to establish a second connection, expect it to fail */ |
| 5198 | PCU.send(UD_connect:{mp_pcu_socket, -1}); |
| 5199 | T.start; |
| 5200 | alt { |
| 5201 | [] PCU.receive(UD_connect_result:{id := ?, result := { result_code := ERROR, err := ? }}) { |
| 5202 | setverdict(pass); |
| 5203 | } |
| 5204 | [] PCU.receive(UD_connect_result:?) { |
| 5205 | setverdict(fail, "Unexpected unix domain connect result"); |
| 5206 | } |
| 5207 | [] T.timeout { |
| 5208 | setverdict(pass); |
| 5209 | } |
| 5210 | } |
| 5211 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5212 | } |
| 5213 | |
Harald Welte | c8effb7 | 2019-05-27 18:23:04 +0200 | [diff] [blame] | 5214 | /* Ensure that PCUIF socket can disconnect + reconnect */ |
| 5215 | testcase TC_pcu_socket_reconnect() runs on test_CT { |
| 5216 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
| 5217 | f_init(); |
| 5218 | |
| 5219 | f_sleep(1.0); |
| 5220 | |
| 5221 | f_pcuif_close(PCU, g_pcu_conn_id); |
| 5222 | g_pcu_conn_id := -1; |
| 5223 | |
| 5224 | f_sleep(1.0); |
| 5225 | |
| 5226 | /* re-connect */ |
| 5227 | PCU.clear; |
| 5228 | f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info); |
| 5229 | setverdict(pass); |
| 5230 | |
| 5231 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5232 | } |
| 5233 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5234 | /* Ensure that GPRS capability is not advertised before PCU socket conncet */ |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 5235 | private function f_get_si(L1CTL_PT pt, RrMessageType si_type) |
| 5236 | runs on test_CT return SystemInformation { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5237 | var L1ctlDlMessage l1_dl; |
| 5238 | var SystemInformation si; |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 5239 | var integer rc; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5240 | timer T := 5.0; |
| 5241 | T.start; |
| 5242 | alt { |
| 5243 | [] pt.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 5244 | rc := dec_SystemInformationSafe(l1_dl.payload.data_ind.payload, si); |
| 5245 | if (rc != 0 or si.header.message_type != si_type) { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5246 | repeat; |
| 5247 | } |
| 5248 | } |
| 5249 | [] pt.receive { |
| 5250 | repeat; |
| 5251 | } |
| 5252 | [] T.timeout { |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 5253 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5254 | log2str("Timeout waiting for ", si_type)); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5255 | } |
| 5256 | } |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 5257 | return si; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5258 | } |
| 5259 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5260 | /* Check if GPRS Indicator is present in RR System Information of a given type */ |
| 5261 | private function f_si_has_gprs_indicator(RrMessageType si_type) |
| 5262 | runs on test_CT return boolean { |
| 5263 | var SystemInformation si := f_get_si(L1CTL, si_type); |
| 5264 | |
| 5265 | if (si_type == SYSTEM_INFORMATION_TYPE_3) { |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 5266 | return si.payload.si3.rest_octets.gprs_ind.presence == '1'B; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5267 | } else if (si_type == SYSTEM_INFORMATION_TYPE_4) { |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 5268 | return si.payload.si4.rest_octets.gprs_ind.presence == '1'B; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5269 | } |
| 5270 | |
| 5271 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unhandled SI type"); |
| 5272 | return false; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5273 | } |
| 5274 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5275 | /* Make sure that GPRS Indicator is absent when the PCU is not connected */ |
| 5276 | private function f_TC_pcu_socket_noconnect(RrMessageType si_type) |
| 5277 | runs on test_CT { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5278 | /* don't call f_init() as this would connect PCU socket */ |
| 5279 | f_init_rsl(testcasename()); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5280 | |
| 5281 | /* Send both System Information Type 3 and 4 (with GPRS Indicator) */ |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5282 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5283 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5284 | |
| 5285 | f_init_l1ctl(); |
| 5286 | f_l1_tune(L1CTL); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5287 | f_sleep(2.0); |
| 5288 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5289 | |
| 5290 | if (f_si_has_gprs_indicator(si_type)) { |
| 5291 | setverdict(fail, si_type, " indicates GPRS even before PCU socket connected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5292 | } else { |
| 5293 | setverdict(pass); |
| 5294 | } |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5295 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5296 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5297 | } |
| 5298 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5299 | testcase TC_pcu_socket_noconnect_nosi3gprs() runs on test_CT { |
| 5300 | f_TC_pcu_socket_noconnect(SYSTEM_INFORMATION_TYPE_3); |
| 5301 | } |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5302 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5303 | testcase TC_pcu_socket_noconnect_nosi4gprs() runs on test_CT { |
| 5304 | f_TC_pcu_socket_noconnect(SYSTEM_INFORMATION_TYPE_4); |
| 5305 | } |
| 5306 | |
| 5307 | /* Ensure that GPRS capability is advertised after PCU socket connect */ |
| 5308 | private function f_TC_pcu_socket_connect(RrMessageType si_type) |
| 5309 | runs on test_CT { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5310 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
| 5311 | f_init(); |
| 5312 | f_init_l1ctl(); |
| 5313 | f_l1_tune(L1CTL); |
| 5314 | |
| 5315 | f_sleep(2.0); |
| 5316 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5317 | |
| 5318 | if (not f_si_has_gprs_indicator(si_type)) { |
| 5319 | setverdict(fail, si_type, " indicates no GPRS despite PCU socket connected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5320 | } else { |
| 5321 | setverdict(pass); |
| 5322 | } |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5323 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5324 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5325 | } |
| 5326 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5327 | testcase TC_pcu_socket_connect_si3gprs() runs on test_CT { |
| 5328 | f_TC_pcu_socket_connect(SYSTEM_INFORMATION_TYPE_3); |
| 5329 | } |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5330 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5331 | testcase TC_pcu_socket_connect_si4gprs() runs on test_CT { |
| 5332 | f_TC_pcu_socket_connect(SYSTEM_INFORMATION_TYPE_4); |
| 5333 | } |
| 5334 | |
| 5335 | /* Ensure that GPRS capability is no longer advertised after PCU socket disconnect */ |
| 5336 | private function f_TC_pcu_socket_disconnect(RrMessageType si_type) |
| 5337 | runs on test_CT { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5338 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
| 5339 | f_init(); |
| 5340 | f_init_l1ctl(); |
| 5341 | f_l1_tune(L1CTL); |
| 5342 | |
| 5343 | f_pcuif_close(PCU, g_pcu_conn_id); |
| 5344 | g_pcu_conn_id := -1; |
| 5345 | |
| 5346 | f_sleep(1.0); |
| 5347 | |
| 5348 | /* re-connect */ |
| 5349 | PCU.clear; |
| 5350 | f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info); |
| 5351 | |
| 5352 | f_sleep(2.0); |
| 5353 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5354 | |
| 5355 | if (f_si_has_gprs_indicator(si_type)) { |
| 5356 | setverdict(fail, si_type, " indicates GPRS after PCU socket disconnected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 5357 | } else { |
| 5358 | setverdict(pass); |
| 5359 | } |
| 5360 | |
| 5361 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5362 | } |
| 5363 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 5364 | testcase TC_pcu_socket_disconnect_nosi3gprs() runs on test_CT { |
| 5365 | f_TC_pcu_socket_disconnect(SYSTEM_INFORMATION_TYPE_3); |
| 5366 | } |
| 5367 | |
| 5368 | testcase TC_pcu_socket_disconnect_nosi4gprs() runs on test_CT { |
| 5369 | f_TC_pcu_socket_disconnect(SYSTEM_INFORMATION_TYPE_4); |
| 5370 | } |
| 5371 | |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 5372 | /* Verify that the cell_id of SI3 (TS 04.08 9.1.35) and other values are passed properly to the PCU socket (OS#3854) */ |
| 5373 | testcase TC_pcu_socket_verify_info_ind() runs on test_CT { |
| 5374 | var SystemInformation si3 := valueof(ts_SI3_default); |
| 5375 | |
| 5376 | f_init(); |
| 5377 | |
| 5378 | /* Verify cell_id */ |
| 5379 | var uint16_t cell_id_si3 := si3.payload.si3.cell_id; |
| 5380 | var uint16_t cell_id_pcu := g_pcu_last_info.u.info_ind.cell_id; |
| 5381 | if (cell_id_si3 != cell_id_pcu) { |
Oliver Smith | e1c00f0 | 2019-09-04 11:35:56 +0200 | [diff] [blame] | 5382 | setverdict(fail, "Expected cell_id '", cell_id_si3, "' and got '", cell_id_pcu, "'. This either means,", |
| 5383 | " that the BTS is sending the wrong cell_id, or that the BTS sent it too early", |
| 5384 | " (OS#4179)"); |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 5385 | } |
| 5386 | |
| 5387 | /* Verify LAC */ |
| 5388 | var uint16_t lac_si3 := si3.payload.si3.lai.lac; |
| 5389 | var uint16_t lac_pcu := g_pcu_last_info.u.info_ind.lac; |
| 5390 | if (lac_si3 != lac_pcu) { |
| 5391 | setverdict(fail, "Expected LAC ", lac_si3, " got: ", lac_pcu); |
| 5392 | } |
| 5393 | |
| 5394 | setverdict(pass); |
| 5395 | } |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 5396 | |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 5397 | /* Verify hopping parameters in the INFO.ind message (version >= 10) */ |
| 5398 | testcase TC_pcu_info_ind_fh_params() runs on test_CT { |
| 5399 | var PCUIF_info_ind info_ind; |
| 5400 | var ConnHdlrPars pars; |
| 5401 | |
| 5402 | f_init(); |
| 5403 | |
| 5404 | info_ind := g_pcu_last_info.u.info_ind; |
| 5405 | |
| 5406 | for (var integer i := 0; i < mp_transceiver_num; i := i + 1) { |
| 5407 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 5408 | if (info_ind.trx.v10[i].pdch_mask[tn] != '1'B) { |
| 5409 | /* Skip inactive timeslots */ |
| 5410 | continue; |
| 5411 | } |
| 5412 | |
| 5413 | pars := valueof(t_Pars(t_RslChanNr_PDCH(tn), ts_RSL_ChanMode_SIGN)); |
| 5414 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) |
| 5415 | { f_resolve_fh_params(pars); } |
| 5416 | |
| 5417 | var template PCUIF_InfoTrxTs tr_ts; |
| 5418 | if (ispresent(pars.maio_hsn)) { |
| 5419 | tr_ts := tr_PCUIF_InfoTrxTsH1( |
| 5420 | hsn := pars.maio_hsn.hsn, |
| 5421 | maio := pars.maio_hsn.maio, |
Vadim Yanitskiy | 9308cd6 | 2020-09-12 18:41:08 +0700 | [diff] [blame^] | 5422 | ma := f_pad_bit(pars.ma_map.ma, 64, '0'B), |
| 5423 | ma_bit_len := lengthof(pars.ma_map.ma)); |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 5424 | } else { |
| 5425 | tr_ts := tr_PCUIF_InfoTrxTsH0; |
| 5426 | } |
| 5427 | |
| 5428 | var PCUIF_InfoTrxTs ts := info_ind.trx.v10[i].ts[tn]; |
| 5429 | log("Checking timeslot #", tn, " of trx#", i, ": ", ts); |
| 5430 | if (not match(ts, tr_ts)) { |
| 5431 | setverdict(fail, "Hopping parameters do not match: ", |
| 5432 | "received ", ts, " vs expected ", tr_ts); |
| 5433 | } else { |
| 5434 | setverdict(pass); |
| 5435 | } |
| 5436 | } |
| 5437 | } |
| 5438 | } |
| 5439 | |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 5440 | /* Verify IPv4 NSVC address in the INFO.ind message (version >= 10) */ |
| 5441 | testcase TC_pcu_socket_nsvc_ipv4() runs on test_CT { |
| 5442 | f_init_vty_bsc(); |
| 5443 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote ip 127.127.127.127"); |
| 5444 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5445 | |
| 5446 | f_init(); |
| 5447 | |
| 5448 | var PCUIF_RemoteAddr remote_addr := g_pcu_last_info.u.info_ind.remote_addr; |
| 5449 | if (not ischosen(remote_addr.v10)) { |
| 5450 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5451 | log2str("Unexpected remote_addr: ", remote_addr)); |
| 5452 | } |
| 5453 | |
| 5454 | if (remote_addr.v10.addr_type[0] != PCUIF_ADDR_TYPE_IPV4) { |
| 5455 | setverdict(fail, "Received address family is not IPv4"); |
| 5456 | } |
| 5457 | |
| 5458 | if (substr(remote_addr.v10.addr[0], 0, 4) != f_inet_addr("127.127.127.127")) { |
| 5459 | setverdict(fail, "Unexpected address: ", remote_addr.v10.addr[0]); |
| 5460 | } |
| 5461 | |
| 5462 | setverdict(pass); |
| 5463 | } |
| 5464 | |
| 5465 | /* Verify IPv4 NSVC address in the INFO.ind message (version >= 10) */ |
| 5466 | testcase TC_pcu_socket_nsvc_ipv6() runs on test_CT { |
| 5467 | f_init_vty_bsc(); |
| 5468 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote ip fd00::ca:ff:ee"); |
| 5469 | |
| 5470 | f_init(); |
| 5471 | |
| 5472 | var PCUIF_RemoteAddr remote_addr := g_pcu_last_info.u.info_ind.remote_addr; |
| 5473 | if (not ischosen(remote_addr.v10)) { |
| 5474 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5475 | log2str("Unexpected remote_addr: ", remote_addr)); |
| 5476 | } |
| 5477 | |
| 5478 | if (remote_addr.v10.addr_type[0] != PCUIF_ADDR_TYPE_IPV6) { |
| 5479 | setverdict(fail, "Received address family is not IPv6"); |
| 5480 | } |
| 5481 | |
| 5482 | if (remote_addr.v10.addr[0] != f_inet6_addr("fd00::ca:ff:ee")) { |
| 5483 | setverdict(fail, "Unexpected address: ", remote_addr.v10.addr[0]); |
| 5484 | } |
| 5485 | |
| 5486 | setverdict(pass); |
| 5487 | } |
| 5488 | |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5489 | /*********************************************************************** |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5490 | * Osmocom Style Dynamic Timeslot Support |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5491 | ***********************************************************************/ |
| 5492 | |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5493 | private altstep as_pcuif_check_pdch_mask(integer pcu_conn_id, BIT1 exp, |
| 5494 | integer bts_nr, integer trx_nr) |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5495 | runs on ConnHdlr { |
| 5496 | var PCUIF_send_data sd; |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5497 | |
| 5498 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
Vadim Yanitskiy | 9e1206c | 2020-07-19 15:52:31 +0700 | [diff] [blame] | 5499 | var bitstring pdch_mask := f_PCUIF_ver_INFO_PDCHMask(sd.data.u.info_ind, trx_nr); |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5500 | if (substr(pdch_mask, g_chan_nr.tn, 1) != exp) { |
| 5501 | repeat; |
| 5502 | } |
| 5503 | } |
| 5504 | } |
| 5505 | |
| 5506 | private function f_dyn_osmo_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 5507 | runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5508 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 5509 | PCU.clear; |
| 5510 | f_rsl_chan_act(g_pars.chan_mode); |
| 5511 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 5512 | timer T_wait := 2.0; |
| 5513 | T_wait.start; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5514 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5515 | [] as_pcuif_check_pdch_mask(pcu_conn_id, '1'B, bts_nr, trx_nr); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5516 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 5517 | [] T_wait.timeout { |
| 5518 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5519 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '1' on TS", g_chan_nr.tn)); |
| 5520 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5521 | } |
| 5522 | /* try to activate this PDCH from the PCU point of view */ |
| 5523 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 5524 | /* FIXME: is there a response? */ |
| 5525 | } |
| 5526 | |
| 5527 | private function f_dyn_osmo_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 5528 | runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5529 | /* Send RSL CHAN REL (deactivate) */ |
| 5530 | PCU.clear; |
| 5531 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 5532 | /* expect BTS to ask PCU to deactivate the channel */ |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 5533 | timer T_wait := 2.0; |
| 5534 | T_wait.start; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5535 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5536 | [] as_pcuif_check_pdch_mask(pcu_conn_id, '0'B, bts_nr, trx_nr); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5537 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 5538 | [] T_wait.timeout { |
| 5539 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5540 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '0' on TS", g_chan_nr.tn)); |
| 5541 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5542 | } |
| 5543 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 5544 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 5545 | alt { |
| 5546 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 5547 | setverdict(pass); |
| 5548 | } |
| 5549 | [] RSL.receive { repeat; } |
| 5550 | } |
| 5551 | } |
| 5552 | |
| 5553 | /* Activate Osmocom-style dynamic PDCH from BSC side */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5554 | private function f_TC_dyn_osmo_pdch_act_deact(charstring id) runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5555 | var PCUIF_Message first_info; |
| 5556 | var integer ts_nr := g_chan_nr.tn; |
| 5557 | var integer trx_nr := 0; |
| 5558 | var integer bts_nr := 0; |
| 5559 | var integer pcu_conn_id := -1; |
| 5560 | |
| 5561 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5562 | |
| 5563 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 5564 | f_sleep(3.0); |
| 5565 | f_dyn_osmo_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 5566 | setverdict(pass); |
| 5567 | } |
| 5568 | testcase TC_dyn_osmo_pdch_act_deact() runs on test_CT { |
| 5569 | var ConnHdlrPars pars; |
| 5570 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5571 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5572 | |
| 5573 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 5574 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_act_deact), pars, true); |
| 5575 | vc_conn.done; |
| 5576 | } |
| 5577 | |
| 5578 | /* send a RF CHAN REL for PDCH on an osmocom dynamci PDCH that's already inactive */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5579 | private function f_TC_dyn_osmo_pdch_unsol_deact(charstring id) runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5580 | var PCUIF_Message first_info; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5581 | var integer pcu_conn_id := -1; |
| 5582 | |
| 5583 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5584 | |
Neels Hofmeyr | 9c50ca5 | 2018-05-08 20:37:54 +0200 | [diff] [blame] | 5585 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 5586 | /* since the lchan is already released, we don't expect any PCU changes, just a rel ack. */ |
| 5587 | RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5588 | setverdict(pass); |
| 5589 | } |
| 5590 | testcase TC_dyn_osmo_pdch_unsol_deact() runs on test_CT { |
| 5591 | var ConnHdlrPars pars; |
| 5592 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5593 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5594 | |
| 5595 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 5596 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_unsol_deact), pars, true); |
| 5597 | vc_conn.done; |
| 5598 | } |
| 5599 | |
| 5600 | /* try to RSL CHAN ACT a PDCH on an osmocom-style PDCH that's already active */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5601 | private function f_TC_dyn_osmo_pdch_double_act(charstring id) runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5602 | var PCUIF_Message first_info; |
| 5603 | var integer ts_nr := g_chan_nr.tn; |
| 5604 | var integer trx_nr := 0; |
| 5605 | var integer bts_nr := 0; |
| 5606 | var integer pcu_conn_id := -1; |
| 5607 | |
| 5608 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5609 | |
| 5610 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
Neels Hofmeyr | df936a2 | 2018-05-08 22:07:57 +0200 | [diff] [blame] | 5611 | /* Send a second Chan Activ and expect it to be NACKed */ |
| 5612 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 5613 | "RSL CHAN ACT NACK"); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5614 | setverdict(pass); |
| 5615 | } |
| 5616 | testcase TC_dyn_osmo_pdch_double_act() runs on test_CT { |
| 5617 | var ConnHdlrPars pars; |
| 5618 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5619 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5620 | |
| 5621 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 5622 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_double_act), pars, true); |
| 5623 | vc_conn.done; |
| 5624 | } |
| 5625 | |
| 5626 | /* try to RSL CHAN ACT a TCH/F on an osmocom-style PDCH */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5627 | private function f_TC_dyn_osmo_pdch_tchf_act(charstring id) runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5628 | var PCUIF_Message first_info; |
| 5629 | var integer ts_nr := g_chan_nr.tn; |
| 5630 | var integer trx_nr := 0; |
| 5631 | var integer bts_nr := 0; |
| 5632 | var integer pcu_conn_id := -1; |
| 5633 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(g_chan_nr.tn)); |
| 5634 | |
| 5635 | /* register for the TCH/F channel number */ |
| 5636 | f_rslem_register(0, chan_nr); |
| 5637 | |
| 5638 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5639 | |
| 5640 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(chan_nr), |
| 5641 | "RSL CHAN ACT"); |
| 5642 | setverdict(pass); |
| 5643 | } |
| 5644 | testcase TC_dyn_osmo_pdch_tchf_act() runs on test_CT { |
| 5645 | var ConnHdlrPars pars; |
| 5646 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5647 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5648 | |
| 5649 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 5650 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchf_act), pars, true); |
| 5651 | vc_conn.done; |
| 5652 | } |
| 5653 | |
| 5654 | /* try to RSL CHAN ACT the TCH/H on an osmocom-style PDCH */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5655 | private function f_TC_dyn_osmo_pdch_tchh_act(charstring id) runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5656 | var PCUIF_Message first_info; |
| 5657 | var integer ts_nr := g_chan_nr.tn; |
| 5658 | var integer trx_nr := 0; |
| 5659 | var integer bts_nr := 0; |
| 5660 | var integer pcu_conn_id := -1; |
| 5661 | var RslChannelNr chan_nr[2] := { valueof(t_RslChanNr_Lm(g_chan_nr.tn, 0)), |
| 5662 | valueof(t_RslChanNr_Lm(g_chan_nr.tn, 1)) }; |
| 5663 | |
| 5664 | /* register for the TCH/H channel numbers */ |
| 5665 | f_rslem_register(0, chan_nr[0]); |
| 5666 | f_rslem_register(0, chan_nr[1]); |
| 5667 | |
| 5668 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5669 | |
| 5670 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[1], g_pars.chan_mode), |
| 5671 | tr_RSL_CHAN_ACT_ACK(chan_nr[1]), "RSL CHAN ACT [1]"); |
| 5672 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[0], g_pars.chan_mode), |
| 5673 | tr_RSL_CHAN_ACT_ACK(chan_nr[0]), "RSL CHAN ACT [0]"); |
| 5674 | setverdict(pass); |
| 5675 | } |
| 5676 | testcase TC_dyn_osmo_pdch_tchh_act() runs on test_CT { |
| 5677 | var ConnHdlrPars pars; |
| 5678 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5679 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 5680 | |
| 5681 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 5682 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchh_act), pars, true); |
| 5683 | vc_conn.done; |
| 5684 | } |
| 5685 | |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5686 | /*********************************************************************** |
| 5687 | * IPA Style Dynamic Timeslot Support |
| 5688 | ***********************************************************************/ |
| 5689 | |
| 5690 | private function f_dyn_ipa_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 5691 | runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5692 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 5693 | PCU.clear; |
| 5694 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 5695 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 5696 | timer T_wait := 2.0; |
| 5697 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5698 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5699 | [] as_pcuif_check_pdch_mask(pcu_conn_id, '1'B, bts_nr, trx_nr); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5700 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 5701 | [] T_wait.timeout { |
| 5702 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5703 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '1' on TS", g_chan_nr.tn)); |
| 5704 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5705 | } |
| 5706 | /* try to activate this PDCH from the PCU point of view */ |
| 5707 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 5708 | /* FIXME: is there a response? */ |
| 5709 | |
| 5710 | RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)); |
| 5711 | } |
| 5712 | |
| 5713 | private function f_dyn_ipa_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 5714 | runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5715 | /* Send RSL CHAN REL (deactivate) */ |
| 5716 | RSL.send(ts_RSL_IPA_PDCH_DEACT(g_chan_nr)); |
| 5717 | PCU.clear; |
| 5718 | /* expect BTS to ask PCU to deactivate the channel */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 5719 | timer T_wait := 2.0; |
| 5720 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5721 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 5722 | [] as_pcuif_check_pdch_mask(pcu_conn_id, '0'B, bts_nr, trx_nr); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5723 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 5724 | [] T_wait.timeout { |
| 5725 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5726 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '0' on TS", g_chan_nr.tn)); |
| 5727 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5728 | } |
| 5729 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 5730 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 5731 | alt { |
| 5732 | [] RSL.receive(tr_RSL_IPA_PDCH_DEACT_ACK(g_chan_nr)) { |
| 5733 | setverdict(pass); |
| 5734 | } |
| 5735 | [] RSL.receive { repeat; } |
| 5736 | } |
| 5737 | } |
| 5738 | |
| 5739 | /* Activate and de-activate an IPA-style dynamic TCH/F + PDCH */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5740 | private function f_TC_dyn_ipa_pdch_act_deact(charstring id) runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5741 | var PCUIF_Message first_info; |
| 5742 | var integer ts_nr := g_chan_nr.tn; |
| 5743 | var integer trx_nr := 0; |
| 5744 | var integer bts_nr := 0; |
| 5745 | var integer pcu_conn_id := -1; |
| 5746 | |
| 5747 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5748 | |
| 5749 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 5750 | f_sleep(3.0); |
| 5751 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 5752 | |
| 5753 | setverdict(pass); |
| 5754 | |
| 5755 | } |
| 5756 | testcase TC_dyn_ipa_pdch_act_deact() runs on test_CT { |
| 5757 | var ConnHdlrPars pars; |
| 5758 | var ConnHdlr vc_conn; |
| 5759 | f_init(); |
| 5760 | |
| 5761 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 5762 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_deact), pars, true); |
| 5763 | vc_conn.done; |
| 5764 | } |
| 5765 | |
| 5766 | /* try to RSL CHAN ACT a TCH/F on an IPA-style PDCH */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5767 | private function f_TC_dyn_ipa_pdch_tchf_act(charstring id) runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5768 | var PCUIF_Message first_info; |
| 5769 | var integer ts_nr := g_chan_nr.tn; |
| 5770 | var integer trx_nr := 0; |
| 5771 | var integer bts_nr := 0; |
| 5772 | var integer pcu_conn_id := -1; |
| 5773 | |
| 5774 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5775 | |
| 5776 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 5777 | "RSL CHAN ACT"); |
| 5778 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 5779 | "RF CHAN REL", true); |
| 5780 | setverdict(pass); |
| 5781 | } |
| 5782 | testcase TC_dyn_ipa_pdch_tchf_act() runs on test_CT { |
| 5783 | var ConnHdlrPars pars; |
| 5784 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5785 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5786 | |
| 5787 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 5788 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act), pars, true); |
| 5789 | vc_conn.done; |
| 5790 | } |
| 5791 | |
| 5792 | /* Activate IPA style dyn PDCH as TCH/F and then illegally try to activate it as PDCH, too */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5793 | private function f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack(charstring id) runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5794 | var PCUIF_Message first_info; |
| 5795 | var integer ts_nr := g_chan_nr.tn; |
| 5796 | var integer trx_nr := 0; |
| 5797 | var integer bts_nr := 0; |
| 5798 | var integer pcu_conn_id := -1; |
| 5799 | |
| 5800 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5801 | |
| 5802 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 5803 | "RSL CHAN ACT"); |
| 5804 | |
| 5805 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 5806 | alt { |
| 5807 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_NACK(g_chan_nr, ?)); |
| 5808 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5809 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PDCH ACT ACK"); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5810 | } |
| 5811 | [] RSL.receive { repeat; } |
| 5812 | } |
| 5813 | |
| 5814 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 5815 | "RF CHAN REL", true); |
| 5816 | setverdict(pass); |
| 5817 | } |
| 5818 | testcase TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() runs on test_CT { |
| 5819 | var ConnHdlrPars pars; |
| 5820 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5821 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5822 | |
| 5823 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 5824 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack), pars, true); |
| 5825 | vc_conn.done; |
| 5826 | } |
| 5827 | |
| 5828 | /* try to RSL CHAN ACT a TCH/F on an IPA-style PDCH that's already in PDCH mode; expect NACK */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5829 | private function f_TC_dyn_ipa_pdch_act_tchf_act_nack(charstring id) runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5830 | var PCUIF_Message first_info; |
| 5831 | var integer ts_nr := g_chan_nr.tn; |
| 5832 | var integer trx_nr := 0; |
| 5833 | var integer bts_nr := 0; |
| 5834 | var integer pcu_conn_id := -1; |
| 5835 | |
| 5836 | /* register for the TCH/F channel number */ |
| 5837 | f_rslem_register(0, g_chan_nr); |
| 5838 | |
| 5839 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 5840 | |
| 5841 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 5842 | |
| 5843 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 5844 | "RSL CHAN ACT"); |
| 5845 | |
| 5846 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 5847 | |
| 5848 | setverdict(pass); |
| 5849 | } |
| 5850 | testcase TC_dyn_ipa_pdch_act_tchf_act_nack() runs on test_CT { |
| 5851 | var ConnHdlrPars pars; |
| 5852 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5853 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 5854 | |
| 5855 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 5856 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_tchf_act_nack), pars, true); |
| 5857 | vc_conn.done; |
| 5858 | } |
| 5859 | |
| 5860 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5861 | /*********************************************************************** |
| 5862 | * LAPDm / RLL related |
| 5863 | ***********************************************************************/ |
| 5864 | |
| 5865 | private function f_tx_lapdm(template (value) LapdmFrame l, |
| 5866 | template (value) RslLinkId link_id) runs on ConnHdlr { |
| 5867 | var octetstring l2 := enc_LapdmFrame(valueof(l)); |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 5868 | var template (value) SacchL1Header l1h; |
| 5869 | |
| 5870 | /* TODO: we can use an extension of TTCN-3 for padding, i.e. PADDING('2B'O) */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5871 | if (valueof(link_id.c) == SACCH) { |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 5872 | /* Compose dummy L1 header */ |
| 5873 | l1h := ts_SacchL1Header(g_pars.l1_pars.ms_power_level, false, g_pars.l1_pars.ms_actual_ta); |
| 5874 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(g_chan_nr, link_id, l1h, f_pad_oct(l2, 21, '2B'O))); |
Pau Espin Pedrol | a0fb42a | 2018-10-10 15:56:39 +0200 | [diff] [blame] | 5875 | } else { |
| 5876 | /* If required, pad L2 frame with constant 0x2b filling */ |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 5877 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, link_id, f_pad_oct(l2, 23, '2B'O))); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5878 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5879 | } |
| 5880 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 5881 | private type record RllTestCase { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5882 | uint3_t sapi, |
| 5883 | RslLinkId link_id, |
| 5884 | octetstring l3, |
| 5885 | boolean exp |
| 5886 | } |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 5887 | private type record of RllTestCase RllTestCases; |
| 5888 | private template RllTestCase t_EITC(uint3_t sapi, RslLinkId id, |
| 5889 | octetstring l3, boolean exp) := { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5890 | sapi := sapi, |
| 5891 | link_id := id, |
| 5892 | l3 := l3, |
| 5893 | exp := exp |
| 5894 | } |
| 5895 | |
| 5896 | /* execute the same callback function with a set of different parameters (tcs) on a |
| 5897 | * variety of logical channels */ |
| 5898 | private function f_rll_testmatrix(RllTestCases tcs, void_fn fn) runs on test_CT { |
| 5899 | var ConnHdlrPars pars; |
| 5900 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5901 | f_init(); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5902 | |
| 5903 | /* test on each of the channels we have */ |
| 5904 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 5905 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 5906 | |
| 5907 | /* test each of the test cases on the current channel */ |
| 5908 | for (var integer j := 0; j < sizeof(tcs); j := j+1) { |
| 5909 | pars.spec.rll := tcs[j]; |
| 5910 | log(testcasename(), ": XXX Starting ", tcs[j] , " on ", g_AllChanTypes[i]); |
| 5911 | vc_conn := f_start_handler(fn, pars); |
| 5912 | vc_conn.done; |
| 5913 | } |
| 5914 | } |
| 5915 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5916 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5917 | } |
| 5918 | |
| 5919 | /* test if SABM on Um triggers EST IND (TS 48.058 3.1) */ |
| 5920 | private function f_TC_rll_est_ind(charstring id) runs on ConnHdlr { |
| 5921 | var RllTestCase tc := g_pars.spec.rll; |
| 5922 | timer T := 3.0; |
| 5923 | |
| 5924 | f_l1_tune(L1CTL); |
| 5925 | RSL.clear; |
| 5926 | |
| 5927 | /* activate the logical channel */ |
| 5928 | f_est_dchan(); |
| 5929 | L1CTL.clear; |
| 5930 | |
| 5931 | f_tx_lapdm(ts_LAPDm_SABM(tc.sapi, cr_MO_CMD, true, tc.l3), tc.link_id); |
| 5932 | T.start; |
| 5933 | alt { |
| 5934 | [tc.l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 5935 | if (tc.exp) { |
| 5936 | setverdict(pass); |
| 5937 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5938 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND with L3 in ", tc)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5939 | } |
| 5940 | } |
| 5941 | [tc.l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, tc.link_id)) { |
| 5942 | if (tc.exp) { |
| 5943 | setverdict(pass); |
| 5944 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5945 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Unexpected EST IND without L3 in ", tc)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5946 | } |
| 5947 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 5948 | /* We also expect to receive the measurements */ |
| 5949 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5950 | [tc.exp] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5951 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for EST IND"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5952 | } |
| 5953 | [not tc.exp] T.timeout { |
| 5954 | setverdict(pass); |
| 5955 | } |
| 5956 | } |
| 5957 | |
| 5958 | f_rsl_chan_deact(); |
| 5959 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 5960 | f_rslem_unregister(0, g_chan_nr); |
| 5961 | } |
| 5962 | testcase TC_rll_est_ind() runs on test_CT { |
| 5963 | var RllTestCases tcs := { |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 5964 | /* SAPI0 establishment (contention resolution) */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5965 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)), |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 5966 | /* normal SAPI0 establishment */ |
| 5967 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), ''O, true)), |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 5968 | /* SAPI 3 doesn't support contention resolution */ |
| 5969 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), '01020304'O, false)), |
| 5970 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), '01020304'O, false)), |
| 5971 | /* normal SAPI3 establishment on main DCCH */ |
| 5972 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)), |
| 5973 | /* normal SAPI3 establishment on SACCH */ |
| 5974 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 5975 | }; |
| 5976 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_ind)); |
| 5977 | } |
| 5978 | |
| 5979 | /* test if RLL EST REQ trigeres SABM on Um; UA on Um triggers EST CONF (TS 48.058 3.2) */ |
| 5980 | private function f_TC_rll_est_req(charstring id) runs on ConnHdlr { |
| 5981 | var RllTestCase tc := g_pars.spec.rll; |
| 5982 | var L1ctlDlMessage dl; |
| 5983 | timer T := 3.0; |
| 5984 | |
| 5985 | f_l1_tune(L1CTL); |
| 5986 | RSL.clear; |
| 5987 | |
| 5988 | /* activate the logical channel */ |
| 5989 | f_est_dchan(); |
| 5990 | L1CTL.clear; |
| 5991 | |
| 5992 | /* Send a RSL EST REQ for SAPI3 on main DCCH */ |
| 5993 | RSL.send(ts_RSL_EST_REQ(g_chan_nr, tc.link_id)); |
| 5994 | T.start; |
| 5995 | alt { |
| 5996 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 5997 | var LapdmFrame lapdm; |
| 5998 | var octetstring l2 := dl.payload.data_ind.payload; |
| 5999 | if (dl.dl_info.link_id.c == SACCH) { |
| 6000 | /* remove L1 header */ |
| 6001 | l2 := substr(l2, 2, lengthof(l2)-2); |
| 6002 | } |
| 6003 | lapdm.ab := dec_LapdmFrameAB(l2); |
| 6004 | if (match(lapdm, tr_LAPDm_SABM(tc.sapi, cr_MT_CMD, true, ''O))) { |
| 6005 | setverdict(pass); |
| 6006 | } else { |
| 6007 | repeat; |
| 6008 | } |
| 6009 | } |
| 6010 | [] L1CTL.receive { repeat; } |
| 6011 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6012 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SABM"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6013 | } |
| 6014 | } |
| 6015 | |
| 6016 | f_rsl_chan_deact(); |
| 6017 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6018 | f_rslem_unregister(0, g_chan_nr); |
| 6019 | } |
| 6020 | testcase TC_rll_est_req_DCCH_3() runs on test_CT { |
| 6021 | var RllTestCases tcs := { |
| 6022 | /* normal SAPI3 establishment on main DCCH */ |
| 6023 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true))//, |
| 6024 | }; |
| 6025 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 6026 | } |
| 6027 | testcase TC_rll_est_req_ACCH_3() runs on test_CT { |
| 6028 | var RllTestCases tcs := { |
| 6029 | /* normal SAPI3 establishment on SACCH */ |
| 6030 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 6031 | } |
| 6032 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 6033 | } |
| 6034 | |
| 6035 | /* altstep to receive a LAPDm frame matching the given template */ |
| 6036 | private altstep as_l1_exp_lapdm(template LapdmFrame exp) runs on ConnHdlr { |
| 6037 | var L1ctlDlMessage dl; |
| 6038 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 6039 | var LapdmFrame lapdm; |
| 6040 | var octetstring l2 := dl.payload.data_ind.payload; |
| 6041 | if (dl.dl_info.link_id.c == SACCH) { |
| 6042 | /* remove L1 header */ |
| 6043 | l2 := substr(l2, 2, lengthof(l2)-2); |
| 6044 | } |
| 6045 | if (ischosen(exp.ab)) { |
| 6046 | lapdm.ab := dec_LapdmFrameAB(l2); |
| 6047 | } else if (ischosen(exp.b4)) { |
| 6048 | lapdm.b4 := dec_LapdmFrameB4(l2); |
| 6049 | } else if (ischosen(exp.bbis)) { |
| 6050 | lapdm.bbis := dec_LapdmFrameBbis(l2); |
| 6051 | } |
| 6052 | log("Rx LAPDm ", lapdm); |
| 6053 | if (match(lapdm, exp)) { |
| 6054 | setverdict(pass); |
| 6055 | } else { |
| 6056 | repeat; |
| 6057 | } |
| 6058 | } |
| 6059 | [] L1CTL.receive { repeat; } |
| 6060 | } |
| 6061 | private function f_l1_exp_lapdm(template LapdmFrame exp, float t := 3.0) runs on ConnHdlr { |
| 6062 | timer T := t; |
| 6063 | T.start; |
| 6064 | alt { |
| 6065 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6066 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for LAPDm ", exp)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6067 | } |
| 6068 | [] as_l1_exp_lapdm(exp); |
| 6069 | } |
| 6070 | } |
| 6071 | |
| 6072 | /* establish one Radio Link Layer via SABM -> UA. Use l3 for contention resolution */ |
| 6073 | private function f_est_rll_mo(uint3_t sapi, RslLinkId link_id, octetstring l3) runs on ConnHdlr { |
| 6074 | /* send SABM from MS -> BTS */ |
| 6075 | f_tx_lapdm(ts_LAPDm_SABM(sapi, cr_MO_CMD, true, l3), link_id); |
| 6076 | /* expect RLL EST IND on Abis */ |
| 6077 | alt { |
| 6078 | [l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3)); |
| 6079 | [l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id)); |
| 6080 | [] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6081 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Failing due to RSL_ERROR_IND"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6082 | } |
| 6083 | [] RSL.receive { repeat; } |
| 6084 | } |
| 6085 | /* expect UA from BTS -> MS */ |
| 6086 | f_l1_exp_lapdm(tr_LAPDm_UA(sapi, cr_MT_RSP, true, l3)); |
| 6087 | } |
| 6088 | |
| 6089 | /* test if DISC on Um triggers RLL REL IND (TS 48.058 3.3) */ |
| 6090 | private function f_TC_rll_rel_ind(charstring id) runs on ConnHdlr { |
| 6091 | var RllTestCase tc := g_pars.spec.rll; |
| 6092 | |
| 6093 | f_l1_tune(L1CTL); |
| 6094 | RSL.clear; |
| 6095 | |
| 6096 | /* activate the logical channel */ |
| 6097 | f_est_dchan(); |
| 6098 | L1CTL.clear; |
| 6099 | |
| 6100 | /* first establish the link-layer */ |
| 6101 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 6102 | |
| 6103 | /* then send the DISC */ |
| 6104 | f_tx_lapdm(ts_LAPDm_DISC(tc.sapi, cr_MO_CMD, true), tc.link_id); |
| 6105 | /* ... and expect the REL IND on the RSL side */ |
| 6106 | alt { |
| 6107 | [] RSL.receive(tr_RSL_REL_IND(g_chan_nr, tc.link_id)) { |
| 6108 | setverdict(pass); |
| 6109 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 6110 | /* We also expect to receive the measurements */ |
| 6111 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6112 | } |
| 6113 | |
| 6114 | /* release the channel */ |
| 6115 | f_rsl_chan_deact(); |
| 6116 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6117 | f_rslem_unregister(0, g_chan_nr); |
| 6118 | } |
| 6119 | testcase TC_rll_rel_ind_DCCH_0() runs on test_CT { |
| 6120 | var RllTestCases tcs := { |
| 6121 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)) |
| 6122 | }; |
| 6123 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 6124 | } |
| 6125 | |
| 6126 | testcase TC_rll_rel_ind_ACCH_0() runs on test_CT { |
| 6127 | var RllTestCases tcs := { |
| 6128 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), ''O, true)) |
| 6129 | }; |
| 6130 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 6131 | } |
| 6132 | testcase TC_rll_rel_ind_DCCH_3() runs on test_CT { |
| 6133 | var RllTestCases tcs := { |
| 6134 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)) |
| 6135 | }; |
| 6136 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 6137 | } |
| 6138 | testcase TC_rll_rel_ind_ACCH_3() runs on test_CT { |
| 6139 | var RllTestCases tcs := { |
| 6140 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 6141 | }; |
| 6142 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 6143 | } |
| 6144 | |
| 6145 | /* test if RLL REL REQ triggers DISC on Um; UA/DM triggers RLL REL CONF (TS 48.058 3.4) */ |
| 6146 | private function f_TC_rll_rel_req(charstring id) runs on ConnHdlr { |
| 6147 | var RllTestCase tc := g_pars.spec.rll; |
| 6148 | f_l1_tune(L1CTL); |
| 6149 | RSL.clear; |
| 6150 | |
| 6151 | /* activate the logical channel */ |
| 6152 | f_est_dchan(); |
| 6153 | L1CTL.clear; |
| 6154 | |
| 6155 | /* first establish the link-layer */ |
| 6156 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 6157 | |
| 6158 | /* then send the REL REQ via RSL */ |
| 6159 | RSL.send(ts_RSL_REL_REQ(g_chan_nr, tc.link_id, RSL_REL_MODE_NORMAL)); |
| 6160 | /* ... and expect the DISC on the Um side */ |
| 6161 | alt { |
Harald Welte | bc6199f | 2018-05-10 19:38:18 +0200 | [diff] [blame] | 6162 | [] as_l1_exp_lapdm(tr_LAPDm_DISC(tc.sapi, cr_MT_CMD, true)) { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6163 | /* FIXME: send a UA in resposne to the DISC */ |
| 6164 | } |
| 6165 | } |
| 6166 | |
| 6167 | /* release the channel */ |
| 6168 | f_rsl_chan_deact(); |
| 6169 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6170 | f_rslem_unregister(0, g_chan_nr); |
| 6171 | } |
| 6172 | testcase TC_rll_rel_req() runs on test_CT { |
| 6173 | var RllTestCases tcs := { |
| 6174 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), '01020304'O, true)), |
| 6175 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), ''O, true)), |
| 6176 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), ''O, true)), |
| 6177 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), ''O, true)) |
| 6178 | }; |
| 6179 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_req)); |
| 6180 | } |
| 6181 | |
Vadim Yanitskiy | 89be060 | 2020-07-04 21:20:57 +0700 | [diff] [blame] | 6182 | /* TODO: test if RLL DATA REQ triggers I-frames on Um (TS 48.058 3.5) */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6183 | testcase TC_rll_data_req() runs on test_CT { |
| 6184 | } |
| 6185 | |
Vadim Yanitskiy | 89be060 | 2020-07-04 21:20:57 +0700 | [diff] [blame] | 6186 | /* TODO: test if I-frames on Um trigger RLL DATA IND (TS 48.058 3.6) */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6187 | testcase TC_rll_data_ind() runs on test_CT { |
| 6188 | } |
| 6189 | |
| 6190 | /* test if RLL UNIT DATA REQ triggers UI-frame on Um (TS 48.058 3.7) */ |
| 6191 | private function f_TC_rll_ud_req(charstring id) runs on ConnHdlr { |
| 6192 | var RllTestCase tc := g_pars.spec.rll; |
| 6193 | |
| 6194 | f_l1_tune(L1CTL); |
| 6195 | RSL.clear; |
| 6196 | |
| 6197 | f_est_dchan(); |
| 6198 | L1CTL.clear; |
| 6199 | |
| 6200 | /* Send UNITDATA REQ on RSL side */ |
| 6201 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, tc.link_id, tc.l3)); |
| 6202 | /* Expect it to arrive on the other side */ |
| 6203 | if (tc.link_id.c == SACCH) { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6204 | f_l1_exp_lapdm(tr_LAPDm_B4_UI(tc.sapi, cr_MT_CMD, tc.l3)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6205 | } else { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6206 | f_l1_exp_lapdm(tr_LAPDm_UI(tc.sapi, cr_MT_CMD, tc.l3)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6207 | } |
| 6208 | |
| 6209 | /* release the channel */ |
| 6210 | f_rsl_chan_deact(); |
| 6211 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6212 | f_rslem_unregister(0, g_chan_nr); |
| 6213 | } |
| 6214 | testcase TC_rll_unit_data_req_DCCH() runs on test_CT { |
| 6215 | var octetstring l3 := f_rnd_octstring(15); |
| 6216 | var RllTestCases tcs := { |
| 6217 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), l3, true)), |
| 6218 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), l3, true)) |
| 6219 | }; |
| 6220 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 6221 | } |
| 6222 | testcase TC_rll_unit_data_req_ACCH() runs on test_CT { |
| 6223 | var octetstring l3 := f_rnd_octstring(19); |
| 6224 | var RllTestCases tcs := { |
| 6225 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), l3, true)), |
| 6226 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), l3, true)) |
| 6227 | }; |
| 6228 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 6229 | } |
| 6230 | |
| 6231 | /* test if UI-frames on Um trigger RLL UNIT DATA IND (TS 48.058 3.8) */ |
| 6232 | private function f_TC_rll_ud_ind(charstring id) runs on ConnHdlr { |
| 6233 | var RllTestCase tc := g_pars.spec.rll; |
| 6234 | |
| 6235 | f_l1_tune(L1CTL); |
| 6236 | RSL.clear; |
| 6237 | |
| 6238 | f_est_dchan(); |
| 6239 | L1CTL.clear; |
| 6240 | |
| 6241 | /* Send LAPDm UI frame. There is no B4 format in uplink! */ |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6242 | f_tx_lapdm(ts_LAPDm_UI(tc.sapi, cr_MO_CMD, tc.l3), tc.link_id); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6243 | /* Expdct RLL UNITDATA IND on RSL side */ |
| 6244 | alt { |
| 6245 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 6246 | setverdict(pass); |
| 6247 | } |
| 6248 | [] RSL.receive { repeat; } |
| 6249 | } |
| 6250 | |
| 6251 | /* release the channel */ |
| 6252 | f_rsl_chan_deact(); |
| 6253 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6254 | f_rslem_unregister(0, g_chan_nr); |
| 6255 | } |
| 6256 | testcase TC_rll_unit_data_ind_DCCH() runs on test_CT { |
Stefan Sperling | c418191 | 2018-07-25 17:03:08 +0200 | [diff] [blame] | 6257 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6258 | var RllTestCases tcs := { |
| 6259 | valueof(t_EITC(0, valueof(ts_RslLinkID_DCCH(0)), l3, true)), |
| 6260 | valueof(t_EITC(3, valueof(ts_RslLinkID_DCCH(3)), l3, true)) |
| 6261 | }; |
| 6262 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 6263 | } |
| 6264 | testcase TC_rll_unit_data_ind_ACCH() runs on test_CT { |
| 6265 | var octetstring l3 := f_rnd_octstring(18); |
| 6266 | var RllTestCases tcs := { |
| 6267 | valueof(t_EITC(0, valueof(ts_RslLinkID_SACCH(0)), l3, true)), |
| 6268 | valueof(t_EITC(3, valueof(ts_RslLinkID_SACCH(3)), l3, true)) |
| 6269 | }; |
| 6270 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 6271 | } |
| 6272 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6273 | /*********************************************************************** |
| 6274 | * Encryption Related |
| 6275 | ***********************************************************************/ |
| 6276 | |
| 6277 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 6278 | private function f_unitdata_mt(RslLinkId link_id, octetstring l3) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6279 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, link_id, l3)); |
| 6280 | if (link_id.c == SACCH) { |
| 6281 | f_l1_exp_lapdm(tr_LAPDm_B4_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 6282 | } else { |
| 6283 | f_l1_exp_lapdm(tr_LAPDm_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 6284 | } |
| 6285 | } |
| 6286 | |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 6287 | /* Expect (or not expect) other kinds of messages */ |
| 6288 | private altstep as_rsl_any_ind(boolean exp_any) runs on ConnHdlr { |
| 6289 | [exp_any] RSL.receive { repeat; } |
| 6290 | [not exp_any] RSL.receive { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6291 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message!"); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 6292 | } |
| 6293 | } |
| 6294 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6295 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
Vadim Yanitskiy | 8d8f91c | 2018-10-04 06:19:45 +0700 | [diff] [blame] | 6296 | private function f_unitdata_mo( |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 6297 | RslLinkId link_id, |
| 6298 | octetstring l3, |
| 6299 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 6300 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 6301 | ) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6302 | timer T := 3.0; |
| 6303 | f_tx_lapdm(ts_LAPDm_UI(link_id.sapi, cr_MO_CMD, l3), link_id); |
| 6304 | T.start; |
| 6305 | /* Expect RLL UNITDATA IND on RSL side */ |
| 6306 | alt { |
| 6307 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, link_id, l3)) { |
| 6308 | setverdict(pass); |
| 6309 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 6310 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 6311 | [] as_rsl_any_ind(exp_any); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6312 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6313 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for UNIT_DATA_IND"); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6314 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6315 | } |
| 6316 | } |
| 6317 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 6318 | /* Send I-frame from MS and expect it to arrive as RLL DATA IND on Abis */ |
| 6319 | private function f_data_mo( |
| 6320 | RslLinkId link_id, |
| 6321 | boolean p, uint3_t nr, uint3_t ns, |
| 6322 | octetstring l3, |
| 6323 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 6324 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 6325 | ) runs on ConnHdlr { |
| 6326 | timer T := 3.0; |
| 6327 | f_tx_lapdm(ts_LAPDm_I(link_id.sapi, cr_MO_CMD, p, nr, ns, l3), link_id); |
| 6328 | T.start; |
| 6329 | /* Expect RLL DATA IND on RSL side */ |
| 6330 | alt { |
| 6331 | [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3)) { |
| 6332 | setverdict(pass); |
| 6333 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 6334 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 6335 | [] as_rsl_any_ind(exp_any); |
| 6336 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6337 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for DATA_IND"); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 6338 | } |
| 6339 | } |
| 6340 | } |
| 6341 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6342 | /* Test channel activation with A5/n right from the beginning (like in assignment + hand-over) */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6343 | private function f_TC_chan_act_encr(charstring id) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6344 | f_l1_tune(L1CTL); |
| 6345 | f_est_dchan(true); |
| 6346 | |
| 6347 | /* now we actually need to transmit some data both ways to check if the encryption works */ |
| 6348 | var L1ctlDlMessage dl; |
| 6349 | |
Stefan Sperling | 603d98e | 2018-07-25 16:47:28 +0200 | [diff] [blame] | 6350 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6351 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 6352 | |
| 6353 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 6354 | f_unitdata_mt(link_id, l3); |
| 6355 | |
| 6356 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
| 6357 | f_unitdata_mo(link_id, l3); |
| 6358 | |
| 6359 | /* release the channel */ |
| 6360 | f_rsl_chan_deact(); |
| 6361 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6362 | f_rslem_unregister(0, g_chan_nr); |
| 6363 | } |
| 6364 | testcase TC_chan_act_a51() runs on test_CT { |
| 6365 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6366 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 6367 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 6368 | } |
| 6369 | testcase TC_chan_act_a52() runs on test_CT { |
| 6370 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6371 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 6372 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 6373 | } |
| 6374 | testcase TC_chan_act_a53() runs on test_CT { |
| 6375 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6376 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 6377 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 6378 | } |
| 6379 | |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 6380 | /* Test channel activation with A5/n right from the beginning and RSL MODE MODIFY |
| 6381 | which should break the en/decryption on purpose by supplying a new key that is unknown to the MS*/ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6382 | private function f_TC_rsl_modify_encr(charstring id) runs on ConnHdlr { |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 6383 | f_l1_tune(L1CTL); |
| 6384 | f_est_dchan(true); |
| 6385 | |
| 6386 | /* now we actually need to transmit some data both ways to check if the encryption works */ |
| 6387 | var L1ctlDlMessage dl; |
| 6388 | |
| 6389 | var octetstring l3 := f_rnd_octstring(20); |
| 6390 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 6391 | |
| 6392 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 6393 | f_unitdata_mt(link_id, l3); |
| 6394 | |
| 6395 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
| 6396 | f_unitdata_mo(link_id, l3); |
| 6397 | |
| 6398 | var RSL_Message rsl; |
| 6399 | rsl := valueof(ts_RSL_MODE_MODIFY_REQ(g_chan_nr, valueof(ts_RSL_ChanMode_SIGN(false)))); |
| 6400 | |
| 6401 | /* modify key to break proper encryption */ |
| 6402 | g_pars.encr.key := f_rnd_octstring(8); |
| 6403 | var RSL_IE ei := valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info := g_pars.encr})); |
| 6404 | rsl.ies := rsl.ies & { ei }; |
| 6405 | RSL.send(rsl); |
| 6406 | |
| 6407 | timer T0 := 1.0; |
| 6408 | T0.start; |
| 6409 | /* Expect RSL MODIFY ACK */ |
| 6410 | alt { |
| 6411 | [] RSL.receive(tr_RSL_MODE_MODIFY_ACK(g_chan_nr)) {} |
| 6412 | [] RSL.receive(tr_RSL_MODE_MODIFY_NACK(g_chan_nr, ?)) { |
| 6413 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,"MODE MODIFY NACK"); |
| 6414 | } |
| 6415 | [] T0.timeout { |
| 6416 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for MODE MODIFY (N)ACK"); |
| 6417 | } |
| 6418 | } |
| 6419 | |
| 6420 | var octetstring l3msg := f_rnd_octstring(15); |
| 6421 | timer T1 := 3.0; |
| 6422 | /* Send UI frame from MS, do not expect it to arrive as RLL UNITDATA IND on Abis |
| 6423 | due to broken encryption */ |
| 6424 | f_tx_lapdm(ts_LAPDm_UI(link_id.sapi, cr_MO_CMD, l3msg), link_id); |
| 6425 | T1.start; |
| 6426 | alt { |
| 6427 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, link_id, l3msg)) { |
| 6428 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "BTS shouldn't be able to decrypt after key change") |
| 6429 | } |
| 6430 | [] T1.timeout { |
| 6431 | setverdict(pass); |
| 6432 | } |
| 6433 | } |
| 6434 | |
| 6435 | /* release the channel */ |
| 6436 | f_rsl_chan_deact(); |
| 6437 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6438 | f_rslem_unregister(0, g_chan_nr); |
| 6439 | } |
| 6440 | testcase TC_rsl_modify_encr() runs on test_CT { |
| 6441 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6442 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 6443 | f_testmatrix_each_chan(pars, refers(f_TC_rsl_modify_encr)); |
| 6444 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6445 | |
| 6446 | /* Test unencrypted channel activation followed by explicit ENCR CMD later */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6447 | private function f_TC_encr_cmd(charstring id) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6448 | /* L3 payload doesn't matter, as it is passed transparently */ |
| 6449 | var BIT3 l3_alg_id := f_alg_id_to_l3(g_pars.encr.alg_id); |
| 6450 | var octetstring l3 := enc_PDU_ML3_NW_MS(valueof(ts_RRM_CiphModeCmd(l3_alg_id))); |
| 6451 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 6452 | |
| 6453 | f_l1_tune(L1CTL); |
| 6454 | |
| 6455 | /* first establish a dedicated channel in the clear */ |
| 6456 | f_est_dchan(false); |
| 6457 | |
| 6458 | /* Establish ABM */ |
| 6459 | f_est_rll_mo(link_id.sapi, link_id, '23420815'O); |
| 6460 | |
| 6461 | /* then send the RSL ENCR CMD with an actual RR CIPH MOD CMD inside */ |
| 6462 | RSL.send(ts_RSL_ENCR_CMD(g_chan_nr, link_id, g_pars.encr.alg_id, g_pars.encr.key, l3)); |
| 6463 | /* expect the L3 to arrive still unencrypted on the MS side */ |
| 6464 | f_l1_exp_lapdm(tr_LAPDm_I(link_id.sapi, cr_MT_CMD, ?, ?, ?, l3)); |
| 6465 | |
| 6466 | /* configure L1 to apply ciphering */ |
| 6467 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 6468 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 6469 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 6470 | /* send first ciphered I-frame in response and expect it on RSL */ |
| 6471 | f_data_mo(link_id, true, 1, 0, '0a0b0c0d'O, exp_sacch := true); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6472 | |
| 6473 | /* now the BTS code should have detected the first properly encrypted uplink I-frame, |
| 6474 | * and hence enable encryption also on the downlink */ |
| 6475 | |
| 6476 | /* expect bi-directional communication work in encrypted mode */ |
| 6477 | f_unitdata_mo(link_id, f_rnd_octstring(15)); |
| 6478 | f_unitdata_mt(link_id, f_rnd_octstring(15)); |
| 6479 | |
| 6480 | /* release the channel */ |
| 6481 | f_rsl_chan_deact(); |
| 6482 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6483 | f_rslem_unregister(0, g_chan_nr); |
| 6484 | } |
| 6485 | testcase TC_encr_cmd_a51() runs on test_CT { |
| 6486 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6487 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 6488 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 6489 | } |
| 6490 | testcase TC_encr_cmd_a52() runs on test_CT { |
| 6491 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6492 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 6493 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 6494 | } |
| 6495 | testcase TC_encr_cmd_a53() runs on test_CT { |
| 6496 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 6497 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 6498 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 6499 | } |
| 6500 | |
| 6501 | private function f_assert_lapdm(octetstring enc, template LapdmFrame exp_match, charstring name := "") { |
| 6502 | var LapdmFrame lf; |
| 6503 | var octetstring reenc; |
| 6504 | |
| 6505 | /* decode the LAPDm frame */ |
| 6506 | if (ischosen(exp_match.ab)) { |
| 6507 | lf.ab := dec_LapdmFrameAB(enc); |
| 6508 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6509 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "unsupported frame type"); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6510 | } |
| 6511 | |
| 6512 | /* check if decoder result matches expectation */ |
| 6513 | if (not match(lf, exp_match)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6514 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": decoded LAPDm doesn't match")); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6515 | } else { |
| 6516 | log(name, ": matched"); |
| 6517 | setverdict(pass); |
| 6518 | } |
| 6519 | |
| 6520 | /* test if re-encoded frame equals original input */ |
| 6521 | reenc := enc_LapdmFrame(lf); |
| 6522 | if (enc != reenc) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6523 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str(name, ": re-encoded LAPDm frame doesn't match")); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6524 | } else { |
| 6525 | setverdict(pass); |
| 6526 | } |
| 6527 | } |
| 6528 | |
| 6529 | testcase TC_lapdm_selftest() runs on test_CT { |
| 6530 | f_assert_lapdm('030301'O, tr_LAPDm_UI(0, true, ''O), "ui_s0_empty"); |
| 6531 | f_assert_lapdm('0F0301'O, tr_LAPDm_UI(3, true, ''O), "ui_s3_empty"); |
| 6532 | f_assert_lapdm('013F01'O, tr_LAPDm_SABM(0, false, true, ''O), "sabm_s0_empty"); |
| 6533 | f_assert_lapdm('013F1123420815'O, tr_LAPDm_SABM(0, false, true, '23420815'O), "sabm_s0_l3"); |
| 6534 | f_assert_lapdm('03E101'O, tr_LAPDm_RR(0, true, false, 7), "rr_s0_7"); |
| 6535 | f_assert_lapdm('03000d063505'O, tr_LAPDm_I(0, true, false, 0, 0, '063505'O), "I/0/0"); |
| 6536 | f_assert_lapdm('03e00d063505'O, tr_LAPDm_I(0, true, false, 7, 0, '063505'O), "I/7/0"); |
| 6537 | } |
| 6538 | |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6539 | /*********************************************************************** |
| 6540 | * DTX Related (see GSM 05.08, section 8.3) |
| 6541 | ***********************************************************************/ |
| 6542 | |
| 6543 | /* XXX These functions must be kept in sync with g_AllChannels defined on test_CT. */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 6544 | private function f_g_chan_is_tchf() runs on ConnHdlr return boolean { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6545 | return (g_chan_nr == valueof(ts_RslChanNr_Bm(1)) or |
| 6546 | g_chan_nr == valueof(ts_RslChanNr_Bm(2)) or |
| 6547 | g_chan_nr == valueof(ts_RslChanNr_Bm(3)) or |
| 6548 | g_chan_nr == valueof(ts_RslChanNr_Bm(4))); |
| 6549 | } |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 6550 | private function f_g_chan_is_tchh() runs on ConnHdlr return boolean { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6551 | return (g_chan_nr == valueof(ts_RslChanNr_Lm(5,0)) or |
| 6552 | g_chan_nr == valueof(ts_RslChanNr_Lm(5,1))); |
| 6553 | } |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 6554 | private function f_g_chan_is_sdcch4() runs on ConnHdlr return boolean { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6555 | return (g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,0)) or |
| 6556 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,1)) or |
| 6557 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,2)) or |
| 6558 | g_chan_nr == valueof(ts_RslChanNr_SDCCH4(0,3))); |
| 6559 | } |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 6560 | private function f_g_chan_is_sdcch8() runs on ConnHdlr return boolean { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6561 | return (g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,0)) or |
| 6562 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,1)) or |
| 6563 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,2)) or |
| 6564 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,3)) or |
| 6565 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,4)) or |
| 6566 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,5)) or |
| 6567 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,6)) or |
| 6568 | g_chan_nr == valueof(ts_RslChanNr_SDCCH8(6,7))); |
| 6569 | } |
| 6570 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6571 | private function f_test_l2_fill_frames(boolean dtxd) runs on ConnHdlr { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6572 | var L1ctlDlMessage dl; |
| 6573 | var octetstring l2_fill_frame := '0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O; |
| 6574 | var octetstring l2_fill_frame_sacch := substr(l2_fill_frame, 0, lengthof(l2_fill_frame) - 2); |
| 6575 | var GsmFrameNumber first_fn; |
| 6576 | var boolean is_first_frame := true; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6577 | var integer nfill_frames_sacch := 0; |
| 6578 | var integer nfill_frames_nonsacch := 0; |
| 6579 | var integer expected_fill_frames := 10000; /* initial value causes test failure if not overridden */ |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6580 | /* Frames numbers (mod 104) for which a fill frame is expected on TCHF if DTX is enabled. */ |
| 6581 | var Integers required_tdma_frames_dtx_tchf := { 52, 53, 54, 55, 56, 57, 58, 59 }; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6582 | const integer frame_dtx_tchf_mod := 104; |
| 6583 | /* Frame numbers (mod 104) for which a fill frame is expected at the L1SAP level, |
| 6584 | * which operates in terms of blocks rather than frames. */ |
| 6585 | var Integers required_tdma_blocks_dtx_tchf := { 52, 56 }; |
| 6586 | const integer block_dtx_tchf_mod := 26; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6587 | timer T := 5.0; |
| 6588 | |
| 6589 | f_l1_tune(L1CTL); |
| 6590 | RSL.clear; |
| 6591 | L1CTL.clear; |
| 6592 | |
| 6593 | /* activate TCHF signalling channel */ |
| 6594 | f_est_dchan(false); |
| 6595 | |
| 6596 | T.start; |
| 6597 | alt { |
| 6598 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 6599 | var GsmFrameNumber fn := dl.dl_info.frame_nr; |
| 6600 | var octetstring l2 := dl.payload.data_ind.payload; |
| 6601 | |
| 6602 | if (is_first_frame) { |
| 6603 | is_first_frame := false; |
| 6604 | first_fn := dl.dl_info.frame_nr; |
| 6605 | } |
| 6606 | |
| 6607 | if (dl.dl_info.link_id.c == SACCH) { |
| 6608 | l2 := substr(l2, 2, lengthof(l2) - 2); /* remove L1 header */ |
| 6609 | if (not match(l2_fill_frame_sacch, l2)) { |
| 6610 | repeat; |
| 6611 | } |
| 6612 | } else if (not match(l2_fill_frame, l2)) { |
| 6613 | repeat; |
| 6614 | } |
| 6615 | |
| 6616 | if (dtxd) { |
| 6617 | if (not f_g_chan_is_tchf()) { |
| 6618 | T.stop; |
| 6619 | f_rsl_chan_deact(); |
| 6620 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6621 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received fill frame on non-TCH/F channel; DTX is only allowed on TCH/F!"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6622 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6623 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6624 | T.stop; |
| 6625 | f_rsl_chan_deact(); |
| 6626 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6627 | |
| 6628 | /* With DTX enabled we can expect at least 3 fill frames for every 104 frames. |
| 6629 | * 2 SACCH, 1 TCH/F */ |
| 6630 | expected_fill_frames := 3; |
| 6631 | |
| 6632 | if (nfill_frames_sacch + nfill_frames_nonsacch < expected_fill_frames) { |
| 6633 | log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch, |
| 6634 | " (SACCH+other) out of ", expected_fill_frames, " expected fill frames"); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6635 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6636 | } else { |
| 6637 | setverdict(pass); |
| 6638 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6639 | } else { |
| 6640 | if (dl.dl_info.link_id.c == SACCH) { |
| 6641 | nfill_frames_sacch := nfill_frames_sacch + 1; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6642 | repeat; |
| 6643 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6644 | /* On DTX TCH/F channels, fill frames occur only for specific frame numbers mod 104. |
| 6645 | * Furthermore, the L1SAP layer gives us frame numbers for the start of a block so |
| 6646 | * we should only see the subset of frames numbers which correspond to a block boundary. |
| 6647 | * TCH/F blocks are defined to start at 0,4,8,13,17,21 (modulo 26) */ |
| 6648 | for (var integer i := 0; i < lengthof(required_tdma_blocks_dtx_tchf); i := i + 1) { |
| 6649 | if (fn mod frame_dtx_tchf_mod == required_tdma_blocks_dtx_tchf[i]) { |
| 6650 | nfill_frames_nonsacch := nfill_frames_nonsacch + 1; |
| 6651 | repeat; |
| 6652 | } |
| 6653 | } |
| 6654 | log("Received DTX TCH fill frame with bad frame number: ", fn, |
| 6655 | " (mod ", frame_dtx_tchf_mod, ": ", fn mod frame_dtx_tchf_mod, ")", |
| 6656 | " (mod ", block_dtx_tchf_mod, ": ", fn mod block_dtx_tchf_mod, ")"); |
| 6657 | f_rsl_chan_deact(); |
| 6658 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6659 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected L2 fill frame received on Um"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6660 | } |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6661 | } else { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6662 | if (dl.dl_info.link_id.c == SACCH) { |
| 6663 | nfill_frames_sacch := nfill_frames_sacch + 1; |
| 6664 | } else { |
| 6665 | nfill_frames_nonsacch := nfill_frames_nonsacch + 1; |
| 6666 | } |
| 6667 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6668 | T.stop; |
| 6669 | if (f_g_chan_is_tchf()) { |
| 6670 | /* Without DTX we can expect 25 fill frames for every 104 frames. |
| 6671 | * (24 FACCH + 1 SACCH filling) */ |
| 6672 | expected_fill_frames := 25; |
| 6673 | } else if (f_g_chan_is_tchh()) { |
| 6674 | /* We can expect 2 fill frames for every 104 frames. */ |
| 6675 | expected_fill_frames := 2; |
| 6676 | } else if (f_g_chan_is_sdcch4() or f_g_chan_is_sdcch8()) { |
| 6677 | /* We can expect 5 fill frames for every 104 frames. */ |
| 6678 | expected_fill_frames := 5; |
| 6679 | } else { |
| 6680 | f_rsl_chan_deact(); |
| 6681 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6682 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknown channel type"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6683 | } |
| 6684 | |
| 6685 | f_rsl_chan_deact(); |
| 6686 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6687 | |
| 6688 | if (nfill_frames_sacch + nfill_frames_nonsacch >= expected_fill_frames) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6689 | setverdict(pass); |
| 6690 | } else { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 6691 | log("received only ", nfill_frames_sacch, "+", nfill_frames_nonsacch, |
| 6692 | " (SACCH+other) out of ", expected_fill_frames, " expected fill frames"); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6693 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Not enough fill frames received"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6694 | } |
| 6695 | } else { |
| 6696 | repeat; |
| 6697 | } |
| 6698 | } |
| 6699 | } |
| 6700 | [] L1CTL.receive { repeat; } |
| 6701 | [] T.timeout { |
| 6702 | f_rsl_chan_deact(); |
| 6703 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6704 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for L2 fill frames on Um"); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6705 | } |
| 6706 | } |
| 6707 | } |
| 6708 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6709 | private function f_TC_tch_sign_l2_fill_frame(charstring id) runs on ConnHdlr { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6710 | f_test_l2_fill_frames(false); |
| 6711 | } |
| 6712 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6713 | private function f_TC_tch_sign_l2_fill_frame_dtxd(charstring id) runs on ConnHdlr { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6714 | f_test_l2_fill_frames(true); |
| 6715 | } |
| 6716 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6717 | private function f_tch_sign_l2_fill_frame(boolean dtxd) runs on test_CT { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6718 | var ConnHdlr vc_conn; |
| 6719 | var ConnHdlrPars pars; |
| 6720 | pars.t_guard := 60.0; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6721 | f_init(); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6722 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
| 6723 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN(dtxd))); |
| 6724 | if (dtxd) { |
| 6725 | if (i >= 4) { /* DTX is only allowed on TCH/F */ |
| 6726 | break; |
| 6727 | } |
| 6728 | vc_conn := f_start_handler(refers(f_TC_tch_sign_l2_fill_frame_dtxd), pars); |
| 6729 | } else { |
| 6730 | vc_conn := f_start_handler(refers(f_TC_tch_sign_l2_fill_frame), pars); |
| 6731 | } |
| 6732 | vc_conn.done; |
| 6733 | } |
| 6734 | } |
| 6735 | |
| 6736 | /* Verify that L2 fill frames are sent on TCH in signaling mode if |
| 6737 | * there is nothing to transmit while DTX is disabled on downlink. */ |
| 6738 | testcase TC_tch_sign_l2_fill_frame() runs on test_CT { |
| 6739 | f_tch_sign_l2_fill_frame(false); |
| 6740 | } |
| 6741 | |
| 6742 | /* Verify that particular L2 fill frames are sent on TCH in signaling mode if |
| 6743 | * there is nothing to transmit while DTX is enabled on downlink. */ |
| 6744 | testcase TC_tch_sign_l2_fill_frame_dtxd() runs on test_CT { |
| 6745 | f_tch_sign_l2_fill_frame(true); |
| 6746 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6747 | |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 6748 | testcase TC_chopped_ipa_ping() runs on test_CT { |
| 6749 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 6750 | } |
| 6751 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6752 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6753 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 6754 | } |
| 6755 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6756 | /* test generation of RLL ERR IND based on Um errors (TS 48.058 3.9) */ |
| 6757 | /* protocol error as per 44.006 */ |
| 6758 | /* link layer failure (repetition of I-frame N200 times without ACK */ |
| 6759 | /* repetition of SABM or DISC N200 times without ACK */ |
| 6760 | /* receptiom of SABM in multi-frame established state */ |
| 6761 | |
| 6762 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6763 | /* TODO Areas: |
| 6764 | |
| 6765 | * channel activation |
| 6766 | ** with BS_Power / MS_Power, bypassing power control loop |
| 6767 | ** on primary vs. secondary TRX |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6768 | ** with timing advance from initial activation on |
| 6769 | * mode modify |
| 6770 | ** encryption |
| 6771 | ** multirate |
| 6772 | * check DEACTIVATE SACCH |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6773 | ** unsupported algorithm |
| 6774 | * handover detection |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6775 | * BS Power Control |
| 6776 | * Physical Context |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6777 | * RF resource ind |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6778 | * error handling |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6779 | ** IE duplicated? |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6780 | * PCU interface |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6781 | ** DATA_IND from BTS->PCU |
| 6782 | ** verification of PCU-originated DATA_REQ arrival on Um/MS side |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6783 | |
| 6784 | */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 6785 | |
| 6786 | control { |
| 6787 | execute( TC_chan_act_stress() ); |
| 6788 | execute( TC_chan_act_react() ); |
| 6789 | execute( TC_chan_deact_not_active() ); |
| 6790 | execute( TC_chan_act_wrong_nr() ); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 6791 | execute( TC_deact_sacch() ); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 6792 | execute( TC_sacch_filling() ); |
| 6793 | execute( TC_sacch_info_mod() ); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 6794 | execute( TC_sacch_multi() ); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 6795 | execute( TC_sacch_multi_chg() ); |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 6796 | execute( TC_sacch_chan_act() ); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 6797 | execute( TC_sacch_chan_act_ho_async() ); |
| 6798 | execute( TC_sacch_chan_act_ho_sync() ); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 6799 | execute( TC_rach_content() ); |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 6800 | execute( TC_rach_content_emerg() ); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 6801 | execute( TC_rach_count() ); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 6802 | execute( TC_rach_max_ta() ); |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 6803 | execute( TC_ho_rach() ); |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 6804 | execute( TC_rach_load_idle_thresh0() ); |
| 6805 | execute( TC_rach_load_idle_below_thresh() ); |
| 6806 | execute( TC_rach_load_count() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 6807 | execute( TC_meas_res_sign_tchf() ); |
| 6808 | execute( TC_meas_res_sign_tchh() ); |
| 6809 | execute( TC_meas_res_sign_sdcch4() ); |
| 6810 | execute( TC_meas_res_sign_sdcch8() ); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 6811 | execute( TC_meas_res_sign_tchh_toa256() ); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 6812 | execute( TC_tx_power_start_ramp_up_bcch() ); |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 6813 | execute( TC_tx_power_start_ramp_down_bcch() ); |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 6814 | execute( TC_tx_power_ramp_adm_state_change() ); |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 6815 | execute( TC_rsl_bs_pwr_static_ass() ); |
| 6816 | execute( TC_rsl_bs_pwr_static_power_control() ); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 6817 | execute( TC_rsl_ms_pwr_ctrl() ); |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 6818 | execute( TC_rsl_ms_pwr_dyn_active() ); |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 6819 | execute( TC_rsl_ms_pwr_dyn_active2() ); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 6820 | execute( TC_rsl_ms_pwr_dyn_up() ); |
| 6821 | execute( TC_rsl_ms_pwr_dyn_down() ); |
| 6822 | execute( TC_rsl_ms_pwr_dyn_ass_updown() ); |
| 6823 | execute( TC_rsl_ms_pwr_dyn_max() ); |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 6824 | execute( TC_rsl_chan_initial_ms_pwr() ); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 6825 | execute( TC_rsl_chan_initial_ta() ); |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 6826 | execute( TC_rsl_modify_encr() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 6827 | execute( TC_conn_fail_crit() ); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 6828 | execute( TC_paging_imsi_80percent() ); |
| 6829 | execute( TC_paging_tmsi_80percent() ); |
| 6830 | execute( TC_paging_imsi_200percent() ); |
| 6831 | execute( TC_paging_tmsi_200percent() ); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 6832 | execute( TC_rsl_protocol_error() ); |
| 6833 | execute( TC_rsl_mand_ie_error() ); |
| 6834 | execute( TC_rsl_ie_content_error() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 6835 | execute( TC_si_sched_default() ); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 6836 | execute( TC_si_sched_1() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 6837 | execute( TC_si_sched_2bis() ); |
| 6838 | execute( TC_si_sched_2ter() ); |
| 6839 | execute( TC_si_sched_2ter_2bis() ); |
| 6840 | execute( TC_si_sched_2quater() ); |
| 6841 | execute( TC_si_sched_13() ); |
| 6842 | execute( TC_si_sched_13_2bis_2ter_2quater() ); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 6843 | execute( TC_ipa_dlcx_not_active() ); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 6844 | execute( TC_ipa_crcx_twice_not_active() ); |
| 6845 | execute( TC_ipa_crcx_mdcx_dlcx_not_active() ); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 6846 | execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() ); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 6847 | execute( TC_ipa_crcx_sdcch_not_active() ); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6848 | |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 6849 | if (mp_pcu_socket != "") { |
| 6850 | execute( TC_pcu_act_req() ); |
| 6851 | execute( TC_pcu_act_req_wrong_ts() ); |
| 6852 | execute( TC_pcu_act_req_wrong_bts() ); |
| 6853 | execute( TC_pcu_act_req_wrong_trx() ); |
| 6854 | execute( TC_pcu_deact_req() ); |
| 6855 | execute( TC_pcu_deact_req_wrong_ts() ); |
| 6856 | execute( TC_pcu_ver_si13() ); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 6857 | if (mp_l1_supports_gprs) { |
| 6858 | execute( TC_pcu_data_req_pdtch() ); |
| 6859 | execute( TC_pcu_data_req_ptcch() ); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 6860 | execute( TC_pcu_data_req_wrong_bts() ); |
| 6861 | execute( TC_pcu_data_req_wrong_trx() ); |
| 6862 | execute( TC_pcu_data_req_wrong_ts() ); |
| 6863 | execute( TC_pcu_data_req_ts_inactive() ); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 6864 | } |
Vadim Yanitskiy | 970b153 | 2019-10-24 15:22:19 +0700 | [diff] [blame] | 6865 | execute( TC_pcu_ptcch() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 6866 | execute( TC_pcu_data_req_agch() ); |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 6867 | execute( TC_pcu_data_req_pch() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 6868 | execute( TC_pcu_data_req_imm_ass_pch() ); |
| 6869 | execute( TC_pcu_rach_content() ); |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 6870 | execute( TC_pcu_ext_rach_content() ); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 6871 | execute( TC_pcu_data_ind_lqual_cb() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 6872 | execute( TC_pcu_paging_from_rsl() ); |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6873 | execute( TC_pcu_time_ind() ); |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6874 | execute( TC_pcu_rts_req() ); |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 6875 | execute( TC_pcu_oml_alert() ); |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 6876 | execute( TC_pcu_rr_suspend() ); |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6877 | execute( TC_pcu_socket_connect_multi() ); |
Harald Welte | c8effb7 | 2019-05-27 18:23:04 +0200 | [diff] [blame] | 6878 | execute( TC_pcu_socket_reconnect() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6879 | execute( TC_pcu_socket_noconnect_nosi3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6880 | execute( TC_pcu_socket_noconnect_nosi4gprs() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6881 | execute( TC_pcu_socket_connect_si3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6882 | execute( TC_pcu_socket_connect_si4gprs() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6883 | execute( TC_pcu_socket_disconnect_nosi3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6884 | execute( TC_pcu_socket_disconnect_nosi4gprs() ); |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 6885 | execute( TC_pcu_socket_verify_info_ind() ); |
Philipp Maier | 15cd687 | 2020-01-08 13:41:41 +0100 | [diff] [blame] | 6886 | execute( TC_dyn_osmo_pdch_act_deact() ); |
| 6887 | execute( TC_dyn_osmo_pdch_double_act() ); |
| 6888 | execute( TC_dyn_ipa_pdch_act_deact() ); |
| 6889 | execute( TC_dyn_ipa_pdch_act_tchf_act_nack() ); |
| 6890 | |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6891 | if (PCUIF_Types.mp_pcuif_version >= 10) { |
| 6892 | execute( TC_pcu_info_ind_fh_params() ); |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6893 | execute( TC_pcu_socket_nsvc_ipv4() ); |
| 6894 | execute( TC_pcu_socket_nsvc_ipv6() ); |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6895 | } |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 6896 | } else { |
| 6897 | log("PCU socket path not available, skipping PCU tests"); |
| 6898 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6899 | |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6900 | execute( TC_dyn_osmo_pdch_unsol_deact() ); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6901 | execute( TC_dyn_osmo_pdch_tchf_act() ); |
| 6902 | execute( TC_dyn_osmo_pdch_tchh_act() ); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6903 | execute( TC_dyn_ipa_pdch_tchf_act() ); |
| 6904 | execute( TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() ); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 6905 | |
| 6906 | execute( TC_rll_est_ind() ); |
| 6907 | execute( TC_rll_est_req_DCCH_3() ); |
| 6908 | execute( TC_rll_est_req_ACCH_3() ); |
| 6909 | execute( TC_rll_rel_ind_DCCH_0() ); |
| 6910 | execute( TC_rll_rel_ind_DCCH_3() ); |
| 6911 | execute( TC_rll_rel_ind_ACCH_0() ); |
| 6912 | execute( TC_rll_rel_ind_ACCH_3() ); |
| 6913 | execute( TC_rll_rel_req() ); |
| 6914 | execute( TC_rll_unit_data_req_DCCH() ); |
| 6915 | execute( TC_rll_unit_data_req_ACCH() ); |
| 6916 | execute( TC_rll_unit_data_ind_DCCH() ); |
| 6917 | execute( TC_rll_unit_data_ind_ACCH() ); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6918 | |
| 6919 | execute( TC_chan_act_a51() ); |
| 6920 | execute( TC_chan_act_a52() ); |
| 6921 | execute( TC_chan_act_a53() ); |
| 6922 | execute( TC_encr_cmd_a51() ); |
| 6923 | execute( TC_encr_cmd_a52() ); |
| 6924 | execute( TC_encr_cmd_a53() ); |
| 6925 | |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 6926 | execute( TC_err_rep_wrong_mdisc() ); |
| 6927 | execute( TC_err_rep_wrong_msg_type() ); |
| 6928 | execute( TC_err_rep_wrong_sequence() ); |
| 6929 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 6930 | execute( TC_lapdm_selftest() ); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 6931 | |
| 6932 | execute( TC_tch_sign_l2_fill_frame() ); |
| 6933 | execute( TC_tch_sign_l2_fill_frame_dtxd() ); |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 6934 | |
| 6935 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6936 | execute( TC_chopped_ipa_payload() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 6937 | } |
| 6938 | |
| 6939 | |
| 6940 | } |