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; |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 43 | import from RTP_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 44 | import from IPA_Types all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 45 | import from IPA_Emulation all; |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 46 | import from IPA_Testing all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 47 | import from RSL_Emulation all; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 48 | import from RTP_Emulation all; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 49 | |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 50 | import from AMR_Types all; |
| 51 | |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 52 | import from OSMUX_Types all; |
| 53 | import from OSMUX_CodecPort all; |
| 54 | import from OSMUX_CodecPort_CtrlFunct all; |
| 55 | import from OSMUX_Emulation all; |
| 56 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 57 | import from IPL4asp_Types all; |
| 58 | import from TRXC_Types all; |
| 59 | import from TRXC_CodecPort all; |
| 60 | import from TRXC_CodecPort_CtrlFunct all; |
| 61 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 62 | import from PCUIF_Types all; |
| 63 | import from PCUIF_CodecPort all; |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 64 | import from UD_Types all; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 65 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 66 | import from MobileL3_CommonIE_Types all; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 67 | import from MobileL3_RRM_Types all; |
| 68 | import from MobileL3_Types all; |
| 69 | import from L3_Templates all; |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 70 | import from L3_Common all; |
| 71 | import from MobileL3_GMM_SM_Types all; |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 72 | |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 73 | import from Osmocom_VTY_Functions all; |
| 74 | import from TELNETasp_PortType all; |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 75 | import from BTS_Tests_LAPDm all; |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 76 | |
Harald Welte | 5a1d727 | 2023-05-10 19:49:44 +0200 | [diff] [blame] | 77 | friend module BTS_Tests_ASCI; |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 78 | friend module BTS_Tests_SMSCB; |
Vadim Yanitskiy | 7387813 | 2021-05-05 02:22:45 +0200 | [diff] [blame] | 79 | friend module BTS_Tests_VAMOS; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 80 | friend module BTS_Tests_virtphy; |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 81 | friend module BTS_Tests_LAPDm; |
Pau Espin Pedrol | 5a012ee | 2020-02-06 19:33:22 +0100 | [diff] [blame] | 82 | friend module BTS_Tests_perf; |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 83 | friend module BTS_Tests_OML; |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 84 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 85 | /* The tests assume a BTS with the following timeslot configuration: |
| 86 | * TS0 : Combined CCCH + SDCCH/4 |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 87 | * TS1 : TCH/F |
| 88 | * TS2 : TCH/F |
| 89 | * TS3 : TCH/F_PDCH (IPA Style) |
| 90 | * TS4 : TCH/F_TCH/H_PDCH (Osmocom Style) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 91 | * TS5 : TCH/H |
| 92 | * TS6 : SDCCH/8 |
| 93 | * TS7 : PDCH |
| 94 | */ |
| 95 | |
| 96 | modulepar { |
| 97 | charstring mp_rsl_ip := "127.0.0.2"; |
| 98 | integer mp_rsl_port := 3003; |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 99 | charstring mp_bts_trxc_ip := "127.0.0.1"; |
| 100 | integer mp_bts_trxc_port := 5701; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 101 | charstring mp_pcu_socket := PCU_SOCK_DEFAULT; |
Neels Hofmeyr | 6a84b23 | 2018-04-03 19:12:36 +0200 | [diff] [blame] | 102 | charstring mp_ctrl_ip := "127.0.0.1"; |
| 103 | integer mp_ctrl_port := 4238; |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 104 | charstring mp_bsc_ctrl_ip := "127.0.0.1"; |
| 105 | integer mp_bsc_ctrl_port := 4249; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 106 | charstring mp_rtpem_bind_ip := "127.0.0.1"; |
| 107 | integer mp_rtpem_bind_port := 6766; |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 108 | charstring mp_osmuxem_bind_ip := "127.0.0.1"; |
| 109 | integer mp_osmuxem_bind_port := 1984; |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 110 | integer mp_tolerance_rxqual := 1; |
| 111 | integer mp_tolerance_rxlev := 3; |
| 112 | integer mp_tolerance_timing_offset_256syms := 0; |
Pau Espin Pedrol | 752ffd5 | 2018-06-07 13:55:45 +0200 | [diff] [blame] | 113 | integer mp_rxlev_exp := 57; |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 114 | integer mp_ul_rxlev_exp := 10; |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 115 | integer mp_ms_power_level_exp := 7; |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 116 | integer mp_bts_tx_nom_pwr_exp := 50; /* Expected Tx Nominal Output Power of the BTS, in dBm */ |
| 117 | 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] | 118 | integer mp_ms_actual_ta_exp := 0; |
| 119 | integer mp_timing_offset_256syms_exp := 512; |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 120 | integer mp_uplink_power_target := -75; |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 121 | integer mp_uplink_power_hysteresis := 8; /* -83 .. -67 */ |
Pau Espin Pedrol | 315e471 | 2018-11-01 16:27:07 +0100 | [diff] [blame] | 122 | /* Time to wait for RSL conn from BTS during startup of test */ |
Philipp Maier | 12567e4 | 2019-04-17 14:10:05 +0200 | [diff] [blame] | 123 | float mp_ipa_up_timeout := 15.0; |
Philipp Maier | e63229e | 2019-04-26 12:21:37 +0200 | [diff] [blame] | 124 | float mp_ipa_up_delay := 0.0; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 125 | /* false for now, as only virtphy supports it, not calypso-l1 nor trxcon */ |
| 126 | boolean mp_l1_supports_gprs := false; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 127 | /* how many transceivers do we expect to connect */ |
| 128 | integer mp_transceiver_num := 1; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 129 | /* frequency hopping status */ |
| 130 | boolean mp_freq_hop_enabled := false; |
| 131 | /* frequency hopping parameters */ |
| 132 | FreqHopConfig mp_fh_config; |
Vadim Yanitskiy | 42d8bd5 | 2020-11-15 20:41:02 +0700 | [diff] [blame] | 133 | /* configuration for each individual transceiver */ |
| 134 | TrxPars mp_trx_pars; /* see BTS_Tests.default */ |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 135 | /* default Training Sequence Code */ |
| 136 | GsmTsc mp_tsc_def := 7; |
Vadim Yanitskiy | 98c4a1a | 2021-06-04 18:46:06 +0200 | [diff] [blame] | 137 | /* Default interference boundaries in osmo-bsc (in dBm): |
| 138 | * 0(-85) X1(-91) X2(-97) X3(-103) X4(-109) X5(-115) |
| 139 | * Default interference level reported by fake_trx.py: |
| 140 | * 0: -109 >= -85 dBm (no) |
| 141 | * X1: -109 >= -91 dBm (no) |
| 142 | * X2: -109 >= -97 dBm (no) |
| 143 | * X3: -109 >= -103 dBm (no) |
| 144 | * X4: -109 >= -109 dBm (yes) |
| 145 | * X5: -109 >= -115 dBm (no) |
| 146 | * So all channels should be in band 4. */ |
| 147 | uint3_t mp_interf_band := 4; |
Vadim Yanitskiy | 1ab332f | 2022-03-12 15:31:23 +0300 | [diff] [blame] | 148 | /* T3105 timer (see 3GPP TS 44.018, section 11.1.2) */ |
| 149 | integer mp_ho_t3105_ms := 100; |
| 150 | /* Ny1 counter (see 3GPP TS 44.018, section 11.1.3) */ |
| 151 | integer mp_ho_ny1 := 10; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 152 | } |
| 153 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 154 | type record of RslChannelNr ChannelNrs; |
| 155 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 156 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 157 | /* IPA Emulation component underneath RSL */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 158 | var IPA_Emulation_CT vc_IPA; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 159 | /* RSL Emulation component (for ConnHdlr tests) */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 160 | var RSL_Emulation_CT vc_RSL; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 161 | /* Direct RSL_CCHAN_PT */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 162 | port RSL_CCHAN_PT RSL_CCHAN; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 163 | |
| 164 | /* L1CTL port (for classic tests) */ |
| 165 | port L1CTL_PT L1CTL; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 166 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 167 | /* Optional TRXC connection to FakeTRX (BTS side) */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 168 | port TRXC_CODEC_PT BTS_TRXC; |
| 169 | var integer g_bts_trxc_conn_id; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 170 | |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 171 | /* VTY connections to both BTS and BSC */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 172 | port TELNETasp_PT BTSVTY; |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 173 | port TELNETasp_PT BSCVTY; |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 174 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 175 | /* PCU Interface of BTS */ |
| 176 | port PCUIF_CODEC_PT PCU; |
| 177 | var integer g_pcu_conn_id; |
| 178 | /* Last PCU INFO IND we received */ |
| 179 | var PCUIF_Message g_pcu_last_info; |
| 180 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 181 | /* SI configuration */ |
| 182 | var SystemInformationConfig si_cfg := { |
| 183 | bcch_extended := false, |
| 184 | si1_present := false, |
| 185 | si2bis_present := false, |
| 186 | si2ter_present := false, |
| 187 | si2quater_present := false, |
| 188 | si7_present := false, |
| 189 | si8_present := false, |
| 190 | si9_present := false, |
| 191 | si13_present := false, |
| 192 | si13alt_present := false, |
| 193 | si15_present := false, |
| 194 | si16_present := false, |
| 195 | si17_present := false, |
| 196 | si2n_present := false, |
| 197 | si21_present := false, |
| 198 | si22_present := false |
| 199 | }; |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 200 | |
| 201 | /* all logical channels available on the BTS */ |
| 202 | var ChannelNrs g_AllChannels; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 203 | var ChannelNrs g_AllChanTypes; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | /* an individual call / channel */ |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 207 | type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 208 | port L1CTL_PT L1CTL; |
| 209 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 210 | /* Optional TRXC connection to FakeTRX (BTS side) */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 211 | port TRXC_CODEC_PT BTS_TRXC; |
| 212 | var integer g_bts_trxc_conn_id; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 213 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 214 | /* port to be initialized optionally to access BSC VTY */ |
| 215 | port TELNETasp_PT BSCVTY; |
| 216 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 217 | timer g_Tguard; |
| 218 | timer g_Tmeas_exp := 2.0; /* >= 103 SACCH multiframe ~ 500ms */ |
| 219 | |
| 220 | var ConnHdlrPars g_pars; |
| 221 | var uint8_t g_next_meas_res_nr := 0; |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 222 | var boolean g_first_meas_res := true; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 223 | |
| 224 | /* PCU Interface of BTS */ |
| 225 | port PCUIF_CODEC_PT PCU; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 226 | |
| 227 | var RTP_Emulation_CT vc_RTPEM; |
| 228 | port RTPEM_CTRL_PT RTPEM_CTRL; |
| 229 | port RTPEM_DATA_PT RTPEM_DATA; |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 230 | var OSMUX_Emulation_CT vc_OsmuxEM; |
| 231 | port OsmuxEM_CTRL_PT OsmuxEM_CTRL; |
| 232 | port OsmuxEM_DATA_PT OsmuxEM_DATA; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 233 | } |
| 234 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 235 | private function f_init_rsl(charstring id) runs on test_CT { |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 236 | var bitstring trx_mask := '00000000'B; |
Pau Espin Pedrol | 9a053c0 | 2020-10-16 13:52:28 +0200 | [diff] [blame] | 237 | var bitstring rfind_mask := '00000000'B; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 238 | var integer trx_count := 0; |
Pau Espin Pedrol | 9a053c0 | 2020-10-16 13:52:28 +0200 | [diff] [blame] | 239 | var integer rfind_count := 0; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 240 | var RSLEm_Event ev; |
Pau Espin Pedrol | 9a053c0 | 2020-10-16 13:52:28 +0200 | [diff] [blame] | 241 | var ASP_RSL_Unitdata rx_ud; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 242 | timer T; |
| 243 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 244 | vc_IPA := IPA_Emulation_CT.create(id & "-RSL-IPA"); |
| 245 | vc_RSL := RSL_Emulation_CT.create(id & "-RSL"); |
| 246 | |
| 247 | map(vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
| 248 | connect(vc_IPA:IPA_RSL_PORT, vc_RSL:IPA_PT); |
| 249 | connect(self:RSL_CCHAN, vc_RSL:CCHAN_PT); |
| 250 | |
| 251 | vc_IPA.start(IPA_Emulation.main_server(mp_rsl_ip, mp_rsl_port)); |
| 252 | vc_RSL.start(RSL_Emulation.main(false)); |
Vadim Yanitskiy | c9c9e29 | 2020-05-18 23:31:40 +0700 | [diff] [blame] | 253 | |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 254 | /* We expect (N = mp_transceiver_num) IPA/RSL transceiver connections here. |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 255 | * See https://gerrit.osmocom.org/q/Ib5ad31388ae25399ad09739aac3fdcb0b3a1f78b. */ |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 256 | T.start(mp_ipa_up_timeout); |
| 257 | alt { |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 258 | /* These events are sent by the RSL_Emulation_CT */ |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 259 | [] RSL_CCHAN.receive(tr_RSLEm_EV(RSLEM_EV_TRX_UP, ?)) -> value ev { |
| 260 | /* Make sure that all transceivers use unique stream ID */ |
| 261 | if (trx_mask[enum2int(ev.sid)] == '1'B) { |
| 262 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 263 | log2str("Duplicate RSL stream ID (", ev.sid, ")")); |
| 264 | } |
Vadim Yanitskiy | fc631d1 | 2020-06-02 23:48:49 +0700 | [diff] [blame] | 265 | |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 266 | trx_mask[enum2int(ev.sid)] := '1'B; |
| 267 | trx_count := trx_count + 1; |
| 268 | |
| 269 | log(trx_count, "/", mp_transceiver_num, " transceiver(s) connected"); |
Pau Espin Pedrol | 9a053c0 | 2020-10-16 13:52:28 +0200 | [diff] [blame] | 270 | repeat; |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 271 | } |
Pau Espin Pedrol | 9a053c0 | 2020-10-16 13:52:28 +0200 | [diff] [blame] | 272 | /* This message (RF RESource INDication) is sent by the IUT itself */ |
| 273 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND, ?)) -> value rx_ud { |
| 274 | if (trx_mask[enum2int(rx_ud.streamId)] == '0'B) { |
| 275 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 276 | log2str("Got RF Resource Indication before RSLEM_EV_TRX_UP (", rx_ud.streamId, ")")); |
| 277 | } |
| 278 | if (rfind_mask[enum2int(rx_ud.streamId)] == '1'B) { |
| 279 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 280 | log2str("Duplicate RF Resource Indication ID (", rx_ud.streamId, ")")); |
| 281 | } |
| 282 | |
| 283 | rfind_mask[enum2int(rx_ud.streamId)] := '1'B; |
| 284 | rfind_count := rfind_count + 1; |
| 285 | log(rfind_count, "/", mp_transceiver_num, " RF Resource Indication(s) received"); |
| 286 | if (rfind_count < mp_transceiver_num) { repeat; } |
| 287 | } |
Vadim Yanitskiy | 89db3e0 | 2020-06-22 17:49:39 +0700 | [diff] [blame] | 288 | /* osmo-bts may send us CCCH LOAD INDication or whatever else */ |
| 289 | [] RSL_CCHAN.receive(ASP_RSL_Unitdata:?) { repeat; } |
| 290 | [] T.timeout { |
| 291 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 292 | "Timeout waiting for RSL bring up"); |
| 293 | } |
| 294 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 295 | } |
| 296 | |
Vadim Yanitskiy | 42d8bd5 | 2020-11-15 20:41:02 +0700 | [diff] [blame] | 297 | friend type record length(1 .. 256) of TrxParsItem TrxPars; |
| 298 | friend type record TrxParsItem { |
| 299 | GsmArfcn arfcn, |
| 300 | TrxTsPars ts |
| 301 | }; |
| 302 | |
| 303 | friend type record length(8) of TrxTsParsItem TrxTsPars; |
| 304 | friend type record TrxTsParsItem { |
| 305 | PchanConfig config |
| 306 | }; |
| 307 | |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 308 | friend type record FreqHopPars { |
| 309 | /* Whether frequency hopping is in use */ |
| 310 | boolean enabled, |
| 311 | /* Mobile Allocation Index Offset / Hopping Sequence Number */ |
| 312 | MaioHsn maio_hsn, |
| 313 | /* MA bitmap to be indicated in RR Immediate Assignment */ |
| 314 | MobileAllocationLV ma_map, |
| 315 | /* The actual Mobile Allocation (ARFCN list) to be used */ |
| 316 | L1ctlMA ma |
| 317 | }; |
| 318 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 319 | type record ConnHdlrPars { |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 320 | uint8_t trx_nr, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 321 | RslChannelNr chan_nr, |
| 322 | RSL_IE_ChannelMode chan_mode, |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 323 | RSL_IE_MultirateCfg mr_conf optional, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 324 | float t_guard, |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 325 | ConnL1Pars l1_pars, |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 326 | TestSpecUnion spec optional, |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 327 | RSL_IE_EncryptionInfo encr optional, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 328 | BtsBand bts0_band optional, |
| 329 | |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 330 | /* Training Sequence Code */ |
| 331 | GsmTsc tsc, |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 332 | /* Frequency hopping parameters */ |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 333 | FreqHopPars fhp, |
| 334 | OsmuxCID loc_osmux_cid, |
| 335 | OsmuxCID rem_osmux_cid optional |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 336 | }; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 337 | |
| 338 | /* Test-specific parameters */ |
Vadim Yanitskiy | 7368a10 | 2021-06-01 01:25:08 +0200 | [diff] [blame] | 339 | friend type union TestSpecUnion { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 340 | RllTestCase rll, |
| 341 | TopTestCase top |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 342 | } |
| 343 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 344 | private template (value) RachControlParameters ts_RachCtrl_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 345 | max_retrans := RACH_MAX_RETRANS_7, |
| 346 | tx_integer := '1001'B, /* 12 slots */ |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 347 | cell_barr_access := false, |
| 348 | re_not_allowed := true, |
Harald Welte | b9585f8 | 2018-03-10 17:18:47 +0100 | [diff] [blame] | 349 | acc := '0000010000000000'B |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 350 | }; |
| 351 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 352 | private template (value) CellSelectionParameters ts_CellSelPar_default := { |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 353 | cell_resel_hyst_2dB := 2, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 354 | ms_txpwr_max_cch := mp_ms_power_level_exp, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 355 | acs := '0'B, |
| 356 | neci := true, |
| 357 | rxlev_access_min := 0 |
| 358 | } |
| 359 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 360 | private template (value) LocationAreaIdentification ts_LAI_default := { |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 361 | mcc_mnc := '262F42'H, |
| 362 | lac := 42 |
| 363 | } |
| 364 | |
Vadim Yanitskiy | 12cf3d9 | 2020-05-05 00:19:50 +0700 | [diff] [blame] | 365 | private template (value) GPRSIndicator ts_GPRSIndicator_def := { |
| 366 | ra_colour := 0, |
| 367 | si13_pos := '0'B |
| 368 | } |
| 369 | |
| 370 | private template (value) SI3RestOctets ts_SI3RestOctets_def |
| 371 | modifies ts_SI3RestOctets := { |
| 372 | gprs_ind := { |
| 373 | presence := CSN1_H, |
| 374 | ind := ts_GPRSIndicator_def |
| 375 | } |
| 376 | } |
| 377 | |
| 378 | private template (value) SI4RestOctets ts_SI4RestOctets_def |
| 379 | modifies ts_SI4RestOctets := { |
| 380 | gprs_ind := { |
Vadim Yanitskiy | ab5363f | 2020-05-05 00:30:22 +0700 | [diff] [blame] | 381 | presence := CSN1_H, |
| 382 | ind := ts_GPRSIndicator_def |
Vadim Yanitskiy | 12cf3d9 | 2020-05-05 00:19:50 +0700 | [diff] [blame] | 383 | } |
| 384 | } |
| 385 | |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 386 | /* Default SYSTEM INFORMATION 3 */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 387 | private template (value) SystemInformation ts_SI3_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 388 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_3, 18), |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 389 | payload := { |
| 390 | si3 := { |
| 391 | cell_id := 23, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 392 | lai := ts_LAI_default, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 393 | ctrl_chan_desc := { |
| 394 | msc_r99 := true, |
| 395 | att := true, |
| 396 | bs_ag_blks_res := 1, |
| 397 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 398 | si22ind := false, |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 399 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 400 | spare := '00'B, |
| 401 | bs_pa_mfrms := 0, /* 2 multiframes */ |
| 402 | t3212 := 1 /* 6 minutes */ |
| 403 | }, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 404 | cell_options := { |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 405 | dn_ind := false, |
| 406 | pwrc := false, |
| 407 | dtx := MS_MAY_USE_UL_DTX, |
Harald Welte | 0fd1fb0 | 2018-03-10 17:19:50 +0100 | [diff] [blame] | 408 | radio_link_tout_div4 := (32/4)-1 |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 409 | }, |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 410 | cell_sel_par := ts_CellSelPar_default, |
Harald Welte | 82ccef7 | 2018-02-25 16:17:33 +0100 | [diff] [blame] | 411 | rach_control := ts_RachCtrl_default, |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 412 | rest_octets := valueof(ts_SI3RestOctets_def) |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 413 | } |
| 414 | } |
| 415 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 416 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 417 | private template (value) SystemInformation ts_SI2_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 418 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_2, 22), |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 419 | payload := { |
| 420 | si2 := { |
| 421 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 422 | ncc_permitted := '11111111'B, |
| 423 | rach_control := ts_RachCtrl_default |
| 424 | } |
| 425 | } |
| 426 | } |
| 427 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 428 | private template (value) SystemInformation ts_SI4_default := { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 429 | header := ts_RrHeader(SYSTEM_INFORMATION_TYPE_4, 12), /* no CBCH / restoct */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 430 | payload := { |
| 431 | si4 := { |
| 432 | lai := ts_LAI_default, |
| 433 | cell_sel_par := ts_CellSelPar_default, |
| 434 | rach_control := ts_RachCtrl_default, |
| 435 | cbch_chan_desc := omit, |
| 436 | cbch_mobile_alloc := omit, |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 437 | rest_octets := valueof(ts_SI4RestOctets_def) |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 442 | 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] | 443 | runs on test_CT { |
| 444 | log("Setting ", rsl_si_type, ": ", si_enc); |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 445 | 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] | 446 | } |
| 447 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 448 | 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] | 449 | runs on test_CT { |
| 450 | var octetstring si_enc := enc_SystemInformation(valueof(si_dec)); |
| 451 | log("Setting ", rsl_si_type, ": ", si_dec); |
| 452 | f_rsl_bcch_fill_raw(rsl_si_type, si_enc); |
| 453 | } |
| 454 | |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 455 | friend function f_init_vty(charstring id) runs on test_CT { |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 456 | map(self:BTSVTY, system:BTSVTY); |
| 457 | f_vty_set_prompts(BTSVTY); |
| 458 | f_vty_transceive(BTSVTY, "enable"); |
| 459 | } |
| 460 | |
Harald Welte | 505cf9b | 2018-09-15 17:47:23 +0300 | [diff] [blame] | 461 | friend function f_init_vty_bsc() runs on test_CT { |
Harald Welte | f50e3ae | 2018-09-10 10:27:56 +0200 | [diff] [blame] | 462 | map(self:BSCVTY, system:BSCVTY); |
| 463 | f_vty_set_prompts(BSCVTY, "OsmoBSC"); |
| 464 | f_vty_transceive(BSCVTY, "enable"); |
| 465 | } |
| 466 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 467 | friend function f_connhdlr_init_vty_bsc() runs on ConnHdlr { |
| 468 | map(self:BSCVTY, system:BSCVTY); |
| 469 | f_vty_set_prompts(BSCVTY, "OsmoBSC"); |
| 470 | f_vty_transceive(BSCVTY, "enable"); |
| 471 | } |
| 472 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 473 | /* PCU socket may at any time receive a new INFO.ind */ |
Pau Espin Pedrol | 65d712e | 2021-06-25 13:55:38 +0200 | [diff] [blame] | 474 | friend altstep as_pcu_info_ind(PCUIF_CODEC_PT pt, integer pcu_conn_id, |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 475 | out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 476 | var PCUIF_send_data sd; |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 477 | [] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(0, ?))) -> value sd { |
| 478 | pcu_last_info := sd.data; |
Harald Welte | d378a25 | 2018-03-13 17:02:14 +0100 | [diff] [blame] | 479 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 480 | [] 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] | 481 | 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] | 482 | } |
| 483 | } |
| 484 | |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 485 | private function f_init_pcu(PCUIF_CODEC_PT pt, charstring id, |
| 486 | out integer pcu_conn_id, out PCUIF_Message pcu_last_info) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 487 | timer T := 2.0; |
| 488 | var PCUIF_send_data sd; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 489 | if (mp_pcu_socket == "") { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 490 | pcu_conn_id := -1; |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 491 | return; |
| 492 | } |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 493 | pcu_conn_id := f_pcuif_connect(pt, mp_pcu_socket); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 494 | |
| 495 | T.start; |
| 496 | alt { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 497 | [] as_pcu_info_ind(pt, pcu_conn_id, pcu_last_info); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 498 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 499 | 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] | 500 | } |
| 501 | } |
| 502 | } |
| 503 | |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 504 | private function f_init_trxc(TRXC_CODEC_PT pt, charstring id, |
| 505 | out integer trxc_conn_id) { |
| 506 | var Result res; |
| 507 | |
| 508 | res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(pt, mp_bts_trxc_ip, mp_bts_trxc_port, |
| 509 | "", -1, -1, { udp := {} }, {}); |
| 510 | if (not ispresent(res.connId)) { |
| 511 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 512 | "Could not connect to the control (TRXC) interface " & |
| 513 | "of FakeTRX, check your configuration"); |
| 514 | } |
| 515 | trxc_conn_id := res.connId; |
| 516 | } |
| 517 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 518 | /* global init function (without PCUIF connection) */ |
Vadim Yanitskiy | 7e70709 | 2020-11-16 17:08:03 +0700 | [diff] [blame] | 519 | friend function f_init(uint8_t trx_nr := 0) |
| 520 | runs on test_CT |
| 521 | { |
| 522 | var TrxParsItem trx_pars := mp_trx_pars[trx_nr]; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 523 | var charstring id := testcasename(); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 524 | |
Vadim Yanitskiy | 7e70709 | 2020-11-16 17:08:03 +0700 | [diff] [blame] | 525 | /* FIXME: FACCH/H is unreliable with calypso firmware, see OS#3653. |
| 526 | * TODO: also generate this list dynamically from module parameters. */ |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 527 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | 3dcf38f | 2018-10-22 14:07:54 +0200 | [diff] [blame] | 528 | g_AllChanTypes := { |
| 529 | /* TS 1..4: TCH/F */ |
| 530 | valueof(ts_RslChanNr_Bm(1)), |
| 531 | /* TS 5: TCH/H */ |
| 532 | valueof(ts_RslChanNr_Lm(5,1)), |
| 533 | /* TS 0: SDCCH/4 */ |
| 534 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 535 | /* TS 6: SDCCH/8 */ |
| 536 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 537 | }; |
| 538 | } else { |
| 539 | g_AllChanTypes := { |
| 540 | /* TS 1..4: TCH/F */ |
| 541 | valueof(ts_RslChanNr_Bm(1)), |
| 542 | /* TS 0: SDCCH/4 */ |
| 543 | valueof(ts_RslChanNr_SDCCH4(0,2)), |
| 544 | /* TS 6: SDCCH/8 */ |
| 545 | valueof(ts_RslChanNr_SDCCH8(6,4)) |
| 546 | }; |
| 547 | } |
Vadim Yanitskiy | 7e70709 | 2020-11-16 17:08:03 +0700 | [diff] [blame] | 548 | |
| 549 | g_AllChannels := { }; |
| 550 | |
| 551 | /* Generate list of all logical channels from module parameters */ |
| 552 | for (var integer tn := 0; tn < lengthof(trx_pars.ts); tn := tn + 1) { |
| 553 | select (trx_pars.ts[tn].config) { |
| 554 | case (GSM_PCHAN_CCCH_SDCCH4) { |
| 555 | g_AllChannels := g_AllChannels & |
| 556 | { valueof(ts_RslChanNr_SDCCH4(tn, 0)), |
| 557 | valueof(ts_RslChanNr_SDCCH4(tn, 1)), |
| 558 | valueof(ts_RslChanNr_SDCCH4(tn, 2)), |
| 559 | valueof(ts_RslChanNr_SDCCH4(tn, 3)) }; |
| 560 | } |
| 561 | case (GSM_PCHAN_SDCCH8) { |
| 562 | g_AllChannels := g_AllChannels & |
| 563 | { valueof(ts_RslChanNr_SDCCH8(tn, 0)), |
| 564 | valueof(ts_RslChanNr_SDCCH8(tn, 1)), |
| 565 | valueof(ts_RslChanNr_SDCCH8(tn, 2)), |
| 566 | valueof(ts_RslChanNr_SDCCH8(tn, 3)), |
| 567 | valueof(ts_RslChanNr_SDCCH8(tn, 4)), |
| 568 | valueof(ts_RslChanNr_SDCCH8(tn, 5)), |
| 569 | valueof(ts_RslChanNr_SDCCH8(tn, 6)), |
| 570 | valueof(ts_RslChanNr_SDCCH8(tn, 7)) }; |
| 571 | } |
| 572 | case (GSM_PCHAN_TCHH_TCHF_PDCH) { |
| 573 | g_AllChannels := g_AllChannels & |
| 574 | { valueof(ts_RslChanNr_Lm(tn, 0)), |
| 575 | valueof(ts_RslChanNr_Lm(tn, 1)), |
| 576 | valueof(ts_RslChanNr_Bm(tn)) }; |
| 577 | } |
| 578 | case (GSM_PCHAN_TCHH) { |
| 579 | g_AllChannels := g_AllChannels & |
| 580 | { valueof(ts_RslChanNr_Lm(tn, 0)), |
| 581 | valueof(ts_RslChanNr_Lm(tn, 1)) }; |
| 582 | } |
| 583 | case (GSM_PCHAN_TCHF, GSM_PCHAN_TCHF_PDCH) { |
| 584 | g_AllChannels := g_AllChannels & |
| 585 | { valueof(ts_RslChanNr_Bm(tn)) }; |
| 586 | } |
| 587 | } |
| 588 | } |
| 589 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 590 | f_init_rsl(id); |
Harald Welte | 2d14259 | 2018-02-25 13:19:44 +0100 | [diff] [blame] | 591 | f_sleep(0.5); /* workaround for OS#3000 */ |
Harald Welte | 8da4824 | 2018-02-27 20:41:32 +0100 | [diff] [blame] | 592 | f_init_vty(id); |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 593 | f_ipa_ctrl_start_client(mp_ctrl_ip, mp_ctrl_port); |
Harald Welte | 7484fc4 | 2018-02-24 14:09:45 +0100 | [diff] [blame] | 594 | |
| 595 | /* Send SI3 to the BTS, it is needed for various computations */ |
Harald Welte | f10153f | 2018-02-25 16:34:05 +0100 | [diff] [blame] | 596 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_3, ts_SI3_default); |
| 597 | /* SI2 + SI4 are required for SI testing as they are mandatory defaults */ |
| 598 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_2, ts_SI2_default); |
| 599 | f_rsl_bcch_fill(RSL_SYSTEM_INFO_4, ts_SI4_default); |
Harald Welte | 57fe823 | 2018-02-26 17:52:50 +0100 | [diff] [blame] | 600 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 601 | if (mp_bts_trxc_port != -1) { |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 602 | var TrxcMessage ret; |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 603 | |
| 604 | /* Init TRXC interface to FakeTRX */ |
| 605 | map(self:BTS_TRXC, system:BTS_TRXC); |
| 606 | f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id); |
| 607 | |
Vadim Yanitskiy | 10d7246 | 2019-06-04 22:27:52 +0700 | [diff] [blame] | 608 | /* Start with a default moderate timing offset equalling TA=2, and RSSI=-60 */ |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 609 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_TIMING(2*256)); |
| 610 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_RSSI(-60)); |
Vadim Yanitskiy | de535e0 | 2019-07-26 16:29:27 +0700 | [diff] [blame] | 611 | /* OsmoBTS may have different AB / NB threshold (see MIN_QUAL_NORM, MIN_QUAL_RACH) */ |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 612 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_CI(60)); |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 613 | } |
Philipp Maier | d95f340 | 2019-04-18 17:50:52 +0200 | [diff] [blame] | 614 | |
| 615 | /* Wait some extra time to make sure the BTS emits a stable carrier. |
| 616 | * (this is only relevant when running the tests with a physical BTS.) */ |
| 617 | f_sleep(mp_ipa_up_delay); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 618 | } |
| 619 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 620 | /* Attach L1CTL to master test_CT (classic tests, non-handler mode) */ |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 621 | friend function f_init_l1ctl() runs on test_CT { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 622 | map(self:L1CTL, system:L1CTL); |
| 623 | f_connect_reset(L1CTL); |
| 624 | } |
| 625 | |
Vadim Yanitskiy | 7387813 | 2021-05-05 02:22:45 +0200 | [diff] [blame] | 626 | friend type function void_fn(charstring id) runs on ConnHdlr; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 627 | |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 628 | private type record length(8) of FreqHopGroups FreqHopConfig; |
| 629 | |
| 630 | private type record of FreqHopGroup FreqHopGroups; |
| 631 | private type record FreqHopGroup { |
| 632 | uint6_t hsn, |
| 633 | FreqHopGroupItems trx_maio |
| 634 | }; |
| 635 | |
| 636 | private type record of FreqHopGroupItem FreqHopGroupItems; |
| 637 | private type record FreqHopGroupItem { |
| 638 | uint8_t trx_nr, |
| 639 | uint6_t maio |
| 640 | }; |
| 641 | |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 642 | friend function f_resolve_fh_params(inout FreqHopPars fhp, uint8_t tn, |
| 643 | uint8_t trx_nr := 0) |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 644 | { |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 645 | var FreqHopGroups groups := mp_fh_config[tn]; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 646 | var integer i, j; |
| 647 | |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 648 | fhp.enabled := false; |
| 649 | |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 650 | for (i := 0; i < lengthof(groups); i := i + 1) { |
| 651 | var FreqHopGroup g := groups[i]; |
| 652 | for (j := 0; j < lengthof(g.trx_maio); j := j + 1) { |
| 653 | var FreqHopGroupItem gi := g.trx_maio[j]; |
| 654 | if (gi.trx_nr == trx_nr) { |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 655 | fhp.maio_hsn.maio := gi.maio; |
| 656 | fhp.maio_hsn.hsn := g.hsn; |
| 657 | fhp.enabled := true; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 658 | break; |
| 659 | } |
| 660 | } |
| 661 | |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 662 | if (fhp.enabled) { |
Vadim Yanitskiy | 4fa7425 | 2020-08-03 15:51:58 +0700 | [diff] [blame] | 663 | /* Prepare the Mobile Allocation bitmask (length & padding) */ |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 664 | fhp.ma_map.len := (mp_transceiver_num + 8 - 1) / 8; /* in bytes */ |
| 665 | fhp.ma_map.ma := f_pad_bit('0'B, fhp.ma_map.len * 8, '0'B); |
| 666 | fhp.ma := { }; /* to be composed below */ |
Vadim Yanitskiy | 4fa7425 | 2020-08-03 15:51:58 +0700 | [diff] [blame] | 667 | |
| 668 | /* Compose the actual Mobile Allocation and the bitmask */ |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 669 | for (j := 0; j < lengthof(g.trx_maio); j := j + 1) { |
| 670 | var FreqHopGroupItem gi := g.trx_maio[j]; |
Vadim Yanitskiy | 42d8bd5 | 2020-11-15 20:41:02 +0700 | [diff] [blame] | 671 | var GsmArfcn arfcn := mp_trx_pars[gi.trx_nr].arfcn; |
Vadim Yanitskiy | 1acc7bb | 2020-11-14 04:24:57 +0700 | [diff] [blame] | 672 | fhp.ma := fhp.ma & { valueof(ts_GsmBandArfcn(arfcn)) }; |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 673 | fhp.ma_map.ma[gi.trx_nr] := '1'B; |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 674 | } |
| 675 | |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 676 | log("Freq. hopping parameters: ", fhp); |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 677 | break; /* We're done */ |
| 678 | } |
| 679 | } |
| 680 | } |
| 681 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 682 | /* create a new test component */ |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 683 | friend function f_start_handler(void_fn fn, ConnHdlrPars pars, |
| 684 | boolean pcu_comp := false, |
Vadim Yanitskiy | 918e2b2 | 2021-05-28 04:57:50 +0200 | [diff] [blame] | 685 | boolean trxc_comp := false, |
| 686 | boolean l1ctl := true) |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 687 | runs on test_CT return ConnHdlr { |
| 688 | var charstring id := testcasename(); |
| 689 | var ConnHdlr vc_conn; |
| 690 | |
| 691 | vc_conn := ConnHdlr.create(id); |
| 692 | /* connect to RSL Emulation main component */ |
| 693 | connect(vc_conn:RSL, vc_RSL:CLIENT_PT); |
| 694 | connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 695 | |
| 696 | /* The ConnHdlr component may want to talk to some ports directly, |
| 697 | * so we disconnect it from the test_CT and connect it to the component. |
| 698 | * This obviously only works for one component, i.e. no concurrency. */ |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 699 | if (pcu_comp) { |
Harald Welte | f26de0b | 2018-04-04 20:28:05 +0200 | [diff] [blame] | 700 | unmap(self:PCU, system:PCU); |
| 701 | map(vc_conn:PCU, system:PCU); |
| 702 | } |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 703 | if (trxc_comp) { |
| 704 | unmap(self:BTS_TRXC, system:BTS_TRXC); |
| 705 | map(vc_conn:BTS_TRXC, system:BTS_TRXC); |
| 706 | } |
Vadim Yanitskiy | 918e2b2 | 2021-05-28 04:57:50 +0200 | [diff] [blame] | 707 | if (l1ctl) { |
| 708 | map(vc_conn:L1CTL, system:L1CTL); |
| 709 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 710 | |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 711 | /* Obtain frequency hopping parameters for a given timeslot */ |
| 712 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) { |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 713 | f_resolve_fh_params(pars.fhp, pars.chan_nr.tn); |
Vadim Yanitskiy | a989428 | 2020-07-14 01:56:15 +0700 | [diff] [blame] | 714 | } |
| 715 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 716 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 717 | return vc_conn; |
| 718 | } |
| 719 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 720 | private altstep as_Tguard() runs on ConnHdlr { |
| 721 | [] g_Tguard.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 722 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Tguard timeout"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 723 | } |
| 724 | } |
| 725 | |
Harald Welte | 990a361 | 2019-05-27 14:02:13 +0200 | [diff] [blame] | 726 | friend function f_l1_tune(L1CTL_PT L1CTL, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED) { |
Vadim Yanitskiy | 42d8bd5 | 2020-11-15 20:41:02 +0700 | [diff] [blame] | 727 | var GsmBandArfcn arfcn := valueof(ts_GsmBandArfcn(mp_trx_pars[0].arfcn)); |
Vadim Yanitskiy | 1acc7bb | 2020-11-14 04:24:57 +0700 | [diff] [blame] | 728 | f_L1CTL_FBSB(L1CTL, arfcn, ccch_mode, mp_rxlev_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 729 | } |
| 730 | |
Vadim Yanitskiy | 2f01fbd | 2019-06-01 01:32:48 +0700 | [diff] [blame] | 731 | private function f_trxc_fake_rssi(TRXC_RSSI rssi) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 732 | var TrxcMessage ret; |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 733 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_RSSI(rssi)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 734 | } |
| 735 | |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 736 | private function f_trxc_fake_toffs256(int16_t toffs256) runs on ConnHdlr { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 737 | var TrxcMessage ret; |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 738 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_TIMING(toffs256)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 739 | } |
| 740 | |
| 741 | /* first function started in ConnHdlr component */ |
| 742 | private function f_handler_init(void_fn fn, charstring id, ConnHdlrPars pars) |
| 743 | runs on ConnHdlr { |
| 744 | g_pars := pars; |
| 745 | g_chan_nr := pars.chan_nr; |
| 746 | |
Vadim Yanitskiy | 918e2b2 | 2021-05-28 04:57:50 +0200 | [diff] [blame] | 747 | if (L1CTL.checkstate("Mapped")) { |
| 748 | f_connect_reset(L1CTL); |
| 749 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 750 | |
Harald Welte | d48c0c7 | 2019-06-05 10:01:15 +0200 | [diff] [blame] | 751 | if (mp_bts_trxc_port != -1 and BTS_TRXC.checkstate("Mapped")) { |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 752 | f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id); |
Harald Welte | 8427162 | 2018-03-10 17:21:03 +0100 | [diff] [blame] | 753 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 754 | |
| 755 | g_Tguard.start(pars.t_guard); |
| 756 | activate(as_Tguard()); |
| 757 | |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 758 | f_rslem_register(pars.trx_nr, pars.chan_nr); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 759 | |
| 760 | /* call the user-supplied test case function */ |
| 761 | fn.apply(id); |
| 762 | } |
| 763 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 764 | private function f_rsl_transceive_ret(template RSL_Message tx, template RSL_Message exp_rx, |
| 765 | charstring id, boolean ignore_other := false) |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 766 | runs on ConnHdlr return RSL_Message { |
| 767 | var RSL_Message rx; |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 768 | timer T := 3.0; |
| 769 | RSL.send(tx); |
| 770 | T.start; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 771 | alt { |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 772 | [] RSL.receive(exp_rx) -> value rx { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 773 | T.stop; |
| 774 | setverdict(pass); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 775 | } |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 776 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 777 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout expecting " & id); |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 778 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 779 | [not ignore_other] as_l1_sacch(); |
| 780 | [not ignore_other] as_meas_res(); |
Vadim Yanitskiy | a4f88c6 | 2020-10-19 14:38:37 +0700 | [diff] [blame] | 781 | [not ignore_other] as_l1_dcch_loop(); |
Vadim Yanitskiy | dc00811 | 2020-10-19 14:42:04 +0700 | [diff] [blame] | 782 | [not ignore_other] as_l1_tch_loop(); |
Pau Espin Pedrol | a6d488d | 2022-10-04 11:20:38 +0200 | [diff] [blame] | 783 | [not ignore_other] RSL.receive(RSL_Message:?) -> value rx { |
| 784 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Rx unexpected RSL port message: ", rx)); |
| 785 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 786 | [not ignore_other] RSL.receive { |
Pau Espin Pedrol | a6d488d | 2022-10-04 11:20:38 +0200 | [diff] [blame] | 787 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Rx unexpected RSL port message"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 788 | } |
Harald Welte | 21240e6 | 2018-03-11 21:43:35 +0100 | [diff] [blame] | 789 | [ignore_other] RSL.receive { repeat; } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 790 | } |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 791 | return rx; |
| 792 | } |
| 793 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 794 | friend function f_rsl_transceive(template RSL_Message tx, template RSL_Message exp_rx, |
| 795 | charstring id, boolean ignore_other := false) |
Harald Welte | b1726c9 | 2018-03-30 11:56:38 +0200 | [diff] [blame] | 796 | runs on ConnHdlr { |
| 797 | 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] | 798 | } |
| 799 | |
Vadim Yanitskiy | 9dd880f | 2022-08-01 19:22:18 +0700 | [diff] [blame] | 800 | /* Send the given measurement results to the IUT over the Um interface */ |
| 801 | friend function f_send_meas_rep(template (value) MeasurementResults meas_res) |
| 802 | runs on ConnHdlr { |
| 803 | var template (value) SacchL1Header l1h; |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 804 | |
| 805 | l1h := ts_SacchL1Header(g_pars.l1_pars.ms_power_level, g_pars.l1_pars.ms_actual_ta); |
| 806 | f_send_meas_rep_l1h(meas_res, l1h); |
| 807 | } |
| 808 | |
| 809 | /* Send the given measurement results and L1H to the IUT over the Um interface */ |
| 810 | friend function f_send_meas_rep_l1h(template (value) MeasurementResults meas_res, |
| 811 | template (value) SacchL1Header l1h) |
| 812 | runs on ConnHdlr { |
Vadim Yanitskiy | 9dd880f | 2022-08-01 19:22:18 +0700 | [diff] [blame] | 813 | var octetstring l2; |
| 814 | |
| 815 | /* RR Measurement Report to be sent */ |
| 816 | var GsmRrL3Message meas_rep := { |
| 817 | header := valueof(t_RrL3Header(MEASUREMENT_REPORT)), |
| 818 | payload := { meas_rep := { meas_res := valueof(meas_res) } } |
| 819 | }; |
| 820 | |
| 821 | /* TITAN has weird (and often unusable) padding model, so we pad here manaully */ |
| 822 | l2 := f_pad_oct(enc_LapdmFrameAB(valueof(ts_LAPDm_AB(0, meas_rep))), 21, '00'O); |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 823 | |
| 824 | log(%definitionId, "(): Tx SACCH L1 header: ", l1h); |
Vadim Yanitskiy | 9dd880f | 2022-08-01 19:22:18 +0700 | [diff] [blame] | 825 | |
| 826 | /* Send RR Measurement Report over the Um interface */ |
| 827 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(g_chan_nr, ts_RslLinkID_SACCH(0), l1h, l2)); |
| 828 | } |
| 829 | |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 830 | /* Send the given measurement results to the IUT over the Um interface, |
| 831 | * wait for the IUT to receive then and forward over the A-bis/RSL interface. */ |
| 832 | friend function f_transceive_meas_rep(template (value) MeasurementResults meas_res) |
| 833 | runs on ConnHdlr { |
Vadim Yanitskiy | 9dd880f | 2022-08-01 19:22:18 +0700 | [diff] [blame] | 834 | var octetstring l3; |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 835 | timer T; |
| 836 | |
| 837 | /* RR Measurement Report to be sent */ |
| 838 | var GsmRrL3Message meas_rep := { |
| 839 | header := valueof(t_RrL3Header(MEASUREMENT_REPORT)), |
| 840 | payload := { meas_rep := { meas_res := valueof(meas_res) } } |
| 841 | }; |
| 842 | |
| 843 | /* TITAN has weird (and often unusable) padding model, so we pad here manaully */ |
| 844 | l3 := f_pad_oct(enc_GsmRrL3Message(meas_rep), 18, '00'O); |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 845 | |
Vadim Yanitskiy | 9dd880f | 2022-08-01 19:22:18 +0700 | [diff] [blame] | 846 | f_send_meas_rep(meas_res); |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 847 | |
| 848 | /* Expect MEASurement RESult on the A-bis/RSL interface */ |
| 849 | T.start(2.0); |
| 850 | alt { |
| 851 | [] RSL.receive(tr_RSL_MEAS_RES_OSMO(g_chan_nr, l3_info := l3)) { |
| 852 | setverdict(pass); |
| 853 | } |
| 854 | [] RSL.receive { repeat; } |
| 855 | [] T.timeout { |
| 856 | setverdict(fail, "Timeout waiting for RSL MEASurement RESult"); |
| 857 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 862 | friend function f_rsl_chan_act(RSL_IE_ChannelMode mode, |
| 863 | boolean encr_enable := false, |
| 864 | RSL_IE_List more_ies := {}, |
| 865 | RSL_IE_ActivationType act_type := t_RSL_IE_ActType_IA) |
| 866 | runs on ConnHdlr { |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 867 | 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] | 868 | if (encr_enable) { |
| 869 | /* append encryption related IEs, if requested */ |
| 870 | var RSL_IE_EncryptionInfo encr_info; |
| 871 | encr_info := valueof(ts_RSL_IE_EncrInfo(g_pars.encr.alg_id, g_pars.encr.key)); |
| 872 | ch_act.ies := ch_act.ies & { valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info := |
| 873 | encr_info})) }; |
| 874 | } |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 875 | if (ischosen(mode.u.speech) and mode.u.speech == RSL_CMOD_SP_GSM3) { |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 876 | ch_act.ies := ch_act.ies & { valueof(t_RSL_IE(RSL_IE_MR_CONFIG, |
| 877 | RSL_IE_Body:{multirate_cfg := g_pars.mr_conf})) }; |
| 878 | } |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 879 | ch_act.ies := ch_act.ies & more_ies; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 880 | 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] | 881 | } |
| 882 | |
Vadim Yanitskiy | b2a90db | 2020-07-04 20:33:47 +0700 | [diff] [blame] | 883 | friend function f_rsl_chan_deact() runs on ConnHdlr { |
Harald Welte | 1eba374 | 2018-02-25 12:48:14 +0100 | [diff] [blame] | 884 | 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] | 885 | "RF CHAN REL", true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 886 | } |
| 887 | |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 888 | friend template ConnHdlrPars t_Pars(template RslChannelNr chan_nr, |
Vadim Yanitskiy | e6c1755 | 2021-06-01 01:20:55 +0200 | [diff] [blame] | 889 | template RSL_IE_ChannelMode chan_mode, |
| 890 | template (omit) TestSpecUnion spec := omit, |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 891 | uint8_t trx_nr := 0, float t_guard := 20.0) := { |
| 892 | trx_nr := trx_nr, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 893 | chan_nr := valueof(chan_nr), |
| 894 | chan_mode := valueof(chan_mode), |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 895 | mr_conf := omit, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 896 | t_guard := t_guard, |
| 897 | l1_pars := { |
| 898 | dtx_enabled := false, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 899 | toa256_enabled := false, |
Vadim Yanitskiy | 7dad608 | 2020-11-28 22:42:27 +0100 | [diff] [blame] | 900 | meas_valid := true, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 901 | meas_ul := { |
| 902 | full := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 903 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 904 | rxqual := 0 |
| 905 | }, |
| 906 | sub := { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 907 | rxlev := mp_ul_rxlev_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 908 | rxqual := 0 |
| 909 | } |
| 910 | }, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 911 | timing_offset_256syms := mp_timing_offset_256syms_exp, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 912 | bs_power_level := 0, |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 913 | ms_power_level := mp_ms_power_level_exp, |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 914 | ms_actual_ta := mp_ms_actual_ta_exp, |
| 915 | facch_enabled := false |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 916 | }, |
Vadim Yanitskiy | e6c1755 | 2021-06-01 01:20:55 +0200 | [diff] [blame] | 917 | spec := spec, |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 918 | encr := omit, |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 919 | bts0_band := omit, |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 920 | tsc := mp_tsc_def, |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 921 | fhp := { |
| 922 | enabled := false, |
| 923 | maio_hsn := ts_HsnMaio(0, 0), |
| 924 | ma_map := c_MA_null, |
Vadim Yanitskiy | 2b991b6 | 2020-11-14 21:40:41 +0700 | [diff] [blame] | 925 | ma := { } |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 926 | }, |
| 927 | loc_osmux_cid := trx_nr, |
| 928 | rem_osmux_cid := omit |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 929 | } |
| 930 | |
Vadim Yanitskiy | f8a9df5 | 2022-03-12 13:29:26 +0300 | [diff] [blame] | 931 | /* This altstep triggers on receipt of a L1CTL DATA.ind matching the given |
| 932 | * RSL chan_nr/link_id and data templates. Used as a base for other altsteps. */ |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 933 | private altstep as_l1ctl_dl_msg(out L1ctlMessage msg, |
Vadim Yanitskiy | f8a9df5 | 2022-03-12 13:29:26 +0300 | [diff] [blame] | 934 | template (present) octetstring tr_data := ?, |
| 935 | template (present) RslChannelNr chan_nr := ?, |
| 936 | template (present) RslLinkId link_id := ?) |
| 937 | runs on ConnHdlr { |
| 938 | [] L1CTL.receive(tr_L1CTL_DATA_IND(chan_nr, link_id, tr_data)) -> value msg; |
| 939 | } |
| 940 | |
| 941 | /* This altstep is built on top of as_l1ctl_dl_msg(), and triggers on receipt |
| 942 | * of dummy LAPDm func=UI frames with empty payload. Repeats by default. */ |
| 943 | private altstep as_dl_lapdm_dummy(template (present) RslChannelNr chan_nr := ?, |
| 944 | template (present) RslLinkId link_id := ?, |
| 945 | template (present) LapdmSapi sapi := ?, |
| 946 | boolean do_repeat := true) |
| 947 | runs on ConnHdlr { |
| 948 | template (present) LapdmFrame tr_frame := tr_LAPDm_UI(sapi, true, ''O); |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 949 | var L1ctlMessage dl_msg; |
Vadim Yanitskiy | f8a9df5 | 2022-03-12 13:29:26 +0300 | [diff] [blame] | 950 | |
| 951 | [] as_l1ctl_dl_msg(dl_msg, decmatch tr_frame, chan_nr, link_id) { |
| 952 | if (do_repeat) { |
| 953 | repeat; |
| 954 | } |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | /* This altstep triggers on receipt of a Downlink DCCH containing a L2 payload |
| 959 | * that matches the given LAPDm frame. The L2 is treated as LapdmFrameAB. */ |
| 960 | private altstep as_dl_dcch_lapdm_ab(out LapdmFrameAB frame, |
| 961 | template (present) LapdmFrameAB tr_frame := ?, |
| 962 | template (present) RslLinkId link_id := ?) |
| 963 | runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 964 | var L1ctlMessage dl_msg; |
Vadim Yanitskiy | f8a9df5 | 2022-03-12 13:29:26 +0300 | [diff] [blame] | 965 | |
| 966 | [] as_l1ctl_dl_msg(dl_msg, decmatch tr_frame, g_chan_nr, link_id) { |
| 967 | frame := dec_LapdmFrameAB(dl_msg.payload.data_ind.payload); |
| 968 | } |
| 969 | } |
| 970 | |
Vadim Yanitskiy | a144e3c | 2022-03-14 23:56:40 +0300 | [diff] [blame] | 971 | /* This altstep triggers on receipt of a Downlink SACCH containing a L2 payload |
| 972 | * that matches the given LAPDm frame, as well as the given SACCH L1 header. */ |
| 973 | private altstep as_dl_sacch_lapdm_ab(out SacchL1Header l1h, out LapdmFrameAB frame, |
| 974 | template (present) LapdmFrameAB tr_frame := ?, |
| 975 | template (present) SacchL1Header tr_l1h := ?, |
| 976 | template (present) GsmSapi sapi := ?) |
| 977 | runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 978 | var L1ctlMessage dl_msg; |
Vadim Yanitskiy | a144e3c | 2022-03-14 23:56:40 +0300 | [diff] [blame] | 979 | template (present) RslLinkId link_id := tr_RslLinkID_SACCH(sapi); |
| 980 | template (present) L1ctlDataReq tr_data := { |
| 981 | l1header := tr_l1h, |
| 982 | l2_payload := decmatch tr_frame |
| 983 | }; |
| 984 | |
| 985 | [] as_l1ctl_dl_msg(dl_msg, decmatch tr_data, g_chan_nr, link_id) { |
| 986 | var octetstring data := dl_msg.payload.data_ind.payload; |
| 987 | l1h := dec_SacchL1Header(substr(data, 0, 2)); |
| 988 | frame := dec_LapdmFrameAB(substr(data, 2, lengthof(data) - 2)); |
| 989 | } |
| 990 | } |
| 991 | |
Vadim Yanitskiy | f8a9df5 | 2022-03-12 13:29:26 +0300 | [diff] [blame] | 992 | /* This altstep is built on top of as_dl_dcch_lapdm_ab(), and triggers on receipt |
| 993 | * of a LAPDm AB frame with a L3 payload matching the given template. The L3 |
| 994 | * payload is treated as PDU_ML3_NW_MS. */ |
| 995 | private altstep as_dl_dcch_pdu(out PDU_ML3_NW_MS pdu, |
| 996 | template (present) PDU_ML3_NW_MS tr_pdu := ?, |
| 997 | template (present) GsmSapi sapi := 0) |
| 998 | runs on ConnHdlr { |
| 999 | template (present) LapdmFrame tr_frame := tr_LAPDm_UI(sapi, true, decmatch tr_pdu); |
| 1000 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(sapi); |
| 1001 | var LapdmFrameAB lapdm_frame; |
| 1002 | |
| 1003 | [] as_dl_dcch_lapdm_ab(lapdm_frame, tr_frame.ab, link_id) { |
| 1004 | pdu := dec_PDU_ML3_NW_MS(lapdm_frame.payload); |
| 1005 | } |
| 1006 | } |
| 1007 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1008 | /*********************************************************************** |
| 1009 | * Channel Activation / Deactivation |
| 1010 | ***********************************************************************/ |
| 1011 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1012 | /* Stress test: Do 500 channel activations/deactivations in rapid succession */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1013 | private function f_TC_chan_act_stress(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1014 | for (var integer i := 0; i < 500; i := i+1) { |
| 1015 | f_rsl_chan_act(g_pars.chan_mode); |
| 1016 | f_rsl_chan_deact(); |
| 1017 | } |
| 1018 | setverdict(pass); |
| 1019 | } |
| 1020 | testcase TC_chan_act_stress() runs on test_CT { |
| 1021 | var ConnHdlr vc_conn; |
| 1022 | 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] | 1023 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1024 | vc_conn := f_start_handler(refers(f_TC_chan_act_stress), pars); |
| 1025 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1026 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | /* Test if re-activation of an already active channel fails as expected */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1030 | private function f_TC_chan_act_react(charstring id) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1031 | f_rsl_chan_act(g_pars.chan_mode); |
| 1032 | /* attempt to activate the same lchan again -> expect reject */ |
| 1033 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 1034 | alt { |
| 1035 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1036 | 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] | 1037 | } |
| 1038 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 1039 | setverdict(pass); |
| 1040 | } |
| 1041 | } |
| 1042 | f_rsl_chan_deact(); |
| 1043 | } |
| 1044 | testcase TC_chan_act_react() runs on test_CT { |
| 1045 | var ConnHdlr vc_conn; |
| 1046 | 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] | 1047 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1048 | vc_conn := f_start_handler(refers(f_TC_chan_act_react), pars); |
| 1049 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1050 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1051 | } |
| 1052 | |
| 1053 | /* Attempt to de-activate a channel that's not active */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1054 | 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] | 1055 | timer T := 3.0; |
| 1056 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 1057 | T.start; |
| 1058 | alt { |
| 1059 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 1060 | setverdict(pass); |
| 1061 | } |
| 1062 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1063 | 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] | 1064 | } |
| 1065 | } |
| 1066 | } |
| 1067 | testcase TC_chan_deact_not_active() runs on test_CT { |
| 1068 | 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] | 1069 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1070 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_chan_deact_not_active), pars); |
| 1071 | vc_conn.done; |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1072 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1073 | } |
| 1074 | |
| 1075 | /* attempt to activate channel with wrong RSL Channel Nr IE; expect NACK */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1076 | 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] | 1077 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode)); |
| 1078 | alt { |
| 1079 | [] RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1080 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN ACT ACK"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1081 | } |
| 1082 | [] RSL.receive(tr_RSL_CHAN_ACT_NACK(g_chan_nr)) { |
| 1083 | setverdict(pass); |
| 1084 | } |
| 1085 | } |
| 1086 | } |
| 1087 | private type record WrongChanNrCase { |
| 1088 | RslChannelNr chan_nr, |
| 1089 | charstring description |
| 1090 | } |
| 1091 | private type record of WrongChanNrCase WrongChanNrCases; |
| 1092 | private template WrongChanNrCase t_WCN(template RslChannelNr chan_nr, charstring desc) := { |
| 1093 | chan_nr := chan_nr, |
| 1094 | description := desc |
| 1095 | } |
| 1096 | |
| 1097 | testcase TC_chan_act_wrong_nr() runs on test_CT { |
| 1098 | var ConnHdlr vc_conn; |
| 1099 | var ConnHdlrPars pars; |
| 1100 | |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1101 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1102 | |
| 1103 | var WrongChanNrCases wrong := { |
| 1104 | valueof(t_WCN(t_RslChanNr_RACH(0), "RACH is not a dedicated channel")), |
| 1105 | valueof(t_WCN(t_RslChanNr_RACH(1), "RACH doesn't exist on timeslot")), |
| 1106 | valueof(t_WCN(t_RslChanNr_BCCH(0), "BCCH is not a dedicated channel")), |
| 1107 | valueof(t_WCN(t_RslChanNr_PCH_AGCH(0), "PCH/AGCH is not a dedicated channel")), |
| 1108 | valueof(t_WCN(t_RslChanNr_Bm(0), "TS0 cannot be TCH/F")), |
| 1109 | valueof(t_WCN(t_RslChanNr_Lm(0, 0), "TS0 cannot be TCH/H")), |
| 1110 | valueof(t_WCN(t_RslChanNr_Lm(0, 1), "TS0 cannot be TCH/H")), |
| 1111 | valueof(t_WCN(t_RslChanNr_PDCH(0), "TS0 cannot be PDCH")), |
| 1112 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 0), "TS0 cannot be SDCCH/8")), |
| 1113 | valueof(t_WCN(t_RslChanNr_SDCCH8(0, 7), "TS0 cannot be SDCCH/8")), |
| 1114 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 0), "TS7 cannot be SDCCH/4")), |
| 1115 | valueof(t_WCN(t_RslChanNr_SDCCH4(7, 3), "TS7 cannot be SDCCH/4")), |
| 1116 | valueof(t_WCN(t_RslChanNr_Lm(1, 0), "TS1 cannot be TCH/H")) |
| 1117 | }; |
| 1118 | |
| 1119 | for (var integer i := 0; i < sizeof(wrong); i := i+1) { |
| 1120 | pars := valueof(t_Pars(wrong[i].chan_nr, ts_RSL_ChanMode_SIGN)); |
| 1121 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_nr), pars); |
| 1122 | vc_conn.done; |
| 1123 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1124 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1125 | } |
| 1126 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1127 | /* execute the same callback function on a variety of logical channels */ |
Harald Welte | 2f2b2b7 | 2019-05-31 22:24:57 +0200 | [diff] [blame] | 1128 | 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] | 1129 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 1130 | f_init(); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1131 | |
| 1132 | /* test on each of the channels we have */ |
| 1133 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 1134 | pars.chan_nr := valueof(g_AllChanTypes[i]); |
| 1135 | |
| 1136 | log(testcasename(), ": XXX Starting on ", g_AllChanTypes[i]); |
| 1137 | vc_conn := f_start_handler(fn, pars); |
| 1138 | vc_conn.done; |
| 1139 | } |
| 1140 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1141 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 1142 | } |
| 1143 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1144 | /*********************************************************************** |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1145 | * SACCH handling |
| 1146 | ***********************************************************************/ |
| 1147 | |
| 1148 | private function f_exp_sacch(boolean exp) runs on ConnHdlr { |
| 1149 | timer T_sacch := 3.0; |
| 1150 | T_sacch.start; |
| 1151 | alt { |
| 1152 | [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] | 1153 | 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] | 1154 | } |
| 1155 | [not exp] T_sacch.timeout { |
| 1156 | setverdict(pass); |
| 1157 | } |
| 1158 | [exp] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) { |
| 1159 | setverdict(pass); |
| 1160 | } |
| 1161 | [exp] T_sacch.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1162 | 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] | 1163 | } |
| 1164 | [] L1CTL.receive { repeat; } |
| 1165 | [] RSL.receive { repeat; } |
| 1166 | } |
| 1167 | } |
| 1168 | |
| 1169 | /* Test if DEACTIVATE SACCH actualy deactivates its transmission (TS 48.058 4.6) */ |
| 1170 | private function f_TC_deact_sacch(charstring id) runs on ConnHdlr { |
| 1171 | f_l1_tune(L1CTL); |
| 1172 | RSL.clear; |
| 1173 | |
| 1174 | /* activate the logical channel */ |
| 1175 | f_est_dchan(); |
| 1176 | L1CTL.clear; |
| 1177 | |
| 1178 | /* check that SACCH actually are received as expected */ |
| 1179 | f_exp_sacch(true); |
| 1180 | |
| 1181 | /* deactivate SACCH on the logical channel */ |
| 1182 | RSL.send(ts_RSL_DEACT_SACCH(g_chan_nr)); |
| 1183 | f_sleep(1.0); |
| 1184 | L1CTL.clear; |
| 1185 | |
| 1186 | /* check that no SACCH are received anymore */ |
| 1187 | f_exp_sacch(false); |
| 1188 | |
| 1189 | /* release the channel */ |
| 1190 | f_rsl_chan_deact(); |
| 1191 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1192 | } |
| 1193 | testcase TC_deact_sacch() runs on test_CT { |
| 1194 | var ConnHdlr vc_conn; |
| 1195 | var ConnHdlrPars pars; |
| 1196 | f_init(); |
| 1197 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1198 | //for (var integer i := 0; i < 1; i := i+1) { |
| 1199 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1200 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1201 | vc_conn := f_start_handler(refers(f_TC_deact_sacch), pars); |
| 1202 | vc_conn.done; |
| 1203 | } |
| 1204 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1205 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1206 | } |
| 1207 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1208 | /* verify that given SACCH payload is present */ |
Vadim Yanitskiy | f9136a1 | 2022-03-11 14:04:27 +0300 | [diff] [blame] | 1209 | private function f_sacch_present(template octetstring l3_exp, |
| 1210 | boolean do_fail := true) |
| 1211 | runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 1212 | var L1ctlMessage dl; |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1213 | timer T_sacch := 3.0; |
| 1214 | L1CTL.clear; |
| 1215 | T_sacch.start; |
| 1216 | alt { |
| 1217 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 1218 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 1219 | if (match(l3, l3_exp)) { |
| 1220 | setverdict(pass); |
| 1221 | } else { |
| 1222 | repeat; |
| 1223 | } |
| 1224 | } |
| 1225 | [] L1CTL.receive { repeat; } |
Vadim Yanitskiy | f9136a1 | 2022-03-11 14:04:27 +0300 | [diff] [blame] | 1226 | [not do_fail] T_sacch.timeout { |
| 1227 | log("Timeout waiting for SACCH ", l3_exp); |
| 1228 | } |
| 1229 | [do_fail] T_sacch.timeout { |
Vadim Yanitskiy | 77a65f8 | 2022-03-11 12:34:47 +0300 | [diff] [blame] | 1230 | setverdict(fail, "Timeout waiting for SACCH ", l3_exp); |
| 1231 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1232 | } |
| 1233 | } |
| 1234 | } |
| 1235 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1236 | /* verify that given SACCH payload is not present */ |
| 1237 | private function f_sacch_missing(template octetstring l3_exp) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 1238 | var L1ctlMessage dl; |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1239 | timer T_sacch := 3.0; |
| 1240 | L1CTL.clear; |
| 1241 | T_sacch.start; |
| 1242 | alt { |
| 1243 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(0))) -> value dl { |
| 1244 | var octetstring l3 := substr(dl.payload.data_ind.payload, 4, 19); |
| 1245 | if (match(l3, l3_exp)) { |
Vadim Yanitskiy | 77a65f8 | 2022-03-11 12:34:47 +0300 | [diff] [blame] | 1246 | setverdict(fail, "Received unexpected SACCH ", dl); |
| 1247 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1248 | } else { |
| 1249 | repeat; |
| 1250 | } |
| 1251 | } |
| 1252 | [] L1CTL.receive { repeat; } |
| 1253 | [] T_sacch.timeout { |
| 1254 | setverdict(pass); |
| 1255 | } |
| 1256 | } |
| 1257 | } |
| 1258 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1259 | /* Test for default SACCH FILL transmitted in DL SACCH (all channel types) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1260 | private function f_TC_sacch_filling(charstring id) runs on ConnHdlr { |
| 1261 | /* Set a known default SACCH filling for SI5 */ |
| 1262 | var octetstring si5 := f_rnd_octstring(19); |
| 1263 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1264 | |
| 1265 | f_l1_tune(L1CTL); |
| 1266 | RSL.clear; |
| 1267 | |
| 1268 | /* activate the logical channel */ |
| 1269 | f_est_dchan(); |
| 1270 | |
| 1271 | /* check that the specified SI5 value is actually sent */ |
| 1272 | f_sacch_present(si5); |
| 1273 | |
| 1274 | /* release the channel */ |
| 1275 | RSL.clear; |
| 1276 | f_rsl_chan_deact(); |
| 1277 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1278 | } |
| 1279 | testcase TC_sacch_filling() runs on test_CT { |
| 1280 | var ConnHdlr vc_conn; |
| 1281 | var ConnHdlrPars pars; |
| 1282 | f_init(); |
| 1283 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1284 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1285 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1286 | vc_conn := f_start_handler(refers(f_TC_sacch_filling), pars); |
| 1287 | vc_conn.done; |
| 1288 | } |
| 1289 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1290 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1291 | } |
| 1292 | |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1293 | /* Test for lchan-specific SACCH INFO MODIFY (TS 48.058 4.12) */ |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1294 | private function f_TC_sacch_info_mod(charstring id) runs on ConnHdlr { |
| 1295 | /* Set a known default SACCH filling for SI5 */ |
| 1296 | var octetstring si5 := f_rnd_octstring(19); |
| 1297 | var octetstring si5_diff := f_rnd_octstring(19); |
| 1298 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1299 | |
| 1300 | f_l1_tune(L1CTL); |
| 1301 | RSL.clear; |
| 1302 | |
| 1303 | log("Activating channel, expecting standard SI5"); |
| 1304 | /* activate the logical channel */ |
| 1305 | f_est_dchan(); |
| 1306 | /* check that the specified SI5 value is actually sent */ |
| 1307 | f_sacch_present(si5); |
| 1308 | |
| 1309 | /* set channel-specific different SI5 */ |
| 1310 | log("Setting channel specific SACCH INFO, expecting it"); |
| 1311 | RSL.send(ts_RSL_SACCH_INF_MOD(g_chan_nr, RSL_SYSTEM_INFO_5, si5_diff)) |
| 1312 | /* check that the specified lchan-specific value is now used */ |
| 1313 | f_sacch_present(si5_diff); |
| 1314 | |
| 1315 | /* deactivate the channel and re-activate it, this should result in default SI5 */ |
| 1316 | log("De-activating and re-activating channel, expecting standard SI5"); |
| 1317 | f_rsl_chan_deact(); |
| 1318 | f_rsl_chan_act(valueof(ts_RSL_ChanMode_SIGN)); |
| 1319 | /* Verify that the TRX-wide default SACCH filling is present again */ |
| 1320 | f_sacch_present(si5); |
| 1321 | |
| 1322 | /* release the channel */ |
| 1323 | RSL.clear; |
| 1324 | f_rsl_chan_deact(); |
| 1325 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1326 | } |
| 1327 | testcase TC_sacch_info_mod() runs on test_CT { |
| 1328 | var ConnHdlr vc_conn; |
| 1329 | var ConnHdlrPars pars; |
| 1330 | f_init(); |
| 1331 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1332 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1333 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1334 | vc_conn := f_start_handler(refers(f_TC_sacch_info_mod), pars); |
| 1335 | vc_conn.done; |
| 1336 | } |
| 1337 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1338 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 1339 | } |
| 1340 | |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 1341 | /* Test SACCH scheduling of multiple different SI message types */ |
| 1342 | private function f_TC_sacch_multi(charstring id) runs on ConnHdlr { |
| 1343 | var octetstring si5 := f_rnd_octstring(19); |
| 1344 | var octetstring si5bis := f_rnd_octstring(19); |
| 1345 | var octetstring si5ter := f_rnd_octstring(19); |
| 1346 | var octetstring si6 := f_rnd_octstring(19); |
| 1347 | |
| 1348 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1349 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5bis, si5bis)); |
| 1350 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5ter, si5ter)); |
| 1351 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1352 | |
| 1353 | f_l1_tune(L1CTL); |
| 1354 | RSL.clear; |
| 1355 | |
| 1356 | /* activate the logical channel */ |
| 1357 | f_est_dchan(); |
| 1358 | L1CTL.clear; |
| 1359 | |
| 1360 | /* check that SACCH actually are received as expected */ |
| 1361 | f_sacch_present(si5); |
| 1362 | f_sacch_present(si5bis); |
| 1363 | f_sacch_present(si5ter); |
| 1364 | f_sacch_present(si6); |
| 1365 | |
| 1366 | /* release the channel */ |
| 1367 | f_rsl_chan_deact(); |
| 1368 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1369 | } |
| 1370 | testcase TC_sacch_multi() runs on test_CT { |
| 1371 | var ConnHdlr vc_conn; |
| 1372 | var ConnHdlrPars pars; |
| 1373 | f_init(); |
| 1374 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1375 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1376 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1377 | vc_conn := f_start_handler(refers(f_TC_sacch_multi), pars); |
| 1378 | vc_conn.done; |
| 1379 | } |
| 1380 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1381 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 1382 | } |
| 1383 | |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1384 | /* Test if SACH information is modified as expected */ |
| 1385 | private function f_TC_sacch_multi_chg(charstring id) runs on ConnHdlr { |
| 1386 | var octetstring si5 := f_rnd_octstring(19); |
| 1387 | var octetstring si6 := f_rnd_octstring(19); |
| 1388 | |
| 1389 | /* First, configure both SI5 and SI6 to be transmitted */ |
| 1390 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1391 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1392 | |
| 1393 | f_l1_tune(L1CTL); |
| 1394 | RSL.clear; |
| 1395 | |
| 1396 | /* activate the logical channel */ |
| 1397 | f_est_dchan(); |
| 1398 | L1CTL.clear; |
| 1399 | |
| 1400 | /* check that SACCH actually are received as expected */ |
| 1401 | f_sacch_present(si5); |
| 1402 | f_sacch_present(si6); |
| 1403 | |
| 1404 | /* disable SI6 */ |
| 1405 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, ''O)); |
| 1406 | |
| 1407 | /* check that SI5 is still transmitted */ |
| 1408 | f_sacch_present(si5); |
| 1409 | /* check if SI6 is now gone */ |
| 1410 | f_sacch_missing(si6); |
| 1411 | |
| 1412 | /* release the channel */ |
| 1413 | f_rsl_chan_deact(); |
| 1414 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1415 | } |
| 1416 | testcase TC_sacch_multi_chg() runs on test_CT { |
| 1417 | var ConnHdlr vc_conn; |
| 1418 | var ConnHdlrPars pars; |
| 1419 | f_init(); |
| 1420 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1421 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1422 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1423 | vc_conn := f_start_handler(refers(f_TC_sacch_multi_chg), pars); |
| 1424 | vc_conn.done; |
| 1425 | } |
| 1426 | /* TODO: do the above in parallel, rather than sequentially? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1427 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 1428 | } |
| 1429 | |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 1430 | /* Test for SACCH information present in RSL CHAN ACT (overrides FILLING) */ |
| 1431 | private function f_TC_sacch_chan_act(charstring id) runs on ConnHdlr { |
| 1432 | var octetstring si5 := f_rnd_octstring(19); |
| 1433 | var octetstring si6 := f_rnd_octstring(19); |
| 1434 | var octetstring si5_specific := f_rnd_octstring(19); |
| 1435 | var octetstring si6_specific := f_rnd_octstring(19); |
| 1436 | |
| 1437 | /* First, configure both SI5 and SI6 to be transmitted */ |
| 1438 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1439 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_6, si6)); |
| 1440 | |
| 1441 | f_l1_tune(L1CTL); |
| 1442 | RSL.clear; |
| 1443 | |
| 1444 | /* activate channel with different SACCH filling */ |
| 1445 | var RSL_SacchInfo sacch_info := valueof(ts_RSL_SacchInfo({ |
| 1446 | ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_5, si5_specific), |
| 1447 | ts_RSL_SacchInfoElem(RSL_SYSTEM_INFO_6, si6_specific) |
| 1448 | })); |
| 1449 | var RSL_IE_List addl_ies := { valueof(t_RSL_IE(RSL_IE_SACCH_INFO, |
| 1450 | RSL_IE_Body:{sacch_info := sacch_info})) }; |
| 1451 | f_est_dchan(more_ies := addl_ies); |
| 1452 | |
| 1453 | /* check that SACCH actually are received as expected */ |
| 1454 | f_sacch_present(si5_specific); |
| 1455 | f_sacch_present(si6_specific); |
| 1456 | |
| 1457 | /* release the channel */ |
| 1458 | f_rsl_chan_deact(); |
| 1459 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1460 | } |
| 1461 | testcase TC_sacch_chan_act() runs on test_CT { |
| 1462 | var ConnHdlr vc_conn; |
| 1463 | var ConnHdlrPars pars; |
| 1464 | f_init(); |
| 1465 | |
| 1466 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i+1) { |
| 1467 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 1468 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 1469 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act), pars); |
| 1470 | vc_conn.done; |
| 1471 | } |
| 1472 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1473 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1474 | } |
| 1475 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1476 | /* verify that SACCH DL transmission is started only if MS power IE present |
| 1477 | * see section 4.1.3 of 3GPP TS 48.058 */ |
| 1478 | private function f_TC_sacch_chan_act_ho_async(charstring id) runs on ConnHdlr { |
| 1479 | var octetstring si5 := f_rnd_octstring(19); |
Neels Hofmeyr | dd59741 | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1480 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1481 | |
| 1482 | f_l1_tune(L1CTL); |
| 1483 | RSL.clear; |
| 1484 | |
| 1485 | /* Step 1: Activate ASYNC HO channel without MS power IE */ |
| 1486 | |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1487 | var integer ho_ref := oct2int(f_rnd_octstring(1)); |
| 1488 | var RSL_IE ho_ref_ie := valueof(t_RSL_IE(RSL_IE_HANDO_REF, |
| 1489 | RSL_IE_Body:{ handover_ref := ho_ref })); |
| 1490 | var RSL_IE_List addl_ies := { |
| 1491 | ho_ref_ie |
| 1492 | }; |
| 1493 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1494 | /* Activate channel on BTS side */ |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1495 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_ASYNC); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1496 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1497 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1498 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1499 | |
| 1500 | /* Verify that no DL SACCH is being received */ |
| 1501 | f_sacch_missing(?); |
| 1502 | |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1503 | /* Send handover Access Burst and expect SACCH to start */ |
| 1504 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1505 | |
| 1506 | f_sacch_present(si5); |
| 1507 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1508 | f_rsl_chan_deact(); |
| 1509 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | 289056c | 2022-12-25 02:07:49 +0700 | [diff] [blame] | 1510 | f_L1CTL_RESET(L1CTL); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1511 | |
Vadim Yanitskiy | e3351bb | 2022-07-29 05:22:51 +0700 | [diff] [blame] | 1512 | /* Tune back to CCCH/BCCH */ |
| 1513 | f_l1_tune(L1CTL); |
| 1514 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1515 | |
| 1516 | /* Step 2: Activate ASYNC HO channel with MS power IE */ |
| 1517 | |
| 1518 | /* Activate channel on BTS side */ |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1519 | addl_ies := { |
| 1520 | ho_ref_ie, |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1521 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1522 | }; |
| 1523 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_ASYNC); |
| 1524 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1525 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1526 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1527 | |
Vadim Yanitskiy | f9136a1 | 2022-03-11 14:04:27 +0300 | [diff] [blame] | 1528 | /* 4.1.3 "If the MS Power IE is present the BTS *may* start transmission |
| 1529 | * also on the SACCH". "May" does not mean "shall", so osmo-bts does not. */ |
| 1530 | f_sacch_present(si5, do_fail := false); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1531 | |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1532 | /* Send handover Access Burst and expect SACCH to remain present */ |
| 1533 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1534 | |
| 1535 | f_sacch_present(si5); |
| 1536 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1537 | f_rsl_chan_deact(); |
| 1538 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1539 | } |
| 1540 | testcase TC_sacch_chan_act_ho_async() runs on test_CT { |
| 1541 | var ConnHdlr vc_conn; |
| 1542 | var ConnHdlrPars pars; |
| 1543 | f_init(); |
| 1544 | |
Vadim Yanitskiy | ce96d35 | 2022-03-11 15:32:07 +0300 | [diff] [blame] | 1545 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 1546 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 1547 | log(testcasename(), ": Starting for ", g_AllChanTypes[i]); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1548 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act_ho_async), pars); |
| 1549 | vc_conn.done; |
| 1550 | } |
| 1551 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1552 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1553 | } |
| 1554 | |
| 1555 | /* verify that SACCH DL transmission is started only if TA + MS power IEs present, |
| 1556 | * see section 4.1.4 of 3GPP TS 48.058 */ |
| 1557 | private function f_TC_sacch_chan_act_ho_sync(charstring id) runs on ConnHdlr { |
| 1558 | var octetstring si5 := f_rnd_octstring(19); |
Neels Hofmeyr | dd59741 | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1559 | RSL.send(ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, si5)); |
| 1560 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1561 | var RSL_IE_List addl_ies; |
| 1562 | |
| 1563 | f_l1_tune(L1CTL); |
| 1564 | RSL.clear; |
| 1565 | |
| 1566 | /* Step 1: Activate SYNC HO channel without MS power IE */ |
| 1567 | |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1568 | var integer ho_ref := oct2int(f_rnd_octstring(1)); |
| 1569 | var RSL_IE ho_ref_ie := valueof(t_RSL_IE(RSL_IE_HANDO_REF, |
| 1570 | RSL_IE_Body:{ handover_ref := ho_ref })); |
| 1571 | addl_ies := { |
| 1572 | ho_ref_ie |
| 1573 | }; |
| 1574 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1575 | /* Activate channel on BTS side */ |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1576 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1577 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1578 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1579 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1580 | |
| 1581 | /* Verify that no DL SACCH is being received */ |
| 1582 | f_sacch_missing(?); |
| 1583 | |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1584 | /* Send handover Access Burst and expect SACCH to start */ |
| 1585 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1586 | |
| 1587 | f_sacch_present(si5); |
| 1588 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1589 | f_rsl_chan_deact(); |
| 1590 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | 289056c | 2022-12-25 02:07:49 +0700 | [diff] [blame] | 1591 | f_L1CTL_RESET(L1CTL); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1592 | |
Vadim Yanitskiy | e3351bb | 2022-07-29 05:22:51 +0700 | [diff] [blame] | 1593 | /* Tune back to CCCH/BCCH */ |
| 1594 | f_l1_tune(L1CTL); |
| 1595 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1596 | |
| 1597 | /* Step 2a: Activate SYNC HO channel with only MS power IE */ |
| 1598 | |
| 1599 | /* Activate channel on BTS side */ |
| 1600 | addl_ies := { |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1601 | ho_ref_ie, |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1602 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1603 | }; |
| 1604 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1605 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1606 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1607 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1608 | |
Vadim Yanitskiy | f9136a1 | 2022-03-11 14:04:27 +0300 | [diff] [blame] | 1609 | /* 4.1.4 "If only the MS Power IE is present the BTS *may* start transmission |
| 1610 | * also on the SACCH". "May" does not mean "shall", so osmo-bts does not. */ |
| 1611 | f_sacch_present(si5, do_fail := false); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1612 | |
Neels Hofmeyr | d55a3ac | 2020-11-09 00:54:34 +0000 | [diff] [blame] | 1613 | /* Send handover Access Burst and expect SACCH to remain present */ |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1614 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1615 | |
| 1616 | f_sacch_present(si5); |
| 1617 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1618 | f_rsl_chan_deact(); |
| 1619 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | 289056c | 2022-12-25 02:07:49 +0700 | [diff] [blame] | 1620 | f_L1CTL_RESET(L1CTL); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1621 | |
Vadim Yanitskiy | e3351bb | 2022-07-29 05:22:51 +0700 | [diff] [blame] | 1622 | /* Tune back to CCCH/BCCH */ |
| 1623 | f_l1_tune(L1CTL); |
| 1624 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1625 | |
| 1626 | /* Step 2b: Activate SYNC HO channel with TA IE */ |
| 1627 | |
| 1628 | /* Activate channel on BTS side */ |
| 1629 | addl_ies := { |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1630 | ho_ref_ie, |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1631 | valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := 0})) |
| 1632 | }; |
| 1633 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1634 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1635 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1636 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1637 | |
| 1638 | /* Verify that no DL SACCH is being received */ |
| 1639 | f_sacch_missing(?); |
| 1640 | |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1641 | /* Send handover Access Burst and expect SACCH to start */ |
| 1642 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1643 | |
| 1644 | f_sacch_present(si5); |
| 1645 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1646 | f_rsl_chan_deact(); |
| 1647 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | 289056c | 2022-12-25 02:07:49 +0700 | [diff] [blame] | 1648 | f_L1CTL_RESET(L1CTL); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1649 | |
Vadim Yanitskiy | e3351bb | 2022-07-29 05:22:51 +0700 | [diff] [blame] | 1650 | /* Tune back to CCCH/BCCH */ |
| 1651 | f_l1_tune(L1CTL); |
| 1652 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1653 | |
| 1654 | /* Step 3: Activate SYNC HO channel with MS power IE and TA IE */ |
| 1655 | |
| 1656 | /* Activate channel on BTS side */ |
| 1657 | addl_ies := { |
Neels Hofmeyr | d34681b | 2020-11-03 20:35:00 +0000 | [diff] [blame] | 1658 | ho_ref_ie, |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1659 | valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := 0})), |
| 1660 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(0)})) |
| 1661 | }; |
| 1662 | f_rsl_chan_act(g_pars.chan_mode, more_ies := addl_ies, act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1663 | /* don't perform immediate assignment here, as we're testing non-IA case */ |
| 1664 | /* enable dedicated mode */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1665 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1666 | |
| 1667 | /* Verify that DL SACCH is being received */ |
| 1668 | f_sacch_present(si5); |
| 1669 | |
Neels Hofmeyr | 76d1d1a | 2020-11-09 00:03:33 +0000 | [diff] [blame] | 1670 | /* Send handover Access Burst and expect SACCH to remain present */ |
| 1671 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 1672 | |
| 1673 | f_sacch_present(si5); |
| 1674 | |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1675 | f_rsl_chan_deact(); |
| 1676 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 1677 | } |
| 1678 | testcase TC_sacch_chan_act_ho_sync() runs on test_CT { |
| 1679 | var ConnHdlr vc_conn; |
| 1680 | var ConnHdlrPars pars; |
| 1681 | f_init(); |
| 1682 | |
Vadim Yanitskiy | ce96d35 | 2022-03-11 15:32:07 +0300 | [diff] [blame] | 1683 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 1684 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 1685 | log(testcasename(), ": Starting for ", g_AllChanTypes[i]); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 1686 | vc_conn := f_start_handler(refers(f_TC_sacch_chan_act_ho_sync), pars); |
| 1687 | vc_conn.done; |
| 1688 | } |
| 1689 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 1690 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1691 | } |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 1692 | |
| 1693 | |
| 1694 | /*********************************************************************** |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 1695 | * RACH Handling |
| 1696 | ***********************************************************************/ |
| 1697 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1698 | /* 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] | 1699 | private function f_TC_rach_content(boolean emerg) runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 1700 | f_init(); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1701 | f_init_l1ctl(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 1702 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1703 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1704 | var GsmFrameNumber fn_last := 0; |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1705 | var boolean test_failed := false; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1706 | for (var integer i := 0; i < 1000; i := i+1) { |
Neels Hofmeyr | c897cfb | 2020-11-09 00:06:01 +0000 | [diff] [blame] | 1707 | var OCT1 ra; |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 1708 | if (emerg == true) { |
| 1709 | ra := f_rnd_ra_emerg(); |
| 1710 | } else { |
| 1711 | ra := f_rnd_ra_cs(); |
| 1712 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1713 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1714 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1715 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1716 | } |
| 1717 | fn_last := fn; |
| 1718 | |
| 1719 | timer T := 5.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1720 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1721 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1722 | [] 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] | 1723 | T.stop; |
| 1724 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1725 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(?, ?, ?, ?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1726 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected CHAN RQD"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1727 | } |
| 1728 | [] RSL_CCHAN.receive { repeat; } |
| 1729 | [] T.timeout { |
Max | a199a2e | 2019-02-25 16:31:11 +0100 | [diff] [blame] | 1730 | test_failed := true; |
| 1731 | log("[", i, "] Timeout waiting for CHAN RQD FN=", fn, " RA=", ra); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1732 | } |
| 1733 | } |
| 1734 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1735 | if (test_failed) { |
| 1736 | 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] | 1737 | } |
Max | ba06feb | 2019-03-05 10:52:46 +0100 | [diff] [blame] | 1738 | setverdict(pass); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1739 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1740 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1741 | |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 1742 | /* Normal variant */ |
| 1743 | testcase TC_rach_content() runs on test_CT { |
| 1744 | f_TC_rach_content(emerg := false); |
| 1745 | } |
| 1746 | |
| 1747 | /* Emergency call variant */ |
| 1748 | testcase TC_rach_content_emerg() runs on test_CT { |
| 1749 | f_TC_rach_content(emerg := true); |
| 1750 | } |
| 1751 | |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1752 | /* Send 1000 RACH Requests (flood ~ 89/s) and count if count(Abis) == count(Um) */ |
| 1753 | testcase TC_rach_count() runs on test_CT { |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1754 | f_init(); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1755 | f_init_l1ctl(); |
Harald Welte | 294b0a2 | 2018-03-10 23:26:48 +0100 | [diff] [blame] | 1756 | f_sleep(1.0); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1757 | f_l1_tune(L1CTL); |
| 1758 | |
| 1759 | var GsmFrameNumber fn_last := 0; |
| 1760 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1761 | var OCT1 ra := f_rnd_ra_cs(); |
| 1762 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1763 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1764 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1765 | } |
| 1766 | fn_last := fn; |
| 1767 | } |
| 1768 | var integer rsl_chrqd := 0; |
| 1769 | timer T := 3.0; |
Harald Welte | 56c0580 | 2018-02-28 21:39:35 +0100 | [diff] [blame] | 1770 | T.start; |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1771 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1772 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_CHAN_RQD(?,?))) { |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1773 | rsl_chrqd := rsl_chrqd + 1; |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 1774 | f_timer_safe_restart(T); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1775 | repeat; |
| 1776 | } |
| 1777 | [] RSL_CCHAN.receive { repeat; } |
| 1778 | [] T.timeout { } |
| 1779 | } |
| 1780 | if (rsl_chrqd == 1000) { |
| 1781 | setverdict(pass); |
| 1782 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1783 | 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] | 1784 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1785 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 1786 | } |
| 1787 | |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1788 | private function f_vty_load_ind_thresh(integer period := 10, integer bts_nr := 0) runs on test_CT { |
| 1789 | var charstring bts_str := "bts " & int2str(bts_nr); |
| 1790 | f_vty_config2(BSCVTY, {"network", bts_str}, "ccch load-indication-threshold " & int2str(period)); |
| 1791 | } |
| 1792 | |
| 1793 | /* empirical value: Number of RACH slots per reporting interval (1s) on combined CCCH */ |
| 1794 | private template integer tr_rach_slots_per_interval := (90 .. 130); |
| 1795 | |
| 1796 | /* Expect 0 RACH load on an idle BTS that has just started up */ |
| 1797 | testcase TC_rach_load_idle_thresh0() runs on test_CT { |
| 1798 | var ASP_RSL_Unitdata rx_ud; |
| 1799 | |
| 1800 | f_init_vty_bsc(); |
| 1801 | /* send load indications even at 0% load */ |
| 1802 | f_vty_load_ind_thresh(0); |
| 1803 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 1804 | f_sleep(2.0); |
| 1805 | |
| 1806 | f_init(); |
| 1807 | |
Harald Welte | e37f9a5 | 2020-10-11 20:45:23 +0200 | [diff] [blame] | 1808 | /* Skip the first RACH LOAD IND, as it may not have the full slot count (BTS started less than 1s before) */ |
| 1809 | alt { |
| 1810 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(?, ?, ?))) { } |
| 1811 | [] RSL_CCHAN.receive { repeat } |
| 1812 | } |
| 1813 | |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1814 | timer T := 5.0; |
| 1815 | T.start; |
| 1816 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1817 | [] 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] | 1818 | setverdict(pass); |
| 1819 | repeat; |
| 1820 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1821 | [] 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] | 1822 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1823 | repeat; |
| 1824 | } |
| 1825 | [] RSL_CCHAN.receive { |
| 1826 | repeat; |
| 1827 | } |
| 1828 | [] T.timeout { } |
| 1829 | } |
| 1830 | |
| 1831 | f_vty_load_ind_thresh(10); |
| 1832 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1833 | } |
| 1834 | |
| 1835 | /* Expect no RACH load indications on an idle BTS that has just started up (default threshold 10%) */ |
| 1836 | testcase TC_rach_load_idle_below_thresh() runs on test_CT { |
| 1837 | var ASP_RSL_Unitdata rx_ud; |
| 1838 | |
| 1839 | f_init_vty_bsc(); |
| 1840 | f_init(); |
| 1841 | |
| 1842 | timer T := 5.0; |
| 1843 | T.start; |
| 1844 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1845 | [] 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] | 1846 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1847 | repeat; |
| 1848 | } |
| 1849 | [] RSL_CCHAN.receive { |
| 1850 | repeat; |
| 1851 | } |
| 1852 | [] T.timeout { |
| 1853 | setverdict(pass); |
| 1854 | } |
| 1855 | } |
| 1856 | |
| 1857 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1858 | } |
| 1859 | |
| 1860 | /* Expect 0 RACH load on an idle BTS that has just started up */ |
| 1861 | testcase TC_rach_load_count() runs on test_CT { |
| 1862 | var ASP_RSL_Unitdata rx_ud; |
| 1863 | var integer load_access_count := 0; |
| 1864 | |
| 1865 | f_init_vty_bsc(); |
| 1866 | /* send load indications even at 0% load */ |
| 1867 | f_vty_load_ind_thresh(0); |
| 1868 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 1869 | f_sleep(2.0); |
| 1870 | f_init(); |
| 1871 | |
| 1872 | f_init_l1ctl(); |
| 1873 | f_sleep(1.0); |
| 1874 | f_l1_tune(L1CTL); |
| 1875 | |
Harald Welte | 52ae168 | 2020-10-11 20:45:55 +0200 | [diff] [blame] | 1876 | /* Skip the first RACH LOAD IND, as it may not have the full slot count (BTS started less than 1s before) */ |
| 1877 | alt { |
| 1878 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RACH_LOAD_IND(?, ?, ?))) { } |
| 1879 | [] RSL_CCHAN.receive { repeat } |
| 1880 | } |
| 1881 | |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 1882 | var GsmFrameNumber fn_last := 0; |
| 1883 | for (var integer i := 0; i < 1000; i := i+1) { |
| 1884 | var OCT1 ra := f_rnd_ra_cs(); |
| 1885 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1886 | if (fn == fn_last) { |
| 1887 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
| 1888 | } |
| 1889 | fn_last := fn; |
| 1890 | } |
| 1891 | |
| 1892 | timer T := 5.0; |
| 1893 | T.start; |
| 1894 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1895 | [] 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] | 1896 | -> value rx_ud { |
| 1897 | var RSL_IE_Body ie; |
| 1898 | f_rsl_find_ie(rx_ud.rsl, RSL_IE_RACH_LOAD, ie); |
| 1899 | load_access_count := load_access_count + ie.rach_load.access_count; |
| 1900 | if (ie.rach_load.busy_count < ie.rach_load.access_count) { |
| 1901 | setverdict(fail, "Access count cannot be < Busy count"); |
| 1902 | } |
| 1903 | repeat; |
| 1904 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1905 | [] 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] | 1906 | setverdict(fail, "Unexpected RACH LOAD IND: ", rx_ud); |
| 1907 | repeat; |
| 1908 | } |
| 1909 | [] RSL_CCHAN.receive { |
| 1910 | repeat; |
| 1911 | } |
| 1912 | [] T.timeout { } |
| 1913 | } |
| 1914 | if (load_access_count == 1000) { |
| 1915 | setverdict(pass); |
| 1916 | } else { |
| 1917 | setverdict(fail, "Load reports state ", load_access_count, " RACH, but we sent 1000"); |
| 1918 | } |
| 1919 | |
| 1920 | f_vty_load_ind_thresh(10); |
| 1921 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 1922 | } |
| 1923 | |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1924 | 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] | 1925 | var TrxcMessage ret; |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1926 | /* tell fake_trx to use a given timing offset for all bursts */ |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 1927 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_TIMING(toffs256)); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1928 | f_sleep(0.5); |
| 1929 | |
| 1930 | /* Transmit RACH request + wait for confirmation */ |
| 1931 | var OCT1 ra := f_rnd_ra_cs(); |
| 1932 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 1933 | |
| 1934 | /* Check for expected result */ |
| 1935 | timer T := 1.5; |
| 1936 | T.start; |
| 1937 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1938 | [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] | 1939 | setverdict(pass); |
| 1940 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 1941 | [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] | 1942 | 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] | 1943 | } |
| 1944 | [] RSL_CCHAN.receive { repeat; } |
| 1945 | [not expect_pass] T.timeout { |
| 1946 | setverdict(pass); |
| 1947 | } |
| 1948 | [expect_pass] T.timeout { |
Max | 6e05304 | 2019-03-14 16:34:22 +0100 | [diff] [blame] | 1949 | 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] | 1950 | } |
| 1951 | } |
| 1952 | } |
| 1953 | |
| 1954 | /* Test if dropping of RACH Based on NM_ATT_MAX_TA works */ |
| 1955 | testcase TC_rach_max_ta() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 1956 | f_init(); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1957 | f_init_l1ctl(); |
| 1958 | f_l1_tune(L1CTL); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1959 | f_sleep(1.0); |
| 1960 | |
| 1961 | /* default max-ta is 63 (full range of GSM timing advance */ |
| 1962 | |
Vadim Yanitskiy | c81d6e4 | 2018-03-05 22:39:01 +0700 | [diff] [blame] | 1963 | /* We allow early arrival up to 2 symbols */ |
| 1964 | f_rach_toffs(-1*256, true); |
| 1965 | f_rach_toffs(-2*256, true); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1966 | f_rach_toffs(-10*256, false); |
| 1967 | |
| 1968 | /* 0 / 32 / 63 bits is legal / permitted */ |
| 1969 | f_rach_toffs(0, true); |
| 1970 | f_rach_toffs(32*256, true); |
| 1971 | f_rach_toffs(63*256, true); |
| 1972 | |
| 1973 | /* more than 63 bits is not legal / permitted */ |
| 1974 | f_rach_toffs(64*256, false); |
| 1975 | f_rach_toffs(127*256, false); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 1976 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 1977 | } |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 1978 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 1979 | private function f_TC_ho_rach(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 1980 | var GsmFrameNumber fn; |
| 1981 | var RSL_Message rm; |
| 1982 | |
| 1983 | f_l1_tune(L1CTL); |
| 1984 | RSL.clear; |
| 1985 | |
| 1986 | /* Generate a random Handover Reference */ |
| 1987 | var integer ho_ref := oct2int(f_rnd_octstring(1)); |
| 1988 | |
| 1989 | /* Handover Reference IE (see 3GPP TS 48.058, 9.3.9) */ |
| 1990 | var RSL_IE ho_ref_ie := valueof(t_RSL_IE(RSL_IE_HANDO_REF, |
| 1991 | RSL_IE_Body:{ handover_ref := ho_ref })); |
| 1992 | |
| 1993 | /* Activate a channel on the BTS side (no encryption) */ |
| 1994 | f_rsl_chan_act(g_pars.chan_mode, more_ies := { ho_ref_ie }, |
| 1995 | act_type := t_RSL_IE_ActType_HO_SYNC); |
| 1996 | |
| 1997 | /* Switch the MS side (e.g. trxcon) to a dedicated channel without |
| 1998 | * waiting for Immediate Assignment and sending Access Burst */ |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 1999 | f_l1ctl_est_dchan(L1CTL, g_pars); |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 2000 | |
| 2001 | /* Send handover Access Burst */ |
| 2002 | fn := f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 2003 | |
| 2004 | /* TODO: test mismatching Handover Reference, and missing IE */ |
| 2005 | |
| 2006 | /* Wait for handover detection */ |
| 2007 | timer T := 3.0; |
| 2008 | T.start; |
| 2009 | alt { |
| 2010 | [] RSL.receive(tr_RSL_HANDO_DET(g_pars.chan_nr)) -> value rm { |
| 2011 | log("Handover RACH has been detected: ", rm); |
| 2012 | setverdict(pass); |
| 2013 | } |
| 2014 | [] RSL.receive(tr_RSL_CHAN_RQD(?, ?, ?, ?)) -> value rm { |
| 2015 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2016 | log2str("RSL_CHAN_RQD was not expected: ", rm)); |
| 2017 | } |
| 2018 | [] RSL.receive { repeat; } |
| 2019 | [] T.timeout { |
| 2020 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2021 | log2str("Timeout waiting for handover RACH: FN=", fn, " RA=", ho_ref)); |
| 2022 | } |
| 2023 | } |
| 2024 | |
| 2025 | /* Release the channel */ |
| 2026 | f_rsl_chan_deact(); |
| 2027 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2028 | } |
| 2029 | |
| 2030 | /* Test handover RACH detection */ |
| 2031 | testcase TC_ho_rach() runs on test_CT { |
| 2032 | var ConnHdlrPars pars; |
| 2033 | var ConnHdlr vc_conn; |
| 2034 | |
| 2035 | f_init(); |
| 2036 | |
| 2037 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
| 2038 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 2039 | log(testcasename(), ": Starting for ", g_AllChannels[i]); |
| 2040 | vc_conn := f_start_handler(refers(f_TC_ho_rach), pars); |
| 2041 | vc_conn.done; |
| 2042 | } |
| 2043 | |
| 2044 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 2045 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2046 | } |
| 2047 | |
Vadim Yanitskiy | 1ab332f | 2022-03-12 15:31:23 +0300 | [diff] [blame] | 2048 | /* Test sending of the RR Physical Information message on DCCH */ |
| 2049 | private function f_TC_ho_physical_info(charstring id) runs on ConnHdlr { |
| 2050 | var PDU_ML3_NW_MS dcch_pdu; |
| 2051 | var integer count := 0; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2052 | var L1ctlMessage dl; |
Vadim Yanitskiy | 1ab332f | 2022-03-12 15:31:23 +0300 | [diff] [blame] | 2053 | timer T; |
| 2054 | |
| 2055 | f_l1_tune(L1CTL); |
| 2056 | RSL.clear; |
| 2057 | |
| 2058 | /* Generate a random Handover Reference */ |
| 2059 | var integer ho_ref := oct2int(f_rnd_octstring(1)); |
| 2060 | |
| 2061 | /* Handover Reference IE (see 3GPP TS 48.058, 9.3.9) */ |
| 2062 | var RSL_IE ho_ref_ie := valueof(t_RSL_IE(RSL_IE_HANDO_REF, |
| 2063 | RSL_IE_Body:{ handover_ref := ho_ref })); |
| 2064 | |
| 2065 | /* Activate a channel on the BTS side (no encryption) */ |
| 2066 | f_rsl_chan_act(g_pars.chan_mode, more_ies := { ho_ref_ie }, |
| 2067 | act_type := t_RSL_IE_ActType_HO_SYNC); |
| 2068 | |
| 2069 | /* Switch the MS side (e.g. trxcon) to a dedicated channel without |
| 2070 | * waiting for Immediate Assignment and sending of an Access Burst. */ |
| 2071 | f_l1ctl_est_dchan(L1CTL, g_pars); /* FIXME: disable Uplink Tx */ |
| 2072 | |
| 2073 | /* Expect nothing to be transmitted on Downlink DCCH. Nothing in this |
| 2074 | * context means any L2 frames, not only the RR Physical Information. */ |
| 2075 | T.start(2.0); |
| 2076 | L1CTL.clear; |
| 2077 | alt { |
| 2078 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_DCCH(?))) -> value dl { |
| 2079 | setverdict(fail, "Rx unexpected Downlink DCCH (before handover RACH): ", dl); |
| 2080 | T.stop; |
| 2081 | } |
| 2082 | [] L1CTL.receive { repeat; } |
| 2083 | [] T.timeout { setverdict(pass); } |
| 2084 | } |
| 2085 | |
| 2086 | /* Send handover Access Burst */ |
| 2087 | log("Sending handover Access Burst"); |
| 2088 | f_L1CTL_RACH(L1CTL, ho_ref, chan_nr := g_pars.chan_nr); |
| 2089 | |
| 2090 | /* Expect RR Physical Information being sent on Downlink DCCH Ny1 times */ |
| 2091 | T.start(int2float(mp_ho_t3105_ms * mp_ho_ny1) / 1000.0 + 1.0); |
| 2092 | L1CTL.clear; |
| 2093 | alt { |
| 2094 | [] as_dl_lapdm_dummy(); /* Ignore empty LAPDm func=UI frames */ |
| 2095 | [] as_dl_dcch_pdu(dcch_pdu, tr_RRM_PhysicalInfo) { |
| 2096 | log("Rx RR Physical Information: ", dcch_pdu); |
| 2097 | /* Wait until the count reaches Ny1 */ |
| 2098 | count := count + 1; |
| 2099 | if (count < mp_ho_ny1) |
| 2100 | { repeat; } |
| 2101 | setverdict(pass); |
| 2102 | } |
| 2103 | [] as_dl_dcch_pdu(dcch_pdu, ?) { |
| 2104 | setverdict(fail, "Rx unexpected DCCH PDU: ", dcch_pdu); |
| 2105 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2106 | } |
| 2107 | [] L1CTL.receive { repeat; } |
| 2108 | [] T.timeout { |
| 2109 | setverdict(fail, "Timeout waiting for RR Physical Information"); |
| 2110 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2111 | } |
| 2112 | } |
| 2113 | |
| 2114 | /* Release the channel */ |
| 2115 | f_rsl_chan_deact(); |
| 2116 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 2117 | } |
| 2118 | testcase TC_ho_physical_info() runs on test_CT { |
| 2119 | var ConnHdlrPars pars; |
| 2120 | var ConnHdlr vc_conn; |
| 2121 | |
| 2122 | f_init(); |
| 2123 | |
| 2124 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i + 1) { |
| 2125 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 2126 | log(testcasename(), ": Starting for ", g_AllChanTypes[i]); |
| 2127 | vc_conn := f_start_handler(refers(f_TC_ho_physical_info), pars); |
| 2128 | vc_conn.done; |
| 2129 | } |
| 2130 | |
| 2131 | /* TODO: do the above in parallel, rather than sequentially? */ |
| 2132 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2133 | } |
| 2134 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 2135 | /*********************************************************************** |
| 2136 | * Measurement Processing / Reporting |
| 2137 | ***********************************************************************/ |
| 2138 | |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2139 | private template (value) LapdmAddressField |
| 2140 | ts_LapdmAddr(template (value) LapdmSapi sapi, |
| 2141 | template (value) boolean c_r) := { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2142 | spare := '0'B, |
| 2143 | lpd := 0, |
| 2144 | sapi := sapi, |
| 2145 | c_r := c_r, |
| 2146 | ea := true |
| 2147 | } |
| 2148 | |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2149 | private template (value) LapdmFrameAB |
| 2150 | ts_LAPDm_AB(template (value) LapdmSapi sapi, |
| 2151 | template (value) GsmRrL3Message l3, |
| 2152 | template (value) boolean c_r := false, |
| 2153 | template (value) boolean p := false) := { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2154 | addr := ts_LapdmAddr(sapi, c_r), |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2155 | ctrl := ts_LapdmCtrlUI(valueof(p)), |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2156 | len := 0, /* overwritten */ |
| 2157 | m := false, |
| 2158 | el := 1, |
Vadim Yanitskiy | 16e2991 | 2022-03-12 13:26:21 +0300 | [diff] [blame] | 2159 | payload := enc_GsmRrL3Message(valueof(l3)), |
| 2160 | padding := ''O |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2161 | } |
| 2162 | |
| 2163 | /* handle incoming downlink SACCH and respond with uplink SACCH (meas res) */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2164 | private altstep as_l1_sacch() runs on ConnHdlr { |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2165 | var template (value) LapdmFrameAB lb; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2166 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2167 | |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 2168 | [] 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] | 2169 | log("SACCH received: ", l1_dl.payload.data_ind.payload); |
Vadim Yanitskiy | 5351ccf | 2020-11-11 20:48:17 +0700 | [diff] [blame] | 2170 | |
Vadim Yanitskiy | 7dad608 | 2020-11-28 22:42:27 +0100 | [diff] [blame] | 2171 | lb := ts_LAPDm_AB(0, ts_MEAS_REP(g_pars.l1_pars.meas_valid, |
Vadim Yanitskiy | cb57c1b | 2020-11-11 20:57:15 +0700 | [diff] [blame] | 2172 | g_pars.l1_pars.meas_ul.full.rxlev, |
| 2173 | g_pars.l1_pars.meas_ul.sub.rxlev, |
| 2174 | g_pars.l1_pars.meas_ul.full.rxqual, |
| 2175 | g_pars.l1_pars.meas_ul.sub.rxqual)); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2176 | log("LAPDm: ", lb); |
Pau Espin Pedrol | ed359cb | 2018-09-28 16:08:24 +0200 | [diff] [blame] | 2177 | |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 2178 | var template (value) SacchL1Header l1h := ts_SacchL1Header( |
Vadim Yanitskiy | 68c4cff | 2022-07-30 23:45:02 +0700 | [diff] [blame] | 2179 | g_pars.l1_pars.ms_power_level, g_pars.l1_pars.ms_actual_ta); |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 2180 | |
Vadim Yanitskiy | f105a5b | 2020-11-30 14:27:55 +0100 | [diff] [blame] | 2181 | /* According to 3GPP TS 44.018, section 10.5.2.20, we should pad with zeroes */ |
| 2182 | var octetstring l2 := f_pad_oct(enc_LapdmFrameAB(valueof(lb)), 21, '00'O); |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 2183 | |
| 2184 | log("Sending Measurement Report: ", l1h, l2); |
| 2185 | 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] | 2186 | repeat; |
| 2187 | } |
| 2188 | } |
| 2189 | |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 2190 | /* handle incoming downlink SACCH, decode the L1 header into the given record */ |
| 2191 | private altstep as_l1_sacch_l1h(inout SacchL1Header l1h, |
| 2192 | boolean do_apply := true) |
| 2193 | runs on ConnHdlr |
| 2194 | { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2195 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 2196 | |
| 2197 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 2198 | /* Parse the L1 SACCH header (MS Power Level & Timing Advance) */ |
| 2199 | l1h := dec_SacchL1Header(substr(l1_dl.payload.data_ind.payload, 0, 2)); |
| 2200 | log(%definitionId, "(): Rx SACCH L1 header: ", l1h); |
| 2201 | |
| 2202 | if (do_apply) { |
| 2203 | /* Update TA and MS power to follow what BTS requests */ |
| 2204 | f_L1CTL_PARAM(L1CTL, l1h.actual_ta, l1h.ms_power_lvl); |
| 2205 | } |
| 2206 | } |
| 2207 | } |
| 2208 | |
Vadim Yanitskiy | a4f88c6 | 2020-10-19 14:38:37 +0700 | [diff] [blame] | 2209 | private altstep as_l1_dcch_loop() runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2210 | var L1ctlMessage l1_dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 2211 | [] 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] | 2212 | log("DCCH received: ", l1_dl.payload.data_ind.payload); |
| 2213 | var octetstring pl := '010301'O; |
Vadim Yanitskiy | 31e7c67 | 2018-07-27 02:23:16 +0700 | [diff] [blame] | 2214 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), |
| 2215 | f_pad_oct(pl, 23, '2B'O))); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2216 | repeat; |
| 2217 | } |
| 2218 | } |
| 2219 | |
Vadim Yanitskiy | dc00811 | 2020-10-19 14:42:04 +0700 | [diff] [blame] | 2220 | private altstep as_l1_tch_loop() runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2221 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | dc00811 | 2020-10-19 14:42:04 +0700 | [diff] [blame] | 2222 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr)) -> value l1_dl { |
Vadim Yanitskiy | 803af35 | 2023-07-07 21:48:45 +0700 | [diff] [blame] | 2223 | var octetstring data := l1_dl.payload.traffic_ind.data; |
| 2224 | log("TCH received (len=", lengthof(data), "): ", data); |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 2225 | |
| 2226 | /* occasionaly inject FACCH frames into the uplink */ |
| 2227 | if (g_pars.l1_pars.facch_enabled == true and l1_dl.dl_info.frame_nr mod 5 == 0) { |
| 2228 | var octetstring pl := '010301'O; |
| 2229 | L1CTL.send(ts_L1CTL_DATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), |
| 2230 | f_pad_oct(pl, 23, '2B'O))); |
| 2231 | } else { |
| 2232 | L1CTL.send(ts_L1CTL_TRAFFIC_REQ(g_chan_nr, l1_dl.dl_info.link_id, |
| 2233 | l1_dl.payload.traffic_ind.data)); |
| 2234 | } |
| 2235 | |
Vadim Yanitskiy | dc00811 | 2020-10-19 14:42:04 +0700 | [diff] [blame] | 2236 | repeat; |
| 2237 | } |
| 2238 | } |
| 2239 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2240 | private type record MeasElem { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2241 | uint6_t rxlev, |
| 2242 | uint3_t rxqual |
| 2243 | } |
| 2244 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2245 | private type record MeasElemFS { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2246 | MeasElem full, |
| 2247 | MeasElem sub |
| 2248 | } |
| 2249 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2250 | private type record ConnL1Pars { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2251 | boolean dtx_enabled, |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2252 | boolean toa256_enabled, |
Vadim Yanitskiy | 7dad608 | 2020-11-28 22:42:27 +0100 | [diff] [blame] | 2253 | boolean meas_valid, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2254 | MeasElemFS meas_ul, |
| 2255 | int16_t timing_offset_256syms, |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 2256 | uint4_t bs_power_level, |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2257 | uint5_t ms_power_level, |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 2258 | uint8_t ms_actual_ta, |
| 2259 | boolean facch_enabled |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2260 | } |
| 2261 | |
| 2262 | /* Convert tiing offset from 1/256th symbol to RSL Timing Offset */ |
| 2263 | private function toffs256s_to_rsl(int16_t toffs256s) return uint8_t { |
| 2264 | return 63 + (toffs256s/256); |
| 2265 | } |
| 2266 | |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 2267 | private function f_max(integer a, integer b) return integer { |
| 2268 | if (a > b) { |
| 2269 | return a; |
| 2270 | } else { |
| 2271 | return b; |
| 2272 | } |
| 2273 | } |
| 2274 | |
| 2275 | private function f_min(integer a, integer b) return integer { |
| 2276 | if (a < b) { |
| 2277 | return a; |
| 2278 | } else { |
| 2279 | return b; |
| 2280 | } |
| 2281 | } |
| 2282 | |
| 2283 | /* compute negative tolerance val-tolerance, ensure >= min */ |
| 2284 | private function f_tolerance_neg(integer val, integer min, integer tolerance) return integer { |
| 2285 | val := val - tolerance; |
| 2286 | return f_max(val, min); |
| 2287 | } |
| 2288 | |
| 2289 | /* compute positive tolerance val+tolerance, ensure <= max */ |
| 2290 | private function f_tolerance_pos(integer val, integer max, integer tolerance) return integer { |
| 2291 | val := val + tolerance; |
| 2292 | return f_min(val, max); |
| 2293 | } |
| 2294 | |
| 2295 | /* return a template of (val-tolerance .. val+tolerance) ensuring it is within (min .. max) */ |
| 2296 | private function f_tolerance(integer val, integer min, integer max, integer tolerance) |
| 2297 | return template integer { |
| 2298 | var template integer ret; |
| 2299 | ret := (f_tolerance_neg(val, min, tolerance) .. f_tolerance_pos(val, max, tolerance)); |
| 2300 | return ret; |
| 2301 | } |
| 2302 | |
| 2303 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2304 | /* build a template for matching measurement results against */ |
| 2305 | private function f_build_meas_res_tmpl() runs on ConnHdlr return template RSL_Message { |
| 2306 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 2307 | var template RSL_IE_UplinkMeas ul_meas := { |
| 2308 | len := 3, |
| 2309 | rfu := '0'B, |
| 2310 | dtx_d := l1p.dtx_enabled, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 2311 | 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] | 2312 | reserved1 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 2313 | 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] | 2314 | reserved2 := '00'B, |
Harald Welte | d568439 | 2018-03-10 18:22:04 +0100 | [diff] [blame] | 2315 | rxq_f_u := f_tolerance(l1p.meas_ul.full.rxqual, 0, 7, mp_tolerance_rxqual), |
| 2316 | 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] | 2317 | supp_meas_info := omit |
| 2318 | }; |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2319 | if (l1p.toa256_enabled) { |
Harald Welte | 15de8ba | 2018-06-29 08:51:42 +0200 | [diff] [blame] | 2320 | ul_meas.len := (3+8); |
| 2321 | ul_meas.supp_meas_info := { |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 2322 | 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] | 2323 | toa256_min := ?, |
| 2324 | toa256_max := ?, |
| 2325 | toa256_std_dev := ? |
| 2326 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 2327 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2328 | var template RSL_IE_BS_Power bs_power := { |
| 2329 | reserved := 0, |
| 2330 | epc := false, |
| 2331 | fpc := false, |
| 2332 | power_level := l1p.bs_power_level |
| 2333 | }; |
| 2334 | var template RSL_IE_L1Info l1_info := { |
| 2335 | ms_power_lvl := l1p.ms_power_level, |
| 2336 | fpc := false, |
| 2337 | reserved := 0, |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 2338 | 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] | 2339 | }; |
| 2340 | var uint8_t offs := toffs256s_to_rsl(l1p.timing_offset_256syms); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 2341 | 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] | 2342 | return tr_RSL_MEAS_RES_OSMO(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power, l1_info, |
| 2343 | ?, t_toffs); |
| 2344 | } |
| 2345 | |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 2346 | /* build a template for matching measurement results that do not contain any |
| 2347 | * MS related measurement (l1_info, l3_info and ms timing offset). */ |
| 2348 | private function f_build_meas_res_tmpl_empty() runs on ConnHdlr return template RSL_Message { |
| 2349 | var ConnL1Pars l1p := g_pars.l1_pars; |
| 2350 | var template RSL_IE_UplinkMeas ul_meas := { |
| 2351 | len := 3, |
| 2352 | rfu := '0'B, |
| 2353 | dtx_d := l1p.dtx_enabled, |
| 2354 | rxlev_f_u := ?, |
| 2355 | reserved1 := '00'B, |
| 2356 | rxlev_s_u := ?, |
| 2357 | reserved2 := '00'B, |
| 2358 | rxq_f_u := ?, |
| 2359 | rxq_s_u := ?, |
| 2360 | supp_meas_info := omit |
| 2361 | }; |
| 2362 | if (l1p.toa256_enabled) { |
| 2363 | ul_meas.len := (3+8); |
| 2364 | ul_meas.supp_meas_info := { |
| 2365 | toa256_mean := f_tolerance(l1p.timing_offset_256syms, -63*256, 192*256, mp_tolerance_timing_offset_256syms), |
| 2366 | toa256_min := ?, |
| 2367 | toa256_max := ?, |
| 2368 | toa256_std_dev := ? |
| 2369 | } |
| 2370 | } |
| 2371 | var template RSL_IE_BS_Power bs_power := { |
| 2372 | reserved := 0, |
| 2373 | epc := false, |
| 2374 | fpc := false, |
| 2375 | power_level := l1p.bs_power_level |
| 2376 | }; |
| 2377 | |
| 2378 | return tr_RSL_MEAS_RES_EMPTY(g_chan_nr, g_next_meas_res_nr, ul_meas, bs_power); |
| 2379 | } |
| 2380 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2381 | /* verify we regularly receive measurement reports with incrementing numbers */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 2382 | private altstep as_meas_res(boolean verify_meas := true) runs on ConnHdlr { |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2383 | var RSL_Message rsl; |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 2384 | var boolean chan_est := false; |
| 2385 | |
Vadim Yanitskiy | 41baf00 | 2018-10-04 17:44:50 +0700 | [diff] [blame] | 2386 | [not verify_meas] RSL.receive(tr_RSL_MEAS_RES(?)) { repeat; } |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 2387 | |
| 2388 | /* Receive osmocom specific measurement reports. This is the normal |
| 2389 | * case. Here we verify that the measurement reports we sent are |
| 2390 | * comming back as we expect them. */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2391 | [] RSL.receive(f_build_meas_res_tmpl()) -> value rsl { |
| 2392 | /* increment counter of next to-be-expected meas rep */ |
| 2393 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 2394 | /* Re-start the timer expecting the next MEAS RES */ |
Harald Welte | c3a3f45 | 2018-02-26 17:37:47 +0100 | [diff] [blame] | 2395 | f_timer_safe_restart(g_Tmeas_exp); |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 2396 | |
| 2397 | /* The following two cases may only happen in the beginning |
| 2398 | * of the channel establishment phase. Once we have received |
| 2399 | * the "our" measurement report the first time, the channel |
| 2400 | * is established and empty or hardcoded TRXCON reports must |
| 2401 | * not occur anymore. */ |
| 2402 | chan_est := true; |
| 2403 | |
| 2404 | repeat; |
| 2405 | } |
| 2406 | |
| 2407 | /* When the BTS has established the channel, the MS might need slightly |
| 2408 | * more time to establish the channel and actually start sending. The |
| 2409 | * result is then a measurement report that just lacks the measurement |
| 2410 | * information of the MS. This is normal and we tolerate this behavior. */ |
| 2411 | [chan_est == false] RSL.receive(f_build_meas_res_tmpl_empty()) -> value rsl { |
| 2412 | /* increment counter of next to-be-expected meas rep */ |
| 2413 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 2414 | /* Re-start the timer expecting the next MEAS RES */ |
| 2415 | f_timer_safe_restart(g_Tmeas_exp); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2416 | repeat; |
| 2417 | } |
Philipp Maier | dd841d3 | 2019-12-17 14:44:54 +0100 | [diff] [blame] | 2418 | |
| 2419 | /* Due to the TDMA nature of GSM, TRXCON implements a way to emit dummy |
| 2420 | * measurements if the TTCN3 side does not supply measurement input in |
| 2421 | * time. In those cases TRXCON will either use a cached measurement |
| 2422 | * report or a hardcoded one. If TRXCON picks the hardcoded measurement |
| 2423 | * report the templates above will not match. We tolerate this |
| 2424 | * behavior, but only once. */ |
| 2425 | [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] | 2426 | /* increment counter of next to-be-expected meas rep */ |
| 2427 | g_next_meas_res_nr := (g_next_meas_res_nr + 1) mod 256; |
| 2428 | if (g_first_meas_res) { |
| 2429 | g_first_meas_res := false; |
| 2430 | repeat; |
| 2431 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2432 | 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] | 2433 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2434 | } |
| 2435 | [] RSL.receive(tr_RSL_MEAS_RES(?)) -> value rsl { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2436 | 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] | 2437 | } |
Pau Espin Pedrol | 425b62f | 2018-07-06 16:11:43 +0200 | [diff] [blame] | 2438 | [g_Tmeas_exp.running] g_Tmeas_exp.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2439 | 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] | 2440 | } |
| 2441 | } |
| 2442 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2443 | private function f_alg_id_to_l1ctl(RSL_AlgId rsl_alg_id) return uint8_t { |
| 2444 | select (rsl_alg_id) { |
| 2445 | case (RSL_ALG_ID_A5_0) { return 0; } |
| 2446 | case (RSL_ALG_ID_A5_1) { return 1; } |
| 2447 | case (RSL_ALG_ID_A5_2) { return 2; } |
| 2448 | case (RSL_ALG_ID_A5_3) { return 3; } |
| 2449 | case (RSL_ALG_ID_A5_4) { return 4; } |
| 2450 | case (RSL_ALG_ID_A5_5) { return 5; } |
| 2451 | case (RSL_ALG_ID_A5_6) { return 6; } |
| 2452 | case (RSL_ALG_ID_A5_7) { return 7; } |
| 2453 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2454 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 2455 | /* Make compiler happy by calling mtc.stop here. It is already |
| 2456 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 2457 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2458 | } |
| 2459 | } |
| 2460 | } |
| 2461 | |
| 2462 | private function f_alg_id_to_l3(RSL_AlgId rsl_alg_id) return BIT3 { |
| 2463 | select (rsl_alg_id) { |
| 2464 | case (RSL_ALG_ID_A5_1) { return '000'B; } |
| 2465 | case (RSL_ALG_ID_A5_2) { return '001'B; } |
| 2466 | case (RSL_ALG_ID_A5_3) { return '010'B; } |
| 2467 | case (RSL_ALG_ID_A5_4) { return '011'B; } |
| 2468 | case (RSL_ALG_ID_A5_5) { return '100'B; } |
| 2469 | case (RSL_ALG_ID_A5_6) { return '101'B; } |
| 2470 | case (RSL_ALG_ID_A5_7) { return '110'B; } |
| 2471 | case else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2472 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unknwon Algorithm ID"); |
| 2473 | /* Make compiler happy by calling mtc.stop here. It is already |
| 2474 | * called in f_shutdown */ |
Daniel Willmann | 17ddd85 | 2018-07-05 17:33:20 +0200 | [diff] [blame] | 2475 | mtc.stop; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2476 | } |
| 2477 | } |
| 2478 | } |
| 2479 | |
Pau Espin Pedrol | 6451b04 | 2018-10-24 20:36:16 +0200 | [diff] [blame] | 2480 | /* Send RACH request through l1CTL and wait for ChanReq on RSL BST->BSC */ |
| 2481 | private function f_rach_req_wait_chan_rqd(integer ra) runs on ConnHdlr return GsmFrameNumber { |
| 2482 | var GsmFrameNumber fn; |
| 2483 | timer T := 8.0; |
| 2484 | |
| 2485 | /* advertise to RSL Emulation that we expect to receive confirmation from RACH */ |
| 2486 | RSL.send(ts_RSLDC_ChanRqd_anyFN(int2oct(ra,1))); |
| 2487 | |
| 2488 | f_L1CTL_PARAM(L1CTL, g_pars.l1_pars.ms_actual_ta, g_pars.l1_pars.ms_power_level); |
| 2489 | /* Send the actual RACH */ |
| 2490 | fn := f_L1CTL_RACH(L1CTL, ra); |
| 2491 | |
| 2492 | T.start; |
| 2493 | alt { |
| 2494 | [] RSL.receive(tr_RSL_CHAN_RQD(int2oct(ra,1), fn)) { setverdict(pass, "Received CHAN-RQD from RACH REQ") } |
| 2495 | [] T.timeout { |
| 2496 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Timeout waiting for CHAN-RQD from RACH REQ <", ra, ", ", fn, ">")); |
| 2497 | } |
| 2498 | } |
| 2499 | T.stop |
| 2500 | return fn; |
| 2501 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2502 | |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 2503 | /* Tune to a dedicated channel: L1CTL only */ |
Andreas Eversberg | 4801baa | 2023-07-17 11:45:38 +0200 | [diff] [blame] | 2504 | friend function f_l1ctl_est_dchan(L1CTL_PT pt, ConnHdlrPars pars) { |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 2505 | if (not pars.fhp.enabled) { |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 2506 | var TrxParsItem trx_pars := mp_trx_pars[pars.trx_nr]; |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 2507 | pt.send(ts_L1CTL_DM_EST_REQ_H0(pars.chan_nr, pars.tsc, |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 2508 | trx_pars.arfcn)); |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 2509 | } else { |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 2510 | pt.send(ts_L1CTL_DM_EST_REQ_H1(pars.chan_nr, pars.tsc, |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 2511 | pars.fhp.maio_hsn.hsn, |
| 2512 | pars.fhp.maio_hsn.maio, |
| 2513 | pars.fhp.ma)); |
Vadim Yanitskiy | 6c71c17 | 2020-07-13 21:49:48 +0700 | [diff] [blame] | 2514 | } |
| 2515 | } |
| 2516 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2517 | /* Establish dedicated channel: L1CTL + RSL side */ |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 2518 | private function f_est_dchan(boolean encr_enable := false, RSL_IE_List more_ies := {}) runs on ConnHdlr { |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2519 | var ChannelDescription ch_desc; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2520 | |
| 2521 | /* Activate channel on BTS side */ |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 2522 | f_rsl_chan_act(g_pars.chan_mode, encr_enable, more_ies); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2523 | |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2524 | /* Craft channel description (with or without frequency hopping parameters) */ |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 2525 | if (g_pars.fhp.enabled) { |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 2526 | ch_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, g_pars.fhp.maio_hsn, g_pars.tsc)); |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2527 | } else { |
Vadim Yanitskiy | f54db11 | 2020-11-16 18:00:15 +0700 | [diff] [blame] | 2528 | var TrxParsItem trx_pars := mp_trx_pars[g_pars.trx_nr]; |
| 2529 | ch_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, trx_pars.arfcn, g_pars.tsc)); |
Vadim Yanitskiy | 28cabc4 | 2020-05-27 19:44:44 +0700 | [diff] [blame] | 2530 | } |
| 2531 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2532 | /* enable dedicated mode */ |
Vadim Yanitskiy | d0eb659 | 2021-10-08 01:19:29 +0600 | [diff] [blame] | 2533 | f_l1ctl_est_dchan(L1CTL, g_pars); |
| 2534 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 2535 | /* enable encryption, if requested */ |
| 2536 | if (encr_enable) { |
| 2537 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 2538 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 2539 | } |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 2540 | |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 2541 | /* Send TCH Mode Request to the L1 if needed */ |
| 2542 | if (match(g_pars.chan_mode.spd_ind, (RSL_SPDI_SPEECH, RSL_SPDI_DATA))) { |
| 2543 | var L1ctlTchMode tch_mode; |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 2544 | var uint8_t amr_start_codec := 0; |
| 2545 | var BIT8 amr_codecs_bitmask := '00000000'B; |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 2546 | |
Vadim Yanitskiy | 8fd78f7 | 2023-05-26 19:21:55 +0700 | [diff] [blame] | 2547 | select (g_pars.chan_mode) { |
| 2548 | case (tr_RSL_ChanMode_SIGN) |
| 2549 | { tch_mode := L1CTL_CHAN_MODE_SIGN; } |
| 2550 | /* Speech modes */ |
| 2551 | case (tr_RSL_ChanMode((RSL_CHRT_TCH_F, RSL_CHRT_TCH_H), RSL_CMOD_SP_GSM1)) |
| 2552 | { tch_mode := L1CTL_CHAN_MODE_SPEECH_V1; } |
| 2553 | case (tr_RSL_ChanMode((RSL_CHRT_TCH_F, RSL_CHRT_TCH_H), RSL_CMOD_SP_GSM2)) |
| 2554 | { tch_mode := L1CTL_CHAN_MODE_SPEECH_V2; } |
| 2555 | case (tr_RSL_ChanMode((RSL_CHRT_TCH_F, RSL_CHRT_TCH_H), RSL_CMOD_SP_GSM3)) |
| 2556 | { tch_mode := L1CTL_CHAN_MODE_SPEECH_V3; |
| 2557 | amr_codecs_bitmask := g_pars.mr_conf.codec_modes; } |
| 2558 | /* Data modes */ |
| 2559 | case (tr_RSL_ChanMode_DATA(RSL_CHRT_TCH_F, /* TCH/F14.4 */ |
| 2560 | (RSL_CMOD_CSD_T_14k4, RSL_CMOD_CSD_NT_14k5))) |
| 2561 | { tch_mode := L1CTL_CHAN_MODE_DATA_14k5; } |
| 2562 | case (tr_RSL_ChanMode_DATA(RSL_CHRT_TCH_F, /* TCH/F9.6 */ |
| 2563 | (RSL_CMOD_CSD_T_9k6, RSL_CMOD_CSD_NT_12k0))) |
| 2564 | { tch_mode := L1CTL_CHAN_MODE_DATA_12k0; } |
| 2565 | case (tr_RSL_ChanMode_DATA((RSL_CHRT_TCH_F, RSL_CHRT_TCH_H), /* TCH/[FH]4.8 */ |
| 2566 | (RSL_CMOD_CSD_T_4k8, RSL_CMOD_CSD_NT_6k0))) |
| 2567 | { tch_mode := L1CTL_CHAN_MODE_DATA_6k0; } |
| 2568 | case (tr_RSL_ChanMode_DATA((RSL_CHRT_TCH_F, RSL_CHRT_TCH_H), /* TCH/[FH]2.4 */ |
| 2569 | (RSL_CMOD_CSD_T_2k4, RSL_CMOD_CSD_T_1k2, |
| 2570 | RSL_CMOD_CSD_T_600, RSL_CMOD_CSD_T_1200_75))) |
| 2571 | { tch_mode := L1CTL_CHAN_MODE_DATA_3k6; } |
| 2572 | case else { |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 2573 | log("RSL channel mode is not supported by the L1, falling back to signalling"); |
| 2574 | tch_mode := L1CTL_CHAN_MODE_SIGN; |
Vadim Yanitskiy | 8fd78f7 | 2023-05-26 19:21:55 +0700 | [diff] [blame] | 2575 | } |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 2576 | } |
| 2577 | |
Pau Espin Pedrol | 440e1dc | 2022-09-02 16:35:49 +0200 | [diff] [blame] | 2578 | f_L1CTL_TCH_MODE(L1CTL, |
| 2579 | ts_L1CTL_TCH_MODE_REQ(tch_mode, |
| 2580 | amr_start_codec := amr_start_codec, |
| 2581 | amr_codecs_bitmask := amr_codecs_bitmask)); |
Vadim Yanitskiy | 52787bf | 2020-10-19 17:34:52 +0700 | [diff] [blame] | 2582 | } |
| 2583 | |
Harald Welte | fa45e9e | 2018-03-10 18:59:03 +0100 | [diff] [blame] | 2584 | g_first_meas_res := true; |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2585 | } |
| 2586 | |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 2587 | private function get_start_amr_ft() runs on ConnHdlr return integer { |
| 2588 | var integer start_nth; |
| 2589 | if (g_pars.mr_conf.icmi) { |
| 2590 | start_nth := 0; /* FIXME: implement 3GPP TS 45.009 3.4.3 */ |
| 2591 | } else { |
| 2592 | start_nth := g_pars.mr_conf.start_mode; |
| 2593 | } |
| 2594 | |
| 2595 | var integer n := 0; |
| 2596 | for (var integer i:= 7; i >= 0; i := i - 1) { |
Vadim Yanitskiy | f14e696 | 2022-09-14 15:18:06 +0700 | [diff] [blame] | 2597 | if (g_pars.mr_conf.codec_modes[i] == '1'B) { |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 2598 | if (n == start_nth) { |
| 2599 | return 7 - i; |
| 2600 | } |
| 2601 | n := n + 1; |
| 2602 | } |
| 2603 | } |
| 2604 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2605 | log2str("mr_conf is wrong! ", g_pars.mr_conf)); |
| 2606 | return 0; |
| 2607 | } |
| 2608 | |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2609 | /* Initialize and start the RTP emulation component for a ConnHdlr */ |
| 2610 | friend function f_rtpem_activate(inout octetstring payload, |
| 2611 | RtpemConfig cfg := c_RtpemDefaultCfg, |
| 2612 | RtpemMode mode := RTPEM_MODE_BIDIR) |
| 2613 | runs on ConnHdlr { |
| 2614 | /* Step 0: initialize, connect and start the emulation component */ |
| 2615 | vc_RTPEM := RTP_Emulation_CT.create(testcasename() & "-RTPEM"); |
| 2616 | map(vc_RTPEM:RTP, system:RTP); |
| 2617 | map(vc_RTPEM:RTCP, system:RTCP); |
| 2618 | connect(vc_RTPEM:CTRL, self:RTPEM_CTRL); |
| 2619 | connect(vc_RTPEM:DATA, self:RTPEM_DATA); |
| 2620 | vc_RTPEM.start(RTP_Emulation.f_main()); |
| 2621 | |
| 2622 | /* Step 1: configure the RTP parameters */ |
| 2623 | var integer payload_len := 0; |
| 2624 | var octetstring hdr := ''O; |
Vadim Yanitskiy | b82fcd0 | 2023-05-19 02:56:19 +0700 | [diff] [blame] | 2625 | var OCT1 pad := '00'O; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2626 | |
| 2627 | select (g_pars.chan_mode) { |
| 2628 | case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1)) /* TCH/FS */ |
Vadim Yanitskiy | b82fcd0 | 2023-05-19 02:56:19 +0700 | [diff] [blame] | 2629 | { payload_len := 33; hdr := 'D0'O; pad := 'FF'O; } |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2630 | case (tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1)) /* TCH/HS */ |
| 2631 | { payload_len := 15; hdr := '00'O; } |
| 2632 | case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2)) /* TCH/EFS */ |
| 2633 | { payload_len := 31; hdr := 'C0'O; } |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 2634 | case (tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3)) /* TCH/AFS */ |
| 2635 | { |
| 2636 | var integer amr_ft := get_start_amr_ft(); |
| 2637 | payload_len := f_amrft_payload_len(amr_ft) + 2; |
| 2638 | hdr := enc_RTP_AMR_Hdr(valueof(ts_RTP_AMR_Hdr(amr_ft, amr_ft, '1'B))); |
| 2639 | } |
| 2640 | case (tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3)) /* TCH/AHS */ |
| 2641 | { |
| 2642 | var integer amr_ft := get_start_amr_ft(); |
| 2643 | payload_len := f_amrft_payload_len(amr_ft) + 2; |
| 2644 | hdr := enc_RTP_AMR_Hdr(valueof(ts_RTP_AMR_Hdr(amr_ft, amr_ft, '1'B))); |
| 2645 | } |
| 2646 | case else { |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2647 | setverdict(fail, "Unhandled RSL channel mode := ", g_pars.chan_mode); |
| 2648 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2649 | } |
| 2650 | } |
| 2651 | |
| 2652 | /* Pad the payload to conform the expected length */ |
Vadim Yanitskiy | b82fcd0 | 2023-05-19 02:56:19 +0700 | [diff] [blame] | 2653 | payload := f_pad_oct(hdr & payload, payload_len, pad); |
Philipp Maier | bbe454d | 2023-03-28 15:31:57 +0200 | [diff] [blame] | 2654 | cfg.tx_payloads[0].fixed_payload := payload; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2655 | f_rtpem_configure(RTPEM_CTRL, cfg); |
| 2656 | |
| 2657 | /* Step 2: bind the RTP emulation to the configured address */ |
| 2658 | var PortNumber rtpem_bind_port := mp_rtpem_bind_port; |
| 2659 | f_rtpem_bind(RTPEM_CTRL, mp_rtpem_bind_ip, rtpem_bind_port); |
| 2660 | |
Vadim Yanitskiy | 0dd96e9 | 2022-05-01 01:36:12 +0300 | [diff] [blame] | 2661 | /* Step 3a: send CRCX to create an RTP connection at the IUT */ |
| 2662 | var RSL_Message crcx_ack := f_rsl_transceive_ret( |
| 2663 | /* FIXME (OS#5242): do not include Remote IP/Port IEs because |
| 2664 | * osmo-bts would respond with nonsense listen addr='0.0.0.0'. */ |
| 2665 | ts_RSL_IPA_CRCX(g_chan_nr, omit, omit), |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 2666 | tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?, omit), |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2667 | "IPA CRCX ACK"); |
Vadim Yanitskiy | 0dd96e9 | 2022-05-01 01:36:12 +0300 | [diff] [blame] | 2668 | var uint16_t conn_id := crcx_ack.ies[1].body.ipa_conn_id; |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2669 | |
Vadim Yanitskiy | 0dd96e9 | 2022-05-01 01:36:12 +0300 | [diff] [blame] | 2670 | /* Step 3b: send MDCX with the configured address/port to the IUT */ |
| 2671 | var RSL_Message mdcx_ack := f_rsl_transceive_ret( |
| 2672 | ts_RSL_IPA_MDCX(g_chan_nr, conn_id, |
| 2673 | remote_ip := f_inet_addr(mp_rtpem_bind_ip), |
| 2674 | remote_port := rtpem_bind_port, |
| 2675 | rtp_pt2 := 0), |
| 2676 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, conn_id, ?, ?, ?), |
| 2677 | "IPA MDCX ACK"); |
| 2678 | |
| 2679 | /* Step 4: connect to the IUT's address/port parsed from MDCX ACK */ |
| 2680 | var HostName bts_bind_ip := f_inet_ntoa(mdcx_ack.ies[2].body.ipa_local_ip); |
| 2681 | var PortNumber bts_bind_port := mdcx_ack.ies[3].body.ipa_local_port; |
| 2682 | f_rtpem_connect(RTPEM_CTRL, bts_bind_ip, bts_bind_port); |
Vadim Yanitskiy | dd228c4 | 2021-07-04 02:37:30 +0200 | [diff] [blame] | 2683 | |
| 2684 | /* Step 5: set the given RTP emulation mode */ |
| 2685 | f_rtpem_mode(RTPEM_CTRL, mode); |
| 2686 | } |
| 2687 | |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 2688 | /* Initialize and start the RTP emulation component for a ConnHdlr */ |
| 2689 | friend function f_osmuxem_activate(inout octetstring payload, |
| 2690 | OsmuxemConfig cfg := c_OsmuxemDefaultCfg, |
| 2691 | OsmuxemMode mode := OSMUXEM_MODE_BIDIR) |
| 2692 | runs on ConnHdlr { |
| 2693 | var RSL_IE_Body ie; |
| 2694 | var OsmuxTxHandle tx_hdl; |
| 2695 | var OsmuxRxHandle rx_hdl; |
| 2696 | /* Step 0: initialize, connect and start the emulation component */ |
| 2697 | vc_OsmuxEM := OSMUX_Emulation_CT.create(testcasename() & "-OsmuxEM"); |
| 2698 | map(vc_OsmuxEM:OSMUX, system:OSMUX); |
| 2699 | connect(vc_OsmuxEM:CTRL, self:OsmuxEM_CTRL); |
| 2700 | connect(vc_OsmuxEM:DATA, self:OsmuxEM_DATA); |
| 2701 | vc_OsmuxEM.start(OSMUX_Emulation.f_main()); |
| 2702 | |
| 2703 | /* Step 1: configure the RTP parameters */ |
| 2704 | var integer payload_len := 31; |
| 2705 | var octetstring hdr := ''O; |
| 2706 | |
| 2707 | /* Pad the payload to conform the expected length */ |
| 2708 | payload := f_pad_oct(hdr & payload, payload_len, '00'O); |
| 2709 | cfg.tx_fixed_payload := payload; |
| 2710 | f_osmuxem_configure(OsmuxEM_CTRL, cfg); |
| 2711 | |
| 2712 | /* Step 2: bind the RTP emulation to the configured address */ |
| 2713 | var PortNumber osmuxem_bind_port := mp_osmuxem_bind_port; |
| 2714 | f_osmuxem_bind(OsmuxEM_CTRL, mp_osmuxem_bind_ip, osmuxem_bind_port); |
| 2715 | rx_hdl := c_OsmuxemDefaultRxHandle; |
| 2716 | rx_hdl.cid := g_pars.loc_osmux_cid; |
| 2717 | f_osmuxem_register_rxhandle(OsmuxEM_CTRL, rx_hdl); |
| 2718 | |
| 2719 | /* Step 3a: send CRCX to create an RTP connection at the IUT */ |
| 2720 | var RSL_Message crcx_ack := f_rsl_transceive_ret( |
| 2721 | /* FIXME (OS#5242): do not include Remote IP/Port IEs because |
| 2722 | * osmo-bts would respond with nonsense listen addr='0.0.0.0'. */ |
| 2723 | ts_RSL_IPA_CRCX(g_chan_nr, omit, omit, g_pars.loc_osmux_cid), |
| 2724 | tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?, ?), |
| 2725 | "IPA CRCX ACK"); |
| 2726 | var uint16_t conn_id := crcx_ack.ies[1].body.ipa_conn_id; |
| 2727 | f_rsl_find_ie(crcx_ack, RSL_IE_OSMO_OSMUX_CID, ie); |
| 2728 | g_pars.rem_osmux_cid := ie.osmux_cid.cid; |
| 2729 | |
| 2730 | |
| 2731 | /* Step 3b: send MDCX with the configured address/port to the IUT */ |
| 2732 | var RSL_Message mdcx_ack := f_rsl_transceive_ret( |
| 2733 | ts_RSL_IPA_MDCX(g_chan_nr, conn_id, |
| 2734 | remote_ip := f_inet_addr(mp_osmuxem_bind_ip), |
| 2735 | remote_port := osmuxem_bind_port, |
| 2736 | rtp_pt2 := 0, |
| 2737 | osmux_cid := g_pars.loc_osmux_cid), |
| 2738 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, conn_id, ?, ?, ?, g_pars.rem_osmux_cid), |
| 2739 | "IPA MDCX ACK"); |
| 2740 | |
| 2741 | tx_hdl := valueof(t_TxHandleAMR590(g_pars.rem_osmux_cid)); |
| 2742 | f_osmuxem_register_txhandle(OsmuxEM_CTRL, tx_hdl); |
| 2743 | |
| 2744 | /* Step 4: connect to the IUT's address/port parsed from MDCX ACK */ |
| 2745 | var HostName bts_bind_ip := f_inet_ntoa(mdcx_ack.ies[2].body.ipa_local_ip); |
| 2746 | var PortNumber bts_bind_port := mdcx_ack.ies[3].body.ipa_local_port; |
| 2747 | f_osmuxem_connect(OsmuxEM_CTRL, bts_bind_ip, bts_bind_port); |
| 2748 | |
| 2749 | /* Step 5: set the given RTP emulation mode */ |
| 2750 | f_osmuxem_mode(OsmuxEM_CTRL, mode); |
| 2751 | } |
| 2752 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2753 | /* establish DChan, verify existance + contents of measurement reports */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2754 | private function f_TC_meas_res_periodic(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 2755 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2756 | RSL.clear; |
| 2757 | |
Vadim Yanitskiy | 44ff214 | 2019-01-12 07:04:58 +0700 | [diff] [blame] | 2758 | if (mp_bts_trxc_port != -1) { |
Pau Espin Pedrol | e9571aa | 2018-10-22 17:13:07 +0200 | [diff] [blame] | 2759 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 2760 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
Pau Espin Pedrol | 121724c | 2018-09-28 15:58:12 +0200 | [diff] [blame] | 2761 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2762 | |
| 2763 | f_est_dchan(); |
| 2764 | |
| 2765 | /* run for a number of seconds, send SACCH + FACCH from MS side and verify |
| 2766 | * RSL measurement reports on Abis side */ |
| 2767 | timer T := 8.0; |
| 2768 | T.start; |
| 2769 | alt { |
| 2770 | [] as_l1_sacch(); |
| 2771 | [] as_meas_res(); |
Vadim Yanitskiy | a4f88c6 | 2020-10-19 14:38:37 +0700 | [diff] [blame] | 2772 | [] as_l1_dcch_loop(); |
Vadim Yanitskiy | dc00811 | 2020-10-19 14:42:04 +0700 | [diff] [blame] | 2773 | [] as_l1_tch_loop(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2774 | [] L1CTL.receive { repeat; } |
| 2775 | [g_Tmeas_exp.running] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2776 | /* 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] | 2777 | * of any earlier errors, so if we reach this timeout, we're good */ |
| 2778 | setverdict(pass); |
| 2779 | } |
| 2780 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 2781 | 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] | 2782 | } |
| 2783 | } |
| 2784 | f_rsl_chan_deact(); |
Harald Welte | 3dc2046 | 2018-03-10 23:03:38 +0100 | [diff] [blame] | 2785 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 2786 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 2787 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2788 | /* Wait until the BTS has reached full tx power (nominal tx power minus configured attenuation) */ |
| 2789 | private function f_wait_ramp_up() runs on ConnHdlr return integer { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2790 | var L1ctlMessage l1_dl; |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2791 | var integer max_rx_lvl := mp_bts_tx_nom_pwr_exp - mp_bts_tx_pwr_att_exp; |
| 2792 | timer Tup := 10.0; |
| 2793 | Tup.start; |
| 2794 | alt { |
| 2795 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2796 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2797 | log("Received rx_level=", rx_lvl); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2798 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2799 | if (rx_lvl != max_rx_lvl) { |
| 2800 | repeat; |
| 2801 | } |
| 2802 | Tup.stop; |
| 2803 | } |
| 2804 | [] L1CTL.receive { repeat; } |
| 2805 | [] Tup.timeout { |
| 2806 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2807 | log2str("Didn't reach full power ", max_rx_lvl)); |
| 2808 | } |
| 2809 | } |
| 2810 | return max_rx_lvl; |
| 2811 | } |
| 2812 | |
| 2813 | /* verify BTS ramps power up to full tx power (nominal tx power minus configured attenuation) */ |
| 2814 | private function f_verify_ramp_up() runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2815 | var L1ctlMessage l1_dl; |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2816 | var integer initial_rx_lvl := -1; |
| 2817 | var integer last_rx_lvl := -1; |
| 2818 | var integer max_rx_lvl := mp_bts_tx_nom_pwr_exp - mp_bts_tx_pwr_att_exp; |
| 2819 | |
| 2820 | timer T := 2.0; |
| 2821 | alt { |
| 2822 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2823 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2824 | log("Received rx_level=", rx_lvl); |
| 2825 | if (initial_rx_lvl == -1) { |
| 2826 | initial_rx_lvl := rx_lvl; |
| 2827 | last_rx_lvl := rx_lvl; |
| 2828 | |
| 2829 | /* Expect a somehow low value during first received messages */ |
| 2830 | if (initial_rx_lvl >= max_rx_lvl / 2) { |
| 2831 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2832 | log2str("Detected high initial tx power during ramp up: ", |
| 2833 | initial_rx_lvl , ", full power is", max_rx_lvl)); |
| 2834 | } |
| 2835 | } |
| 2836 | |
| 2837 | /* received Rx level bigger than maximum allowed power by CN */ |
| 2838 | if (rx_lvl > max_rx_lvl) { |
| 2839 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2840 | log2str("Detected Tx power higher than full power: ", |
| 2841 | rx_lvl , " > ", max_rx_lvl)); |
| 2842 | } |
| 2843 | |
| 2844 | /* Make sure it never decreases, since we are rumping up */ |
| 2845 | if (last_rx_lvl > rx_lvl) { |
| 2846 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2847 | log2str("Detected Tx power decrease during ramp up: ", |
| 2848 | last_rx_lvl , " -> ", rx_lvl)); |
| 2849 | } |
| 2850 | |
| 2851 | if (rx_lvl == max_rx_lvl and not T.running) { |
| 2852 | /* We reached the maximum power, start timer and receive |
| 2853 | /* a few more to make sure we don't surpass it */ |
| 2854 | log("Reached full power, wating a bit more until success"); |
| 2855 | T.start; |
| 2856 | } |
| 2857 | |
| 2858 | last_rx_lvl := rx_lvl; |
| 2859 | repeat; |
| 2860 | } |
| 2861 | [] L1CTL.receive { repeat; } |
| 2862 | [] T.timeout { } |
| 2863 | } |
| 2864 | |
| 2865 | /* We didn't increase tx power during ramp up */ |
| 2866 | if (initial_rx_lvl < last_rx_lvl) { |
| 2867 | log("Tx power increased during ramp up: ", initial_rx_lvl , " -> ", last_rx_lvl); |
| 2868 | } else { |
| 2869 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2870 | log2str("No Tx power increase during whole ramp up: ", |
| 2871 | initial_rx_lvl , " -> ", last_rx_lvl)); |
| 2872 | } |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2873 | } |
| 2874 | |
| 2875 | /* verify BTS ramps power down to rx_level 0 */ |
| 2876 | private function f_verify_ramp_down(integer max_rx_lvl) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2877 | var L1ctlMessage l1_dl; |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2878 | var integer last_rx_lvl := max_rx_lvl; |
| 2879 | |
| 2880 | timer Tdown := 5.0; |
| 2881 | Tdown.start; |
| 2882 | alt { |
| 2883 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2884 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2885 | log("Received rx_level=", rx_lvl); |
| 2886 | |
| 2887 | /* received Rx level bigger than maximum allowed power by CN */ |
| 2888 | if (rx_lvl > max_rx_lvl) { |
| 2889 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2890 | log2str("Detected Tx power higher than full power: ", |
| 2891 | rx_lvl , " > ", max_rx_lvl)); |
| 2892 | } |
| 2893 | |
| 2894 | /* Make sure it never increases, since we are rumping down */ |
| 2895 | if (last_rx_lvl < rx_lvl) { |
| 2896 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2897 | log2str("Detected Tx power increase during ramp up: ", |
| 2898 | last_rx_lvl , " -> ", rx_lvl)); |
| 2899 | } |
| 2900 | |
| 2901 | last_rx_lvl := rx_lvl; |
| 2902 | if (last_rx_lvl != 0) { |
| 2903 | repeat; |
| 2904 | } |
| 2905 | /* we reached power level 0, we are done */ |
| 2906 | Tdown.stop; |
| 2907 | } |
| 2908 | [] L1CTL.receive { repeat; } |
| 2909 | [] Tdown.timeout { } |
| 2910 | } |
| 2911 | |
| 2912 | /* We didn't increase tx power during ramp down */ |
| 2913 | if (max_rx_lvl > last_rx_lvl) { |
| 2914 | log("Tx power decreased during ramp down: ", max_rx_lvl , " -> ", last_rx_lvl); |
| 2915 | } else { |
| 2916 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2917 | log2str("No Tx power decrease during whole ramp down: ", |
| 2918 | max_rx_lvl , " -> ", last_rx_lvl)); |
| 2919 | } |
| 2920 | } |
| 2921 | |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 2922 | /* verify BTS power down to rx_level 0 without ramping */ |
| 2923 | private function f_verify_power_down(integer max_rx_lvl) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 2924 | var L1ctlMessage l1_dl; |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 2925 | var boolean first_data_ind := true; |
| 2926 | |
| 2927 | timer Tdown := 5.0; |
| 2928 | Tdown.start; |
| 2929 | alt { |
| 2930 | [first_data_ind == true] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2931 | first_data_ind := false; |
| 2932 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2933 | log("Received rx_level=", rx_lvl); |
| 2934 | |
| 2935 | /* The first data indication could still have the original power level */ |
| 2936 | if (rx_lvl != 0 and rx_lvl != max_rx_lvl) { |
| 2937 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2938 | log2str("Detected Tx power: ", |
| 2939 | rx_lvl , " should be 0 or ", max_rx_lvl)); |
| 2940 | } |
| 2941 | repeat; |
| 2942 | } |
| 2943 | [first_data_ind == false] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 2944 | var GsmRxLev rx_lvl := l1_dl.dl_info.rx_level; |
| 2945 | log("Received rx_level=", rx_lvl); |
| 2946 | |
| 2947 | /* Expect immediate power off so either rx_level == 0 or no report at all |
| 2948 | because TRX was shut down already */ |
| 2949 | if (rx_lvl != 0) { |
| 2950 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 2951 | log2str("Detected Tx power: ", |
| 2952 | rx_lvl , " should be 0")); |
| 2953 | } |
| 2954 | |
| 2955 | repeat; |
| 2956 | } |
| 2957 | [] L1CTL.receive { repeat; } |
| 2958 | [] Tdown.timeout { } |
| 2959 | } |
| 2960 | } |
| 2961 | |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2962 | /* Verify Tx power reduction and ramping up during BTS bring up */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 2963 | 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] | 2964 | f_l1_tune(L1CTL); |
| 2965 | RSL.clear; |
| 2966 | |
| 2967 | f_verify_ramp_up(); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 2968 | |
| 2969 | setverdict(pass); |
| 2970 | } |
| 2971 | testcase TC_tx_power_start_ramp_up_bcch() runs on test_CT { |
| 2972 | var ConnHdlr vc_conn; |
| 2973 | var ConnHdlrPars pars; |
| 2974 | f_init(); |
| 2975 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
| 2976 | vc_conn := f_start_handler(refers(f_TC_tx_power_start_ramp_up_bcch), pars, |
| 2977 | pcu_comp := false, trxc_comp := true); |
| 2978 | vc_conn.done; |
| 2979 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 2980 | } |
| 2981 | |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 2982 | /* Verify Tx power reduction without ramping down during BTS shutdown due to Abis link failure */ |
| 2983 | private function f_TC_tx_power_down_bcch(charstring id) runs on ConnHdlr { |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2984 | f_connhdlr_init_vty_bsc(); |
| 2985 | |
| 2986 | f_l1_tune(L1CTL); |
| 2987 | RSL.clear; |
| 2988 | |
| 2989 | /* Wait until BTS is started and at full power */ |
| 2990 | var integer max_rx_lvl := f_wait_ramp_up(); |
| 2991 | log("Reached nominal level ", max_rx_lvl, ", shutting down OML link"); |
| 2992 | |
| 2993 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 2994 | f_verify_power_down(max_rx_lvl); |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2995 | |
| 2996 | setverdict(pass); |
| 2997 | } |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 2998 | testcase TC_tx_power_down_bcch() runs on test_CT { |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 2999 | var ConnHdlr vc_conn; |
| 3000 | var ConnHdlrPars pars; |
| 3001 | f_init(); |
| 3002 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 3003 | vc_conn := f_start_handler(refers(f_TC_tx_power_down_bcch), pars, |
Pau Espin Pedrol | b6985f9 | 2020-06-23 14:01:02 +0200 | [diff] [blame] | 3004 | pcu_comp := false, trxc_comp := true); |
| 3005 | vc_conn.done; |
| 3006 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3007 | } |
| 3008 | |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 3009 | /* Verify Tx power: |
| 3010 | * + ramping down during ADM state UNLOCKED->LOCKED |
| 3011 | * + ramping up during ADM state LOCKED->UNLOCKED |
| 3012 | */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3013 | private function f_TC_tx_power_ramp_adm_state_change(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 3014 | var L1ctlMessage l1_dl; |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 3015 | var integer last_rx_lvl; |
| 3016 | |
| 3017 | f_connhdlr_init_vty_bsc(); |
| 3018 | |
| 3019 | f_l1_tune(L1CTL); |
| 3020 | RSL.clear; |
| 3021 | |
| 3022 | /* Wait until BTS is started and at full power */ |
| 3023 | var integer max_rx_lvl := f_wait_ramp_up(); |
| 3024 | log("Reached nominal level ", max_rx_lvl, ", changing ADM state to LOCKED"); |
| 3025 | |
| 3026 | log("ADM STATE UNLOCKED->LOCKED"); |
| 3027 | f_vty_enter_cfg_trx(BSCVTY); |
| 3028 | f_vty_transceive(BSCVTY, "rf_locked 1"); |
| 3029 | last_rx_lvl := max_rx_lvl; |
| 3030 | f_verify_ramp_down(max_rx_lvl); |
| 3031 | |
| 3032 | /* Let some time after we received 0dBm, then check we don't receive BCCH |
| 3033 | * anymore because scheduler has stopped after ramping down */ |
| 3034 | f_sleep(2.0); |
| 3035 | L1CTL.clear; |
| 3036 | timer Tlocked := 2.0; |
| 3037 | Tlocked.start; |
| 3038 | alt { |
| 3039 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_BCCH(0), ?)) -> value l1_dl { |
| 3040 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3041 | log2str("Received data_ind during rf_locked: ", l1_dl)); |
| 3042 | } |
| 3043 | [] L1CTL.receive { repeat; } |
| 3044 | [] Tlocked.timeout { setverdict(pass, "Didn't receive data_ind while in rf_locked state."); } |
| 3045 | } |
| 3046 | |
| 3047 | log("ADM STATE LOCKED->UNLOCKED"); |
| 3048 | f_vty_transceive(BSCVTY, "rf_locked 0"); |
| 3049 | f_verify_ramp_up(); |
| 3050 | setverdict(pass); |
| 3051 | } |
| 3052 | testcase TC_tx_power_ramp_adm_state_change() runs on test_CT { |
| 3053 | var ConnHdlr vc_conn; |
| 3054 | var ConnHdlrPars pars; |
| 3055 | f_init(); |
| 3056 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN)); |
| 3057 | vc_conn := f_start_handler(refers(f_TC_tx_power_ramp_adm_state_change), pars, |
| 3058 | pcu_comp := false, trxc_comp := true); |
| 3059 | vc_conn.done; |
| 3060 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3061 | } |
| 3062 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3063 | 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] | 3064 | timer T := 8.0; |
| 3065 | T.start; |
| 3066 | var RSL_Message rsl; |
| 3067 | alt { |
| 3068 | [] as_l1_sacch(); |
| 3069 | [] L1CTL.receive { repeat; } |
| 3070 | [] RSL.receive(tr_RSL_MEAS_RES(g_chan_nr, ?, ?, ?)) -> value rsl { |
| 3071 | if (rsl.ies[3].body.bs_power.power_level == level) { |
| 3072 | setverdict(pass) |
| 3073 | } else { |
| 3074 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Received wrong BS power level in MEAS RES ", rsl)); |
| 3075 | } |
| 3076 | } |
| 3077 | [] T.timeout { |
| 3078 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No MEAS RES received at all"); |
| 3079 | } |
| 3080 | } |
| 3081 | } |
| 3082 | |
Vadim Yanitskiy | 6860e86 | 2021-06-30 00:16:26 +0200 | [diff] [blame] | 3083 | /* See if the RSL MEASurement RESult contains expeced BS power level |
| 3084 | * set _during_ the CHANnel ACTIVation procedure. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3085 | 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] | 3086 | f_l1_tune(L1CTL); |
| 3087 | RSL.clear; |
| 3088 | |
| 3089 | if (mp_bts_trxc_port != -1) { |
| 3090 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
| 3091 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 3092 | } |
| 3093 | |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 3094 | var uint4_t pwr_var := 1; |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3095 | var template (value) RSL_IE_BS_Power bs_power := ts_RSL_IE_BS_Power(pwr_var); |
| 3096 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_BS_POWER, RSL_IE_Body:{bs_power := bs_power}); |
| 3097 | |
| 3098 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 3099 | |
| 3100 | f_check_meas_bs_power_level(pwr_var); |
| 3101 | |
| 3102 | f_rsl_chan_deact(); |
| 3103 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3104 | } |
| 3105 | |
Vadim Yanitskiy | 6860e86 | 2021-06-30 00:16:26 +0200 | [diff] [blame] | 3106 | /* See if the RSL MEASurement RESult contains expeced BS power level |
| 3107 | * set _after_ the CHANnel ACTIVation procedure. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3108 | 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] | 3109 | f_l1_tune(L1CTL); |
| 3110 | RSL.clear; |
| 3111 | |
| 3112 | if (mp_bts_trxc_port != -1) { |
| 3113 | f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp)); |
| 3114 | f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms); |
| 3115 | } |
| 3116 | |
Vadim Yanitskiy | 117c176 | 2020-06-16 01:40:10 +0700 | [diff] [blame] | 3117 | var uint4_t pwr_var := 1; |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3118 | var template (value) RSL_IE_BS_Power bs_power := ts_RSL_IE_BS_Power(pwr_var); |
| 3119 | |
| 3120 | f_est_dchan(); |
| 3121 | |
| 3122 | RSL.send(ts_RSL_BS_PWR_CTRL(g_chan_nr, bs_power)); |
| 3123 | |
| 3124 | f_check_meas_bs_power_level(pwr_var); |
| 3125 | |
| 3126 | f_rsl_chan_deact(); |
| 3127 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3128 | } |
| 3129 | |
| 3130 | testcase TC_rsl_bs_pwr_static_ass() runs on test_CT { |
| 3131 | var ConnHdlr vc_conn; |
| 3132 | var ConnHdlrPars pars; |
Vadim Yanitskiy | da5964d | 2021-10-23 16:27:27 +0300 | [diff] [blame] | 3133 | |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3134 | f_init(); |
Vadim Yanitskiy | da5964d | 2021-10-23 16:27:27 +0300 | [diff] [blame] | 3135 | |
| 3136 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, trx_nr := 1)); |
| 3137 | vc_conn := f_start_handler(refers(f_TC_rsl_bs_pwr_static_ass), pars, |
| 3138 | pcu_comp := false, trxc_comp := true); |
| 3139 | vc_conn.done; |
| 3140 | |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3141 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3142 | } |
| 3143 | |
| 3144 | testcase TC_rsl_bs_pwr_static_power_control() runs on test_CT { |
| 3145 | var ConnHdlr vc_conn; |
| 3146 | var ConnHdlrPars pars; |
Vadim Yanitskiy | da5964d | 2021-10-23 16:27:27 +0300 | [diff] [blame] | 3147 | |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3148 | f_init(); |
Vadim Yanitskiy | da5964d | 2021-10-23 16:27:27 +0300 | [diff] [blame] | 3149 | |
| 3150 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, trx_nr := 1)); |
| 3151 | vc_conn := f_start_handler(refers(f_TC_rsl_bs_pwr_static_power_control), pars, |
| 3152 | pcu_comp := false, trxc_comp := true); |
| 3153 | vc_conn.done; |
| 3154 | |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 3155 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3156 | } |
| 3157 | |
Vadim Yanitskiy | 6860e86 | 2021-06-30 00:16:26 +0200 | [diff] [blame] | 3158 | /* Target level -100, first rssi -90, ms power 7, expected increase to 7+6 within 6 seconds, |
| 3159 | * second rssi -110, ms power 7+6, expected decrease to 7 within 6 seconds. |
| 3160 | * 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] | 3161 | 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] | 3162 | var uint5_t pwr_var := 7; |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3163 | var SacchL1Header l1h; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3164 | |
| 3165 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 3166 | f_l1_tune(L1CTL); |
| 3167 | RSL.clear; |
| 3168 | |
| 3169 | var RSL_IE_List addl_ies; |
| 3170 | var template (value) RSL_IE_MS_Power_Parameters pp := (ts_RSL_IE_MS_Power_Parameters(''O)); |
| 3171 | |
| 3172 | addl_ies := { |
| 3173 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(pwr_var)})), |
| 3174 | valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ms_power_params := pp})) |
| 3175 | }; |
| 3176 | |
| 3177 | /* establish with power parameters */ |
| 3178 | f_est_dchan(more_ies := addl_ies); |
| 3179 | |
| 3180 | /* set a high value to ensure L1 power control level increases */ |
| 3181 | f_trxc_fake_rssi(rxlev2dbm(20)); |
| 3182 | |
| 3183 | timer T2 := 6.0; |
| 3184 | T2.start; |
| 3185 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3186 | [] as_l1_sacch_l1h(l1h) { |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 3187 | f_send_meas_rep_l1h(ts_MeasurementResults, l1h); |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3188 | |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3189 | if (l1h.ms_power_lvl < (pwr_var + 6)) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3190 | repeat; |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 3191 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3192 | T2.stop; |
| 3193 | } |
| 3194 | [] L1CTL.receive { repeat; } |
| 3195 | [] T2.timeout { |
| 3196 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3197 | "Power Level in L1 header has not increased sufficiently"); |
| 3198 | } |
| 3199 | } |
| 3200 | |
| 3201 | /* set a low value to ensure L1 power control level decreases */ |
| 3202 | f_trxc_fake_rssi(rxlev2dbm(0)); |
| 3203 | |
| 3204 | timer T4 := 6.0; |
| 3205 | T4.start; |
| 3206 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3207 | [] as_l1_sacch_l1h(l1h) { |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 3208 | f_send_meas_rep_l1h(ts_MeasurementResults, l1h); |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3209 | |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3210 | if (l1h.ms_power_lvl > pwr_var) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3211 | repeat; |
Pau Espin Pedrol | a1f7d24 | 2019-12-04 16:08:09 +0100 | [diff] [blame] | 3212 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3213 | T4.stop; |
| 3214 | setverdict(pass, "Power level in L1 decreased/increased as expected"); |
| 3215 | } |
| 3216 | [] L1CTL.receive { repeat; } |
| 3217 | [] T4.timeout { |
| 3218 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3219 | "Power Level in L1 header has not decreased sufficiently"); |
| 3220 | } |
| 3221 | } |
| 3222 | |
| 3223 | f_rsl_chan_deact(); |
| 3224 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3225 | |
| 3226 | } |
| 3227 | |
| 3228 | /* check that we do not exceed the max power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3229 | 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] | 3230 | var uint5_t pwr_var := 7; |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3231 | var SacchL1Header l1h; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3232 | |
| 3233 | /* set a low value to ensure power increases */ |
| 3234 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 3235 | f_l1_tune(L1CTL); |
| 3236 | RSL.clear; |
| 3237 | |
| 3238 | var RSL_IE_List addl_ies; |
| 3239 | var template (value) RSL_IE_MS_Power_Parameters pp := (ts_RSL_IE_MS_Power_Parameters(''O)); |
| 3240 | |
| 3241 | addl_ies := { |
| 3242 | valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ts_RSL_IE_MS_Power(pwr_var)})), |
| 3243 | valueof(t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ms_power_params := pp})) |
| 3244 | }; |
| 3245 | |
| 3246 | /* establish with power parameters */ |
| 3247 | f_est_dchan(more_ies := addl_ies); |
| 3248 | |
| 3249 | timer T1 := 10.0; |
| 3250 | T1.start; |
| 3251 | alt { |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3252 | [] as_l1_sacch_l1h(l1h) { |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 3253 | f_send_meas_rep_l1h(ts_MeasurementResults, l1h); |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3254 | repeat; |
| 3255 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3256 | [] L1CTL.receive { repeat; } |
| 3257 | [] T1.timeout { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3258 | if (not isbound(l1h)) { |
| 3259 | setverdict(fail, "No SACCH blocks were received"); |
| 3260 | } else if (l1h.ms_power_lvl != pwr_var) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3261 | setverdict(fail, "Power level in L1 header should not have changed"); |
| 3262 | } |
| 3263 | } |
| 3264 | } |
| 3265 | |
| 3266 | f_rsl_chan_deact(); |
| 3267 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3268 | |
| 3269 | } |
| 3270 | |
| 3271 | /* see if we reach the band max power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3272 | private function f_TC_rsl_ms_pwr_dyn_up(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3273 | var SacchL1Header l1h; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3274 | var uint5_t pwr_var := 15; |
| 3275 | var uint5_t pwr_max_var := f_get_max_power_from_band(); |
| 3276 | |
| 3277 | /* set a low value to ensure power increases */ |
| 3278 | f_trxc_fake_rssi(rxlev2dbm(10)); |
| 3279 | f_l1_tune(L1CTL); |
| 3280 | RSL.clear; |
| 3281 | |
| 3282 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 3283 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 3284 | |
| 3285 | /* establish with fixed power level */ |
| 3286 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 3287 | |
| 3288 | /* check our initial power level */ |
| 3289 | f_wait_for_l1_power_level(pwr_var); |
| 3290 | |
| 3291 | /* update power param to enable power loop |
| 3292 | 48.058 The maximum power to be used is indicated in the BS and MS Power elements respectively. */ |
| 3293 | RSL.send(ts_RSL_MS_PWR_CTRL_with_pp(g_chan_nr, pwr_max_var)); |
| 3294 | |
Vadim Yanitskiy | 93ad814 | 2022-04-08 01:52:13 +0300 | [diff] [blame] | 3295 | /* By default, the MS power loop gets triggered every 4th SACCH block (1.92s). |
| 3296 | * We need 9 * 4 dB steps to get from 0 dBm to 33 dBm, so 9 * 1.92s total. |
| 3297 | * Add an extra offset to avoid race conditions: +1.92s. */ |
| 3298 | timer T1 := 9.0 * 1.92 + 1.92; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3299 | T1.start; |
| 3300 | alt { |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3301 | [] as_l1_sacch_l1h(l1h) { |
Vadim Yanitskiy | a2cd893 | 2022-08-10 17:56:25 +0700 | [diff] [blame] | 3302 | f_send_meas_rep_l1h(ts_MeasurementResults, l1h); |
Vadim Yanitskiy | 3999491 | 2022-07-30 18:06:13 +0700 | [diff] [blame] | 3303 | repeat; |
| 3304 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3305 | [] L1CTL.receive { repeat; } |
| 3306 | [] T1.timeout { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3307 | if (not isbound(l1h)) { |
| 3308 | setverdict(fail, "No SACCH blocks were received"); |
| 3309 | } else if (f_power_level_is_highest_dbm(l1h.ms_power_lvl)) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3310 | setverdict(pass, "Power level in L1 header reduced as expected"); |
| 3311 | } else { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3312 | setverdict(fail, "Power level := ", l1h.ms_power_lvl, " did not ", |
| 3313 | "reach the expected value := ", pwr_max_var); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3314 | } |
| 3315 | } |
| 3316 | } |
| 3317 | |
| 3318 | f_rsl_chan_deact(); |
| 3319 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3320 | |
| 3321 | } |
| 3322 | |
| 3323 | /* see if we reach the band min power */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3324 | private function f_TC_rsl_ms_pwr_dyn_down(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3325 | var SacchL1Header l1h; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3326 | |
| 3327 | /* set a high value to ensure power decreases */ |
| 3328 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 3329 | f_l1_tune(L1CTL); |
| 3330 | RSL.clear; |
| 3331 | |
| 3332 | var uint5_t pwr_var := 5; |
| 3333 | var uint5_t pwr_target_val := 15; |
| 3334 | |
| 3335 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 3336 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 3337 | |
| 3338 | /* establish with fixed power level */ |
| 3339 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 3340 | |
| 3341 | /* check our initial power level */ |
| 3342 | f_wait_for_l1_power_level(pwr_var); |
| 3343 | |
| 3344 | /* update power param to enable power loop |
| 3345 | 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] | 3346 | 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] | 3347 | |
| 3348 | /* wait, then check that our power level was increased */ |
| 3349 | timer T1 := 10.0; |
| 3350 | T1.start; |
| 3351 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3352 | [] as_l1_sacch_l1h(l1h) { repeat; } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3353 | [] L1CTL.receive { repeat; } |
| 3354 | [] T1.timeout { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3355 | if (not isbound(l1h)) { |
| 3356 | setverdict(fail, "No SACCH blocks were received"); |
| 3357 | } else if (f_power_level_is_lowest_dbm(l1h.ms_power_lvl)) { |
| 3358 | setverdict(pass, "Power level increased to lowest power value"); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3359 | } else { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3360 | setverdict(fail, "Power level NOT increased to lowest power value"); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3361 | } |
| 3362 | } |
| 3363 | } |
| 3364 | |
| 3365 | f_rsl_chan_deact(); |
| 3366 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3367 | |
| 3368 | } |
| 3369 | |
Vadim Yanitskiy | 6860e86 | 2021-06-30 00:16:26 +0200 | [diff] [blame] | 3370 | /* See if the power level remains constant when MS Power Parameters IE |
| 3371 | * is _absent_ in the CHANnel ACTIVation message. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3372 | private function f_TC_rsl_ms_pwr_dyn_active(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3373 | var SacchL1Header l1h; |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 3374 | |
| 3375 | /* set a high value to ensure power decreases */ |
| 3376 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 3377 | f_l1_tune(L1CTL); |
| 3378 | RSL.clear; |
| 3379 | |
| 3380 | var uint5_t pwr_var := 5; |
| 3381 | |
| 3382 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 3383 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 3384 | |
| 3385 | /* establish with fixed power level */ |
| 3386 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 3387 | |
| 3388 | /* check our initial power level */ |
| 3389 | f_wait_for_l1_power_level(pwr_var); |
| 3390 | |
| 3391 | /* wait, then check that our power level did not change */ |
| 3392 | timer T1 := 10.0; |
| 3393 | T1.start; |
| 3394 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3395 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3396 | if (l1h.ms_power_lvl != pwr_var) { |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 3397 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3398 | "BS power control should not be active unless we receive a power parameters IE!"); |
| 3399 | } |
| 3400 | repeat; |
| 3401 | } |
| 3402 | [] L1CTL.receive { repeat; } |
| 3403 | [] T1.timeout { setverdict(pass); } |
| 3404 | } |
| 3405 | |
| 3406 | f_rsl_chan_deact(); |
| 3407 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3408 | |
| 3409 | } |
| 3410 | |
Vadim Yanitskiy | 6860e86 | 2021-06-30 00:16:26 +0200 | [diff] [blame] | 3411 | /* See if the power level remains constant when MS Power Parameters IE |
| 3412 | * is _absent_ in the CHANnel ACTIVation and MS Power Control messages. */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 3413 | private function f_TC_rsl_ms_pwr_dyn_active2(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3414 | var SacchL1Header l1h; |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 3415 | |
| 3416 | /* set a high value to ensure power decreases */ |
| 3417 | f_trxc_fake_rssi(rxlev2dbm(50)); |
| 3418 | f_l1_tune(L1CTL); |
| 3419 | RSL.clear; |
| 3420 | |
| 3421 | var uint5_t pwr_var := 5; |
| 3422 | |
| 3423 | var template (value) RSL_IE_MS_Power ms_power := ts_RSL_IE_MS_Power(pwr_var); |
| 3424 | var template (value) RSL_IE pwr := t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}); |
| 3425 | |
| 3426 | /* establish with fixed power level */ |
| 3427 | f_est_dchan(more_ies :={valueof(pwr)}); |
| 3428 | |
| 3429 | /* check our initial power level */ |
| 3430 | f_wait_for_l1_power_level(pwr_var); |
| 3431 | |
| 3432 | /* pwr control without power params IE, should NOT activate MS power control*/ |
| 3433 | RSL.send(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 3434 | |
| 3435 | /* wait, then check that our power level did not change */ |
| 3436 | timer T1 := 10.0; |
| 3437 | T1.start; |
| 3438 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3439 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3440 | if (l1h.ms_power_lvl != pwr_var) { |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 3441 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3442 | "BS power control should not be active unless we receive a power parameters IE!"); |
| 3443 | } |
| 3444 | repeat; |
| 3445 | } |
| 3446 | [] L1CTL.receive { repeat; } |
| 3447 | [] T1.timeout { setverdict(pass); } |
| 3448 | } |
| 3449 | |
| 3450 | f_rsl_chan_deact(); |
| 3451 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3452 | |
| 3453 | } |
| 3454 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3455 | private function f_wait_for_l1_power_level(integer level) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3456 | var SacchL1Header l1h; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3457 | timer T0 := 10.0; |
| 3458 | T0.start; |
| 3459 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3460 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3461 | if (l1h.ms_power_lvl != level) { |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3462 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3463 | "Power level in L1 header != signaled (RSL) power level."); |
| 3464 | } |
| 3465 | } |
| 3466 | [] L1CTL.receive { repeat; } |
| 3467 | [] T0.timeout { |
| 3468 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 3469 | "Timeout waiting for initial power level"); |
| 3470 | } |
| 3471 | } |
| 3472 | T0.stop; |
| 3473 | } |
| 3474 | |
| 3475 | private function f_power_level_is_lowest_dbm(integer level) runs on ConnHdlr return boolean { |
| 3476 | var IntegerRecord min_dbm_level; |
| 3477 | var IntegerRecord max_dbm_level; |
| 3478 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 3479 | |
| 3480 | for (var integer i := 0; i < sizeof(min_dbm_level); i := i+1) { |
| 3481 | if (min_dbm_level[i] == level) { |
| 3482 | return true; |
| 3483 | } |
| 3484 | } |
| 3485 | return false; |
| 3486 | } |
| 3487 | |
| 3488 | private function f_power_level_is_highest_dbm(integer level) runs on ConnHdlr return boolean { |
| 3489 | var IntegerRecord min_dbm_level; |
| 3490 | var IntegerRecord max_dbm_level; |
| 3491 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 3492 | |
| 3493 | for (var integer i := 0; i < sizeof(max_dbm_level); i := i+1) { |
| 3494 | if (max_dbm_level[i] == level) { |
| 3495 | return true; |
| 3496 | } |
| 3497 | } |
| 3498 | return false; |
| 3499 | } |
| 3500 | |
| 3501 | private function f_get_max_power_from_band() runs on ConnHdlr return integer { |
| 3502 | var IntegerRecord min_dbm_level; |
| 3503 | var IntegerRecord max_dbm_level; |
| 3504 | var IntegerRecord x := f_power_from_band(g_pars.bts0_band, min_dbm_level, max_dbm_level); |
| 3505 | return max_dbm_level[0]; |
| 3506 | } |
| 3507 | |
| 3508 | type charstring BtsBand ("GSM450","GSM480","GSM750","GSM810","GSM850","GSM900","DCS1800","PCS1900"); |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 3509 | private template charstring BtsBand_allGSM := pattern "GSM???"; |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3510 | private function f_power_from_band(in BtsBand band, out IntegerRecord min_dbm_level, out IntegerRecord max_dbm_level) return IntegerRecord { |
| 3511 | // 45.005 4.1.1 |
| 3512 | var IntegerRecord gsm_power :={31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, |
| 3513 | 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, |
| 3514 | 2, 1, 0}; |
| 3515 | var IntegerRecord dcs_power :={28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, |
| 3516 | 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30, 29}; |
| 3517 | var IntegerRecord pcs_power :={15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 31, 30}; |
| 3518 | var IntegerRecord rv; |
| 3519 | |
| 3520 | select(band){ |
| 3521 | case (BtsBand_allGSM){ |
| 3522 | rv := gsm_power; |
| 3523 | min_dbm_level := {31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19} ; |
| 3524 | max_dbm_level := {2, 1, 0}; |
| 3525 | } |
| 3526 | case("DCS1800"){ |
| 3527 | rv := dcs_power; |
| 3528 | min_dbm_level := {28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15}; |
| 3529 | max_dbm_level := {0, 29}; // let's cheat here, assume MS_TXPWR_MAX_CCH might be being broadcast, so maybe no 29,30,31 |
| 3530 | } |
| 3531 | case("PCS1900"){ |
| 3532 | rv := pcs_power; |
| 3533 | min_dbm_level := {15}; |
| 3534 | max_dbm_level := {30}; |
| 3535 | } |
Harald Welte | 194b691 | 2020-10-11 21:01:55 +0200 | [diff] [blame] | 3536 | case else { |
| 3537 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unsupported band: " & band); |
| 3538 | } |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3539 | } |
| 3540 | |
| 3541 | return rv; |
| 3542 | } |
| 3543 | |
| 3544 | private function f_vty_get_bts0_band() runs on test_CT return BtsBand { |
Harald Welte | c935fad | 2020-10-11 21:02:54 +0200 | [diff] [blame] | 3545 | return f_vty_transceive_match_regex(BTSVTY, "show bts 0", "BTS 0 is of*type* in band (\w+),*", 0); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3546 | } |
| 3547 | |
| 3548 | testcase TC_rsl_ms_pwr_dyn_ass_updown() runs on test_CT { |
| 3549 | var ConnHdlr vc_conn; |
| 3550 | var ConnHdlrPars pars; |
| 3551 | f_init(); |
| 3552 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 3553 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 3554 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3555 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3556 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_ass_updown), pars, trxc_comp := true); |
| 3557 | vc_conn.done; |
| 3558 | } |
| 3559 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3560 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3561 | } |
| 3562 | |
| 3563 | testcase TC_rsl_ms_pwr_dyn_up() runs on test_CT { |
| 3564 | var ConnHdlr vc_conn; |
| 3565 | var ConnHdlrPars pars; |
| 3566 | f_init(); |
| 3567 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -10"); |
| 3568 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
Vadim Yanitskiy | c78aeb7 | 2022-07-30 17:56:39 +0700 | [diff] [blame] | 3569 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN, t_guard := 30.0)); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 3570 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3571 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_up), pars, trxc_comp := true); |
| 3572 | vc_conn.done; |
| 3573 | } |
| 3574 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3575 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3576 | } |
| 3577 | |
| 3578 | testcase TC_rsl_ms_pwr_dyn_max() runs on test_CT { |
| 3579 | var ConnHdlr vc_conn; |
| 3580 | var ConnHdlrPars pars; |
| 3581 | f_init(); |
| 3582 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -10"); |
| 3583 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 3584 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3585 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3586 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_max), pars, trxc_comp := true); |
| 3587 | vc_conn.done; |
| 3588 | } |
| 3589 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3590 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3591 | } |
| 3592 | |
| 3593 | testcase TC_rsl_ms_pwr_dyn_down() runs on test_CT { |
| 3594 | var ConnHdlr vc_conn; |
| 3595 | var ConnHdlrPars pars; |
| 3596 | f_init(); |
| 3597 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 3598 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 3599 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3600 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3601 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_down), pars, trxc_comp := true); |
| 3602 | vc_conn.done; |
| 3603 | } |
| 3604 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3605 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3606 | } |
| 3607 | |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 3608 | testcase TC_rsl_ms_pwr_dyn_active() runs on test_CT { |
| 3609 | var ConnHdlr vc_conn; |
| 3610 | var ConnHdlrPars pars; |
| 3611 | f_init(); |
| 3612 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 3613 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 3614 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3615 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3616 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_active), pars, trxc_comp := true); |
| 3617 | vc_conn.done; |
| 3618 | } |
| 3619 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3620 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3621 | } |
| 3622 | |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 3623 | testcase TC_rsl_ms_pwr_dyn_active2() runs on test_CT { |
| 3624 | var ConnHdlr vc_conn; |
| 3625 | var ConnHdlrPars pars; |
| 3626 | f_init(); |
| 3627 | f_vty_config(BTSVTY, "phy 0", "osmotrx ms-power-loop -100"); |
| 3628 | for (var integer tn := 1; tn <= 1; tn := tn+1) { |
| 3629 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3630 | pars.bts0_band := f_vty_get_bts0_band(); |
| 3631 | vc_conn := f_start_handler(refers(f_TC_rsl_ms_pwr_dyn_active2), pars, trxc_comp := true); |
| 3632 | vc_conn.done; |
| 3633 | } |
| 3634 | f_vty_config(BTSVTY, "phy 0", "no osmotrx ms-power-loop"); |
| 3635 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3636 | } |
| 3637 | |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 3638 | function f_TC_meas_res_speech_tchf(boolean facch_enabled) runs on test_CT { |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 3639 | var template RSL_IE_ChannelMode ch_mode; |
| 3640 | var ConnHdlr vc_conn; |
| 3641 | var ConnHdlrPars pars; |
| 3642 | f_init(); |
| 3643 | ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1); |
| 3644 | for (var integer tn := 1; tn <= 1; tn := tn + 1) { |
| 3645 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ch_mode)); |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 3646 | pars.l1_pars.facch_enabled := facch_enabled; |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 3647 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3648 | pcu_comp := false, trxc_comp := true); |
| 3649 | vc_conn.done; |
| 3650 | } |
| 3651 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3652 | } |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 3653 | |
| 3654 | testcase TC_meas_res_speech_tchf() runs on test_CT { |
| 3655 | f_TC_meas_res_speech_tchf(false); |
| 3656 | } |
| 3657 | |
| 3658 | testcase TC_meas_res_speech_tchf_facch() runs on test_CT { |
| 3659 | f_TC_meas_res_speech_tchf(true); |
| 3660 | } |
| 3661 | |
| 3662 | function f_TC_meas_res_speech_tchh(boolean facch_enabled) runs on test_CT { |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 3663 | var template RSL_IE_ChannelMode ch_mode; |
| 3664 | var ConnHdlr vc_conn; |
| 3665 | var ConnHdlrPars pars; |
| 3666 | f_init(); |
| 3667 | ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1); |
| 3668 | for (var integer ss := 0; ss <= 1; ss := ss + 1) { |
| 3669 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ch_mode)); |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 3670 | pars.l1_pars.facch_enabled := facch_enabled; |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 3671 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3672 | pcu_comp := false, trxc_comp := true); |
| 3673 | vc_conn.done; |
| 3674 | } |
| 3675 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3676 | } |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 3677 | |
| 3678 | testcase TC_meas_res_speech_tchh() runs on test_CT { |
| 3679 | f_TC_meas_res_speech_tchh(false) |
| 3680 | } |
| 3681 | |
| 3682 | testcase TC_meas_res_speech_tchh_facch() runs on test_CT { |
| 3683 | f_TC_meas_res_speech_tchh(true) |
| 3684 | } |
| 3685 | |
Vadim Yanitskiy | 780bc07 | 2020-10-20 02:16:01 +0700 | [diff] [blame] | 3686 | testcase TC_meas_res_speech_tchh_toa256() runs on test_CT { |
| 3687 | var template RSL_IE_ChannelMode ch_mode; |
| 3688 | var ConnHdlr vc_conn; |
| 3689 | var ConnHdlrPars pars; |
| 3690 | f_init(); |
| 3691 | f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256"); |
| 3692 | ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1); |
| 3693 | for (var integer ss := 0; ss <= 1; ss := ss + 1) { |
| 3694 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ch_mode)); |
| 3695 | pars.l1_pars.toa256_enabled := true; |
| 3696 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3697 | pcu_comp := false, trxc_comp := true); |
| 3698 | vc_conn.done; |
| 3699 | } |
| 3700 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3701 | } |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 3702 | |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3703 | testcase TC_meas_res_sign_tchf() runs on test_CT { |
| 3704 | var ConnHdlr vc_conn; |
| 3705 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3706 | f_init(); |
Pau Espin Pedrol | 93a7b8b | 2021-10-08 16:57:50 +0200 | [diff] [blame] | 3707 | f_vty_config(BTSVTY, "bts 0", "no supp-meas-info toa256"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3708 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 3709 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN(RSL_CHRT_TCH_F))); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 3710 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3711 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3712 | vc_conn.done; |
| 3713 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3714 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3715 | } |
| 3716 | testcase TC_meas_res_sign_tchh() runs on test_CT { |
| 3717 | var ConnHdlr vc_conn; |
| 3718 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3719 | f_init(); |
Pau Espin Pedrol | 93a7b8b | 2021-10-08 16:57:50 +0200 | [diff] [blame] | 3720 | f_vty_config(BTSVTY, "bts 0", "no supp-meas-info toa256"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3721 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 3722 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN(RSL_CHRT_TCH_H))); |
Eric Wild | 5b9ef14 | 2019-07-11 19:28:02 +0200 | [diff] [blame] | 3723 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3724 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3725 | vc_conn.done; |
| 3726 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3727 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3728 | } |
| 3729 | testcase TC_meas_res_sign_sdcch4() runs on test_CT { |
| 3730 | var ConnHdlr vc_conn; |
| 3731 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3732 | f_init(); |
Pau Espin Pedrol | 93a7b8b | 2021-10-08 16:57:50 +0200 | [diff] [blame] | 3733 | f_vty_config(BTSVTY, "bts 0", "no supp-meas-info toa256"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3734 | for (var integer ss := 0; ss <= 3; ss := ss+1) { |
| 3735 | 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] | 3736 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3737 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3738 | vc_conn.done; |
| 3739 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3740 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3741 | } |
| 3742 | testcase TC_meas_res_sign_sdcch8() runs on test_CT { |
| 3743 | var ConnHdlr vc_conn; |
| 3744 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3745 | f_init(); |
Pau Espin Pedrol | 93a7b8b | 2021-10-08 16:57:50 +0200 | [diff] [blame] | 3746 | f_vty_config(BTSVTY, "bts 0", "no supp-meas-info toa256"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3747 | for (var integer ss := 0; ss <= 7; ss := ss+1) { |
| 3748 | 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] | 3749 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3750 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3751 | vc_conn.done; |
| 3752 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3753 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3754 | } |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 3755 | testcase TC_meas_res_sign_tchh_toa256() runs on test_CT { |
| 3756 | var ConnHdlr vc_conn; |
| 3757 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3758 | f_init(); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 3759 | f_vty_config(BTSVTY, "bts 0", "supp-meas-info toa256"); |
| 3760 | for (var integer ss := 0; ss <= 1; ss := ss+1) { |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 3761 | pars := valueof(t_Pars(t_RslChanNr_Lm(5, ss), ts_RSL_ChanMode_SIGN(RSL_CHRT_TCH_H))); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 3762 | pars.l1_pars.toa256_enabled := true; |
Vadim Yanitskiy | 0b65219 | 2020-10-20 02:39:02 +0700 | [diff] [blame] | 3763 | vc_conn := f_start_handler(refers(f_TC_meas_res_periodic), pars, |
| 3764 | pcu_comp := false, trxc_comp := true); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 3765 | vc_conn.done; |
| 3766 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 3767 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 3768 | } |
| 3769 | |
Vadim Yanitskiy | 8f6eae0 | 2021-10-26 02:49:21 +0300 | [diff] [blame] | 3770 | /* Make sure that we always get RSL MEASurement RESult messages regardless |
| 3771 | * of what is sent on SACCH: (RR) Measurement Report or SAPI=3 data (SMS). */ |
| 3772 | private function f_TC_meas_res_sapi3(charstring id) runs on ConnHdlr { |
| 3773 | timer Texec := 8.0; |
| 3774 | timer Timpf := 2.0; |
| 3775 | timer Tmr; |
| 3776 | |
| 3777 | f_l1_tune(L1CTL); |
| 3778 | RSL.clear; |
| 3779 | |
| 3780 | f_est_dchan(); |
| 3781 | L1CTL.clear; |
| 3782 | |
| 3783 | /* Establish the main SAPI=0 link on DCCH first */ |
| 3784 | f_tx_lapdm(ts_LAPDm_SABM(0, cr_MO_CMD, true, ''O), ts_RslLinkID_DCCH(0)); |
| 3785 | |
| 3786 | /* Give more time for the first RSL MEASurement RESult */ |
| 3787 | Tmr.start(0.480 * 2.0); |
| 3788 | Texec.start; /* EXECution timer */ |
| 3789 | Timpf.start; /* IMPFung timer */ |
| 3790 | |
| 3791 | alt { |
| 3792 | /* We expect RSL MEASurement RESult messages every ~480ms (plus some guard) */ |
| 3793 | [] RSL.receive(tr_RSL_MEAS_RES(g_pars.chan_nr)) { |
| 3794 | /* Reschedule the MEAS RES timer */ |
| 3795 | Tmr.start(0.480 + 0.120); |
| 3796 | repeat; |
| 3797 | } |
| 3798 | [] RSL.receive { repeat; } |
| 3799 | [] Tmr.timeout { |
| 3800 | setverdict(fail, "Timeout waiting for RSL MEAS RES"); |
| 3801 | } |
| 3802 | /* Inject some SAPI=3 traffic on SACCH every 2 seconds */ |
| 3803 | [] Timpf.timeout { |
| 3804 | f_tx_lapdm(ts_LAPDm_SABM(3, cr_MO_CMD, true, ''O), ts_RslLinkID_SACCH(3)); |
| 3805 | log("Injected SAPI=3 traffic on SACCH"); |
| 3806 | Timpf.start; |
| 3807 | repeat; |
| 3808 | } |
| 3809 | /* We're good if survived so far */ |
| 3810 | [] Texec.timeout { |
| 3811 | setverdict(pass); |
| 3812 | } |
| 3813 | } |
| 3814 | |
| 3815 | f_rsl_chan_deact(); |
| 3816 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3817 | f_rslem_unregister(0, g_chan_nr); |
| 3818 | } |
| 3819 | testcase TC_meas_res_speech_tchf_sapi3() runs on test_CT { |
| 3820 | var template RSL_IE_ChannelMode ch_mode; |
| 3821 | var template ConnHdlrPars pars; |
| 3822 | var ConnHdlr vc_conn; |
| 3823 | |
| 3824 | f_init(); |
| 3825 | |
| 3826 | ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1); |
| 3827 | pars := t_Pars(t_RslChanNr_Bm(1), ch_mode); |
| 3828 | |
| 3829 | vc_conn := f_start_handler(refers(f_TC_meas_res_sapi3), valueof(pars)); |
| 3830 | vc_conn.done; |
| 3831 | |
| 3832 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3833 | } |
| 3834 | testcase TC_meas_res_speech_tchh_sapi3() runs on test_CT { |
| 3835 | var template RSL_IE_ChannelMode ch_mode; |
| 3836 | var template ConnHdlrPars pars; |
| 3837 | var ConnHdlr vc_conn; |
| 3838 | |
| 3839 | f_init(); |
| 3840 | |
| 3841 | ch_mode := ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1); |
| 3842 | pars := t_Pars(t_RslChanNr_Lm(5, 0), ch_mode); |
| 3843 | |
| 3844 | vc_conn := f_start_handler(refers(f_TC_meas_res_sapi3), valueof(pars)); |
| 3845 | vc_conn.done; |
| 3846 | |
| 3847 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3848 | } |
| 3849 | |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 3850 | /* establish DChan, and send MS POWER CONTROL messages via RSL, verify that |
| 3851 | * 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] | 3852 | private function f_tc_rsl_ms_pwr_ctrl(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3853 | var SacchL1Header l1h; |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 3854 | var RSL_IE_MS_Power ms_power; |
| 3855 | var RSL_Message rsl; |
| 3856 | var uint5_t power_level := 0; |
| 3857 | |
| 3858 | f_l1_tune(L1CTL); |
| 3859 | RSL.clear; |
| 3860 | |
| 3861 | f_est_dchan(); |
| 3862 | |
| 3863 | ms_power.reserved := 0; |
| 3864 | ms_power.fpc_epc := false; |
| 3865 | |
| 3866 | /* Send the first power control command. This will disable any BTS/TRX |
| 3867 | * internal power control and switch the MS (which is not in scope of |
| 3868 | * this test) to a constant power level. We start with a power level |
| 3869 | * of 0 */ |
| 3870 | ms_power.power_level := power_level; |
| 3871 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 3872 | RSL.send(rsl); |
| 3873 | |
| 3874 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3875 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3876 | if (l1h.ms_power_lvl != power_level) { |
| 3877 | setverdict(fail, "Power level := ", l1h.ms_power_lvl, "does not ", |
| 3878 | "match the signaled (RSL) power level := ", power_level); |
| 3879 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 3880 | } |
| 3881 | |
| 3882 | /* Signal a new power level via RSL for the next turn. */ |
| 3883 | if (power_level < 31) { |
| 3884 | power_level := power_level + 1; |
| 3885 | ms_power.power_level := power_level; |
| 3886 | rsl := valueof(ts_RSL_MS_PWR_CTRL(g_chan_nr, ms_power)); |
| 3887 | RSL.send(rsl); |
| 3888 | repeat; |
| 3889 | } |
| 3890 | |
| 3891 | } |
| 3892 | |
| 3893 | /* Ignore all other blocks */ |
| 3894 | [] L1CTL.receive { repeat; } |
| 3895 | |
| 3896 | } |
| 3897 | |
| 3898 | f_rsl_chan_deact(); |
| 3899 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3900 | |
| 3901 | setverdict(pass); |
| 3902 | } |
| 3903 | |
| 3904 | testcase TC_rsl_ms_pwr_ctrl() runs on test_CT { |
| 3905 | var ConnHdlr vc_conn; |
| 3906 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3907 | f_init(); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 3908 | |
| 3909 | for (var integer tn := 1; tn <= 4; tn := tn+1) { |
| 3910 | pars := valueof(t_Pars(t_RslChanNr_Bm(tn), ts_RSL_ChanMode_SIGN)); |
| 3911 | vc_conn := f_start_handler(refers(f_tc_rsl_ms_pwr_ctrl), pars); |
| 3912 | vc_conn.done; |
| 3913 | } |
| 3914 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3915 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 3916 | |
Pau Espin Pedrol | 188bfd2 | 2020-06-03 20:32:45 +0200 | [diff] [blame] | 3917 | /* 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] | 3918 | 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] | 3919 | 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] | 3920 | var uint5_t ta_to_test := 16; |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3921 | var SacchL1Header l1h; |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3922 | |
| 3923 | f_l1_tune(L1CTL); |
| 3924 | RSL.clear; |
| 3925 | |
| 3926 | /* tell fake_trx to use a given timing offset for all bursts */ |
Vadim Yanitskiy | dc8db92 | 2019-06-04 21:58:15 +0700 | [diff] [blame] | 3927 | f_trxc_fake_toffs256(ta_to_test*256); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3928 | |
| 3929 | f_est_dchan(more_ies :={valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, RSL_IE_Body:{timing_adv := ta_to_test}))} ); |
| 3930 | |
| 3931 | |
| 3932 | alt { |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3933 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3934 | if (l1h.actual_ta != ta_to_test) { |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3935 | setverdict(fail, "TA in L1 header does not match the signaled (RSL) TA."); |
| 3936 | } |
| 3937 | |
| 3938 | } |
| 3939 | |
| 3940 | /* Ignore all other blocks */ |
| 3941 | [] L1CTL.receive { repeat; } |
| 3942 | |
| 3943 | } |
| 3944 | |
| 3945 | f_rsl_chan_deact(); |
| 3946 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3947 | |
| 3948 | setverdict(pass); |
| 3949 | } |
| 3950 | |
| 3951 | testcase TC_rsl_chan_initial_ta() runs on test_CT { |
| 3952 | var ConnHdlr vc_conn; |
| 3953 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 3954 | f_init(); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3955 | pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
Vadim Yanitskiy | f4e997c | 2019-06-04 21:40:33 +0700 | [diff] [blame] | 3956 | vc_conn := f_start_handler(refers(f_tc_rsl_chan_initial_ta), pars, |
| 3957 | pcu_comp := false, trxc_comp := true); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 3958 | vc_conn.done; |
| 3959 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 3960 | } |
| 3961 | |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 3962 | /* 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] | 3963 | 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] | 3964 | var uint5_t ms_power_level := 7; |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3965 | var SacchL1Header l1h; |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 3966 | |
| 3967 | var RSL_IE_MS_Power ms_power; |
| 3968 | ms_power.reserved := 0; |
| 3969 | ms_power.fpc_epc := false; |
| 3970 | ms_power.power_level := ms_power_level; |
| 3971 | |
| 3972 | f_l1_tune(L1CTL); |
| 3973 | RSL.clear; |
| 3974 | |
| 3975 | f_est_dchan(more_ies :={valueof(t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ms_power := ms_power}))} ); |
| 3976 | |
| 3977 | timer T := 1.0; |
| 3978 | T.start; |
| 3979 | alt { |
| 3980 | /* Pick all SACCH blocks for checking */ |
Vadim Yanitskiy | ab5769c | 2020-11-11 07:02:28 +0700 | [diff] [blame] | 3981 | [] as_l1_sacch_l1h(l1h, do_apply := false) { |
| 3982 | if (l1h.ms_power_lvl != ms_power_level) { |
| 3983 | setverdict(fail, "Power level := ", l1h.ms_power_lvl, "does not ", |
| 3984 | "match the signaled (RSL) power level := ", ms_power_level); |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 3985 | } |
| 3986 | } |
| 3987 | /* Ignore all other blocks */ |
| 3988 | [] L1CTL.receive { repeat; } |
| 3989 | [] T.timeout { |
| 3990 | setverdict(fail, "Power Level in L1 header does not match the signaled (RSL) MS Power Level."); |
| 3991 | } |
| 3992 | } |
| 3993 | |
| 3994 | f_rsl_chan_deact(); |
| 3995 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 3996 | setverdict(pass); |
| 3997 | } |
| 3998 | |
| 3999 | testcase TC_rsl_chan_initial_ms_pwr() runs on test_CT { |
| 4000 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 4001 | f_testmatrix_each_chan(pars, refers(f_tc_rsl_chan_initial_ms_pwr)); |
| 4002 | } |
| 4003 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 4004 | /* 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] | 4005 | private function f_TC_conn_fail_crit(charstring id) runs on ConnHdlr { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4006 | f_l1_tune(L1CTL); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4007 | RSL.clear; |
| 4008 | |
| 4009 | f_est_dchan(); |
| 4010 | f_sleep(2.0); |
Vadim Yanitskiy | 289056c | 2022-12-25 02:07:49 +0700 | [diff] [blame] | 4011 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 4012 | f_L1CTL_RESET(L1CTL); |
Vadim Yanitskiy | 6ff06a3 | 2022-11-01 00:01:38 +0700 | [diff] [blame] | 4013 | f_l1_tune(L1CTL); /* tune back to BCCH */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4014 | |
| 4015 | timer T := 40.0; |
| 4016 | T.start; |
| 4017 | alt { |
| 4018 | [] RSL.receive(tr_RSL_CONN_FAIL_IND(g_chan_nr, ?)) { |
| 4019 | setverdict(pass) |
| 4020 | } |
| 4021 | [] RSL.receive { repeat }; |
| 4022 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4023 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "No CONN FAIL IND received"); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4024 | } |
| 4025 | } |
| 4026 | f_rsl_chan_deact(); |
| 4027 | } |
| 4028 | testcase TC_conn_fail_crit() runs on test_CT { |
| 4029 | var ConnHdlr vc_conn; |
| 4030 | var ConnHdlrPars pars; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4031 | f_init(); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4032 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6, 3), ts_RSL_ChanMode_SIGN)); |
| 4033 | pars.t_guard := 60.0; |
| 4034 | vc_conn := f_start_handler(refers(f_TC_conn_fail_crit), pars); |
| 4035 | vc_conn.done; |
| 4036 | } |
| 4037 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 4038 | /*********************************************************************** |
| 4039 | * Paging |
| 4040 | ***********************************************************************/ |
| 4041 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4042 | private function tmsi_is_dummy(TMSIP_TMSI_V tmsi) return boolean { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4043 | if (tmsi == 'FFFFFFFF'O) { |
| 4044 | return true; |
| 4045 | } else { |
| 4046 | return false; |
| 4047 | } |
| 4048 | } |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 4049 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4050 | private type record allowedFn { integer frame_nr } |
| 4051 | private template allowedFn bs_ag_blks_res_0 := { frame_nr := (6, 12, 16, 22, 26, 32, 36, 42, 46) } |
| 4052 | private template allowedFn bs_ag_blks_res_1 := { frame_nr := (12, 16, 22, 26, 32, 36, 42, 46) } |
| 4053 | private template allowedFn bs_ag_blks_res_2 := { frame_nr := (16, 22, 26, 32, 36, 42, 46) } |
| 4054 | private template allowedFn bs_ag_blks_res_3 := { frame_nr := (22, 26, 32, 36, 42, 46) } |
| 4055 | private template allowedFn bs_ag_blks_res_4 := { frame_nr := (26, 32, 36, 42, 46) } |
| 4056 | private template allowedFn bs_ag_blks_res_5 := { frame_nr := (32, 36, 42, 46) } |
| 4057 | private template allowedFn bs_ag_blks_res_6 := { frame_nr := (36, 42, 46) } |
| 4058 | private template allowedFn bs_ag_blks_res_7 := { frame_nr := (42, 46) } |
| 4059 | 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] | 4060 | { |
| 4061 | var integer frame_nr_51; |
| 4062 | frame_nr_51 := frame_nr mod 51 |
| 4063 | |
| 4064 | var allowedFn fn_check; |
| 4065 | fn_check.frame_nr := frame_nr_51; |
| 4066 | |
| 4067 | if (bs_ag_blks_res < 0 or bs_ag_blks_res > 7) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4068 | 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] | 4069 | return; |
| 4070 | } |
| 4071 | |
| 4072 | if (bs_ag_blks_res == 0 and match(fn_check, bs_ag_blks_res_0)) { |
| 4073 | return; |
| 4074 | } |
| 4075 | if (bs_ag_blks_res == 1 and match(fn_check, bs_ag_blks_res_1)) { |
| 4076 | return; |
| 4077 | } |
| 4078 | if (bs_ag_blks_res == 2 and match(fn_check, bs_ag_blks_res_2)) { |
| 4079 | return; |
| 4080 | } |
| 4081 | if (bs_ag_blks_res == 3 and match(fn_check, bs_ag_blks_res_3)) { |
| 4082 | return; |
| 4083 | } |
| 4084 | if (bs_ag_blks_res == 4 and match(fn_check, bs_ag_blks_res_4)) { |
| 4085 | return; |
| 4086 | } |
| 4087 | if (bs_ag_blks_res == 5 and match(fn_check, bs_ag_blks_res_5)) { |
| 4088 | return; |
| 4089 | } |
| 4090 | if (bs_ag_blks_res == 6 and match(fn_check, bs_ag_blks_res_6)) { |
| 4091 | return; |
| 4092 | } |
| 4093 | if (bs_ag_blks_res == 7 and match(fn_check, bs_ag_blks_res_7)) { |
| 4094 | return; |
| 4095 | } |
| 4096 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4097 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "received paging on AGCH"); |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 4098 | return; |
| 4099 | } |
| 4100 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4101 | private altstep as_l1_count_paging(inout integer num_paging_rcv_msgs, |
| 4102 | inout integer num_paging_rcv_ids, |
| 4103 | PagingTestCfg cfg) |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4104 | runs on test_CT { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 4105 | var L1ctlMessage dl; |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 4106 | [] 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] | 4107 | repeat; |
| 4108 | } |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 4109 | [] 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] | 4110 | var octetstring without_plen := |
| 4111 | substr(dl.payload.data_ind.payload, 1, lengthof(dl.payload.data_ind.payload)-1); |
| 4112 | 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] | 4113 | |
| 4114 | check_pch_fn(dl.dl_info.frame_nr, cfg.bs_ag_blks_res); |
| 4115 | |
Vadim Yanitskiy | 36aa07c | 2020-03-31 14:33:43 +0700 | [diff] [blame] | 4116 | if (match(rr, tr_PAGING_REQ1(tr_MI_LV(t_MI_NoIdentity(?))))) { |
| 4117 | /* Ignore empty RR Paging Request (PCH filling) messages. |
| 4118 | * TODO: does it make sense to count them? */ |
| 4119 | } else if (match(rr, tr_PAGING_REQ1)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4120 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 4121 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
Vadim Yanitskiy | d665c23 | 2020-03-30 14:40:41 +0700 | [diff] [blame] | 4122 | if (ispresent(rr.msgs.rrm.pagingReq_Type1.mobileIdentity2)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4123 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4124 | } |
| 4125 | } else if (match(rr, tr_PAGING_REQ2)) { |
| 4126 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 4127 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity1)) { |
| 4128 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4129 | } |
| 4130 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type2.mobileIdentity2)) { |
| 4131 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4132 | } |
Vadim Yanitskiy | d665c23 | 2020-03-30 14:40:41 +0700 | [diff] [blame] | 4133 | if (ispresent(rr.msgs.rrm.pagingReq_Type2.mobileIdentity3)) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4134 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4135 | } |
| 4136 | } else if (match(rr, tr_PAGING_REQ3)) { |
| 4137 | num_paging_rcv_msgs := num_paging_rcv_msgs + 1; |
| 4138 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity1)) { |
| 4139 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4140 | } |
| 4141 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity2)) { |
| 4142 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4143 | } |
| 4144 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity3)) { |
| 4145 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4146 | } |
| 4147 | if (not tmsi_is_dummy(rr.msgs.rrm.pagingReq_Type3.mobileIdentity4)) { |
| 4148 | num_paging_rcv_ids := num_paging_rcv_ids + 1; |
| 4149 | } |
| 4150 | } |
| 4151 | repeat; |
| 4152 | } |
| 4153 | } |
| 4154 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4155 | private type record PagingTestCfg { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4156 | boolean combined_ccch, |
| 4157 | integer bs_ag_blks_res, |
| 4158 | float load_factor, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4159 | /* Mix in a paging request through the PCU socket for every Nth (ps_load_modulus) |
| 4160 | * paging command that is issued via RSL. */ |
| 4161 | integer ps_load_modulus, |
| 4162 | /* Wait until the paging queue inside the BTS is congested before starting to add |
| 4163 | * pagings via the PCU socket (0 = disabled) */ |
| 4164 | boolean ps_wait_cong, |
| 4165 | /* Maximum time to wait until the paging queue is drained at the end of the test. |
| 4166 | * This usually takes about 15s (size: 200, ~ 13 per s -> 15s), it is recommended |
| 4167 | * to set this value to 18s, however the draining process may take significantly |
| 4168 | * longer when the queue contains paging requests for PS as those are implemented |
| 4169 | * as immediate assignments and require an entire MAC block alone. */ |
| 4170 | float queue_drain_timeout, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4171 | boolean exp_load_ind, |
| 4172 | boolean exp_overload, |
| 4173 | boolean use_tmsi |
| 4174 | } |
| 4175 | |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4176 | private type record PagingTestState { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4177 | integer num_paging_sent, |
| 4178 | integer num_paging_rcv_msgs, |
| 4179 | integer num_paging_rcv_ids, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4180 | integer num_overload, |
| 4181 | /* When free space inside the paging queue reaches more than 2 thirds |
| 4182 | * of its capacity cong_detected is set to true. */ |
| 4183 | boolean cong_detected |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4184 | } |
| 4185 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4186 | /* Helper function for paging related testing */ |
| 4187 | private function f_TC_paging(PagingTestCfg cfg) runs on test_CT return PagingTestState { |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4188 | /* Using the PCU socket affects the timing of the paging processing. We only |
| 4189 | * activate the PCU socket if we do paging load tests that include additional |
| 4190 | * paging load that is introduced through the PCU socket. */ |
| 4191 | if (cfg.ps_load_modulus > 0) { |
| 4192 | f_init_with_pcuif(); |
| 4193 | } else { |
| 4194 | f_init(); |
| 4195 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4196 | f_init_l1ctl(); |
| 4197 | f_l1_tune(L1CTL); |
| 4198 | |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4199 | var octetstring imm_ass := f_rnd_octstring(23); |
| 4200 | var ASP_RSL_Unitdata load_ind; |
| 4201 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4202 | var PagingTestState st := { |
| 4203 | num_paging_sent := 0, |
| 4204 | num_paging_rcv_msgs := 0, |
| 4205 | num_paging_rcv_ids := 0, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4206 | num_overload := 0, |
| 4207 | cong_detected := false |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4208 | }; |
| 4209 | |
| 4210 | var float max_pch_blocks_per_sec := f_pch_block_rate_est(cfg.combined_ccch, cfg.bs_ag_blks_res); |
| 4211 | var float max_pch_imsi_per_sec; |
| 4212 | if (cfg.use_tmsi) { |
| 4213 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 4.0; /* Type 3 */ |
| 4214 | } else { |
| 4215 | max_pch_imsi_per_sec := max_pch_blocks_per_sec * 2.0; /* Type 1 */ |
| 4216 | } |
| 4217 | var float pch_blocks_per_sec := max_pch_imsi_per_sec * cfg.load_factor; |
| 4218 | var float interval := 1.0 / pch_blocks_per_sec; |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4219 | var float time_total := 20.0; |
| 4220 | var integer pkt_total := float2int(time_total * pch_blocks_per_sec); |
| 4221 | 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] | 4222 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4223 | timer T_total := 300.0; /* big value (far bigger than time_total), used to count elapsed time */ |
| 4224 | T_total.start; |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4225 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4226 | timer T_itv := 0.0; |
| 4227 | T_itv.start; |
| 4228 | while (st.num_paging_sent < pkt_total) { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4229 | alt { |
| 4230 | /* check for presence of CCCH LOAD IND (paging load) */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4231 | [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] | 4232 | st.num_overload := st.num_overload + 1; |
| 4233 | repeat; |
| 4234 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4235 | [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] | 4236 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PCH Overload"); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4237 | } |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4238 | [cfg.exp_load_ind] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND)) -> value load_ind { |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4239 | log("Rx LOAD_IND"); |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4240 | |
| 4241 | /* Detect paging congestion: The logic inside the BTS will diagnose the |
| 4242 | * paging queue as congested when the fill state is more than 66% (which |
| 4243 | * is two thirds fill state, or approx. 66 of 200 paging slots. When a |
| 4244 | * paging congestion is detected pagings that are issued through the PCU |
| 4245 | * socket (PS) are dropped in order to prefer the CS related pagings. */ |
| 4246 | if (load_ind.rsl.ies[1].body.paging_load < 66) { |
| 4247 | st.cong_detected := true; |
| 4248 | } |
| 4249 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4250 | /* FIXME: analyze/verify interval + contents */ |
| 4251 | repeat; |
| 4252 | } |
Vadim Yanitskiy | 2372db6 | 2021-06-09 00:50:11 +0200 | [diff] [blame] | 4253 | /* ignore other RSL messages like RF RESource INDication */ |
| 4254 | [] RSL_CCHAN.receive { repeat; } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4255 | /* check if paging requests arrive on Um side */ |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 4256 | [] 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] | 4257 | [] L1CTL.receive { repeat; } |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4258 | /* Only relevant when testing including with PCU sock connected */ |
| 4259 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4260 | [] T_itv.timeout { |
| 4261 | /* Send paging cmds based on elapsed time */ |
| 4262 | var integer new_sent := f_min(pkt_total, float2int(T_total.read * pch_blocks_per_sec) + 1); |
| 4263 | while (st.num_paging_sent < new_sent) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4264 | var MobileIdentityV mi; |
| 4265 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4266 | /* build mobile Identity */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4267 | if (cfg.use_tmsi) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4268 | mi := valueof(t_MI_TMSI(f_rnd_octstring(4))); |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4269 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 4270 | 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] | 4271 | } |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4272 | |
| 4273 | /* Send RSL PAGING COMMAND */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4274 | 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] | 4275 | |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4276 | /* Add additional pagings through the PCU socket interface. */ |
| 4277 | if (cfg.ps_load_modulus > 0 and st.num_paging_sent mod cfg.ps_load_modulus == 0) { |
| 4278 | if (st.cong_detected == true or cfg.ps_wait_cong == false) { |
| 4279 | f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H, wait_for_cnf := false); |
| 4280 | } |
| 4281 | } |
| 4282 | |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4283 | st.num_paging_sent := st.num_paging_sent + 1; |
| 4284 | } |
| 4285 | if (st.num_paging_sent < pkt_total) { |
| 4286 | /* Wait for interval to next PAGING COMMAND */ |
| 4287 | var float time_now := T_total.read; |
| 4288 | var float next_sched := int2float(st.num_paging_sent)*interval; |
| 4289 | if (next_sched > time_now) { |
| 4290 | T_itv.start(next_sched - time_now); |
| 4291 | } else { |
| 4292 | T_itv.start(0.0); |
| 4293 | } |
| 4294 | } else { |
| 4295 | /* We are done, no need to keep counting */ |
| 4296 | T_total.stop; |
| 4297 | } |
| 4298 | } |
| 4299 | [] T_total.timeout { } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4300 | } |
| 4301 | } |
| 4302 | |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4303 | timer T_wait := cfg.queue_drain_timeout |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4304 | T_wait.start; |
| 4305 | alt { |
Philipp Maier | 82cb0b1 | 2018-08-31 14:41:39 +0200 | [diff] [blame] | 4306 | [] 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] | 4307 | [] L1CTL.receive { repeat; } |
| 4308 | /* 65535 == empty paging queue, we can terminate*/ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4309 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND(65535))) { } |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4310 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_LOAD_IND)) -> value load_ind { repeat; } |
Vadim Yanitskiy | 2372db6 | 2021-06-09 00:50:11 +0200 | [diff] [blame] | 4311 | /* ignore other RSL messages like RF RESource INDication */ |
| 4312 | [] RSL_CCHAN.receive { repeat; } |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4313 | /* Only relevant when testing including with PCU sock connected */ |
| 4314 | [] PCU.receive { repeat; } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4315 | [] T_wait.timeout { |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4316 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Waiting for paging queue, last detected fill state: ", load_ind.rsl.ies[1].body.paging_load)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4317 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4318 | } |
| 4319 | |
| 4320 | log("num_paging_sent=", st.num_paging_sent, " rcvd_msgs=", st.num_paging_rcv_msgs, |
| 4321 | " rcvd_ids=", st.num_paging_rcv_ids); |
| 4322 | return st; |
| 4323 | } |
| 4324 | |
| 4325 | /* Create ~ 80% paging load (IMSI only) sustained for about 20s, verifying that |
| 4326 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 4327 | * - that CCCH LOAD IND (PCH) are being generated |
| 4328 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 4329 | testcase TC_paging_imsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4330 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4331 | var PagingTestCfg cfg := { |
| 4332 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4333 | 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] | 4334 | load_factor := 0.8, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4335 | ps_load_modulus := 0, |
| 4336 | ps_wait_cong := false, |
| 4337 | queue_drain_timeout := 18.0, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4338 | exp_load_ind := true, |
| 4339 | exp_overload := false, |
| 4340 | use_tmsi := false |
| 4341 | }; |
| 4342 | var PagingTestState st := f_TC_paging(cfg); |
| 4343 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4344 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 4345 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4346 | } else { |
| 4347 | setverdict(pass); |
| 4348 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4349 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4350 | } |
| 4351 | |
| 4352 | /* Create ~ 80% paging load (TMSI only) sustained for about 20s, verifying that |
| 4353 | * - the number of Mobile Identities on Um PCH match the number of pages on RSL |
| 4354 | * - that CCCH LOAD IND (PCH) are being generated |
| 4355 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 4356 | testcase TC_paging_tmsi_80percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4357 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4358 | var PagingTestCfg cfg := { |
| 4359 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4360 | 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] | 4361 | load_factor := 0.8, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4362 | ps_load_modulus := 0, |
| 4363 | ps_wait_cong := false, |
| 4364 | queue_drain_timeout := 18.0, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4365 | exp_load_ind := true, |
| 4366 | exp_overload := false, |
| 4367 | use_tmsi := true |
| 4368 | }; |
| 4369 | var PagingTestState st := f_TC_paging(cfg); |
| 4370 | if (st.num_paging_sent != st.num_paging_rcv_ids) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4371 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", st.num_paging_sent, " pagings but have ", |
| 4372 | st.num_paging_rcv_ids)); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4373 | } else { |
| 4374 | setverdict(pass); |
| 4375 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4376 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4377 | } |
| 4378 | |
| 4379 | /* Create ~ 200% paging load (IMSI only) sustained for about 20s, verifying that |
| 4380 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 4381 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 4382 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 4383 | testcase TC_paging_imsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4384 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4385 | var PagingTestCfg cfg := { |
| 4386 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4387 | 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] | 4388 | load_factor := 2.0, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4389 | ps_load_modulus := 0, |
| 4390 | ps_wait_cong := false, |
| 4391 | queue_drain_timeout := 18.0, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4392 | exp_load_ind := true, |
| 4393 | exp_overload := true, |
| 4394 | use_tmsi := false |
| 4395 | }; |
| 4396 | var PagingTestState st := f_TC_paging(cfg); |
| 4397 | /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200 |
| 4398 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4399 | 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] | 4400 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4401 | 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] | 4402 | } else { |
| 4403 | setverdict(pass); |
| 4404 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4405 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4406 | } |
| 4407 | |
| 4408 | /* Create ~ 200% paging load (TMSI only) sustained for about 20s, verifying that |
| 4409 | * - the number of Mobile Identities on Um PCH are ~ 82% of the number of pages on RSL |
| 4410 | * - that CCCH LOAD IND (PCH) are being generated and reach 0 at some point |
| 4411 | * - that CCCH LOAD IND (PCH) [no load] is received after paging flood is over */ |
| 4412 | testcase TC_paging_tmsi_200percent() runs on test_CT { |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4413 | var SystemInformation si3 := valueof(ts_SI3_default); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4414 | var PagingTestCfg cfg := { |
| 4415 | combined_ccch := true, |
Philipp Maier | d65d056 | 2018-08-30 16:25:47 +0200 | [diff] [blame] | 4416 | 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] | 4417 | load_factor := 2.0, |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4418 | ps_load_modulus := 0, |
| 4419 | ps_wait_cong := false, |
| 4420 | queue_drain_timeout := 18.0, |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4421 | exp_load_ind := true, |
| 4422 | exp_overload := true, |
| 4423 | use_tmsi := true |
| 4424 | }; |
| 4425 | var PagingTestState st := f_TC_paging(cfg); |
| 4426 | /* We expect about 70% to pass, given that we can fill the paging buffer of 200 |
| 4427 | * slots and will fully drain that buffer before returning */ |
Pau Espin Pedrol | 9c3ff4e | 2018-09-26 18:30:16 +0200 | [diff] [blame] | 4428 | 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] | 4429 | if (not match(st.num_paging_rcv_ids, tpl)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4430 | 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] | 4431 | } else { |
| 4432 | setverdict(pass); |
| 4433 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4434 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4435 | } |
| 4436 | |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 4437 | /* Same as above, but with additional paging load created by PS pagings that |
| 4438 | * are issued through the PCU socket. The additional load is introduced when |
| 4439 | * the paging queue is already two thirds full. Since the BTS implements a |
| 4440 | * prioritization logic that drops the pagings from the PCU under in those |
| 4441 | * congestive sitautions the behaviour on the PS side is expected to be |
| 4442 | * unaffected and match the behavior of TC_paging_imsi_200percent() */ |
| 4443 | testcase TC_paging_imsi_200percent_with_ps() runs on test_CT { |
| 4444 | var SystemInformation si3 := valueof(ts_SI3_default); |
| 4445 | var PagingTestCfg cfg := { |
| 4446 | combined_ccch := true, |
| 4447 | bs_ag_blks_res := si3.payload.si3.ctrl_chan_desc.bs_ag_blks_res, |
| 4448 | load_factor := 2.0, |
| 4449 | ps_load_modulus := 16, |
| 4450 | ps_wait_cong := true, |
| 4451 | queue_drain_timeout := 18.0, |
| 4452 | exp_load_ind := true, |
| 4453 | exp_overload := true, |
| 4454 | use_tmsi := false |
| 4455 | }; |
| 4456 | var PagingTestState st := f_TC_paging(cfg); |
| 4457 | /* We expect about 80-85% to pass, given that we can fill the paging buffer of 200 |
| 4458 | * slots and will fully drain that buffer before returning */ |
| 4459 | var template integer tpl := (st.num_paging_sent*78/100 .. st.num_paging_sent *85/100); |
| 4460 | if (not match(st.num_paging_rcv_ids, tpl)) { |
| 4461 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("Expected ", tpl, " pagings but have ", st.num_paging_rcv_ids)); |
| 4462 | } else { |
| 4463 | setverdict(pass); |
| 4464 | } |
| 4465 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 4466 | } |
| 4467 | |
| 4468 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4469 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 4470 | /*********************************************************************** |
| 4471 | * Immediate Assignment / AGCH |
| 4472 | ***********************************************************************/ |
Vadim Yanitskiy | 3b464a9 | 2020-08-25 03:55:32 +0700 | [diff] [blame] | 4473 | private const MobileAllocationLV c_MA_null := { |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4474 | len := 0, |
| 4475 | ma := ''B |
| 4476 | } |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 4477 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4478 | private function f_fmt_ia_stats(integer num_tx, integer num_rx, integer num_del) return charstring { |
| 4479 | return int2str(num_tx) & " sent, " |
| 4480 | & int2str(num_rx) & " received, " |
| 4481 | & int2str(num_del) & " deleted"; |
| 4482 | } |
| 4483 | |
| 4484 | private function f_TC_imm_ass(integer num_total, float sleep_s, float exp_pass) runs on test_CT { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 4485 | var L1ctlMessage l1_dl; |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4486 | timer T := 10.0; |
| 4487 | var integer num_tx := 0; |
| 4488 | var integer num_rx := 0; |
| 4489 | var integer num_del := 0; |
| 4490 | var charstring res_str; |
| 4491 | var float rx_ratio; |
| 4492 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 4493 | f_init(); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4494 | f_init_l1ctl(); |
| 4495 | f_l1_tune(L1CTL); |
| 4496 | |
| 4497 | for (var integer i := 0; i < num_total; i := i+1) { |
Vadim Yanitskiy | 42d8bd5 | 2020-11-15 20:41:02 +0700 | [diff] [blame] | 4498 | var ChannelDescription ch_desc := valueof(ts_ChanDescH0(ts_RslChanNr_SDCCH4(0, 0), |
Vadim Yanitskiy | 3191d73 | 2020-11-15 20:45:01 +0700 | [diff] [blame] | 4499 | mp_trx_pars[0].arfcn, |
| 4500 | mp_tsc_def)); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4501 | var GsmRrMessage ia := valueof(ts_IMM_ASS(42, i, 5, ch_desc, c_MA_null)); |
| 4502 | var octetstring ia_enc := enc_GsmRrMessage(ia); |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4503 | 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] | 4504 | num_tx := num_tx+1; |
| 4505 | f_sleep(sleep_s); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4506 | } |
| 4507 | /* FIXME: check if imm.ass arrive on Um side */ |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4508 | T.start; |
| 4509 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 4510 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_DELETE_IND(?, 0))) { |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4511 | num_del := num_del+1; |
| 4512 | repeat; |
| 4513 | } |
| 4514 | [] RSL_CCHAN.receive { |
| 4515 | repeat; |
| 4516 | } |
| 4517 | [] 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] | 4518 | var GsmRrMessage rr := dec_GsmRrMessage(l1_dl.payload.data_ind.payload); |
| 4519 | if (not match(rr, tr_IMM_ASS(42, ?, 5, ?, ?))) { |
| 4520 | /* FIXME: Why are we seeing paging requests on PCH/AGCH? */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4521 | //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] | 4522 | } else { |
| 4523 | num_rx := num_rx+1; |
| 4524 | } |
| 4525 | repeat; |
| 4526 | } |
| 4527 | [] L1CTL.receive { repeat; } |
| 4528 | [] T.timeout { } |
| 4529 | } |
| 4530 | res_str := f_fmt_ia_stats(num_tx, num_rx, num_del); |
| 4531 | log("AGCH test: " & res_str); |
| 4532 | if (num_rx + num_del != num_tx) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4533 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "RX + DEL != TX ?!?: " & res_str); |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4534 | } |
| 4535 | rx_ratio := int2float(num_rx) / int2float(num_tx); |
| 4536 | 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] | 4537 | 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] | 4538 | } else { |
| 4539 | setverdict(pass); |
| 4540 | } |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4541 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 4542 | } |
| 4543 | |
Harald Welte | e8d750e | 2018-06-10 21:41:35 +0200 | [diff] [blame] | 4544 | /* send a long burst of 1000 IMM.ASS with 20ms spacing (50 per s); expect 75% of them to be deleted */ |
| 4545 | testcase TC_imm_ass_1000_20ms() runs on test_CT { |
| 4546 | f_TC_imm_ass(1000, 0.02, 0.25); |
| 4547 | } |
| 4548 | |
| 4549 | /* send a short burst of 200 IMM.ASS without any spacing; expect 95% of them to be deleted */ |
| 4550 | testcase TC_imm_ass_200_0ms() runs on test_CT { |
| 4551 | f_TC_imm_ass(200, 0.0, 0.05); |
| 4552 | } |
| 4553 | |
| 4554 | /* send 150 IMM.ASS at rate of 13/s; expect none of them to be deleted */ |
| 4555 | testcase TC_imm_ass_200_76ms() runs on test_CT { |
| 4556 | f_TC_imm_ass(150, 0.076, 1.00); |
| 4557 | } |
| 4558 | |
| 4559 | |
| 4560 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4561 | /*********************************************************************** |
| 4562 | * BCCH |
| 4563 | ***********************************************************************/ |
| 4564 | |
| 4565 | /* tuple of Frame Number + decoded SI */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4566 | private type record SystemInformationFn { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4567 | GsmFrameNumber frame_number, |
| 4568 | SystemInformation si |
| 4569 | } |
| 4570 | |
| 4571 | /* an arbitrary-length vector of decoded SI + gsmtap header */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4572 | private type record of SystemInformationFn SystemInformationVector; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4573 | |
| 4574 | /* an array of SI-vectors indexed by TC value */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4575 | private type SystemInformationVector SystemInformationVectorPerTc[8]; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4576 | |
| 4577 | /* 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] | 4578 | private function f_si_vecslot_contains(SystemInformationVector arr, |
| 4579 | RrMessageType key, |
| 4580 | boolean bcch_ext := false) |
| 4581 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4582 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 4583 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 4584 | if (not bcch_ext and fn_mod51 == 2 or |
| 4585 | bcch_ext and fn_mod51 == 6) { |
| 4586 | if (arr[i].si.header.message_type == key) { |
| 4587 | return true; |
| 4588 | } |
| 4589 | } |
| 4590 | } |
| 4591 | return false; |
| 4592 | } |
| 4593 | |
| 4594 | /* 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] | 4595 | private function f_ensure_si_vec_contains(SystemInformationVectorPerTc arr, |
| 4596 | integer tc, RrMessageType key, |
| 4597 | boolean ext_bcch := false) |
| 4598 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4599 | if (not f_si_vecslot_contains(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4600 | 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] | 4601 | } |
| 4602 | } |
| 4603 | |
| 4604 | /* 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] | 4605 | private function f_si_vec_contains(SystemInformationVectorPerTc arr, |
| 4606 | RrMessageType key) |
| 4607 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4608 | for (var integer tc:= 0; tc < sizeof(arr); tc := tc + 1) { |
| 4609 | if (f_si_vecslot_contains(arr[tc], key) or |
| 4610 | f_si_vecslot_contains(arr[tc], key, true)) { |
| 4611 | return true; |
| 4612 | } |
| 4613 | } |
| 4614 | return false; |
| 4615 | } |
| 4616 | |
| 4617 | /* 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] | 4618 | private function f_si_vecslot_contains_n_of_m(SystemInformationVector arr, |
| 4619 | RrMessageType key, |
| 4620 | boolean bcch_ext := false, |
| 4621 | integer n := 1, integer m := 4) |
| 4622 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4623 | var integer count := 0; |
| 4624 | if (sizeof(arr) < m) { |
Harald Welte | a616ec9 | 2020-10-11 21:28:00 +0200 | [diff] [blame] | 4625 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Error: Insufficient SI in array: " |
| 4626 | & int2str(sizeof(arr)) & " < " & int2str(m)); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4627 | } |
| 4628 | for (var integer i:= 0; i < m; i := i + 1) { |
| 4629 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 4630 | if (not bcch_ext and fn_mod51 == 2 or |
| 4631 | bcch_ext and fn_mod51 == 6) { |
| 4632 | if (arr[i].si.header.message_type == key) { |
| 4633 | count := count + 1; |
| 4634 | } |
| 4635 | } |
| 4636 | } |
| 4637 | if (count >= n) { |
| 4638 | return true; |
| 4639 | } else { |
| 4640 | return false; |
| 4641 | } |
| 4642 | } |
| 4643 | |
| 4644 | /* 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] | 4645 | private function f_ensure_si_vec_contains_n_of_m(SystemInformationVectorPerTc arr, |
| 4646 | integer tc, RrMessageType key, |
| 4647 | boolean ext_bcch := false, |
| 4648 | integer n, integer m) |
| 4649 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4650 | 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] | 4651 | 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] | 4652 | } |
| 4653 | } |
| 4654 | |
| 4655 | /* 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] | 4656 | private function f_si_vecslot_contains_only(SystemInformationVector arr, |
| 4657 | RrMessageType key, |
| 4658 | boolean bcch_ext := false) |
| 4659 | return boolean { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4660 | for (var integer i:= 0; i< sizeof(arr); i := i + 1) { |
| 4661 | var integer fn_mod51 := arr[i].frame_number mod 51; |
| 4662 | if (not bcch_ext and fn_mod51 == 2 or |
| 4663 | bcch_ext and fn_mod51 == 6) { |
| 4664 | if (arr[i].si.header.message_type != key) { |
| 4665 | return false; |
| 4666 | } |
| 4667 | } |
| 4668 | } |
| 4669 | return true; |
| 4670 | } |
| 4671 | |
| 4672 | /* 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] | 4673 | private function f_ensure_si_vec_contains_only(SystemInformationVectorPerTc arr, |
| 4674 | integer tc, RrMessageType key, |
| 4675 | boolean ext_bcch := false) |
| 4676 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4677 | if (not f_si_vecslot_contains_only(arr[tc], key, ext_bcch)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4678 | 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] | 4679 | } |
| 4680 | } |
| 4681 | |
| 4682 | /* SI configuration of cell, against which we validate actual SI messages */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4683 | private type set SystemInformationConfig { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4684 | boolean bcch_extended, |
| 4685 | boolean si1_present, |
| 4686 | boolean si2bis_present, |
| 4687 | boolean si2ter_present, |
| 4688 | boolean si2quater_present, |
| 4689 | boolean si7_present, |
| 4690 | boolean si8_present, |
| 4691 | boolean si9_present, |
| 4692 | boolean si13_present, |
| 4693 | boolean si13alt_present, |
| 4694 | boolean si15_present, |
| 4695 | boolean si16_present, |
| 4696 | boolean si17_present, |
| 4697 | boolean si2n_present, |
| 4698 | boolean si21_present, |
| 4699 | boolean si22_present |
| 4700 | } |
| 4701 | |
| 4702 | /* 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] | 4703 | private function f_validate_si_scheduling(SystemInformationConfig cfg, |
| 4704 | SystemInformationVectorPerTc si_per_tc) |
| 4705 | { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4706 | var integer i; |
| 4707 | for (i := 0; i < sizeof(si_per_tc); i := i + 1) { |
| 4708 | if (sizeof(si_per_tc[i]) == 0) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4709 | 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] | 4710 | } |
| 4711 | } |
| 4712 | if (cfg.si1_present) { |
| 4713 | /* ii) System Information Type 1 needs to be sent if frequency hopping is in use or |
| 4714 | * when the NCH is present in a cell. If the MS finds another message on BCCH Norm |
| 4715 | * when TC = 0, it can assume that System Information Type 1 is not in use. */ |
| 4716 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 4717 | /* make sure *ALL* contain SI1 */ |
| 4718 | f_ensure_si_vec_contains_only(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_1); |
| 4719 | } |
| 4720 | f_ensure_si_vec_contains(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_2); |
| 4721 | /* iii) A SI 2 message will be sent at least every time TC = 1 */ |
| 4722 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_3); |
| 4723 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_3); |
| 4724 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_4); |
| 4725 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_4); |
| 4726 | |
| 4727 | /* iii) System information type 2 bis or 2 ter messages are sent if needed, as determined by the |
| 4728 | * system operator. If only one of them is needed, it is sent when TC = 5. If both are |
| 4729 | * needed, 2bis is sent when TC = 5 and 2ter is sent at least once within any of 4 |
| 4730 | * consecutive occurrences of TC = 4. */ |
| 4731 | if (cfg.si2bis_present and not cfg.si2ter_present) { |
| 4732 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 4733 | } else if (cfg.si2ter_present and not cfg.si2bis_present) { |
| 4734 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2ter); |
| 4735 | } else if (cfg.si2ter_present and cfg.si2bis_present) { |
| 4736 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2bis); |
| 4737 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2ter, false, 1, 4); |
| 4738 | } |
| 4739 | |
| 4740 | if (cfg.si7_present or cfg.si8_present) { |
| 4741 | /* vi) Use of System Information type 7 and 8 is not always necessary. It is necessary |
| 4742 | * if System Information type 4 does not contain all information needed for cell |
| 4743 | * selection and reselection. */ |
| 4744 | if (not cfg.bcch_extended) { |
| 4745 | testcase.stop("Error: SI7/SI8 require BCCH Extd."); |
| 4746 | } |
| 4747 | if (cfg.si7_present) { |
| 4748 | f_ensure_si_vec_contains(si_per_tc, 7, SYSTEM_INFORMATION_TYPE_7, true); |
| 4749 | } |
| 4750 | if (cfg.si8_present) { |
| 4751 | f_ensure_si_vec_contains(si_per_tc, 3, SYSTEM_INFORMATION_TYPE_8, true); |
| 4752 | } |
| 4753 | } |
| 4754 | |
| 4755 | if (cfg.si2quater_present) { |
| 4756 | /* iii) System information type 2 quater is sent if needed, as determined by the system |
| 4757 | * operator. If sent on BCCH Norm, it shall be sent when TC = 5 if neither of 2bis |
| 4758 | * and 2ter are used, otherwise it shall be sent at least once within any of 4 |
| 4759 | * consecutive occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once |
| 4760 | * within any of 4 consecutive occurrences of TC = 5. */ |
| 4761 | if (not (cfg.bcch_extended)) { |
| 4762 | if (not (cfg.si2bis_present or cfg.si2ter_present)) { |
| 4763 | f_ensure_si_vec_contains(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater); |
| 4764 | } else { |
| 4765 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2quater, false, 1, 4); |
| 4766 | } |
| 4767 | } else { |
| 4768 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 5, SYSTEM_INFORMATION_TYPE_2quater, true, 1, 4); |
| 4769 | } |
| 4770 | } |
| 4771 | if (cfg.si9_present) { |
| 4772 | /* vi) System Information type 9 is sent in those blocks with TC = 4 which are specified |
| 4773 | * in system information type 3 as defined in 3GPP TS 44.018. */ |
| 4774 | f_ensure_si_vec_contains(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_9); // FIXME SI3 |
| 4775 | } |
| 4776 | if (cfg.si13_present) { |
| 4777 | /* vii) System Information type 13 is only related to the GPRS service. System Information |
| 4778 | * Type 13 need only be sent if GPRS support is indicated in one or more of System |
| 4779 | * Information Type 3 or 4 or 7 or 8 messages. These messages also indicate if the |
| 4780 | * message is sent on the BCCH Norm or if the message is transmitted on the BCCH Ext. |
| 4781 | * In the case that the message is sent on the BCCH Norm, it is sent at least once |
| 4782 | * within any of 4 consecutive occurrences of TC=4. */ |
| 4783 | if (not cfg.bcch_extended) { |
| 4784 | log("not-bccch-extended"); |
| 4785 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13, false, 1, 4); |
| 4786 | } else { |
| 4787 | log("bccch-extended"); |
| 4788 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13, true); |
| 4789 | } |
| 4790 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13alt)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4791 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4792 | } |
| 4793 | } |
| 4794 | if (cfg.si16_present or cfg.si17_present) { |
| 4795 | /* viii) System Information type 16 and 17 are only related to the SoLSA service. They |
| 4796 | * should not be sent in a cell where network sharing is used (see rule xv). */ |
| 4797 | if (cfg.si22_present) { |
| 4798 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 4799 | } |
| 4800 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_22)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4801 | 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] | 4802 | } |
| 4803 | if (not cfg.bcch_extended) { |
| 4804 | testcase.stop("Error: SI16/SI17 requires BCCH Extd!"); |
| 4805 | } |
| 4806 | if (cfg.si16_present) { |
| 4807 | f_ensure_si_vec_contains(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_16, true); |
| 4808 | } |
| 4809 | if (cfg.si17_present) { |
| 4810 | f_ensure_si_vec_contains(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_17, true); |
| 4811 | } |
| 4812 | } |
| 4813 | |
| 4814 | /* ix) System Information type 18 and 20 are sent in order to transmit non-GSM |
| 4815 | * broadcast information. The frequency with which they are sent is determined by the |
| 4816 | * system operator. System Information type 9 identifies the scheduling of System |
| 4817 | * Information type 18 and 20 messages. */ |
| 4818 | |
| 4819 | /* x) System Information Type 19 is sent if COMPACT neighbours exist. If System |
| 4820 | * Information Type 19 is present, then its scheduling shall be indicated in System |
| 4821 | * Information Type 9. */ |
| 4822 | |
| 4823 | if (cfg.si15_present) { |
| 4824 | /* xi) System Information Type 15 is broadcast if dynamic ARFCN mapping is used in the |
| 4825 | * PLMN. If sent on BCCH Norm, it is sent at least once within any of 4 consecutive |
| 4826 | * occurrences of TC = 4. If sent on BCCH Ext, it is sent at least once within any of |
| 4827 | * 4 consecutive occurrences of TC = 1. */ |
| 4828 | if (not cfg.bcch_extended) { |
| 4829 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_15, false, 1, 4); |
| 4830 | } else { |
| 4831 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 1, SYSTEM_INFORMATION_TYPE_15, true, 1, 4); |
| 4832 | } |
| 4833 | } |
| 4834 | if (cfg.si13alt_present) { |
| 4835 | /* xii) System Information type 13 alt is only related to the GERAN Iu mode. System |
| 4836 | * Information Type 13 alt need only be sent if GERAN Iu mode support is indicated in |
| 4837 | * one or more of System Information Type 3 or 4 or 7 or 8 messages and SI 13 is not |
| 4838 | * broadcast. These messages also indicate if the message is sent on the BCCH Norm or |
| 4839 | * if the message is transmitted on the BCCH Ext. In the case that the message is sent |
| 4840 | * on the BCCH Norm, it is sent at least once within any of 4 consecutive occurrences |
| 4841 | * of TC = 4. */ |
| 4842 | if (cfg.si13_present) { |
| 4843 | testcase.stop("Error: Cannot have SI13alt and SI13"); |
| 4844 | } |
| 4845 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_13)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4846 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Cannot have SI13alt and SI13"); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4847 | } |
| 4848 | if (not cfg.bcch_extended) { |
| 4849 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_13alt, false, 1, 4); |
| 4850 | } else { |
| 4851 | f_ensure_si_vec_contains(si_per_tc, 0, SYSTEM_INFORMATION_TYPE_13alt, true); |
| 4852 | } |
| 4853 | } |
| 4854 | if (cfg.si2n_present) { |
| 4855 | /* xiii) System Information Type 2n is optionally sent on BCCH Norm or BCCH Ext if needed, |
| 4856 | * as determined by the system operator. In the case that the message is sent on the |
| 4857 | * BCCH Norm, it is sent at least once within any of 4 consecutive occurrences of TC = |
| 4858 | * 4. If the message is sent on BCCH Ext, it is sent at least once within any of 2 |
| 4859 | * consecutive occurrences of TC = 4. */ |
| 4860 | if (not cfg.bcch_extended) { |
| 4861 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, false, 1, 4); |
| 4862 | } else { |
| 4863 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_2n, true, 2, 4); |
| 4864 | } |
| 4865 | } |
| 4866 | if (cfg.si21_present) { |
| 4867 | /* xiv) System Information Type 21 is optionally sent on BCCH Norm or BCCH Ext, as |
| 4868 | * determined by the system operator. If Extended Access Barring is in use in the cell |
| 4869 | * then this message is sent at least once within any of 4 consecutive occurrences of |
| 4870 | * TC = 4 regardless if it is sent on BCCH Norm or BCCH Ext. If BCCH Ext is used in a |
| 4871 | * cell then this message shall only be sent on BCCH Ext. */ |
| 4872 | if (not cfg.bcch_extended) { |
| 4873 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, false, 1, 4); |
| 4874 | } else { |
| 4875 | f_ensure_si_vec_contains_n_of_m(si_per_tc, 4, SYSTEM_INFORMATION_TYPE_21, true, 1, 4); |
| 4876 | 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] | 4877 | 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] | 4878 | } |
| 4879 | } |
| 4880 | } |
| 4881 | if (cfg.si22_present) { |
| 4882 | /* xv) System Information Type 22 is sent if network sharing is in use in the cell. It |
| 4883 | * should not be sent in a cell where SoLSA is used (see rule viii). System |
| 4884 | * Information Type 22 instances shall be sent on BCCH Ext within any occurrence of TC |
| 4885 | * =2 and TC=6. */ |
| 4886 | if (cfg.si16_present or cfg.si17_present) { |
| 4887 | testcase.stop("Error: Cannot have SI16/SI17 and SI22!"); |
| 4888 | } |
| 4889 | if (f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_16) or |
| 4890 | f_si_vec_contains(si_per_tc, SYSTEM_INFORMATION_TYPE_17)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4891 | 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] | 4892 | } |
| 4893 | if (not cfg.bcch_extended) { |
| 4894 | testcase.stop("Error: SI22 requires BCCH Extd!"); |
| 4895 | } else { |
| 4896 | f_ensure_si_vec_contains_only(si_per_tc, 2, SYSTEM_INFORMATION_TYPE_22, true); |
| 4897 | f_ensure_si_vec_contains_only(si_per_tc, 6, SYSTEM_INFORMATION_TYPE_22, true); |
| 4898 | } |
| 4899 | } |
| 4900 | } |
| 4901 | |
| 4902 | /* sample Systme Information for specified duration via L1CTL */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 4903 | private function f_l1_sample_si(L1CTL_PT pt, float duration := 8.0) |
| 4904 | return SystemInformationVectorPerTc { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4905 | timer T := duration; |
| 4906 | var SystemInformationVectorPerTc si_per_tc; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 4907 | var L1ctlMessage l1_dl; |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4908 | |
| 4909 | /* initialize all per-TC vectors empty */ |
| 4910 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 4911 | si_per_tc[i] := {}; |
| 4912 | } |
| 4913 | |
| 4914 | /* flush all previous L1 queued msgs */ |
| 4915 | pt.clear; |
| 4916 | |
| 4917 | T.start; |
| 4918 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 4919 | [] 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] | 4920 | var SystemInformationFn sig := { frame_number := l1_dl.dl_info.frame_nr }; |
| 4921 | if (dec_SystemInformationSafe(l1_dl.payload.data_ind.payload, sig.si) != 0) { |
| 4922 | log("Ignoring non-RR or invalid SI ", l1_dl); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4923 | repeat; |
| 4924 | } |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 4925 | |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4926 | var integer tc := f_gsm_compute_tc(sig.frame_number); |
| 4927 | log("SI received at TC=", tc, ": ", sig.si); |
| 4928 | /* append to the per-TC bucket */ |
| 4929 | si_per_tc[tc] := si_per_tc[tc] & { sig }; |
| 4930 | repeat; |
| 4931 | } |
| 4932 | [] pt.receive { repeat; } |
| 4933 | [] T.timeout { } |
| 4934 | } |
| 4935 | |
| 4936 | for (var integer i:= 0; i < sizeof(si_per_tc); i := i+1) { |
| 4937 | log(testcasename(), ": TC=", i, " has #of SI=", sizeof(si_per_tc[i])); |
| 4938 | } |
| 4939 | log("si_per_tc=", si_per_tc); |
| 4940 | return si_per_tc; |
| 4941 | } |
| 4942 | |
| 4943 | /* helper function: Set given SI via RSL + validate scheduling. |
| 4944 | * CALLER MUST MAKE SURE TO CHANGE GLOBAL si_cfg! */ |
Harald Welte | 9b965d5 | 2020-10-11 21:28:22 +0200 | [diff] [blame] | 4945 | private function f_TC_si_sched(float duration := 8.0) runs on test_CT { |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4946 | var SystemInformationVectorPerTc si_per_tc; |
| 4947 | f_init_l1ctl(); |
| 4948 | f_l1_tune(L1CTL); |
| 4949 | |
| 4950 | /* Sample + Validate Scheduling */ |
Harald Welte | 9b965d5 | 2020-10-11 21:28:22 +0200 | [diff] [blame] | 4951 | si_per_tc := f_l1_sample_si(L1CTL, duration); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4952 | f_validate_si_scheduling(si_cfg, si_per_tc); |
| 4953 | |
| 4954 | setverdict(pass); |
| 4955 | } |
| 4956 | |
| 4957 | testcase TC_si_sched_default() runs on test_CT { |
| 4958 | f_init(); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 4959 | /* 2+3+4 are mandatory and set in f_init() */ |
| 4960 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4961 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 4962 | } |
| 4963 | |
| 4964 | testcase TC_si_sched_1() runs on test_CT { |
| 4965 | f_init(); |
| 4966 | si_cfg.si1_present := true; |
| 4967 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_1, '5506198fb38000000000000000000000000000e504002b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4968 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4969 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4970 | } |
| 4971 | |
| 4972 | testcase TC_si_sched_2bis() runs on test_CT { |
| 4973 | f_init(); |
| 4974 | si_cfg.si2bis_present := true; |
| 4975 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 4976 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4977 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4978 | } |
| 4979 | |
| 4980 | testcase TC_si_sched_2ter() runs on test_CT { |
| 4981 | f_init(); |
| 4982 | si_cfg.si2ter_present := true; |
| 4983 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 4984 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4985 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4986 | } |
| 4987 | |
| 4988 | testcase TC_si_sched_2ter_2bis() runs on test_CT { |
| 4989 | f_init(); |
| 4990 | si_cfg.si2bis_present := true; |
| 4991 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 4992 | si_cfg.si2ter_present := true; |
| 4993 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 4994 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 4995 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 4996 | } |
| 4997 | |
| 4998 | testcase TC_si_sched_2quater() runs on test_CT { |
| 4999 | f_init(); |
| 5000 | si_cfg.si2quater_present := true; |
Vadim Yanitskiy | 3bb3b60 | 2020-10-24 21:24:05 +0700 | [diff] [blame] | 5001 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607b10004864982eddb8d555867ee3c95540b2b2b2b'O); |
Harald Welte | 9b965d5 | 2020-10-11 21:28:22 +0200 | [diff] [blame] | 5002 | f_TC_si_sched(16.0); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5003 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5004 | } |
| 5005 | |
| 5006 | testcase TC_si_sched_13() runs on test_CT { |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 5007 | /* NOTE: PCUIF connection is not used in this test case, but |
| 5008 | * without it the IUT would not broadcast SI13 (see OS#3075). */ |
| 5009 | f_init_with_pcuif(); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5010 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 5011 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5012 | f_TC_si_sched(); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5013 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5014 | } |
| 5015 | |
| 5016 | testcase TC_si_sched_13_2bis_2ter_2quater() runs on test_CT { |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 5017 | /* NOTE: PCUIF connection is not used in this test case, but |
| 5018 | * without it the IUT would not broadcast SI13 (see OS#3075). */ |
| 5019 | f_init_with_pcuif(); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5020 | si_cfg.si2bis_present := true; |
| 5021 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2bis, '550602bfe809b3ff00000000000000000000007900002b'O); |
| 5022 | si_cfg.si2ter_present := true; |
| 5023 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2ter, '010603bf66b0aa0a00000002000000000000002b2b2b2b'O); |
| 5024 | si_cfg.si2quater_present := true; |
Vadim Yanitskiy | 3bb3b60 | 2020-10-24 21:24:05 +0700 | [diff] [blame] | 5025 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_2quater, '050607b10004864982eddb8d555867ee3c95540b2b2b2b'O); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5026 | si_cfg.si13_present := true; |
Harald Welte | 5618c2a | 2018-04-15 16:24:46 +0200 | [diff] [blame] | 5027 | f_rsl_bcch_fill_raw(RSL_SYSTEM_INFO_13, '0106009000185a6fc9e08410ab2b2b2b2b2b2b2b2b2b2b'O); |
Harald Welte | 9b965d5 | 2020-10-11 21:28:22 +0200 | [diff] [blame] | 5028 | f_TC_si_sched(16.0); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5029 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 5030 | } |
| 5031 | |
| 5032 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 5033 | testcase TC_bcch_info() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5034 | f_init(); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 5035 | /* FIXME: enable / disable individual BCCH info */ |
| 5036 | //ts_RSL_BCCH_INFO(si_type, info); |
| 5037 | /* expect no ERROR REPORT after either of them * |
| 5038 | /* negative test: ensure ERROR REPORT on unsupported types */ |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5039 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 5040 | } |
| 5041 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 5042 | /*********************************************************************** |
| 5043 | * Low-Level Protocol Errors / ERROR REPORT |
| 5044 | ***********************************************************************/ |
| 5045 | |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5046 | private function f_exp_err_rep(template RSL_Cause cause) runs on test_CT { |
| 5047 | timer T := 5.0; |
| 5048 | T.start; |
| 5049 | alt { |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5050 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_ERROR_REPORT(cause))) { |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5051 | setverdict(pass); |
| 5052 | } |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5053 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_ERROR_REPORT(?))) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5054 | 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] | 5055 | } |
| 5056 | [] RSL_CCHAN.receive { |
| 5057 | repeat; |
| 5058 | } |
| 5059 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5060 | 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] | 5061 | } |
| 5062 | } |
| 5063 | } |
| 5064 | |
| 5065 | /* Provoke a protocol error (message too short) and match on ERROR REPORT */ |
| 5066 | testcase TC_rsl_protocol_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5067 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5068 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 5069 | rsl.ies := omit; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5070 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5071 | |
| 5072 | f_exp_err_rep(RSL_ERR_PROTO); |
| 5073 | } |
| 5074 | |
| 5075 | /* Provoke a mandatory IE error and match on ERROR REPORT */ |
| 5076 | testcase TC_rsl_mand_ie_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5077 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5078 | |
| 5079 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 5080 | rsl.ies := { rsl.ies[0] }; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5081 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5082 | |
| 5083 | f_exp_err_rep(RSL_ERR_MAND_IE_ERROR); |
| 5084 | } |
| 5085 | |
| 5086 | /* Provoke an IE content error and match on ERROR REPORT */ |
| 5087 | testcase TC_rsl_ie_content_error() runs on test_CT { |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5088 | f_init(); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5089 | var RSL_Message rsl := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 5090 | rsl.ies[1].body.sysinfo_type := RSL_SYSTEM_INFO_5; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5091 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl)); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 5092 | |
| 5093 | f_exp_err_rep(RSL_ERR_IE_CONTENT); |
| 5094 | } |
| 5095 | |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5096 | /* attempt to activate channel with wrong RSL Message Discriminator IE */ |
| 5097 | function f_TC_chan_act_wrong_mdisc(charstring id) runs on ConnHdlr { |
| 5098 | var template RSL_Message rsl := ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode); |
| 5099 | rsl.msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RESERVED, false); |
| 5100 | RSL.send(rsl); |
| 5101 | f_rslem_unregister(0, g_chan_nr); |
| 5102 | } |
| 5103 | testcase TC_err_rep_wrong_mdisc() runs on test_CT { |
| 5104 | var ConnHdlr vc_conn; |
| 5105 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 5106 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5107 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5108 | |
| 5109 | vc_conn := f_start_handler(refers(f_TC_chan_act_wrong_mdisc), pars); |
| 5110 | vc_conn.done; |
| 5111 | f_exp_err_rep(RSL_ERR_MSG_DISCR); |
| 5112 | |
| 5113 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5114 | } |
| 5115 | |
| 5116 | /* Send messages with wrong message type */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5117 | 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] | 5118 | var template (value) RSL_Message rsl_tx; |
| 5119 | rsl_tx := ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode); |
| 5120 | rsl_tx.msg_type := RSL_MT_NOT_CMD; |
| 5121 | RSL.send(rsl_tx); |
| 5122 | f_rslem_unregister(0, g_chan_nr); |
| 5123 | } |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5124 | 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] | 5125 | var template (value) RSL_Message rsl_tx; |
| 5126 | /* we first have to activate the dedicated channel */ |
| 5127 | f_rsl_chan_act(g_pars.chan_mode); |
| 5128 | /* ... to then send an invalid RLL message */ |
| 5129 | rsl_tx := ts_RSL_UNITDATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), '0102'O); |
| 5130 | rsl_tx.msg_type := RSL_MT_CBCH_LOAD_IND; |
| 5131 | RSL.send(rsl_tx); |
| 5132 | f_rslem_unregister(0, g_chan_nr); |
| 5133 | } |
| 5134 | testcase TC_err_rep_wrong_msg_type() runs on test_CT { |
| 5135 | var ConnHdlr vc_conn; |
| 5136 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 5137 | var template (value) RSL_Message rsl_tx; |
| 5138 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5139 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5140 | |
| 5141 | /* Common Channel with wrong message type */ |
| 5142 | RSL_CCHAN.clear; |
| 5143 | rsl_tx := valueof(ts_RSL_BCCH_INFO(RSL_SYSTEM_INFO_1, ''O)); |
| 5144 | rsl_tx.msg_type := RSL_MT_LOCATION_INFO; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5145 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl_tx)); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5146 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 5147 | |
| 5148 | /* TRX Management */ |
| 5149 | RSL_CCHAN.clear; |
| 5150 | rsl_tx := ts_RSL_SACCH_FILL(RSL_SYSTEM_INFO_5, ''O); |
| 5151 | rsl_tx.msg_type := RSL_MT_UNIT_DATA_IND; |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 5152 | RSL_CCHAN.send(ts_ASP_RSL_UD(rsl_tx)); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5153 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 5154 | |
| 5155 | /* Dedicated Channel */ |
| 5156 | RSL_CCHAN.clear; |
| 5157 | vc_conn := f_start_handler(refers(f_TC_wrong_msg_type_dchan), pars); |
| 5158 | vc_conn.done; |
| 5159 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 5160 | |
| 5161 | /* RLL */ |
| 5162 | RSL_CCHAN.clear; |
| 5163 | vc_conn := f_start_handler(refers(f_TC_wrong_msg_type_rll), pars); |
| 5164 | vc_conn.done; |
| 5165 | f_exp_err_rep(RSL_ERR_MSG_TYPE); |
| 5166 | } |
| 5167 | |
| 5168 | /* Send messages in wrong sequence (RLL to an inactive lchan) */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5169 | 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] | 5170 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, ts_RslLinkID_DCCH(0), '0102'O)); |
| 5171 | f_rslem_unregister(0, g_chan_nr); |
| 5172 | } |
| 5173 | testcase TC_err_rep_wrong_sequence() runs on test_CT { |
| 5174 | var ConnHdlr vc_conn; |
| 5175 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_SDCCH4(0,0), ts_RSL_ChanMode_SIGN)); |
| 5176 | |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5177 | f_init(); |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 5178 | |
| 5179 | RSL_CCHAN.clear; |
| 5180 | vc_conn := f_start_handler(refers(f_TC_err_rep_wrong_sequence), pars); |
| 5181 | vc_conn.done; |
| 5182 | f_exp_err_rep(RSL_ERR_MSG_SEQ); |
| 5183 | } |
| 5184 | |
Harald Welte | 93640c6 | 2018-02-25 16:59:33 +0100 | [diff] [blame] | 5185 | /*********************************************************************** |
| 5186 | * IPA CRCX/MDCX/DLCS media stream handling |
| 5187 | ***********************************************************************/ |
| 5188 | |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 5189 | /* Send IPA DLCX to inactive lchan */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5190 | 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] | 5191 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, 0), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 5192 | "IPA DLCX ACK"); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 5193 | } |
| 5194 | testcase TC_ipa_dlcx_not_active() runs on test_CT { |
| 5195 | 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] | 5196 | f_init(); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 5197 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_dlcx_not_active), pars); |
| 5198 | vc_conn.done; |
| 5199 | } |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 5200 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 5201 | /* Send IPA CRCX twice to inactive lchan */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5202 | 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] | 5203 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 5204 | "IPA CRCX ACK"); |
| 5205 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, RSL_ERR_RES_UNAVAIL), |
| 5206 | "IPA CRCX NACK"); |
| 5207 | } |
| 5208 | testcase TC_ipa_crcx_twice_not_active() runs on test_CT { |
| 5209 | 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] | 5210 | f_init(); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 5211 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_twice_not_active), pars); |
| 5212 | vc_conn.done; |
| 5213 | } |
| 5214 | |
| 5215 | /* Regular sequence of CRCX/MDCX/DLCX */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5216 | 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] | 5217 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 5218 | "IPA CRCX ACK"); |
Vadim Yanitskiy | fc63164 | 2021-07-03 02:42:45 +0200 | [diff] [blame] | 5219 | var OCT4 remote_ip := f_rnd_octstring(4); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 5220 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 5221 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 5222 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 5223 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 5224 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 5225 | "IPA MDCX ACK"); |
| 5226 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 5227 | "IPA DLCX ACK"); |
| 5228 | } |
| 5229 | testcase TC_ipa_crcx_mdcx_dlcx_not_active() runs on test_CT { |
| 5230 | 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] | 5231 | f_init(); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 5232 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_dlcx_not_active), pars); |
| 5233 | vc_conn.done; |
| 5234 | } |
| 5235 | |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 5236 | /* Sequence of CRCX, 2x MDCX, DLCX */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5237 | 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] | 5238 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 5239 | "IPA CRCX ACK"); |
Vadim Yanitskiy | fc63164 | 2021-07-03 02:42:45 +0200 | [diff] [blame] | 5240 | var OCT4 remote_ip := f_rnd_octstring(4); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 5241 | var uint16_t remote_port := f_rnd_int(c_UINT16_MAX); |
| 5242 | var uint7_t rtp_pt2 := f_rnd_int(127); |
| 5243 | var uint16_t fake_conn_id := 23; /* we're too lazy to read it out from the CRCX ACK above */ |
| 5244 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 5245 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 5246 | "IPA MDCX ACK"); |
| 5247 | /* Second MDCX */ |
Vadim Yanitskiy | fc63164 | 2021-07-03 02:42:45 +0200 | [diff] [blame] | 5248 | remote_ip := f_rnd_octstring(4); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 5249 | remote_port := f_rnd_int(c_UINT16_MAX); |
| 5250 | f_rsl_transceive(ts_RSL_IPA_MDCX(g_chan_nr, fake_conn_id, remote_ip, remote_port, rtp_pt2), |
| 5251 | tr_RSL_IPA_MDCX_ACK(g_chan_nr, ?, ?, ?, rtp_pt2), |
| 5252 | "IPA MDCX ACK"); |
| 5253 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, fake_conn_id), tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 5254 | "IPA DLCX ACK"); |
| 5255 | } |
| 5256 | testcase TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() runs on test_CT { |
| 5257 | 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] | 5258 | f_init(); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 5259 | var ConnHdlr vc_conn := f_start_handler(refers(f_TC_ipa_crcx_mdcx_mdcx_dlcx_not_active), pars); |
| 5260 | vc_conn.done; |
| 5261 | } |
| 5262 | |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 5263 | /* IPA CRCX on SDCCH/4 and SDCCH/8 (doesn't make sense) */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 5264 | 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] | 5265 | f_rsl_transceive(ts_RSL_IPA_CRCX(g_chan_nr), tr_RSL_IPA_CRCX_NACK(g_chan_nr, ?), |
| 5266 | "IPA CRCX NACK"); |
| 5267 | } |
| 5268 | testcase TC_ipa_crcx_sdcch_not_active() runs on test_CT { |
| 5269 | var ConnHdlrPars pars; |
| 5270 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 5271 | f_init(); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 5272 | |
| 5273 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,1), ts_RSL_ChanMode_SIGN)); |
| 5274 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 5275 | vc_conn.done; |
| 5276 | |
| 5277 | pars := valueof(t_Pars(t_RslChanNr_SDCCH8(6,5), ts_RSL_ChanMode_SIGN)); |
| 5278 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_sdcch_not_active), pars); |
| 5279 | vc_conn.done; |
| 5280 | } |
| 5281 | |
Vadim Yanitskiy | 866afc2 | 2022-05-01 16:08:30 +0300 | [diff] [blame] | 5282 | /* Make sure that CRCX ACK contains a valid listen address (see OS#5242) */ |
| 5283 | private function f_TC_ipa_crcx_ack_addr(charstring id) runs on ConnHdlr { |
| 5284 | var OCT4 bind_ip := f_inet_addr("192.168.1.1"); |
| 5285 | var PortNumber bind_port := 16811; |
| 5286 | var RSL_Message crcx_ack; |
| 5287 | |
| 5288 | crcx_ack := f_rsl_transceive_ret(ts_RSL_IPA_CRCX(g_chan_nr, bind_ip, bind_port), |
| 5289 | tr_RSL_IPA_CRCX_ACK(g_chan_nr, ?, ?, ?), |
| 5290 | "IPA CRCX ACK"); |
| 5291 | var HostName bts_bind_ip := f_inet_ntoa(crcx_ack.ies[2].body.ipa_local_ip); |
| 5292 | if (match(bts_bind_ip, "0.0.0.0")) { |
| 5293 | setverdict(fail, "CRCX ACK indicates nonsense addr ", bts_bind_ip); |
| 5294 | } |
| 5295 | |
| 5296 | var uint16_t conn_id := crcx_ack.ies[1].body.ipa_conn_id; |
| 5297 | f_rsl_transceive(ts_RSL_IPA_DLCX(g_chan_nr, conn_id), |
| 5298 | tr_RSL_IPA_DLCX_ACK(g_chan_nr, ?, ?), |
| 5299 | "IPA DLCX ACK"); |
| 5300 | } |
| 5301 | testcase TC_ipa_crcx_ack_addr() runs on test_CT { |
| 5302 | var ConnHdlrPars pars; |
| 5303 | var ConnHdlr vc_conn; |
| 5304 | f_init(); |
| 5305 | |
| 5306 | pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))); |
| 5307 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_ack_addr), pars); |
| 5308 | vc_conn.done; |
| 5309 | |
| 5310 | pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))); |
| 5311 | vc_conn := f_start_handler(refers(f_TC_ipa_crcx_ack_addr), pars); |
| 5312 | vc_conn.done; |
| 5313 | } |
| 5314 | |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 5315 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5316 | /*********************************************************************** |
| 5317 | * PCU Socket related tests |
| 5318 | ***********************************************************************/ |
| 5319 | |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5320 | /* Catch a PCUIF message (without having to use t_SD_PCUIF) */ |
| 5321 | private altstep as_pcuif_msg(out PCUIF_Message msg, |
| 5322 | template (present) PCUIF_Message tr_msg := ?) |
| 5323 | runs on test_CT { |
| 5324 | var PCUIF_send_data sd; |
| 5325 | |
| 5326 | [] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_msg)) -> value sd { |
| 5327 | msg := sd.data; |
| 5328 | } |
| 5329 | } |
| 5330 | |
Vadim Yanitskiy | c70a626 | 2023-05-31 04:42:08 +0700 | [diff] [blame] | 5331 | /* Catch a L1CTL DL BLOCK.ind with the given parameters */ |
| 5332 | private altstep as_l1ctl_dl_block_ind(out L1ctlGprsDlBlockInd block_ind, |
| 5333 | template (present) GsmFrameNumber fn := ?, |
| 5334 | template (present) uint3_t tn := ?, |
| 5335 | template (present) uint3_t usf := ?, |
| 5336 | template (present) octetstring data := ?) |
| 5337 | runs on test_CT { |
| 5338 | var L1ctlMessage l1_dl; |
| 5339 | |
| 5340 | [] L1CTL.receive(tr_L1CTL_GPRS_DL_BLOCK_IND(fn, tn, usf, data)) -> value l1_dl { |
| 5341 | block_ind := l1_dl.payload.dl_block_ind; |
| 5342 | } |
| 5343 | } |
| 5344 | |
| 5345 | /* tuple of TDMA frame number and timeslot number */ |
| 5346 | private type record TdmaFnTn { |
| 5347 | GsmFrameNumber fn, |
| 5348 | uint3_t tn |
| 5349 | } |
| 5350 | |
| 5351 | /* Wait for a L1CTL DL BLOCK.ind and send an UL BLOCK.req */ |
| 5352 | private function f_TC_pcu_tx_ul_block_req(octetstring data, |
| 5353 | template (present) uint3_t tn := ?, |
| 5354 | template (present) uint3_t usf := ?) |
| 5355 | runs on test_CT return TdmaFnTn { |
| 5356 | var L1ctlGprsDlBlockInd block_ind; |
| 5357 | timer T; |
| 5358 | |
| 5359 | T.start(1.0); |
| 5360 | alt { |
| 5361 | [] as_l1ctl_dl_block_ind(block_ind, tn := tn, usf := usf) { |
| 5362 | var integer fn := block_ind.hdr.fn; |
| 5363 | |
| 5364 | /* Ignore PTCCH/D blocks, their Fn is too far away */ |
| 5365 | if (fn mod 104 == 12) { |
| 5366 | repeat; |
| 5367 | } |
| 5368 | |
| 5369 | /* Every fn % 13 == 12 we have either a PTCCH or an IDLE slot, thus |
| 5370 | * every fn % 13 == 8 we add 5 frames, or 4 frames othrwise. The |
| 5371 | * resulting value is first fn of the next block. */ |
| 5372 | if (fn mod 13 == 8) { |
| 5373 | fn := (fn + 5) mod (2048 * 51 * 26); |
| 5374 | } else { |
| 5375 | fn := (fn + 4) mod (2048 * 51 * 26); |
| 5376 | } |
| 5377 | |
| 5378 | L1CTL.send(ts_L1CTL_GPRS_UL_BLOCK_REQ(fn, block_ind.hdr.tn, data)); |
| 5379 | return {fn, block_ind.hdr.tn}; |
| 5380 | } |
| 5381 | [] L1CTL.receive { repeat; } |
| 5382 | [] T.timeout { |
| 5383 | setverdict(fail, "Timeout waiting for DL BLOCK.ind (RTS)"); |
| 5384 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 5385 | } |
| 5386 | } |
| 5387 | |
| 5388 | return {0, 0}; /* make TITAN happy */ |
| 5389 | } |
| 5390 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5391 | /* Tune the L1 to PDCH on the given timeslot number */ |
| 5392 | private function f_TC_pcu_l1ctl_est_pdch(uint3_t tn) runs on test_CT { |
| 5393 | var ConnHdlrPars pars := valueof(t_Pars(ts_RslChanNr_PDCH(tn), ts_RSL_ChanMode_SIGN)); |
| 5394 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) |
| 5395 | { f_resolve_fh_params(pars.fhp, tn); } |
| 5396 | f_l1ctl_est_dchan(L1CTL, pars); |
| 5397 | } |
| 5398 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 5399 | /* Verify no RTS before ACT_REQ; verify RTS after ACT_REQ */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5400 | 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] | 5401 | runs on test_CT { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5402 | var PCUIF_Message msg; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5403 | timer T := 3.0; |
| 5404 | |
| 5405 | /* we don't expect any RTS.req before PDCH are active */ |
| 5406 | T.start; |
| 5407 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5408 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(bts_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5409 | 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] | 5410 | } |
| 5411 | [] PCU.receive { repeat; } |
| 5412 | [] T.timeout { } |
| 5413 | } |
| 5414 | |
| 5415 | /* Send PDCH activate request for known PDCH timeslot */ |
| 5416 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, ts_nr))); |
| 5417 | |
| 5418 | /* we now expect RTS.req for this timeslot (only) */ |
| 5419 | T.start; |
| 5420 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5421 | [exp_success] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5422 | setverdict(pass); |
| 5423 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5424 | [not exp_success] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5425 | 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] | 5426 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5427 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5428 | 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] | 5429 | } |
| 5430 | [] PCU.receive { repeat; } |
| 5431 | [exp_success] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5432 | 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] | 5433 | } |
| 5434 | [not exp_success] T.timeout { |
| 5435 | setverdict(pass); |
| 5436 | } |
| 5437 | } |
| 5438 | } |
| 5439 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 5440 | /* verify no more RTS after DEACT_REQ */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5441 | 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] | 5442 | runs on test_CT { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5443 | var PCUIF_Message msg; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5444 | timer T := 3.0; |
| 5445 | |
| 5446 | /* Send PDCH activate request for known PDCH timeslot */ |
| 5447 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, ts_nr))); |
Harald Welte | c87d81f | 2020-10-11 18:17:25 +0200 | [diff] [blame] | 5448 | /* wait for some time as there is no PCUIF_DEACT_RESP or the like, so we don't know |
| 5449 | * when it will actually have been executed in the BTS */ |
| 5450 | f_sleep(1.0); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5451 | PCU.clear; |
| 5452 | /* we now expect no RTS.req for this timeslot */ |
| 5453 | T.start; |
| 5454 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5455 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5456 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received unexpected PCU RTS.req"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5457 | } |
| 5458 | [] PCU.receive { repeat; } |
| 5459 | [] T.timeout { |
| 5460 | setverdict(pass); |
| 5461 | } |
| 5462 | } |
| 5463 | } |
| 5464 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5465 | friend function f_init_with_pcuif() runs on test_CT { |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5466 | f_init(); |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 5467 | map(self:PCU, system:PCU); |
| 5468 | f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5469 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename()))); |
| 5470 | } |
| 5471 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5472 | /* PDCH activation via PCU socket; check for presence of RTS.req */ |
| 5473 | testcase TC_pcu_act_req() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5474 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5475 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5476 | f_TC_pcu_act_req(0, 0, 7, true); |
| 5477 | } |
| 5478 | |
| 5479 | /* PDCH activation via PCU socket on non-PDCU timeslot */ |
| 5480 | testcase TC_pcu_act_req_wrong_ts() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5481 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5482 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5483 | f_TC_pcu_act_req(0, 0, 1, false); |
| 5484 | } |
| 5485 | |
| 5486 | /* PDCH activation via PCU socket on wrong BTS */ |
| 5487 | testcase TC_pcu_act_req_wrong_bts() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5488 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5489 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5490 | f_TC_pcu_act_req(23, 0, 7, false); |
| 5491 | } |
| 5492 | |
| 5493 | /* PDCH activation via PCU socket on wrong TRX */ |
| 5494 | testcase TC_pcu_act_req_wrong_trx() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5495 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5496 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5497 | f_TC_pcu_act_req(0, 23, 7, false); |
| 5498 | } |
| 5499 | |
| 5500 | /* PDCH deactivation via PCU socket; check for absence of RTS.req */ |
| 5501 | testcase TC_pcu_deact_req() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5502 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5503 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5504 | /* Activate PDCH */ |
| 5505 | f_TC_pcu_act_req(0, 0, 7, true); |
| 5506 | f_sleep(1.0); |
| 5507 | /* and De-Activate again */ |
| 5508 | f_TC_pcu_deact_req(0, 0, 7); |
| 5509 | } |
| 5510 | |
| 5511 | /* Attempt to deactivate a PDCH on a non-PDCH timeslot */ |
| 5512 | testcase TC_pcu_deact_req_wrong_ts() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5513 | f_init_with_pcuif(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5514 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5515 | f_TC_pcu_deact_req(0, 0, 1); |
| 5516 | } |
| 5517 | |
| 5518 | /* Test the PCU->BTS Version and BTS->PCU SI13 handshake */ |
Philipp Maier | 94c0848 | 2021-02-01 17:36:05 +0100 | [diff] [blame] | 5519 | function f_TC_pcu_ver_siXX(octetstring si, RSL_IE_SysinfoType rsl_si_type) runs on test_CT { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5520 | var PCUIF_Message msg; |
| 5521 | timer T := 3.0; |
| 5522 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5523 | f_init_with_pcuif(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5524 | |
| 5525 | /* Set SI13 via RSL */ |
Philipp Maier | 94c0848 | 2021-02-01 17:36:05 +0100 | [diff] [blame] | 5526 | f_rsl_bcch_fill_raw(rsl_si_type, si); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5527 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5528 | T.start; |
| 5529 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5530 | [] as_pcuif_msg(msg, tr_PCUIF_DATA_IND(0, 0, 0, sapi := PCU_IF_SAPI_BCCH)) { |
| 5531 | if (substr(msg.u.data_ind.data, 0, lengthof(si)) == si) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5532 | setverdict(pass); |
| 5533 | } else { |
| 5534 | repeat; |
| 5535 | } |
| 5536 | } |
| 5537 | [] PCU.receive { repeat; } |
| 5538 | [] T.timeout { |
Philipp Maier | 94c0848 | 2021-02-01 17:36:05 +0100 | [diff] [blame] | 5539 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SI"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5540 | } |
| 5541 | } |
| 5542 | } |
| 5543 | |
Philipp Maier | 94c0848 | 2021-02-01 17:36:05 +0100 | [diff] [blame] | 5544 | /* Test the PCU->BTS Version and BTS->PCU SI1 handshake */ |
| 5545 | testcase TC_pcu_ver_si1() runs on test_CT { |
| 5546 | const octetstring si1 := '550111132A252B27CC29AA11BB33CC'O; |
| 5547 | f_TC_pcu_ver_siXX(si1, RSL_SYSTEM_INFO_1); |
| 5548 | } |
| 5549 | |
| 5550 | /* Test the PCU->BTS Version and BTS->PCU SI3 handshake */ |
| 5551 | testcase TC_pcu_ver_si3() runs on test_CT { |
| 5552 | const octetstring si3 := '49012223242526272929AABBCC'O; |
| 5553 | f_TC_pcu_ver_siXX(si3, RSL_SYSTEM_INFO_3); |
| 5554 | } |
| 5555 | |
| 5556 | /* Test the PCU->BTS Version and BTS->PCU SI13 handshake */ |
| 5557 | testcase TC_pcu_ver_si13() runs on test_CT { |
| 5558 | const octetstring si13 := '01010203040506070909'O; |
| 5559 | f_TC_pcu_ver_siXX(si13, RSL_SYSTEM_INFO_13); |
| 5560 | } |
| 5561 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5562 | private const octetstring c_PCU_DATA := '000102030405060708090a0b0c0d0e0f10111213141516'O; |
| 5563 | |
| 5564 | /* helper function to send a PCU DATA.req */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5565 | 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] | 5566 | uint8_t block_nr, uint32_t fn, PCUIF_Sapi sapi, octetstring data) |
| 5567 | runs on test_CT |
| 5568 | { |
| 5569 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, |
| 5570 | ts_PCUIF_DATA_REQ(bts_nr, trx_nr, ts_nr, block_nr, fn, sapi, data))); |
| 5571 | } |
| 5572 | |
| 5573 | /* 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] | 5574 | friend function f_pcu_wait_rts_and_data_req(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr, |
| 5575 | PCUIF_Sapi sapi, octetstring data) |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5576 | runs on test_CT |
| 5577 | { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5578 | var PCUIF_Message msg; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5579 | timer T := 3.0; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5580 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5581 | T.start; |
| 5582 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5583 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(bts_nr, trx_nr, ts_nr, sapi)) { |
| 5584 | f_pcu_data_req(bts_nr, trx_nr, ts_nr, msg.u.rts_req.block_nr, |
| 5585 | msg.u.rts_req.fn, sapi, data); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5586 | } |
| 5587 | [] PCU.receive { repeat; } |
| 5588 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5589 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RTS.ind"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5590 | } |
| 5591 | } |
| 5592 | } |
| 5593 | |
| 5594 | /* Send DATA.req on invalid BTS */ |
| 5595 | testcase TC_pcu_data_req_wrong_bts() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5596 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5597 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5598 | f_TC_pcu_init(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5599 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5600 | f_TC_pcu_act_req(0, 0, 7, true); |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5601 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5602 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5603 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5604 | 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] | 5605 | } |
| 5606 | |
| 5607 | /* Send DATA.req on invalid TRX */ |
| 5608 | testcase TC_pcu_data_req_wrong_trx() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5609 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5610 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5611 | f_TC_pcu_init(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5612 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5613 | f_TC_pcu_act_req(0, 0, 7, true); |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5614 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5615 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5616 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5617 | 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] | 5618 | } |
| 5619 | |
| 5620 | /* Send DATA.req on invalid timeslot */ |
| 5621 | testcase TC_pcu_data_req_wrong_ts() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5622 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5623 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5624 | f_TC_pcu_init(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5625 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5626 | f_TC_pcu_act_req(0, 0, 7, true); |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5627 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5628 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5629 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5630 | 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] | 5631 | } |
| 5632 | |
| 5633 | /* Send DATA.req on timeslot that hasn't been activated */ |
| 5634 | testcase TC_pcu_data_req_ts_inactive() runs on test_CT { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5635 | var octetstring data := '0000'O & f_rnd_octstring(21); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5636 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5637 | f_TC_pcu_init(); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5638 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5639 | /* intentionally not calling f_TC_pcu_act_req() */ |
| 5640 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5641 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5642 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5643 | 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] | 5644 | } |
| 5645 | |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5646 | 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] | 5647 | PCUIF_Sapi sapi, octetstring data, boolean expect_data := true, |
| 5648 | boolean wait_rts := true) |
| 5649 | runs on test_CT { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5650 | timer T := 5.0; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 5651 | var L1ctlMessage rx_dl; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5652 | |
Vadim Yanitskiy | 9b2ac19 | 2023-03-20 04:22:25 +0700 | [diff] [blame] | 5653 | L1CTL.clear; |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5654 | PCU.clear; |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5655 | if (wait_rts) { |
| 5656 | f_pcu_wait_rts_and_data_req(bts_nr, trx_nr, ts_nr, sapi, data); |
| 5657 | } else { |
| 5658 | f_pcu_data_req(bts_nr, trx_nr, ts_nr, 0, 0, sapi, data); |
| 5659 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5660 | |
| 5661 | T.start; |
| 5662 | alt { |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5663 | [expect_data] L1CTL.receive(tr_L1CTL_GPRS_DL_BLOCK_IND(tn := ts_nr, data := data)) { |
| 5664 | /* FIXME: why is fn of DL BLOCK.ind different to fn of RTS / DATA_REQ above? */ |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5665 | setverdict(pass); |
| 5666 | } |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5667 | [not expect_data] L1CTL.receive(tr_L1CTL_GPRS_DL_BLOCK_IND(tn := ts_nr, data := data)) -> value rx_dl { |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5668 | setverdict(fail, "Received unexpected ", rx_dl); |
| 5669 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5670 | [] L1CTL.receive { |
| 5671 | repeat; |
| 5672 | } |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5673 | [expect_data] T.timeout { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5674 | setverdict(fail, "Timeout waiting for ", data); |
| 5675 | } |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 5676 | [not expect_data] T.timeout { |
| 5677 | setverdict(pass); |
| 5678 | } |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5679 | } |
| 5680 | } |
| 5681 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5682 | private function f_TC_pcu_init() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5683 | f_init_with_pcuif(); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5684 | f_init_l1ctl(); |
| 5685 | f_l1_tune(L1CTL); |
| 5686 | } |
| 5687 | |
| 5688 | testcase TC_pcu_data_req_pdtch() runs on test_CT { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5689 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5690 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5691 | f_TC_pcu_init(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5692 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5693 | f_TC_pcu_act_req(0, 0, 7, true); |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5694 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5695 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5696 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5697 | 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] | 5698 | } |
| 5699 | |
| 5700 | testcase TC_pcu_data_req_ptcch() runs on test_CT { |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5701 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5702 | |
Vadim Yanitskiy | d744d45 | 2023-03-20 04:25:18 +0700 | [diff] [blame] | 5703 | f_TC_pcu_init(); |
Max | 2c6f563 | 2019-03-18 17:25:17 +0100 | [diff] [blame] | 5704 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5705 | f_TC_pcu_act_req(0, 0, 7, true); |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5706 | f_TC_pcu_l1ctl_est_pdch(7); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5707 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5708 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 5709 | f_pcu_to_l1(0, 0, 7, PCU_IF_SAPI_PTCCH, data); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5710 | } |
| 5711 | |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5712 | private function f_TC_pcu_ptcch_ul(uint16_t ra) |
| 5713 | runs on test_CT { |
| 5714 | var template PCUIF_Message pcu_rach_ind; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5715 | var PCUIF_Message msg; |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5716 | var GsmFrameNumber fn; |
| 5717 | timer T; |
| 5718 | |
| 5719 | /* Send an Access Burst on PTCCH/U over the Um-interface */ |
| 5720 | fn := f_L1CTL_RACH(L1CTL, ra := ra, combined := 0, offset := 0, |
| 5721 | chan_nr := ts_RslChanNr_PDCH(7), |
| 5722 | link_id := ts_RslLinkID_OSMO_PTCCH(0)); |
| 5723 | |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 5724 | pcu_rach_ind := tr_PCUIF_RACH_IND(bts_nr := 0, trx_nr := 0, ts_nr := 7, |
| 5725 | ra := ra, fn := fn, sapi := PCU_IF_SAPI_PTCCH); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5726 | |
| 5727 | /* Expect a RACH.ind on the PCU interface (timeout is one multi-frame) */ |
| 5728 | T.start(52.0 * 4.615 / 1000.0); |
| 5729 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5730 | [] as_pcuif_msg(msg, pcu_rach_ind) { |
| 5731 | log("Rx an Access Burst on the PCU interface: ", msg); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5732 | setverdict(pass); |
| 5733 | T.stop; |
| 5734 | } |
| 5735 | [] PCU.receive { repeat; } |
| 5736 | [] T.timeout { |
| 5737 | setverdict(fail, "Timeout waiting for RACH.ind on the PCU interface"); |
| 5738 | /* Keep going, that's not the end of the world */ |
| 5739 | } |
| 5740 | } |
| 5741 | } |
| 5742 | |
| 5743 | testcase TC_pcu_ptcch() runs on test_CT { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 5744 | var L1ctlMessage dl; |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5745 | var octetstring data; |
| 5746 | timer T; |
| 5747 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5748 | f_init_with_pcuif(); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5749 | f_init_l1ctl(); |
| 5750 | f_l1_tune(L1CTL); |
| 5751 | |
| 5752 | /* Activate PDCH channel on TS7 */ |
| 5753 | f_TC_pcu_act_req(0, 0, 7, true); |
| 5754 | |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5755 | /* Tune the L1 to that PDCH channel */ |
| 5756 | f_TC_pcu_l1ctl_est_pdch(7); |
| 5757 | L1CTL.send(ts_L1CTL_GPRS_DL_TBF_CFG_REQ(0, '00000001'B)); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5758 | |
| 5759 | /* Verify PTCCH/U: send several access bursts, make sure they're received */ |
| 5760 | for (var integer i := 0; i < 16; i := i + 1) { |
| 5761 | log("Sending an Access Burst towards the L1CTL interface"); |
| 5762 | f_TC_pcu_ptcch_ul(oct2int(f_rnd_ra_ps())); |
| 5763 | } |
| 5764 | |
| 5765 | /* Generate a random payload for PTCCH/D (23 octets, CS-1) */ |
| 5766 | data := f_rnd_octstring(23); |
| 5767 | |
| 5768 | /* Verify PTCCH/D: send a random data block, make sure it's received */ |
| 5769 | log("Sending a PTCCH/D block towards the PCU interface: ", data); |
| 5770 | f_pcu_wait_rts_and_data_req(0, 0, 7, PCU_IF_SAPI_PTCCH, data); |
| 5771 | |
| 5772 | /* PTCCH/D period is 2 multi-frames (2 * 52 * 4.615 ms), but |
| 5773 | * let's give it more time in case if we miss the beginning. */ |
| 5774 | T.start(2.0 * 2.0 * 52.0 * 4.615 / 1000.0); |
| 5775 | alt { |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5776 | [] L1CTL.receive(tr_L1CTL_GPRS_DL_BLOCK_IND(fn := ?, tn := 7, data := data)) { |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5777 | setverdict(pass); |
| 5778 | T.stop; |
| 5779 | } |
| 5780 | [] L1CTL.receive { repeat; } |
| 5781 | [] T.timeout { |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 5782 | setverdict(fail, "Timeout waiting DL BLOCK.ind with PTCCH/D"); |
Vadim Yanitskiy | 8c242f0 | 2019-10-13 15:25:54 +0700 | [diff] [blame] | 5783 | } |
| 5784 | } |
| 5785 | } |
| 5786 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5787 | /* Send AGCH from PCU; check it appears on Um side */ |
| 5788 | testcase TC_pcu_data_req_agch() runs on test_CT { |
| 5789 | timer T := 3.0; |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5790 | f_init_with_pcuif(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5791 | f_init_l1ctl(); |
| 5792 | f_l1_tune(L1CTL); |
| 5793 | |
| 5794 | f_TC_pcu_act_req(0, 0, 7, true); |
Philipp Maier | 2291bf6 | 2023-08-03 11:30:36 +0200 | [diff] [blame] | 5795 | f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_AGCH, c_PCU_DATA); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5796 | |
| 5797 | T.start; |
| 5798 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 5799 | [] 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] | 5800 | setverdict(pass); |
| 5801 | } |
| 5802 | [] L1CTL.receive { repeat; } |
| 5803 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5804 | 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] | 5805 | } |
| 5806 | } |
| 5807 | } |
| 5808 | |
Philipp Maier | 9aeafbd | 2023-08-03 11:44:55 +0200 | [diff] [blame] | 5809 | /* Send PCH from PCU; check it appears on Um side */ |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 5810 | testcase TC_pcu_data_req_pch() runs on test_CT { |
| 5811 | timer T := 3.0; |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5812 | f_init_with_pcuif(); |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 5813 | f_init_l1ctl(); |
| 5814 | f_l1_tune(L1CTL); |
| 5815 | |
| 5816 | f_TC_pcu_act_req(0, 0, 7, true); |
Philipp Maier | 3b4abb8 | 2023-06-23 16:27:46 +0200 | [diff] [blame] | 5817 | |
| 5818 | if (mp_pcuif_version < 11) { |
| 5819 | /* three characters prefix: last 3 digits of IMSI as ASCII */ |
Philipp Maier | 2291bf6 | 2023-08-03 11:30:36 +0200 | [diff] [blame] | 5820 | f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_PCH, '313233'O & c_PCU_DATA); |
Philipp Maier | 3b4abb8 | 2023-06-23 16:27:46 +0200 | [diff] [blame] | 5821 | } else { |
| 5822 | var PCUIF_pch_dt pch_dt; |
Philipp Maier | a6708cf | 2023-08-08 16:12:27 +0200 | [diff] [blame^] | 5823 | pch_dt.msg_id := '01020304'O; |
Philipp Maier | 3b4abb8 | 2023-06-23 16:27:46 +0200 | [diff] [blame] | 5824 | pch_dt.imsi := "00101000000000123"; |
| 5825 | pch_dt.data := c_PCU_DATA; |
Philipp Maier | 2291bf6 | 2023-08-03 11:30:36 +0200 | [diff] [blame] | 5826 | f_pcu_data_req(0, 0, 0, 0, 0, PCU_IF_SAPI_PCH_DT, enc_PCUIF_pch_dt(pch_dt)); |
Philipp Maier | 3b4abb8 | 2023-06-23 16:27:46 +0200 | [diff] [blame] | 5827 | } |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 5828 | |
| 5829 | T.start; |
| 5830 | alt { |
| 5831 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0), ?, c_PCU_DATA)) { |
| 5832 | setverdict(pass); |
| 5833 | } |
| 5834 | [] L1CTL.receive { repeat; } |
| 5835 | [] T.timeout { |
| 5836 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated PCH block on Um"); |
| 5837 | } |
| 5838 | } |
| 5839 | } |
| 5840 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5841 | /* Send IMM.ASS from PCU for PCH; check it appears on Um side */ |
| 5842 | testcase TC_pcu_data_req_imm_ass_pch() runs on test_CT { |
Philipp Maier | 55e6635 | 2023-06-08 14:58:08 +0200 | [diff] [blame] | 5843 | var octetstring req_ref := f_rnd_octstring(3); |
| 5844 | var octetstring tlli := f_rnd_octstring(4); |
| 5845 | var octetstring imm_ass := '2d063f300fc364'O & req_ref & '0000dc'O & tlli & '00232b2b2b2b'O; |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5846 | f_init_with_pcuif(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5847 | f_init_l1ctl(); |
| 5848 | f_l1_tune(L1CTL); |
| 5849 | |
| 5850 | /* append 3 last imsi digits so BTS can compute pagng group */ |
| 5851 | var uint32_t fn := f_PCUIF_tx_imm_ass_pch(PCU, g_pcu_conn_id, imm_ass, '123459987'H); |
| 5852 | |
| 5853 | timer T := 0.5; |
| 5854 | T.start; |
| 5855 | alt { |
Harald Welte | f8df4cb | 2018-03-10 15:15:08 +0100 | [diff] [blame] | 5856 | [] 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] | 5857 | /* TODO: verify paging group */ |
| 5858 | setverdict(pass); |
| 5859 | } |
| 5860 | [] L1CTL.receive { repeat; } |
| 5861 | [] T.timeout { |
Philipp Maier | 5515715 | 2023-08-03 12:11:56 +0200 | [diff] [blame] | 5862 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU-originated PCH block on Um"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5863 | } |
| 5864 | } |
| 5865 | } |
| 5866 | |
| 5867 | /* Send RACH from Um side, expect it to show up on PCU socket */ |
| 5868 | testcase TC_pcu_rach_content() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5869 | f_init_with_pcuif(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5870 | f_init_l1ctl(); |
| 5871 | f_l1_tune(L1CTL); |
| 5872 | |
| 5873 | var GsmFrameNumber fn_last := 0; |
| 5874 | for (var integer i := 0; i < 1000; i := i+1) { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5875 | var PCUIF_Message msg; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5876 | var OCT1 ra := f_rnd_ra_ps(); |
| 5877 | var GsmFrameNumber fn := f_L1CTL_RACH(L1CTL, oct2int(ra)); |
| 5878 | if (fn == fn_last) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5879 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Two RACH in same FN?!?"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5880 | } |
| 5881 | fn_last := fn; |
| 5882 | |
| 5883 | timer T := 2.0; |
| 5884 | T.start; |
| 5885 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5886 | [] as_pcuif_msg(msg, tr_PCUIF_RACH_IND(0, 0, 0, oct2int(ra), 0, ?, fn)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5887 | T.stop; |
| 5888 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5889 | [] as_pcuif_msg(msg, tr_PCUIF_RACH_IND) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5890 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5891 | } |
| 5892 | [] PCU.receive { repeat; } |
| 5893 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 5894 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 5895 | } |
| 5896 | } |
| 5897 | } |
| 5898 | setverdict(pass); |
| 5899 | } |
| 5900 | |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5901 | /* Send extended (11-bit, TS1 & TS2) RACH bursts from the Um side, |
| 5902 | * expect them to show up on PCU socket (with proper BURST_TYPE_*). */ |
| 5903 | testcase TC_pcu_ext_rach_content() runs on test_CT { |
| 5904 | var template PCUIF_Message pcu_rach_ind; |
| 5905 | var GsmFrameNumber fn_last := 0; |
| 5906 | var L1ctlRachSynchSeq synch_seq; |
| 5907 | var PCUIF_BurstType pcu_bt; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5908 | var GsmFrameNumber fn |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5909 | var BIT11 ra11; |
| 5910 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5911 | f_init_with_pcuif(); |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5912 | f_init_l1ctl(); |
| 5913 | f_l1_tune(L1CTL); |
| 5914 | |
| 5915 | for (var integer i := 0; i < 1000; i := i+1) { |
| 5916 | /* We need to test both TS1 & TS2 */ |
| 5917 | if (i rem 2 == 0) { |
| 5918 | synch_seq := RACH_SYNCH_SEQ_TS1; |
| 5919 | pcu_bt := BURST_TYPE_1; |
| 5920 | } else { |
| 5921 | synch_seq := RACH_SYNCH_SEQ_TS2; |
| 5922 | pcu_bt := BURST_TYPE_2; |
| 5923 | } |
| 5924 | |
| 5925 | ra11 := f_rnd_ra11_ps(); |
| 5926 | fn := f_L1CTL_EXT_RACH(L1CTL, bit2int(ra11), synch_seq); |
| 5927 | if (fn == fn_last) { |
| 5928 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5929 | "Two RACH in same FN?!?"); |
| 5930 | } |
| 5931 | fn_last := fn; |
| 5932 | |
| 5933 | /* Compose the expected message */ |
| 5934 | pcu_rach_ind := tr_PCUIF_RACH_IND( |
Vadim Yanitskiy | 36558d9 | 2019-11-17 02:23:51 +0700 | [diff] [blame] | 5935 | bts_nr := 0, trx_nr := 0, ts_nr := 0, |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5936 | ra := bit2int(ra11), |
| 5937 | is_11bit := 1, |
| 5938 | burst_type := pcu_bt, |
| 5939 | fn := fn); |
| 5940 | |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5941 | var PCUIF_Message msg; |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5942 | timer T := 2.0; |
| 5943 | T.start; |
| 5944 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5945 | [] as_pcuif_msg(msg, pcu_rach_ind) { |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5946 | T.stop; |
| 5947 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5948 | [] as_pcuif_msg(msg, tr_PCUIF_RACH_IND) { |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 5949 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RACH IND"); |
| 5950 | } |
| 5951 | [] PCU.receive { repeat; } |
| 5952 | [] T.timeout { |
| 5953 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RACH IND"); |
| 5954 | } |
| 5955 | } |
| 5956 | } |
| 5957 | setverdict(pass); |
| 5958 | } |
| 5959 | |
Vadim Yanitskiy | 8bf2dc4 | 2023-05-31 17:52:55 +0700 | [diff] [blame] | 5960 | private function f_TC_pcu_data_ind_lqual_cb(int16_t lqual_cb_exp) |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5961 | runs on test_CT { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 5962 | var PCUIF_Message msg; |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5963 | timer T := 1.0; |
| 5964 | |
Vadim Yanitskiy | c70a626 | 2023-05-31 04:42:08 +0700 | [diff] [blame] | 5965 | L1CTL.clear; |
| 5966 | PCU.clear; |
| 5967 | |
| 5968 | /* Send a random Uplink block over the Um */ |
Vadim Yanitskiy | 8bf2dc4 | 2023-05-31 17:52:55 +0700 | [diff] [blame] | 5969 | var octetstring data := '0000'O & f_rnd_octstring(21); |
| 5970 | f_TC_pcu_tx_ul_block_req(data, tn := 7); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5971 | |
| 5972 | T.start; |
| 5973 | alt { |
Vadim Yanitskiy | 8bf2dc4 | 2023-05-31 17:52:55 +0700 | [diff] [blame] | 5974 | [] as_pcuif_msg(msg, tr_PCUIF_DATA_IND(data := data)) { |
| 5975 | var integer lqual_cb := msg.u.data_ind.lqual_cb; |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5976 | log("Rx PCUIF_DATA.ind (lqual_cb=", lqual_cb, ")"); |
| 5977 | |
| 5978 | /* Make sure the actual link quality matches the expected value */ |
| 5979 | if (not match(lqual_cb, lqual_cb_exp)) { |
| 5980 | setverdict(fail, log2str("Link quality ", lqual_cb, " does not match ", |
| 5981 | "expected value ", lqual_cb_exp)); |
| 5982 | } else { |
| 5983 | setverdict(pass); |
| 5984 | } |
| 5985 | } |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5986 | /* Ignore PCUIF_RTS.req and PCUIF_TIME.ind */ |
| 5987 | [] PCU.receive { repeat; } |
Vadim Yanitskiy | 8bf2dc4 | 2023-05-31 17:52:55 +0700 | [diff] [blame] | 5988 | [] T.timeout { |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5989 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 5990 | "Timeout waiting for PCUIF_DATA.ind"); |
| 5991 | } |
| 5992 | } |
| 5993 | } |
| 5994 | |
| 5995 | /* Verify C/I (Carrier-to-Interference ratio) processing of PDTCH frames */ |
| 5996 | testcase TC_pcu_data_ind_lqual_cb() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 5997 | f_init_with_pcuif(); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 5998 | PCU.clear; |
| 5999 | |
| 6000 | f_init_l1ctl(); |
| 6001 | f_l1_tune(L1CTL); |
| 6002 | |
| 6003 | /* Activate a PDCH channel on TS7 */ |
| 6004 | f_TC_pcu_act_req(0, 0, 7, true); |
| 6005 | |
| 6006 | /* Tune trxcon to that PDCH channel on TS7 */ |
Vadim Yanitskiy | 72a76b5 | 2023-03-18 00:12:09 +0700 | [diff] [blame] | 6007 | f_TC_pcu_l1ctl_est_pdch(7); |
| 6008 | L1CTL.send(ts_L1CTL_GPRS_UL_TBF_CFG_REQ(0, '00000001'B)); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 6009 | |
| 6010 | /* C/I in centiBels, test range: -256 .. +1280, step 128 */ |
| 6011 | for (var int16_t i := -256; i <= 1280; i := i + 128) { |
| 6012 | var TrxcMessage ret; |
| 6013 | |
Vadim Yanitskiy | 418066a | 2021-10-03 14:04:17 +0600 | [diff] [blame] | 6014 | ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, ts_TRXC_FAKE_CI(i)); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 6015 | |
Vadim Yanitskiy | c7fe343 | 2023-05-31 04:37:00 +0700 | [diff] [blame] | 6016 | log("Testing C/I=", i, " cB"); |
Vadim Yanitskiy | 8bf2dc4 | 2023-05-31 17:52:55 +0700 | [diff] [blame] | 6017 | f_TC_pcu_data_ind_lqual_cb(i); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 6018 | } |
| 6019 | } |
| 6020 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6021 | /* Send PAGING via RSL, expect it to shw up on PCU socket */ |
| 6022 | testcase TC_pcu_paging_from_rsl() runs on test_CT { |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 6023 | f_init_with_pcuif(); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6024 | |
| 6025 | for (var integer i := 0; i < 100; i := i+1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 6026 | var MobileIdentityLV mi_lv; |
| 6027 | var octetstring mi_lv_enc; |
| 6028 | var MobileIdentityV mi; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6029 | var PCUIF_Message msg; |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6030 | timer T := 3.0; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 6031 | |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6032 | if (i < 50) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 6033 | mi := valueof(t_MI_TMSI(f_rnd_octstring(4))); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6034 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 6035 | mi := valueof(ts_MI_IMSI(f_gen_imsi(i))); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6036 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 6037 | |
| 6038 | /* Fancy encoding for PCUIF */ |
| 6039 | mi_lv := valueof(ts_MI_LV(mi)); |
| 6040 | mi_lv_enc := enc_MobileIdentityLV(mi_lv); |
| 6041 | mi_lv_enc := f_pad_oct(mi_lv_enc, 9, '00'O); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6042 | |
| 6043 | /* Send RSL PAGING COMMAND */ |
Vadim Yanitskiy | 493abe7 | 2020-05-25 22:03:48 +0700 | [diff] [blame] | 6044 | 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] | 6045 | T.start; |
| 6046 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6047 | [] as_pcuif_msg(msg, tr_PCUIF_PAG_REQ(0, mi_lv_enc)) { |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6048 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6049 | [] as_pcuif_msg(msg, tr_PCUIF_PAG_REQ) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6050 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6051 | } |
| 6052 | [] PCU.receive { repeat; } |
| 6053 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 6054 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PAGING REQ"); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 6055 | } |
| 6056 | } |
| 6057 | } |
| 6058 | setverdict(pass); |
| 6059 | } |
| 6060 | |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6061 | /* test for periodic TIME_IND; check number of FN expired and number of TIME_IND within frames */ |
| 6062 | testcase TC_pcu_time_ind() runs on test_CT { |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6063 | var integer num_time_ind := 0; |
| 6064 | var integer first_fn, last_fn; |
| 6065 | var float test_duration := 5.0; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6066 | var PCUIF_Message msg; |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6067 | timer T; |
| 6068 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 6069 | f_init_with_pcuif(); |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6070 | f_TC_pcu_act_req(0, 0, 7, true); |
| 6071 | |
| 6072 | PCU.clear; |
| 6073 | T.start(test_duration); |
| 6074 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6075 | [] as_pcuif_msg(msg, tr_PCUIF_TIME_IND(0, ?)) { |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6076 | num_time_ind := num_time_ind + 1; |
| 6077 | if (not isbound(first_fn)) { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6078 | first_fn := msg.u.time_ind.fn; |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6079 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6080 | last_fn := msg.u.time_ind.fn; |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6081 | repeat; |
| 6082 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6083 | [] as_pcuif_msg(msg, tr_PCUIF_TIME_IND(?, ?)) { |
| 6084 | setverdict(fail, "Received unexpected PCUIF_TIME_IND: ", msg); |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6085 | repeat; |
| 6086 | } |
| 6087 | [] PCU.receive { |
| 6088 | repeat; |
| 6089 | } |
| 6090 | [] T.timeout {} |
| 6091 | } |
| 6092 | var integer fn_expired := last_fn - first_fn; |
| 6093 | log(fn_expired, " fn expired with ", num_time_ind, " PCU_TIME.ind"); |
| 6094 | |
| 6095 | /* verify the number of frames expired matches our expectation */ |
| 6096 | const float c_GSM_FN_DURATION_MS := 4.61538; |
| 6097 | 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] | 6098 | 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] | 6099 | if (not match(fn_expired, t_fn_expected)) { |
| 6100 | setverdict(fail, "Number of TDMA Frames (", fn_expired, ") not matching ", t_fn_expected); |
| 6101 | } |
| 6102 | |
| 6103 | /* There are three TIME.ind in every fn MOD 13 */ |
| 6104 | var float time_ind_expected := int2float(fn_expired) * 3.0 / 13.0; |
| 6105 | /* Add some tolerance */ |
| 6106 | var template integer t_time_ind_exp := f_tolerance(float2int(time_ind_expected), 1, 100000, 5); |
| 6107 | if (not match(num_time_ind, t_time_ind_exp)) { |
| 6108 | setverdict(fail, "Number of TIME.ind (", num_time_ind, ") not matching ", t_time_ind_exp); |
| 6109 | } |
| 6110 | |
| 6111 | setverdict(pass); |
| 6112 | } |
| 6113 | |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6114 | /* test for periodic RTS_REQ; check number of FN expired and number of RTS_IND per SAPI */ |
| 6115 | testcase TC_pcu_rts_req() runs on test_CT { |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6116 | var integer first_fn, last_fn; |
| 6117 | var integer num_rts_pdtch := 0; |
| 6118 | var integer num_rts_ptcch := 0; |
| 6119 | var float test_duration := 5.0; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6120 | var PCUIF_Message msg; |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6121 | timer T; |
| 6122 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 6123 | f_init_with_pcuif(); |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6124 | f_TC_pcu_act_req(0, 0, 7, true); |
| 6125 | |
| 6126 | PCU.clear; |
| 6127 | T.start(test_duration); |
| 6128 | alt { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6129 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PDTCH, ?, ?)) { |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6130 | num_rts_pdtch := num_rts_pdtch + 1; |
| 6131 | if (not isbound(first_fn)) { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6132 | first_fn := msg.u.rts_req.fn; |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6133 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6134 | last_fn := msg.u.rts_req.fn; |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6135 | repeat; |
| 6136 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6137 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ(0, 0, 7, PCU_IF_SAPI_PTCCH, ?, ?)) { |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6138 | num_rts_ptcch := num_rts_ptcch + 1; |
| 6139 | if (not isbound(first_fn)) { |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6140 | first_fn := msg.u.rts_req.fn; |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6141 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6142 | last_fn := msg.u.rts_req.fn; |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6143 | repeat; |
| 6144 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6145 | [] as_pcuif_msg(msg, tr_PCUIF_RTS_REQ) { |
| 6146 | setverdict(fail, "Received unexpected PCUIF_RTS_REQ: ", msg); |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 6147 | repeat; |
| 6148 | } |
| 6149 | [] PCU.receive { |
| 6150 | repeat; |
| 6151 | } |
| 6152 | [] T.timeout {} |
| 6153 | } |
| 6154 | var integer fn_expired := last_fn - first_fn; |
| 6155 | log(fn_expired, " fn expired with num_rts_pdtch=", num_rts_pdtch, |
| 6156 | ", num_rts_ptcch=", num_rts_ptcch); |
| 6157 | |
| 6158 | /* verify the number of frames expired matches our expectation */ |
| 6159 | const float c_GSM_FN_DURATION_MS := 4.61538; |
| 6160 | 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] | 6161 | 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] | 6162 | if (not match(fn_expired, t_fn_expected)) { |
| 6163 | setverdict(fail, "Number of TDMA Frames (", fn_expired, ") not matching ", t_fn_expected); |
| 6164 | } |
| 6165 | |
| 6166 | /* PTCCH is in pos. 12 + 38 of 52-multiframe, but four slots/bursts required per block */ |
| 6167 | var float ptcch_expected := int2float(fn_expired) / 52.0 * 0.5; |
| 6168 | var template integer t_ptcch_exp := f_tolerance(float2int(ptcch_expected), 1, 100000, 1); |
| 6169 | if (not match(num_rts_ptcch, t_ptcch_exp)) { |
| 6170 | setverdict(fail, "Number of RTS.ind for PTCCH (", num_rts_ptcch, ") not matching ", |
| 6171 | t_ptcch_exp); |
| 6172 | } |
| 6173 | |
| 6174 | /* We have 12 PDTCH blocks every 52-multiframe */ |
| 6175 | var float pdtch_expected := int2float(fn_expired) / 52.0 * 12.0; |
| 6176 | var template integer t_pdtch_exp := f_tolerance(float2int(pdtch_expected), 1, 100000, 2); |
| 6177 | if (not match(num_rts_pdtch, t_pdtch_exp)) { |
| 6178 | setverdict(fail, "Number of RTS.ind for PDTCH (", num_rts_pdtch, ") not matching ", |
| 6179 | t_pdtch_exp); |
| 6180 | } |
| 6181 | |
| 6182 | setverdict(pass); |
| 6183 | } |
| 6184 | |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 6185 | /* test for generating Abis side OML ALERT from the PCU */ |
| 6186 | testcase TC_pcu_oml_alert() runs on test_CT { |
| 6187 | var PCUIF_send_data pcu_sd; |
| 6188 | var integer num_time_ind := 0; |
| 6189 | var integer first_fn, last_fn; |
| 6190 | var float test_duration := 5.0; |
| 6191 | timer T; |
| 6192 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 6193 | f_init_with_pcuif(); |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 6194 | f_TC_pcu_act_req(0, 0, 7, true); |
| 6195 | |
| 6196 | /* re-connect CTRL port from BTS to BSC */ |
| 6197 | f_ipa_ctrl_stop(); |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 6198 | f_ipa_ctrl_start_client(mp_bsc_ctrl_ip, mp_bsc_ctrl_port); |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 6199 | |
| 6200 | /* Send that OML Alert */ |
| 6201 | PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_OML_ALERT, testcasename()))); |
| 6202 | |
| 6203 | /* This requires https://gerrit.osmocom.org/#/c/osmo-bsc/+/14177 to be merged */ |
| 6204 | f_ctrl_exp_trap(IPA_CTRL, "bts.0.oml_failure_report", ?); |
| 6205 | setverdict(pass); |
| 6206 | } |
| 6207 | |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 6208 | /* test for forwarding of RR SUSPEND from CS lchan to PCU via PCU socket */ |
| 6209 | private function f_TC_rr_suspend_req(charstring id) runs on ConnHdlr { |
| 6210 | var PCUIF_Message first_info; |
| 6211 | var integer pcu_conn_id := -1; |
| 6212 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 6213 | var RoutingAreaIdentificationV rai := f_RAI('262'H, '42F'H, '2342'O, '55'O); |
| 6214 | var OCT4 tlli := '01020304'O; |
| 6215 | var OCT1 cause := '23'O; |
| 6216 | timer T := 5.0; |
| 6217 | |
| 6218 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6219 | |
| 6220 | f_l1_tune(L1CTL); |
| 6221 | RSL.clear; |
| 6222 | |
| 6223 | f_est_dchan(); |
| 6224 | L1CTL.clear; |
| 6225 | |
| 6226 | f_est_rll_mo(link_id.sapi, link_id, '23420815'O); |
| 6227 | |
| 6228 | var PDU_ML3_MS_NW susp_req := valueof(ts_RRM_GprsSuspReq(tlli, rai, cause)); |
| 6229 | var octetstring l3 := enc_PDU_ML3_MS_NW(susp_req); |
| 6230 | f_tx_lapdm(ts_LAPDm_I(link_id.sapi, cr_MO_CMD, true, 1, 0, l3), link_id); |
| 6231 | |
| 6232 | /* ConnHdlr has terminated after sending the RR SUSP REQ over a dedicaed channel */ |
| 6233 | T.start; |
| 6234 | alt { |
| 6235 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_SUSP_REQ(0, tlli, ?, oct2int(cause)))) { |
| 6236 | setverdict(pass); |
| 6237 | } |
| 6238 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_SUSP_REQ(?, ?, ?, ?))) { |
| 6239 | setverdict(fail, "Received unexpected PCUIF SUSPE REQ: "); |
| 6240 | } |
| 6241 | [] PCU.receive { |
| 6242 | repeat; |
| 6243 | } |
| 6244 | [] T.timeout { |
| 6245 | setverdict(fail, "Timeout waiting for SUSP REQ on PCUIF"); |
| 6246 | } |
| 6247 | } |
Alexander Couzens | a063483 | 2019-06-07 00:28:56 +0200 | [diff] [blame] | 6248 | |
| 6249 | /* release the channel */ |
| 6250 | f_rsl_chan_deact(); |
| 6251 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 6252 | f_rslem_unregister(0, g_chan_nr); |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 6253 | } |
| 6254 | testcase TC_pcu_rr_suspend() runs on test_CT { |
| 6255 | var ConnHdlrPars pars; |
| 6256 | var ConnHdlr vc_conn; |
| 6257 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6258 | f_init_with_pcuif(); |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 6259 | |
| 6260 | pars := valueof(t_Pars(t_RslChanNr_SDCCH4(0,3), ts_RSL_ChanMode_SIGN)); |
| 6261 | vc_conn := f_start_handler(refers(f_TC_rr_suspend_req), pars, true); |
| 6262 | vc_conn.done; |
| 6263 | } |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 6264 | |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6265 | /* Ensure that PCUIF socket can accept only a single connection */ |
| 6266 | testcase TC_pcu_socket_connect_multi() runs on test_CT { |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6267 | var boolean connected := false; |
| 6268 | var UD_connect_result cr; |
| 6269 | var integer cid; |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6270 | timer T := 5.0; |
| 6271 | |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6272 | var template UD_Result tr_ok := { result_code := SUCCESS, err := omit }; |
| 6273 | var template UD_Result tr_err := { result_code := ERROR, err := ? }; |
| 6274 | |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6275 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6276 | f_init_with_pcuif(); |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6277 | |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6278 | /* try to establish a second connection */ |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6279 | PCU.send(UD_connect:{mp_pcu_socket, -1}); |
| 6280 | T.start; |
| 6281 | alt { |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6282 | /* the IUT will first accept() the new connection, and close() it immediately */ |
| 6283 | [not connected] PCU.receive(UD_connect_result:{ id := ?, result := tr_ok }) -> value cr { |
| 6284 | log("BTS has accept()ed connection"); |
| 6285 | connected := true; |
| 6286 | cid := cr.id; |
| 6287 | repeat; |
| 6288 | } |
| 6289 | [connected] PCU.receive(UD_connect_result:{ id := cid, result := tr_err }) { |
| 6290 | log("BTS has close()d connection"); |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6291 | setverdict(pass); |
| 6292 | } |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6293 | /* ignore other messages related to the first connection */ |
| 6294 | [] PCU.receive { repeat; } |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6295 | [] T.timeout { |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6296 | setverdict(fail, "Timeout waiting for connection result"); |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6297 | } |
| 6298 | } |
Vadim Yanitskiy | 94bbe99 | 2021-03-23 07:23:34 +0100 | [diff] [blame] | 6299 | |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 6300 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6301 | } |
| 6302 | |
Harald Welte | c8effb7 | 2019-05-27 18:23:04 +0200 | [diff] [blame] | 6303 | /* Ensure that PCUIF socket can disconnect + reconnect */ |
| 6304 | testcase TC_pcu_socket_reconnect() runs on test_CT { |
| 6305 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6306 | f_init_with_pcuif(); |
Harald Welte | c8effb7 | 2019-05-27 18:23:04 +0200 | [diff] [blame] | 6307 | |
| 6308 | f_sleep(1.0); |
| 6309 | |
| 6310 | f_pcuif_close(PCU, g_pcu_conn_id); |
| 6311 | g_pcu_conn_id := -1; |
| 6312 | |
| 6313 | f_sleep(1.0); |
| 6314 | |
| 6315 | /* re-connect */ |
| 6316 | PCU.clear; |
| 6317 | f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info); |
| 6318 | setverdict(pass); |
| 6319 | |
| 6320 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6321 | } |
| 6322 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6323 | /* Ensure that GPRS capability is not advertised before PCU socket conncet */ |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 6324 | private function f_get_si(L1CTL_PT pt, RrMessageType si_type) |
| 6325 | runs on test_CT return SystemInformation { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 6326 | var L1ctlMessage l1_dl; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6327 | var SystemInformation si; |
Vadim Yanitskiy | cb478ec | 2020-07-11 02:37:17 +0700 | [diff] [blame] | 6328 | var integer rc; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6329 | timer T := 5.0; |
| 6330 | T.start; |
| 6331 | alt { |
| 6332 | [] 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] | 6333 | rc := dec_SystemInformationSafe(l1_dl.payload.data_ind.payload, si); |
| 6334 | if (rc != 0 or si.header.message_type != si_type) { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6335 | repeat; |
| 6336 | } |
| 6337 | } |
| 6338 | [] pt.receive { |
| 6339 | repeat; |
| 6340 | } |
| 6341 | [] T.timeout { |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 6342 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6343 | log2str("Timeout waiting for ", si_type)); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6344 | } |
| 6345 | } |
Vadim Yanitskiy | 3c18538 | 2020-05-04 14:55:02 +0700 | [diff] [blame] | 6346 | return si; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6347 | } |
| 6348 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6349 | /* Check if GPRS Indicator is present in RR System Information of a given type */ |
| 6350 | private function f_si_has_gprs_indicator(RrMessageType si_type) |
| 6351 | runs on test_CT return boolean { |
| 6352 | var SystemInformation si := f_get_si(L1CTL, si_type); |
| 6353 | |
| 6354 | if (si_type == SYSTEM_INFORMATION_TYPE_3) { |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 6355 | return si.payload.si3.rest_octets.gprs_ind.presence == '1'B; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6356 | } else if (si_type == SYSTEM_INFORMATION_TYPE_4) { |
Neels Hofmeyr | a5f0ed2 | 2020-07-06 02:39:40 +0200 | [diff] [blame] | 6357 | return si.payload.si4.rest_octets.gprs_ind.presence == '1'B; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6358 | } |
| 6359 | |
| 6360 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unhandled SI type"); |
| 6361 | return false; |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6362 | } |
| 6363 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6364 | /* Make sure that GPRS Indicator is absent when the PCU is not connected */ |
| 6365 | private function f_TC_pcu_socket_noconnect(RrMessageType si_type) |
| 6366 | runs on test_CT { |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6367 | f_init(); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6368 | f_init_l1ctl(); |
| 6369 | f_l1_tune(L1CTL); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6370 | f_sleep(2.0); |
| 6371 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6372 | |
| 6373 | if (f_si_has_gprs_indicator(si_type)) { |
| 6374 | setverdict(fail, si_type, " indicates GPRS even before PCU socket connected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6375 | } else { |
| 6376 | setverdict(pass); |
| 6377 | } |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6378 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6379 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6380 | } |
| 6381 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6382 | testcase TC_pcu_socket_noconnect_nosi3gprs() runs on test_CT { |
| 6383 | f_TC_pcu_socket_noconnect(SYSTEM_INFORMATION_TYPE_3); |
| 6384 | } |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6385 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6386 | testcase TC_pcu_socket_noconnect_nosi4gprs() runs on test_CT { |
| 6387 | f_TC_pcu_socket_noconnect(SYSTEM_INFORMATION_TYPE_4); |
| 6388 | } |
| 6389 | |
| 6390 | /* Ensure that GPRS capability is advertised after PCU socket connect */ |
| 6391 | private function f_TC_pcu_socket_connect(RrMessageType si_type) |
| 6392 | runs on test_CT { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6393 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6394 | f_init_with_pcuif(); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6395 | f_init_l1ctl(); |
| 6396 | f_l1_tune(L1CTL); |
| 6397 | |
| 6398 | f_sleep(2.0); |
| 6399 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6400 | |
| 6401 | if (not f_si_has_gprs_indicator(si_type)) { |
| 6402 | setverdict(fail, si_type, " indicates no GPRS despite PCU socket connected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6403 | } else { |
| 6404 | setverdict(pass); |
| 6405 | } |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6406 | |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6407 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6408 | } |
| 6409 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6410 | testcase TC_pcu_socket_connect_si3gprs() runs on test_CT { |
| 6411 | f_TC_pcu_socket_connect(SYSTEM_INFORMATION_TYPE_3); |
| 6412 | } |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6413 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6414 | testcase TC_pcu_socket_connect_si4gprs() runs on test_CT { |
| 6415 | f_TC_pcu_socket_connect(SYSTEM_INFORMATION_TYPE_4); |
| 6416 | } |
| 6417 | |
| 6418 | /* Ensure that GPRS capability is no longer advertised after PCU socket disconnect */ |
| 6419 | private function f_TC_pcu_socket_disconnect(RrMessageType si_type) |
| 6420 | runs on test_CT { |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6421 | /* this (among other things) establishes the first connection to the PCUIF socket */ |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6422 | f_init_with_pcuif(); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6423 | f_init_l1ctl(); |
| 6424 | f_l1_tune(L1CTL); |
| 6425 | |
| 6426 | f_pcuif_close(PCU, g_pcu_conn_id); |
| 6427 | g_pcu_conn_id := -1; |
| 6428 | |
| 6429 | f_sleep(1.0); |
| 6430 | |
| 6431 | /* re-connect */ |
| 6432 | PCU.clear; |
| 6433 | f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info); |
| 6434 | |
| 6435 | f_sleep(2.0); |
| 6436 | L1CTL.clear; |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6437 | |
| 6438 | if (f_si_has_gprs_indicator(si_type)) { |
| 6439 | setverdict(fail, si_type, " indicates GPRS after PCU socket disconnected"); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 6440 | } else { |
| 6441 | setverdict(pass); |
| 6442 | } |
| 6443 | |
| 6444 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6445 | } |
| 6446 | |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 6447 | testcase TC_pcu_socket_disconnect_nosi3gprs() runs on test_CT { |
| 6448 | f_TC_pcu_socket_disconnect(SYSTEM_INFORMATION_TYPE_3); |
| 6449 | } |
| 6450 | |
| 6451 | testcase TC_pcu_socket_disconnect_nosi4gprs() runs on test_CT { |
| 6452 | f_TC_pcu_socket_disconnect(SYSTEM_INFORMATION_TYPE_4); |
| 6453 | } |
| 6454 | |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 6455 | /* 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) */ |
| 6456 | testcase TC_pcu_socket_verify_info_ind() runs on test_CT { |
| 6457 | var SystemInformation si3 := valueof(ts_SI3_default); |
| 6458 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6459 | f_init_with_pcuif(); |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 6460 | |
Harald Welte | 7622022 | 2020-10-11 20:32:44 +0200 | [diff] [blame] | 6461 | /* actually give the BTS some time to fully come up and to send a PCU INFO IND with the correct |
| 6462 | * information */ |
| 6463 | timer T := 2.0; |
| 6464 | T.start; |
| 6465 | alt { |
| 6466 | [] as_pcu_info_ind(PCU, g_pcu_conn_id, g_pcu_last_info) { repeat; } |
| 6467 | [] T.timeout {} |
| 6468 | } |
| 6469 | |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 6470 | /* Verify cell_id */ |
| 6471 | var uint16_t cell_id_si3 := si3.payload.si3.cell_id; |
| 6472 | var uint16_t cell_id_pcu := g_pcu_last_info.u.info_ind.cell_id; |
| 6473 | if (cell_id_si3 != cell_id_pcu) { |
Oliver Smith | e1c00f0 | 2019-09-04 11:35:56 +0200 | [diff] [blame] | 6474 | setverdict(fail, "Expected cell_id '", cell_id_si3, "' and got '", cell_id_pcu, "'. This either means,", |
| 6475 | " that the BTS is sending the wrong cell_id, or that the BTS sent it too early", |
| 6476 | " (OS#4179)"); |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 6477 | } |
| 6478 | |
| 6479 | /* Verify LAC */ |
| 6480 | var uint16_t lac_si3 := si3.payload.si3.lai.lac; |
| 6481 | var uint16_t lac_pcu := g_pcu_last_info.u.info_ind.lac; |
| 6482 | if (lac_si3 != lac_pcu) { |
| 6483 | setverdict(fail, "Expected LAC ", lac_si3, " got: ", lac_pcu); |
| 6484 | } |
| 6485 | |
| 6486 | setverdict(pass); |
| 6487 | } |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 6488 | |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6489 | /* Verify hopping parameters in the INFO.ind message (version >= 10) */ |
| 6490 | testcase TC_pcu_info_ind_fh_params() runs on test_CT { |
| 6491 | var PCUIF_info_ind info_ind; |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 6492 | var FreqHopPars fhp; |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6493 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6494 | f_init_with_pcuif(); |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6495 | |
| 6496 | info_ind := g_pcu_last_info.u.info_ind; |
| 6497 | |
| 6498 | for (var integer i := 0; i < mp_transceiver_num; i := i + 1) { |
| 6499 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6500 | if (info_ind.trx[i].pdch_mask[tn] != '1'B) { |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6501 | /* Skip inactive timeslots */ |
| 6502 | continue; |
| 6503 | } |
| 6504 | |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6505 | if (mp_freq_hop_enabled and mp_transceiver_num > 1) |
Vadim Yanitskiy | 7e1d0a2 | 2020-09-17 19:48:11 +0700 | [diff] [blame] | 6506 | { f_resolve_fh_params(fhp, tn, trx_nr := i); } |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 6507 | else |
| 6508 | { fhp.enabled := false; } |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6509 | |
| 6510 | var template PCUIF_InfoTrxTs tr_ts; |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 6511 | if (fhp.enabled) { |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6512 | tr_ts := tr_PCUIF_InfoTrxTsH1( |
Vadim Yanitskiy | ca81392 | 2020-09-12 19:08:31 +0700 | [diff] [blame] | 6513 | hsn := fhp.maio_hsn.hsn, |
| 6514 | maio := fhp.maio_hsn.maio, |
| 6515 | ma := f_pad_bit(fhp.ma_map.ma, 64, '0'B), |
Vadim Yanitskiy | aa553ed | 2020-09-17 19:44:32 +0700 | [diff] [blame] | 6516 | ma_bit_len := mp_transceiver_num); |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6517 | } else { |
| 6518 | tr_ts := tr_PCUIF_InfoTrxTsH0; |
| 6519 | } |
| 6520 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6521 | var PCUIF_InfoTrxTs ts := info_ind.trx[i].ts[tn]; |
Vadim Yanitskiy | 7faef07 | 2020-08-03 04:22:04 +0700 | [diff] [blame] | 6522 | log("Checking timeslot #", tn, " of trx#", i, ": ", ts); |
| 6523 | if (not match(ts, tr_ts)) { |
| 6524 | setverdict(fail, "Hopping parameters do not match: ", |
| 6525 | "received ", ts, " vs expected ", tr_ts); |
| 6526 | } else { |
| 6527 | setverdict(pass); |
| 6528 | } |
| 6529 | } |
| 6530 | } |
| 6531 | } |
| 6532 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6533 | /* Verify IPv4 NSVC address in the INFO.ind message */ |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6534 | testcase TC_pcu_socket_nsvc_ipv4() runs on test_CT { |
| 6535 | f_init_vty_bsc(); |
| 6536 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote ip 127.127.127.127"); |
| 6537 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6538 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6539 | f_init_with_pcuif(); |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6540 | |
| 6541 | var PCUIF_RemoteAddr remote_addr := g_pcu_last_info.u.info_ind.remote_addr; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6542 | var template PCUIF_RemoteAddr tr_remote_addr := { |
| 6543 | addr_type := { PCUIF_ADDR_TYPE_IPV4, ? }, |
Vadim Yanitskiy | 216021a | 2021-03-24 15:51:06 +0100 | [diff] [blame] | 6544 | addr := { f_pad_oct(f_inet_addr("127.127.127.127"), 16, '00'O), ? } |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6545 | }; |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6546 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6547 | if (not match(remote_addr, tr_remote_addr)) { |
| 6548 | setverdict(fail, "NSVC address ", remote_addr, " does not match ", tr_remote_addr); |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6549 | } |
| 6550 | |
| 6551 | setverdict(pass); |
| 6552 | } |
| 6553 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6554 | /* Verify IPv4 NSVC address in the INFO.ind message */ |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6555 | testcase TC_pcu_socket_nsvc_ipv6() runs on test_CT { |
| 6556 | f_init_vty_bsc(); |
| 6557 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote ip fd00::ca:ff:ee"); |
| 6558 | |
Vadim Yanitskiy | ec9e981 | 2021-03-21 23:02:44 +0100 | [diff] [blame] | 6559 | f_init_with_pcuif(); |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6560 | |
| 6561 | var PCUIF_RemoteAddr remote_addr := g_pcu_last_info.u.info_ind.remote_addr; |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6562 | var template PCUIF_RemoteAddr tr_remote_addr := { |
| 6563 | addr_type := { PCUIF_ADDR_TYPE_IPV6, ? }, |
| 6564 | addr := { f_inet6_addr("fd00::ca:ff:ee"), ? } |
| 6565 | }; |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6566 | |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6567 | if (not match(remote_addr, tr_remote_addr)) { |
| 6568 | setverdict(fail, "NSVC address ", remote_addr, " does not match ", tr_remote_addr); |
Alexander Couzens | 5283f55 | 2020-07-28 15:39:04 +0200 | [diff] [blame] | 6569 | } |
| 6570 | |
| 6571 | setverdict(pass); |
| 6572 | } |
| 6573 | |
Vadim Yanitskiy | e2a50a8 | 2021-03-23 05:58:02 +0100 | [diff] [blame] | 6574 | /* Verify coding of two NSVCs in the INFO.ind message */ |
| 6575 | testcase TC_pcu_socket_two_nsvc() runs on test_CT { |
| 6576 | f_init_vty_bsc(); |
| 6577 | |
| 6578 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 nsvci 1234"); |
| 6579 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 local udp port 1234"); |
| 6580 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote ip 127.127.127.127"); |
| 6581 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 0 remote udp port 1234"); |
| 6582 | |
| 6583 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 1 nsvci 5678"); |
| 6584 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 1 local udp port 5678"); |
| 6585 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 1 remote ip fd00::ca:ff:ee"); |
| 6586 | f_vty_config2(BSCVTY, {"network", "bts 0"} , "gprs nsvc 1 remote udp port 5678"); |
| 6587 | |
Vadim Yanitskiy | c1981b7 | 2021-03-23 03:01:49 +0100 | [diff] [blame] | 6588 | f_init_with_pcuif(); |
Vadim Yanitskiy | e2a50a8 | 2021-03-23 05:58:02 +0100 | [diff] [blame] | 6589 | |
| 6590 | var PCUIF_info_ind info_ind := g_pcu_last_info.u.info_ind; |
| 6591 | var PCUIF_RemoteAddr remote_addr := info_ind.remote_addr; |
| 6592 | var template PCUIF_RemoteAddr tr_remote_addr := { |
| 6593 | addr_type := { PCUIF_ADDR_TYPE_IPV4, PCUIF_ADDR_TYPE_IPV6 }, |
Vadim Yanitskiy | 216021a | 2021-03-24 15:51:06 +0100 | [diff] [blame] | 6594 | addr := { |
| 6595 | f_pad_oct(f_inet_addr("127.127.127.127"), 16, '00'O), |
| 6596 | f_inet6_addr("fd00::ca:ff:ee") |
| 6597 | } |
Vadim Yanitskiy | e2a50a8 | 2021-03-23 05:58:02 +0100 | [diff] [blame] | 6598 | }; |
| 6599 | |
| 6600 | if (not match(info_ind.nsvci, { 1234, 5678 })) |
| 6601 | { setverdict(fail, "NSVCI ", info_ind.nsvci, " does not match { 1234, 5678 }"); } |
| 6602 | if (not match(remote_addr, tr_remote_addr)) |
| 6603 | { setverdict(fail, "NSVC address ", remote_addr, " does not match ", tr_remote_addr); } |
| 6604 | if (not match(info_ind.local_port, { 1234, 5678 })) |
| 6605 | { setverdict(fail, "NSVC lport ", info_ind.local_port, " does not match { 1234, 5678 }"); } |
| 6606 | if (not match(info_ind.remote_port, { 1234, 5678 })) |
| 6607 | { setverdict(fail, "NSVC rport ", info_ind.remote_port, " does not match { 1234, 5678 }"); } |
| 6608 | |
| 6609 | setverdict(pass); |
| 6610 | } |
| 6611 | |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6612 | /* Verify periodic interference reports on PDCH */ |
| 6613 | testcase TC_pcu_interf_ind() runs on test_CT { |
| 6614 | var template PCUIF_Message tr_interf_ind; |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6615 | var integer interf_ind_num := 0; |
Vadim Yanitskiy | 3b868cb | 2021-11-10 04:10:48 +0300 | [diff] [blame] | 6616 | var boolean first := true; |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6617 | var PCUIF_Message msg; |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6618 | timer T; |
| 6619 | |
Vadim Yanitskiy | d9b60e6 | 2021-11-10 03:58:31 +0300 | [diff] [blame] | 6620 | /* Set the averaging/reporting period to 480ms */ |
| 6621 | f_init_vty_bsc(); |
| 6622 | f_vty_cfg_bts(BSCVTY, 0, { "interference-meas avg-period 1" }); |
| 6623 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6624 | |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6625 | f_init_with_pcuif(); |
| 6626 | f_TC_pcu_act_req(0, 0, 7, true); |
| 6627 | |
| 6628 | /* We need trxcon for NOPE indications */ |
| 6629 | f_init_l1ctl(); |
| 6630 | f_l1_tune(L1CTL); |
| 6631 | |
| 6632 | /* Expect -120 .. -90 dBm on TS7 of BTS0/TRX0 */ |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6633 | tr_interf_ind := tr_PCUIF_INTERF_IND( |
| 6634 | bts_nr := 0, |
| 6635 | trx_nr := 0, |
| 6636 | fn := ?, |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 6637 | interf := { 0, 0, 0, 0, 0, 0, 0, (90..120) } |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6638 | ); |
| 6639 | |
Vadim Yanitskiy | 3b868cb | 2021-11-10 04:10:48 +0300 | [diff] [blame] | 6640 | T.start(0.480 * 1.5); |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6641 | alt { |
Vadim Yanitskiy | 3b868cb | 2021-11-10 04:10:48 +0300 | [diff] [blame] | 6642 | /* The first interference report may contain unreliable values, so we ignore it */ |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6643 | [first] as_pcuif_msg(msg, tr_PCUIF_INTERF_IND(0, 0)) { |
Vadim Yanitskiy | 3b868cb | 2021-11-10 04:10:48 +0300 | [diff] [blame] | 6644 | /* 4 SACCH periods => 4 reports (plus some guard time) */ |
| 6645 | T.start(0.480 * 4.0 + 0.480 / 2.0); |
| 6646 | first := false; |
| 6647 | repeat; |
| 6648 | } |
| 6649 | /* Subsequent interference reports shall match our expectations */ |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6650 | [not first] as_pcuif_msg(msg, tr_interf_ind) { |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6651 | /* Check TDMA frame number period */ |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6652 | if (msg.u.interf_ind.fn mod 104 != 0) { |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6653 | setverdict(fail, "Odd TDMA frame number := ", |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6654 | msg.u.interf_ind.fn); |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6655 | } |
| 6656 | interf_ind_num := interf_ind_num + 1; |
| 6657 | if (interf_ind_num < 4) |
| 6658 | { repeat; } |
| 6659 | } |
Vadim Yanitskiy | 73b39cf | 2023-05-31 16:23:19 +0700 | [diff] [blame] | 6660 | [not first] as_pcuif_msg(msg, tr_PCUIF_INTERF_IND(0, 0)) { |
| 6661 | setverdict(fail, "Received unexpected interference report: ", msg); |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6662 | } |
| 6663 | [] PCU.receive { repeat; } |
| 6664 | [] T.timeout { |
| 6665 | setverdict(fail, "Timeout waiting for interference reports"); |
| 6666 | } |
| 6667 | } |
| 6668 | |
Vadim Yanitskiy | d9b60e6 | 2021-11-10 03:58:31 +0300 | [diff] [blame] | 6669 | /* Reset the averaging/reporting period back to default */ |
| 6670 | f_vty_cfg_bts(BSCVTY, 0, { "interference-meas avg-period 6" }); |
| 6671 | |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 6672 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 6673 | } |
| 6674 | |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6675 | /*********************************************************************** |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6676 | * Osmocom Style Dynamic Timeslot Support |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6677 | ***********************************************************************/ |
| 6678 | |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6679 | private altstep as_pcuif_check_pdch_mask(integer pcu_conn_id, BIT1 exp, |
| 6680 | integer bts_nr, integer trx_nr) |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6681 | runs on ConnHdlr { |
| 6682 | var PCUIF_send_data sd; |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6683 | |
| 6684 | [] PCU.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(bts_nr, ?))) -> value sd { |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 6685 | var BIT8 pdch_mask := sd.data.u.info_ind.trx[trx_nr].pdch_mask; |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6686 | if (substr(pdch_mask, g_chan_nr.tn, 1) != exp) { |
| 6687 | repeat; |
| 6688 | } |
| 6689 | } |
| 6690 | } |
| 6691 | |
| 6692 | private function f_dyn_osmo_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 6693 | runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6694 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 6695 | PCU.clear; |
| 6696 | f_rsl_chan_act(g_pars.chan_mode); |
| 6697 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 6698 | timer T_wait := 2.0; |
| 6699 | T_wait.start; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6700 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6701 | [] 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] | 6702 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 6703 | [] T_wait.timeout { |
| 6704 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6705 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '1' on TS", g_chan_nr.tn)); |
| 6706 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6707 | } |
| 6708 | /* try to activate this PDCH from the PCU point of view */ |
| 6709 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 6710 | /* FIXME: is there a response? */ |
| 6711 | } |
| 6712 | |
| 6713 | private function f_dyn_osmo_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 6714 | runs on ConnHdlr { |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6715 | /* Send RSL CHAN REL (deactivate) */ |
| 6716 | PCU.clear; |
| 6717 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 6718 | /* expect BTS to ask PCU to deactivate the channel */ |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 6719 | timer T_wait := 2.0; |
| 6720 | T_wait.start; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6721 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6722 | [] 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] | 6723 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 202c2f7 | 2019-10-08 13:11:05 +0200 | [diff] [blame] | 6724 | [] T_wait.timeout { |
| 6725 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6726 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '0' on TS", g_chan_nr.tn)); |
| 6727 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6728 | } |
| 6729 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 6730 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 6731 | alt { |
| 6732 | [] RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)) { |
| 6733 | setverdict(pass); |
| 6734 | } |
| 6735 | [] RSL.receive { repeat; } |
| 6736 | } |
| 6737 | } |
| 6738 | |
| 6739 | /* Activate Osmocom-style dynamic PDCH from BSC side */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 6740 | 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] | 6741 | var PCUIF_Message first_info; |
| 6742 | var integer ts_nr := g_chan_nr.tn; |
| 6743 | var integer trx_nr := 0; |
| 6744 | var integer bts_nr := 0; |
| 6745 | var integer pcu_conn_id := -1; |
| 6746 | |
| 6747 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6748 | |
| 6749 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 6750 | f_sleep(3.0); |
| 6751 | f_dyn_osmo_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 6752 | setverdict(pass); |
| 6753 | } |
| 6754 | testcase TC_dyn_osmo_pdch_act_deact() runs on test_CT { |
| 6755 | var ConnHdlrPars pars; |
| 6756 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6757 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6758 | |
| 6759 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6760 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_act_deact), pars, true); |
| 6761 | vc_conn.done; |
| 6762 | } |
| 6763 | |
| 6764 | /* 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] | 6765 | 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] | 6766 | var PCUIF_Message first_info; |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6767 | var integer pcu_conn_id := -1; |
| 6768 | |
| 6769 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6770 | |
Neels Hofmeyr | 9c50ca5 | 2018-05-08 20:37:54 +0200 | [diff] [blame] | 6771 | RSL.send(ts_RSL_RF_CHAN_REL(g_chan_nr)); |
| 6772 | /* since the lchan is already released, we don't expect any PCU changes, just a rel ack. */ |
| 6773 | RSL.receive(tr_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6774 | setverdict(pass); |
| 6775 | } |
| 6776 | testcase TC_dyn_osmo_pdch_unsol_deact() runs on test_CT { |
| 6777 | var ConnHdlrPars pars; |
| 6778 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6779 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6780 | |
| 6781 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6782 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_unsol_deact), pars, true); |
| 6783 | vc_conn.done; |
| 6784 | } |
| 6785 | |
| 6786 | /* 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] | 6787 | 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] | 6788 | var PCUIF_Message first_info; |
| 6789 | var integer ts_nr := g_chan_nr.tn; |
| 6790 | var integer trx_nr := 0; |
| 6791 | var integer bts_nr := 0; |
| 6792 | var integer pcu_conn_id := -1; |
| 6793 | |
| 6794 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6795 | |
| 6796 | f_dyn_osmo_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
Neels Hofmeyr | df936a2 | 2018-05-08 22:07:57 +0200 | [diff] [blame] | 6797 | /* Send a second Chan Activ and expect it to be NACKed */ |
| 6798 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 6799 | "RSL CHAN ACT NACK"); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6800 | setverdict(pass); |
| 6801 | } |
| 6802 | testcase TC_dyn_osmo_pdch_double_act() runs on test_CT { |
| 6803 | var ConnHdlrPars pars; |
| 6804 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6805 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6806 | |
| 6807 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6808 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_double_act), pars, true); |
| 6809 | vc_conn.done; |
| 6810 | } |
| 6811 | |
| 6812 | /* 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] | 6813 | 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] | 6814 | var PCUIF_Message first_info; |
| 6815 | var integer ts_nr := g_chan_nr.tn; |
| 6816 | var integer trx_nr := 0; |
| 6817 | var integer bts_nr := 0; |
| 6818 | var integer pcu_conn_id := -1; |
| 6819 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(g_chan_nr.tn)); |
| 6820 | |
| 6821 | /* register for the TCH/F channel number */ |
| 6822 | f_rslem_register(0, chan_nr); |
| 6823 | |
| 6824 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6825 | |
| 6826 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(chan_nr), |
| 6827 | "RSL CHAN ACT"); |
| 6828 | setverdict(pass); |
| 6829 | } |
| 6830 | testcase TC_dyn_osmo_pdch_tchf_act() runs on test_CT { |
| 6831 | var ConnHdlrPars pars; |
| 6832 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6833 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6834 | |
| 6835 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6836 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchf_act), pars, true); |
| 6837 | vc_conn.done; |
| 6838 | } |
| 6839 | |
| 6840 | /* 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] | 6841 | 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] | 6842 | var PCUIF_Message first_info; |
| 6843 | var integer ts_nr := g_chan_nr.tn; |
| 6844 | var integer trx_nr := 0; |
| 6845 | var integer bts_nr := 0; |
| 6846 | var integer pcu_conn_id := -1; |
| 6847 | var RslChannelNr chan_nr[2] := { valueof(t_RslChanNr_Lm(g_chan_nr.tn, 0)), |
| 6848 | valueof(t_RslChanNr_Lm(g_chan_nr.tn, 1)) }; |
| 6849 | |
| 6850 | /* register for the TCH/H channel numbers */ |
| 6851 | f_rslem_register(0, chan_nr[0]); |
| 6852 | f_rslem_register(0, chan_nr[1]); |
| 6853 | |
| 6854 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6855 | |
| 6856 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[1], g_pars.chan_mode), |
| 6857 | tr_RSL_CHAN_ACT_ACK(chan_nr[1]), "RSL CHAN ACT [1]"); |
| 6858 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[0], g_pars.chan_mode), |
| 6859 | tr_RSL_CHAN_ACT_ACK(chan_nr[0]), "RSL CHAN ACT [0]"); |
| 6860 | setverdict(pass); |
| 6861 | } |
| 6862 | testcase TC_dyn_osmo_pdch_tchh_act() runs on test_CT { |
| 6863 | var ConnHdlrPars pars; |
| 6864 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 6865 | f_init(); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 6866 | |
| 6867 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6868 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_tchh_act), pars, true); |
| 6869 | vc_conn.done; |
| 6870 | } |
| 6871 | |
Pau Espin Pedrol | 8e57ac1 | 2021-06-29 17:04:24 +0200 | [diff] [blame] | 6872 | /* try to RSL CHAN ACT the SDCCH8 on an osmocom-style PDCH */ |
| 6873 | private function f_TC_dyn_osmo_pdch_sdcch8_act(charstring id) runs on ConnHdlr { |
| 6874 | var PCUIF_Message first_info; |
| 6875 | var integer ts_nr := g_chan_nr.tn; |
| 6876 | var integer trx_nr := 0; |
| 6877 | var integer bts_nr := 0; |
| 6878 | var integer pcu_conn_id := -1; |
| 6879 | var RslChannelNr chan_nr[8] := { valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 0)), |
| 6880 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 1)), |
| 6881 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 2)), |
| 6882 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 3)), |
| 6883 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 4)), |
| 6884 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 5)), |
| 6885 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 6)), |
| 6886 | valueof(t_RslChanNr_SDCCH8(g_chan_nr.tn, 7)) }; |
| 6887 | |
| 6888 | /* register for the TCH/H channel numbers */ |
| 6889 | for (var integer i := 0; i < lengthof(chan_nr); i := i + 1) { |
| 6890 | f_rslem_register(0, chan_nr[i]); |
| 6891 | } |
| 6892 | |
| 6893 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 6894 | |
| 6895 | for (var integer i := 0; i < lengthof(chan_nr); i := i + 1) { |
| 6896 | f_rsl_transceive(ts_RSL_CHAN_ACT(chan_nr[i], g_pars.chan_mode), |
| 6897 | tr_RSL_CHAN_ACT_ACK(chan_nr[i]), "RSL CHAN ACT [" & int2str(i) & "]"); |
| 6898 | } |
| 6899 | setverdict(pass); |
| 6900 | } |
| 6901 | testcase TC_dyn_osmo_pdch_sdcch8_act() runs on test_CT { |
| 6902 | var ConnHdlrPars pars; |
| 6903 | var ConnHdlr vc_conn; |
| 6904 | f_init(); |
| 6905 | |
| 6906 | pars := valueof(t_Pars(t_RslChanNr_PDCH(4), ts_RSL_ChanMode_SIGN)); |
| 6907 | vc_conn := f_start_handler(refers(f_TC_dyn_osmo_pdch_sdcch8_act), pars, true); |
| 6908 | vc_conn.done; |
| 6909 | } |
| 6910 | |
Vadim Yanitskiy | 64043d8 | 2021-10-03 15:00:20 +0600 | [diff] [blame] | 6911 | /* Reproduce a race condition described in OS#5245 */ |
| 6912 | private function f_rsl_chan_act_deact(charstring id) runs on ConnHdlr { |
| 6913 | f_rsl_chan_act(g_pars.chan_mode); |
| 6914 | f_sleep(1.0); |
| 6915 | f_rsl_chan_deact(); |
| 6916 | setverdict(pass); |
| 6917 | } |
| 6918 | testcase TC_dyn_osmo_pdch_tchh_race_act() runs on test_CT { |
| 6919 | var ConnHdlrPars pars[2]; |
| 6920 | var ConnHdlr vc_conn[2]; |
| 6921 | var TrxcMessage rsp; |
| 6922 | |
| 6923 | f_init(); |
| 6924 | |
| 6925 | /* Configure an artificial delay of 200 ms for TRXC RSP messages */ |
| 6926 | rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, |
| 6927 | ts_TRXC_FAKE_TRXC_DELAY(200)); |
| 6928 | |
| 6929 | /* Activate all sub-channels of TCH/H on TS4 immediately in hope that the second |
| 6930 | * CHANnel ACTIVation message will be handled before the PHY responds to 'SETSLOT' */ |
| 6931 | for (var integer i := 0; i < sizeof(pars); i := i + 1) { |
| 6932 | /* TS4 is an Osmocom style dynamic timeslot, we want it to be TCH/H */ |
| 6933 | pars[i] := valueof(t_Pars(t_RslChanNr_Lm(4, i), ts_RSL_ChanMode_SIGN)); |
| 6934 | vc_conn[i] := f_start_handler(refers(f_rsl_chan_act_deact), |
| 6935 | pars[i], l1ctl := false); |
| 6936 | } |
| 6937 | |
| 6938 | /* Wait for all components to finish */ |
| 6939 | for (var integer i := 0; i < sizeof(pars); i := i + 1) { |
| 6940 | vc_conn[i].done; |
| 6941 | } |
| 6942 | |
| 6943 | /* Disable the artificial delay for TRXC RSP messages */ |
| 6944 | rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, |
| 6945 | ts_TRXC_FAKE_TRXC_DELAY(0)); |
| 6946 | } |
| 6947 | testcase TC_dyn_osmo_pdch_sdcch8_race_act() runs on test_CT { |
| 6948 | var ConnHdlrPars pars[8]; |
| 6949 | var ConnHdlr vc_conn[8]; |
| 6950 | var TrxcMessage rsp; |
| 6951 | |
| 6952 | f_init(); |
| 6953 | |
| 6954 | /* Configure an artificial delay of 200 ms for TRXC RSP messages */ |
| 6955 | rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, |
| 6956 | ts_TRXC_FAKE_TRXC_DELAY(200)); |
| 6957 | |
| 6958 | /* Activate all sub-channels of SDCCH/8 on TS4 immediately in hope that subsequent |
| 6959 | * CHANnel ACTIVation messages will be handled before the PHY responds to 'SETSLOT' */ |
| 6960 | for (var integer i := 0; i < sizeof(pars); i := i + 1) { |
| 6961 | /* TS4 is an Osmocom style dynamic timeslot, we want it to be SDCCH/8 */ |
| 6962 | pars[i] := valueof(t_Pars(t_RslChanNr_SDCCH8(4, i), ts_RSL_ChanMode_SIGN)); |
| 6963 | vc_conn[i] := f_start_handler(refers(f_rsl_chan_act_deact), |
| 6964 | pars[i], l1ctl := false); |
| 6965 | } |
| 6966 | |
| 6967 | /* Wait for all components to finish */ |
| 6968 | for (var integer i := 0; i < sizeof(pars); i := i + 1) { |
| 6969 | vc_conn[i].done; |
| 6970 | } |
| 6971 | |
| 6972 | /* Disable the artificial delay for TRXC RSP messages */ |
| 6973 | rsp := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, |
| 6974 | ts_TRXC_FAKE_TRXC_DELAY(0)); |
| 6975 | } |
| 6976 | |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6977 | /*********************************************************************** |
| 6978 | * IPA Style Dynamic Timeslot Support |
| 6979 | ***********************************************************************/ |
| 6980 | |
| 6981 | private function f_dyn_ipa_pdch_act(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 6982 | runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6983 | /* Expect BTS to immediately acknowledge activation as PDCH */ |
| 6984 | PCU.clear; |
| 6985 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 6986 | /* expect INFO_IND on PCU interface listing TS as PDCH */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 6987 | timer T_wait := 2.0; |
| 6988 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6989 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 6990 | [] 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] | 6991 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 6992 | [] T_wait.timeout { |
| 6993 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6994 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '1' on TS", g_chan_nr.tn)); |
| 6995 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 6996 | } |
| 6997 | /* try to activate this PDCH from the PCU point of view */ |
| 6998 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_ACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 6999 | /* FIXME: is there a response? */ |
| 7000 | |
| 7001 | RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)); |
| 7002 | } |
| 7003 | |
| 7004 | private function f_dyn_ipa_pdch_deact(integer pcu_conn_id, integer bts_nr, integer trx_nr) |
| 7005 | runs on ConnHdlr { |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7006 | /* Send RSL CHAN REL (deactivate) */ |
| 7007 | RSL.send(ts_RSL_IPA_PDCH_DEACT(g_chan_nr)); |
| 7008 | PCU.clear; |
| 7009 | /* expect BTS to ask PCU to deactivate the channel */ |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 7010 | timer T_wait := 2.0; |
| 7011 | T_wait.start; |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7012 | alt { |
Vadim Yanitskiy | b1ebcc0 | 2020-07-19 17:43:02 +0700 | [diff] [blame] | 7013 | [] 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] | 7014 | [] PCU.receive { repeat; } |
Pau Espin Pedrol | 446e07b | 2019-02-18 21:18:36 +0100 | [diff] [blame] | 7015 | [] T_wait.timeout { |
| 7016 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 7017 | log2str("Timeout waiting for PCUIF_INFO_IND PDCH_MASK to be '0' on TS", g_chan_nr.tn)); |
| 7018 | } |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7019 | } |
| 7020 | /* Emulate PCU asking BTS to deactivate PDCH */ |
| 7021 | PCU.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_DEACT_REQ(bts_nr, trx_nr, g_chan_nr.tn))); |
| 7022 | alt { |
| 7023 | [] RSL.receive(tr_RSL_IPA_PDCH_DEACT_ACK(g_chan_nr)) { |
| 7024 | setverdict(pass); |
| 7025 | } |
| 7026 | [] RSL.receive { repeat; } |
| 7027 | } |
| 7028 | } |
| 7029 | |
| 7030 | /* Activate and de-activate an IPA-style dynamic TCH/F + PDCH */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 7031 | 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] | 7032 | var PCUIF_Message first_info; |
| 7033 | var integer ts_nr := g_chan_nr.tn; |
| 7034 | var integer trx_nr := 0; |
| 7035 | var integer bts_nr := 0; |
| 7036 | var integer pcu_conn_id := -1; |
| 7037 | |
| 7038 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 7039 | |
| 7040 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 7041 | f_sleep(3.0); |
| 7042 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 7043 | |
| 7044 | setverdict(pass); |
| 7045 | |
| 7046 | } |
| 7047 | testcase TC_dyn_ipa_pdch_act_deact() runs on test_CT { |
| 7048 | var ConnHdlrPars pars; |
| 7049 | var ConnHdlr vc_conn; |
| 7050 | f_init(); |
| 7051 | |
| 7052 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 7053 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_deact), pars, true); |
| 7054 | vc_conn.done; |
| 7055 | } |
| 7056 | |
| 7057 | /* 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] | 7058 | 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] | 7059 | var PCUIF_Message first_info; |
| 7060 | var integer ts_nr := g_chan_nr.tn; |
| 7061 | var integer trx_nr := 0; |
| 7062 | var integer bts_nr := 0; |
| 7063 | var integer pcu_conn_id := -1; |
| 7064 | |
| 7065 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 7066 | |
| 7067 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 7068 | "RSL CHAN ACT"); |
| 7069 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 7070 | "RF CHAN REL", true); |
| 7071 | setverdict(pass); |
| 7072 | } |
| 7073 | testcase TC_dyn_ipa_pdch_tchf_act() runs on test_CT { |
| 7074 | var ConnHdlrPars pars; |
| 7075 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 7076 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7077 | |
| 7078 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 7079 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act), pars, true); |
| 7080 | vc_conn.done; |
| 7081 | } |
| 7082 | |
| 7083 | /* 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] | 7084 | 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] | 7085 | var PCUIF_Message first_info; |
| 7086 | var integer ts_nr := g_chan_nr.tn; |
| 7087 | var integer trx_nr := 0; |
| 7088 | var integer bts_nr := 0; |
| 7089 | var integer pcu_conn_id := -1; |
| 7090 | |
| 7091 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 7092 | |
| 7093 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_ACK(g_chan_nr), |
| 7094 | "RSL CHAN ACT"); |
| 7095 | |
| 7096 | RSL.send(ts_RSL_IPA_PDCH_ACT(g_chan_nr)); |
| 7097 | alt { |
| 7098 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_NACK(g_chan_nr, ?)); |
| 7099 | [] RSL.receive(tr_RSL_IPA_PDCH_ACT_ACK(g_chan_nr, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7100 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected PDCH ACT ACK"); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7101 | } |
| 7102 | [] RSL.receive { repeat; } |
| 7103 | } |
| 7104 | |
| 7105 | f_rsl_transceive(ts_RSL_RF_CHAN_REL(g_chan_nr), tr_RSL_RF_CHAN_REL_ACK(g_chan_nr), |
| 7106 | "RF CHAN REL", true); |
| 7107 | setverdict(pass); |
| 7108 | } |
| 7109 | testcase TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() runs on test_CT { |
| 7110 | var ConnHdlrPars pars; |
| 7111 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 7112 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7113 | |
| 7114 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 7115 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_tchf_act_pdch_act_nack), pars, true); |
| 7116 | vc_conn.done; |
| 7117 | } |
| 7118 | |
| 7119 | /* 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] | 7120 | 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] | 7121 | var PCUIF_Message first_info; |
| 7122 | var integer ts_nr := g_chan_nr.tn; |
| 7123 | var integer trx_nr := 0; |
| 7124 | var integer bts_nr := 0; |
| 7125 | var integer pcu_conn_id := -1; |
| 7126 | |
| 7127 | /* register for the TCH/F channel number */ |
| 7128 | f_rslem_register(0, g_chan_nr); |
| 7129 | |
| 7130 | f_init_pcu(PCU, id, pcu_conn_id, first_info); |
| 7131 | |
| 7132 | f_dyn_ipa_pdch_act(pcu_conn_id, bts_nr, trx_nr); |
| 7133 | |
| 7134 | f_rsl_transceive(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode), tr_RSL_CHAN_ACT_NACK(g_chan_nr), |
| 7135 | "RSL CHAN ACT"); |
| 7136 | |
| 7137 | f_dyn_ipa_pdch_deact(pcu_conn_id, bts_nr, trx_nr); |
| 7138 | |
| 7139 | setverdict(pass); |
| 7140 | } |
| 7141 | testcase TC_dyn_ipa_pdch_act_tchf_act_nack() runs on test_CT { |
| 7142 | var ConnHdlrPars pars; |
| 7143 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 7144 | f_init(); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 7145 | |
| 7146 | pars := valueof(t_Pars(t_RslChanNr_Bm(3), ts_RSL_ChanMode_SIGN)); |
| 7147 | vc_conn := f_start_handler(refers(f_TC_dyn_ipa_pdch_act_tchf_act_nack), pars, true); |
| 7148 | vc_conn.done; |
| 7149 | } |
| 7150 | |
| 7151 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7152 | /*********************************************************************** |
| 7153 | * LAPDm / RLL related |
| 7154 | ***********************************************************************/ |
| 7155 | |
| 7156 | private function f_tx_lapdm(template (value) LapdmFrame l, |
| 7157 | template (value) RslLinkId link_id) runs on ConnHdlr { |
| 7158 | var octetstring l2 := enc_LapdmFrame(valueof(l)); |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 7159 | var template (value) SacchL1Header l1h; |
| 7160 | |
| 7161 | /* 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] | 7162 | if (valueof(link_id.c) == SACCH) { |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 7163 | /* Compose dummy L1 header */ |
Vadim Yanitskiy | 68c4cff | 2022-07-30 23:45:02 +0700 | [diff] [blame] | 7164 | l1h := ts_SacchL1Header(g_pars.l1_pars.ms_power_level, g_pars.l1_pars.ms_actual_ta); |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 7165 | 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] | 7166 | } else { |
| 7167 | /* If required, pad L2 frame with constant 0x2b filling */ |
Vadim Yanitskiy | 0a8d6da | 2019-05-28 22:18:28 +0700 | [diff] [blame] | 7168 | 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] | 7169 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7170 | } |
| 7171 | |
Vadim Yanitskiy | 7368a10 | 2021-06-01 01:25:08 +0200 | [diff] [blame] | 7172 | friend type record RllTestCase { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7173 | uint3_t sapi, |
| 7174 | RslLinkId link_id, |
| 7175 | octetstring l3, |
| 7176 | boolean exp |
| 7177 | } |
Vadim Yanitskiy | 7368a10 | 2021-06-01 01:25:08 +0200 | [diff] [blame] | 7178 | friend type record of RllTestCase RllTestCases; |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7179 | friend template RllTestCase t_EITC(template (present) uint3_t sapi, |
| 7180 | template (present) RslLinkId id, |
Vadim Yanitskiy | 7368a10 | 2021-06-01 01:25:08 +0200 | [diff] [blame] | 7181 | octetstring l3, boolean exp) := { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7182 | sapi := sapi, |
| 7183 | link_id := id, |
| 7184 | l3 := l3, |
| 7185 | exp := exp |
| 7186 | } |
| 7187 | |
| 7188 | /* execute the same callback function with a set of different parameters (tcs) on a |
| 7189 | * variety of logical channels */ |
| 7190 | private function f_rll_testmatrix(RllTestCases tcs, void_fn fn) runs on test_CT { |
| 7191 | var ConnHdlrPars pars; |
| 7192 | var ConnHdlr vc_conn; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 7193 | f_init(); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7194 | |
| 7195 | /* test on each of the channels we have */ |
| 7196 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i+1) { |
| 7197 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 7198 | |
| 7199 | /* test each of the test cases on the current channel */ |
| 7200 | for (var integer j := 0; j < sizeof(tcs); j := j+1) { |
| 7201 | pars.spec.rll := tcs[j]; |
| 7202 | log(testcasename(), ": XXX Starting ", tcs[j] , " on ", g_AllChanTypes[i]); |
| 7203 | vc_conn := f_start_handler(fn, pars); |
| 7204 | vc_conn.done; |
| 7205 | } |
| 7206 | } |
| 7207 | |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7208 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7209 | } |
| 7210 | |
| 7211 | /* test if SABM on Um triggers EST IND (TS 48.058 3.1) */ |
| 7212 | private function f_TC_rll_est_ind(charstring id) runs on ConnHdlr { |
| 7213 | var RllTestCase tc := g_pars.spec.rll; |
| 7214 | timer T := 3.0; |
| 7215 | |
| 7216 | f_l1_tune(L1CTL); |
| 7217 | RSL.clear; |
| 7218 | |
| 7219 | /* activate the logical channel */ |
| 7220 | f_est_dchan(); |
| 7221 | L1CTL.clear; |
| 7222 | |
| 7223 | f_tx_lapdm(ts_LAPDm_SABM(tc.sapi, cr_MO_CMD, true, tc.l3), tc.link_id); |
| 7224 | T.start; |
| 7225 | alt { |
| 7226 | [tc.l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 7227 | if (tc.exp) { |
| 7228 | setverdict(pass); |
| 7229 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7230 | 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] | 7231 | } |
| 7232 | } |
| 7233 | [tc.l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, tc.link_id)) { |
| 7234 | if (tc.exp) { |
| 7235 | setverdict(pass); |
| 7236 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7237 | 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] | 7238 | } |
| 7239 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 7240 | /* We also expect to receive the measurements */ |
| 7241 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7242 | [tc.exp] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7243 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for EST IND"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7244 | } |
| 7245 | [not tc.exp] T.timeout { |
| 7246 | setverdict(pass); |
| 7247 | } |
| 7248 | } |
| 7249 | |
| 7250 | f_rsl_chan_deact(); |
| 7251 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7252 | f_rslem_unregister(0, g_chan_nr); |
| 7253 | } |
| 7254 | testcase TC_rll_est_ind() runs on test_CT { |
| 7255 | var RllTestCases tcs := { |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 7256 | /* SAPI0 establishment (contention resolution) */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7257 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), '01020304'O, true)), |
Harald Welte | 7aacbbf | 2018-05-09 16:56:41 +0200 | [diff] [blame] | 7258 | /* normal SAPI0 establishment */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7259 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), ''O, true)), |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7260 | /* SAPI 3 doesn't support contention resolution */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7261 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), '01020304'O, false)), |
| 7262 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), '01020304'O, false)), |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7263 | /* normal SAPI3 establishment on main DCCH */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7264 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), ''O, true)), |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7265 | /* normal SAPI3 establishment on SACCH */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7266 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7267 | }; |
| 7268 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_ind)); |
| 7269 | } |
| 7270 | |
| 7271 | /* test if RLL EST REQ trigeres SABM on Um; UA on Um triggers EST CONF (TS 48.058 3.2) */ |
| 7272 | private function f_TC_rll_est_req(charstring id) runs on ConnHdlr { |
| 7273 | var RllTestCase tc := g_pars.spec.rll; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7274 | var L1ctlMessage dl; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7275 | timer T := 3.0; |
| 7276 | |
| 7277 | f_l1_tune(L1CTL); |
| 7278 | RSL.clear; |
| 7279 | |
| 7280 | /* activate the logical channel */ |
| 7281 | f_est_dchan(); |
| 7282 | L1CTL.clear; |
| 7283 | |
| 7284 | /* Send a RSL EST REQ for SAPI3 on main DCCH */ |
| 7285 | RSL.send(ts_RSL_EST_REQ(g_chan_nr, tc.link_id)); |
| 7286 | T.start; |
| 7287 | alt { |
Vadim Yanitskiy | 0310f63 | 2021-06-01 01:22:24 +0200 | [diff] [blame] | 7288 | [] as_l1_exp_lapdm(tr_LAPDm_SABM(tc.sapi, cr_MT_CMD, true, ''O)); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7289 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7290 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for SABM"); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7291 | } |
| 7292 | } |
| 7293 | |
| 7294 | f_rsl_chan_deact(); |
| 7295 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7296 | f_rslem_unregister(0, g_chan_nr); |
| 7297 | } |
| 7298 | testcase TC_rll_est_req_DCCH_3() runs on test_CT { |
| 7299 | var RllTestCases tcs := { |
| 7300 | /* normal SAPI3 establishment on main DCCH */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7301 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), ''O, true))//, |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7302 | }; |
| 7303 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 7304 | } |
| 7305 | testcase TC_rll_est_req_ACCH_3() runs on test_CT { |
| 7306 | var RllTestCases tcs := { |
| 7307 | /* normal SAPI3 establishment on SACCH */ |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7308 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7309 | } |
| 7310 | f_rll_testmatrix(tcs, refers(f_TC_rll_est_req)); |
| 7311 | } |
| 7312 | |
| 7313 | /* altstep to receive a LAPDm frame matching the given template */ |
Vadim Yanitskiy | 7368a10 | 2021-06-01 01:25:08 +0200 | [diff] [blame] | 7314 | friend altstep as_l1_exp_lapdm(template LapdmFrame exp) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7315 | var L1ctlMessage dl; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7316 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, ?)) -> value dl { |
| 7317 | var LapdmFrame lapdm; |
| 7318 | var octetstring l2 := dl.payload.data_ind.payload; |
| 7319 | if (dl.dl_info.link_id.c == SACCH) { |
| 7320 | /* remove L1 header */ |
| 7321 | l2 := substr(l2, 2, lengthof(l2)-2); |
| 7322 | } |
| 7323 | if (ischosen(exp.ab)) { |
| 7324 | lapdm.ab := dec_LapdmFrameAB(l2); |
| 7325 | } else if (ischosen(exp.b4)) { |
| 7326 | lapdm.b4 := dec_LapdmFrameB4(l2); |
| 7327 | } else if (ischosen(exp.bbis)) { |
| 7328 | lapdm.bbis := dec_LapdmFrameBbis(l2); |
Andreas Eversberg | 3699b11 | 2023-07-17 11:35:05 +0200 | [diff] [blame] | 7329 | } else if (ischosen(exp.bter)) { |
| 7330 | lapdm.bter := dec_LapdmFrameBter(l2); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7331 | } |
| 7332 | log("Rx LAPDm ", lapdm); |
| 7333 | if (match(lapdm, exp)) { |
| 7334 | setverdict(pass); |
| 7335 | } else { |
| 7336 | repeat; |
| 7337 | } |
| 7338 | } |
| 7339 | [] L1CTL.receive { repeat; } |
| 7340 | } |
Andreas Eversberg | 4801baa | 2023-07-17 11:45:38 +0200 | [diff] [blame] | 7341 | friend function f_l1_exp_lapdm(template LapdmFrame exp, float t := 3.0) runs on ConnHdlr { |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7342 | timer T := t; |
| 7343 | T.start; |
| 7344 | alt { |
| 7345 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7346 | 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] | 7347 | } |
| 7348 | [] as_l1_exp_lapdm(exp); |
| 7349 | } |
| 7350 | } |
| 7351 | |
| 7352 | /* establish one Radio Link Layer via SABM -> UA. Use l3 for contention resolution */ |
Andreas Eversberg | 083202a | 2023-07-18 14:47:57 +0200 | [diff] [blame] | 7353 | friend function f_est_rll_mo(uint3_t sapi, RslLinkId link_id, octetstring l3) runs on ConnHdlr { |
Vadim Yanitskiy | 2534135 | 2022-07-25 06:13:12 +0700 | [diff] [blame] | 7354 | timer T := 2.0; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7355 | /* send SABM from MS -> BTS */ |
| 7356 | f_tx_lapdm(ts_LAPDm_SABM(sapi, cr_MO_CMD, true, l3), link_id); |
| 7357 | /* expect RLL EST IND on Abis */ |
Vadim Yanitskiy | 2534135 | 2022-07-25 06:13:12 +0700 | [diff] [blame] | 7358 | T.start; |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7359 | alt { |
| 7360 | [l3 != ''O] RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3)); |
| 7361 | [l3 == ''O] RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id)); |
| 7362 | [] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, ?)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7363 | 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] | 7364 | } |
| 7365 | [] RSL.receive { repeat; } |
Vadim Yanitskiy | 2534135 | 2022-07-25 06:13:12 +0700 | [diff] [blame] | 7366 | [] T.timeout { |
| 7367 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for RLL EST IND"); |
| 7368 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7369 | } |
| 7370 | /* expect UA from BTS -> MS */ |
| 7371 | f_l1_exp_lapdm(tr_LAPDm_UA(sapi, cr_MT_RSP, true, l3)); |
| 7372 | } |
| 7373 | |
| 7374 | /* test if DISC on Um triggers RLL REL IND (TS 48.058 3.3) */ |
| 7375 | private function f_TC_rll_rel_ind(charstring id) runs on ConnHdlr { |
| 7376 | var RllTestCase tc := g_pars.spec.rll; |
| 7377 | |
| 7378 | f_l1_tune(L1CTL); |
| 7379 | RSL.clear; |
| 7380 | |
| 7381 | /* activate the logical channel */ |
| 7382 | f_est_dchan(); |
| 7383 | L1CTL.clear; |
| 7384 | |
| 7385 | /* first establish the link-layer */ |
| 7386 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 7387 | |
| 7388 | /* then send the DISC */ |
| 7389 | f_tx_lapdm(ts_LAPDm_DISC(tc.sapi, cr_MO_CMD, true), tc.link_id); |
| 7390 | /* ... and expect the REL IND on the RSL side */ |
| 7391 | alt { |
| 7392 | [] RSL.receive(tr_RSL_REL_IND(g_chan_nr, tc.link_id)) { |
| 7393 | setverdict(pass); |
| 7394 | } |
Vadim Yanitskiy | 3567787 | 2018-10-04 17:30:21 +0700 | [diff] [blame] | 7395 | /* We also expect to receive the measurements */ |
| 7396 | [] as_meas_res(verify_meas := false); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7397 | } |
| 7398 | |
| 7399 | /* release the channel */ |
| 7400 | f_rsl_chan_deact(); |
| 7401 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7402 | f_rslem_unregister(0, g_chan_nr); |
| 7403 | } |
| 7404 | testcase TC_rll_rel_ind_DCCH_0() runs on test_CT { |
| 7405 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7406 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), '01020304'O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7407 | }; |
| 7408 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 7409 | } |
| 7410 | |
| 7411 | testcase TC_rll_rel_ind_ACCH_0() runs on test_CT { |
| 7412 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7413 | valueof(t_EITC(0, ts_RslLinkID_SACCH(0), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7414 | }; |
| 7415 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 7416 | } |
| 7417 | testcase TC_rll_rel_ind_DCCH_3() runs on test_CT { |
| 7418 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7419 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7420 | }; |
| 7421 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 7422 | } |
| 7423 | testcase TC_rll_rel_ind_ACCH_3() runs on test_CT { |
| 7424 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7425 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7426 | }; |
| 7427 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_ind)); |
| 7428 | } |
| 7429 | |
| 7430 | /* test if RLL REL REQ triggers DISC on Um; UA/DM triggers RLL REL CONF (TS 48.058 3.4) */ |
| 7431 | private function f_TC_rll_rel_req(charstring id) runs on ConnHdlr { |
| 7432 | var RllTestCase tc := g_pars.spec.rll; |
| 7433 | f_l1_tune(L1CTL); |
| 7434 | RSL.clear; |
| 7435 | |
| 7436 | /* activate the logical channel */ |
| 7437 | f_est_dchan(); |
| 7438 | L1CTL.clear; |
| 7439 | |
| 7440 | /* first establish the link-layer */ |
| 7441 | f_est_rll_mo(tc.sapi, tc.link_id, tc.l3); |
| 7442 | |
| 7443 | /* then send the REL REQ via RSL */ |
| 7444 | RSL.send(ts_RSL_REL_REQ(g_chan_nr, tc.link_id, RSL_REL_MODE_NORMAL)); |
| 7445 | /* ... and expect the DISC on the Um side */ |
| 7446 | alt { |
Harald Welte | bc6199f | 2018-05-10 19:38:18 +0200 | [diff] [blame] | 7447 | [] as_l1_exp_lapdm(tr_LAPDm_DISC(tc.sapi, cr_MT_CMD, true)) { |
Oliver Smith | 23e192e | 2023-02-13 15:00:46 +0100 | [diff] [blame] | 7448 | /* FIXME: send a UA in response to the DISC */ |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7449 | } |
| 7450 | } |
| 7451 | |
| 7452 | /* release the channel */ |
| 7453 | f_rsl_chan_deact(); |
| 7454 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7455 | f_rslem_unregister(0, g_chan_nr); |
| 7456 | } |
| 7457 | testcase TC_rll_rel_req() runs on test_CT { |
| 7458 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7459 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), '01020304'O, true)), |
| 7460 | valueof(t_EITC(0, ts_RslLinkID_SACCH(0), ''O, true)), |
| 7461 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), ''O, true)), |
| 7462 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), ''O, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7463 | }; |
| 7464 | f_rll_testmatrix(tcs, refers(f_TC_rll_rel_req)); |
| 7465 | } |
| 7466 | |
Vadim Yanitskiy | 89be060 | 2020-07-04 21:20:57 +0700 | [diff] [blame] | 7467 | /* 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] | 7468 | testcase TC_rll_data_req() runs on test_CT { |
| 7469 | } |
| 7470 | |
Vadim Yanitskiy | 89be060 | 2020-07-04 21:20:57 +0700 | [diff] [blame] | 7471 | /* 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] | 7472 | testcase TC_rll_data_ind() runs on test_CT { |
| 7473 | } |
| 7474 | |
| 7475 | /* test if RLL UNIT DATA REQ triggers UI-frame on Um (TS 48.058 3.7) */ |
| 7476 | private function f_TC_rll_ud_req(charstring id) runs on ConnHdlr { |
| 7477 | var RllTestCase tc := g_pars.spec.rll; |
| 7478 | |
| 7479 | f_l1_tune(L1CTL); |
| 7480 | RSL.clear; |
| 7481 | |
| 7482 | f_est_dchan(); |
| 7483 | L1CTL.clear; |
| 7484 | |
| 7485 | /* Send UNITDATA REQ on RSL side */ |
| 7486 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, tc.link_id, tc.l3)); |
| 7487 | /* Expect it to arrive on the other side */ |
| 7488 | if (tc.link_id.c == SACCH) { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7489 | 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] | 7490 | } else { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7491 | 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] | 7492 | } |
| 7493 | |
| 7494 | /* release the channel */ |
| 7495 | f_rsl_chan_deact(); |
| 7496 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7497 | f_rslem_unregister(0, g_chan_nr); |
| 7498 | } |
| 7499 | testcase TC_rll_unit_data_req_DCCH() runs on test_CT { |
| 7500 | var octetstring l3 := f_rnd_octstring(15); |
| 7501 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7502 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), l3, true)), |
| 7503 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), l3, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7504 | }; |
| 7505 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 7506 | } |
| 7507 | testcase TC_rll_unit_data_req_ACCH() runs on test_CT { |
| 7508 | var octetstring l3 := f_rnd_octstring(19); |
| 7509 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7510 | valueof(t_EITC(0, ts_RslLinkID_SACCH(0), l3, true)), |
| 7511 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), l3, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7512 | }; |
| 7513 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_req)); |
| 7514 | } |
| 7515 | |
| 7516 | /* test if UI-frames on Um trigger RLL UNIT DATA IND (TS 48.058 3.8) */ |
| 7517 | private function f_TC_rll_ud_ind(charstring id) runs on ConnHdlr { |
| 7518 | var RllTestCase tc := g_pars.spec.rll; |
| 7519 | |
| 7520 | f_l1_tune(L1CTL); |
| 7521 | RSL.clear; |
| 7522 | |
| 7523 | f_est_dchan(); |
| 7524 | L1CTL.clear; |
| 7525 | |
| 7526 | /* Send LAPDm UI frame. There is no B4 format in uplink! */ |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7527 | 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] | 7528 | /* Expdct RLL UNITDATA IND on RSL side */ |
| 7529 | alt { |
| 7530 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, tc.link_id, tc.l3)) { |
| 7531 | setverdict(pass); |
| 7532 | } |
| 7533 | [] RSL.receive { repeat; } |
| 7534 | } |
| 7535 | |
| 7536 | /* release the channel */ |
| 7537 | f_rsl_chan_deact(); |
| 7538 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7539 | f_rslem_unregister(0, g_chan_nr); |
| 7540 | } |
| 7541 | testcase TC_rll_unit_data_ind_DCCH() runs on test_CT { |
Stefan Sperling | c418191 | 2018-07-25 17:03:08 +0200 | [diff] [blame] | 7542 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7543 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7544 | valueof(t_EITC(0, ts_RslLinkID_DCCH(0), l3, true)), |
| 7545 | valueof(t_EITC(3, ts_RslLinkID_DCCH(3), l3, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7546 | }; |
| 7547 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 7548 | } |
| 7549 | testcase TC_rll_unit_data_ind_ACCH() runs on test_CT { |
| 7550 | var octetstring l3 := f_rnd_octstring(18); |
| 7551 | var RllTestCases tcs := { |
Vadim Yanitskiy | 1b9a7f6 | 2021-06-01 01:56:37 +0200 | [diff] [blame] | 7552 | valueof(t_EITC(0, ts_RslLinkID_SACCH(0), l3, true)), |
| 7553 | valueof(t_EITC(3, ts_RslLinkID_SACCH(3), l3, true)) |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 7554 | }; |
| 7555 | f_rll_testmatrix(tcs, refers(f_TC_rll_ud_ind)); |
| 7556 | } |
| 7557 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7558 | /*********************************************************************** |
| 7559 | * Encryption Related |
| 7560 | ***********************************************************************/ |
| 7561 | |
| 7562 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
Vadim Yanitskiy | 8239dd9 | 2020-07-04 20:31:35 +0700 | [diff] [blame] | 7563 | 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] | 7564 | RSL.send(ts_RSL_UNITDATA_REQ(g_chan_nr, link_id, l3)); |
| 7565 | if (link_id.c == SACCH) { |
| 7566 | f_l1_exp_lapdm(tr_LAPDm_B4_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 7567 | } else { |
| 7568 | f_l1_exp_lapdm(tr_LAPDm_UI(link_id.sapi, cr_MT_CMD, l3)); |
| 7569 | } |
| 7570 | } |
| 7571 | |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 7572 | /* Expect (or not expect) other kinds of messages */ |
| 7573 | private altstep as_rsl_any_ind(boolean exp_any) runs on ConnHdlr { |
| 7574 | [exp_any] RSL.receive { repeat; } |
| 7575 | [not exp_any] RSL.receive { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7576 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Unexpected RSL message!"); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 7577 | } |
| 7578 | } |
| 7579 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7580 | /* 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] | 7581 | private function f_unitdata_mo( |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 7582 | RslLinkId link_id, |
| 7583 | octetstring l3, |
| 7584 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 7585 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 98e0315 | 2018-10-03 18:06:06 +0700 | [diff] [blame] | 7586 | ) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7587 | timer T := 3.0; |
| 7588 | f_tx_lapdm(ts_LAPDm_UI(link_id.sapi, cr_MO_CMD, l3), link_id); |
| 7589 | T.start; |
| 7590 | /* Expect RLL UNITDATA IND on RSL side */ |
| 7591 | alt { |
| 7592 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, link_id, l3)) { |
| 7593 | setverdict(pass); |
| 7594 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 7595 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | ad131c8 | 2018-10-04 06:18:59 +0700 | [diff] [blame] | 7596 | [] as_rsl_any_ind(exp_any); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7597 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7598 | 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] | 7599 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7600 | } |
| 7601 | } |
| 7602 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 7603 | /* Send I-frame from MS and expect it to arrive as RLL DATA IND on Abis */ |
| 7604 | private function f_data_mo( |
| 7605 | RslLinkId link_id, |
| 7606 | boolean p, uint3_t nr, uint3_t ns, |
| 7607 | octetstring l3, |
| 7608 | boolean exp_sacch := true, /* Should tolerate SACCH messages? */ |
Vadim Yanitskiy | b992050 | 2018-10-03 18:29:51 +0700 | [diff] [blame] | 7609 | boolean exp_any := false /* Should tolerate any other RSL messages? */ |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 7610 | ) runs on ConnHdlr { |
| 7611 | timer T := 3.0; |
| 7612 | f_tx_lapdm(ts_LAPDm_I(link_id.sapi, cr_MO_CMD, p, nr, ns, l3), link_id); |
| 7613 | T.start; |
| 7614 | /* Expect RLL DATA IND on RSL side */ |
| 7615 | alt { |
| 7616 | [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3)) { |
| 7617 | setverdict(pass); |
| 7618 | } |
Vadim Yanitskiy | e0b91a7 | 2018-10-04 15:44:40 +0700 | [diff] [blame] | 7619 | [exp_sacch] as_meas_res(verify_meas := false); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 7620 | [] as_rsl_any_ind(exp_any); |
| 7621 | [] T.timeout { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7622 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for DATA_IND"); |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 7623 | } |
| 7624 | } |
| 7625 | } |
| 7626 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7627 | /* 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] | 7628 | private function f_TC_chan_act_encr(charstring id) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7629 | f_l1_tune(L1CTL); |
| 7630 | f_est_dchan(true); |
| 7631 | |
| 7632 | /* now we actually need to transmit some data both ways to check if the encryption works */ |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7633 | var L1ctlMessage dl; |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7634 | |
Stefan Sperling | 603d98e | 2018-07-25 16:47:28 +0200 | [diff] [blame] | 7635 | var octetstring l3 := f_rnd_octstring(20); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7636 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 7637 | |
| 7638 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 7639 | f_unitdata_mt(link_id, l3); |
| 7640 | |
| 7641 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
| 7642 | f_unitdata_mo(link_id, l3); |
| 7643 | |
| 7644 | /* release the channel */ |
| 7645 | f_rsl_chan_deact(); |
| 7646 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7647 | f_rslem_unregister(0, g_chan_nr); |
| 7648 | } |
| 7649 | testcase TC_chan_act_a51() runs on test_CT { |
| 7650 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7651 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 7652 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 7653 | } |
| 7654 | testcase TC_chan_act_a52() runs on test_CT { |
| 7655 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7656 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 7657 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 7658 | } |
| 7659 | testcase TC_chan_act_a53() runs on test_CT { |
| 7660 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7661 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 7662 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 7663 | } |
Eric Wild | b926039 | 2021-05-15 19:48:22 +0200 | [diff] [blame] | 7664 | testcase TC_chan_act_a54() runs on test_CT { |
| 7665 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7666 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_4, f_rnd_octstring(16))); |
| 7667 | f_testmatrix_each_chan(pars, refers(f_TC_chan_act_encr)); |
| 7668 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7669 | |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 7670 | /* Test channel activation with A5/n right from the beginning and RSL MODE MODIFY |
| 7671 | 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] | 7672 | private function f_TC_rsl_modify_encr(charstring id) runs on ConnHdlr { |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 7673 | f_l1_tune(L1CTL); |
| 7674 | f_est_dchan(true); |
| 7675 | |
| 7676 | /* now we actually need to transmit some data both ways to check if the encryption works */ |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7677 | var L1ctlMessage dl; |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 7678 | |
| 7679 | var octetstring l3 := f_rnd_octstring(20); |
| 7680 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 7681 | |
| 7682 | /* send UNITDATA_REQ from BTS to MS and expect it to arrive */ |
| 7683 | f_unitdata_mt(link_id, l3); |
| 7684 | |
| 7685 | /* Send UI frame from MS and expect it to arrive as RLL UNITDATA IND on Abis */ |
| 7686 | f_unitdata_mo(link_id, l3); |
| 7687 | |
| 7688 | var RSL_Message rsl; |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 7689 | rsl := valueof(ts_RSL_MODE_MODIFY_REQ(g_chan_nr, ts_RSL_ChanMode_SIGN)); |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 7690 | |
| 7691 | /* modify key to break proper encryption */ |
| 7692 | g_pars.encr.key := f_rnd_octstring(8); |
| 7693 | var RSL_IE ei := valueof(t_RSL_IE(RSL_IE_ENCR_INFO, RSL_IE_Body:{encr_info := g_pars.encr})); |
| 7694 | rsl.ies := rsl.ies & { ei }; |
| 7695 | RSL.send(rsl); |
| 7696 | |
| 7697 | timer T0 := 1.0; |
| 7698 | T0.start; |
| 7699 | /* Expect RSL MODIFY ACK */ |
| 7700 | alt { |
| 7701 | [] RSL.receive(tr_RSL_MODE_MODIFY_ACK(g_chan_nr)) {} |
| 7702 | [] RSL.receive(tr_RSL_MODE_MODIFY_NACK(g_chan_nr, ?)) { |
| 7703 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,"MODE MODIFY NACK"); |
| 7704 | } |
| 7705 | [] T0.timeout { |
| 7706 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for MODE MODIFY (N)ACK"); |
| 7707 | } |
| 7708 | } |
| 7709 | |
| 7710 | var octetstring l3msg := f_rnd_octstring(15); |
| 7711 | timer T1 := 3.0; |
| 7712 | /* Send UI frame from MS, do not expect it to arrive as RLL UNITDATA IND on Abis |
| 7713 | due to broken encryption */ |
| 7714 | f_tx_lapdm(ts_LAPDm_UI(link_id.sapi, cr_MO_CMD, l3msg), link_id); |
| 7715 | T1.start; |
| 7716 | alt { |
| 7717 | [] RSL.receive(tr_RSL_UNITDATA_IND(g_chan_nr, link_id, l3msg)) { |
| 7718 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "BTS shouldn't be able to decrypt after key change") |
| 7719 | } |
| 7720 | [] T1.timeout { |
| 7721 | setverdict(pass); |
| 7722 | } |
| 7723 | } |
| 7724 | |
| 7725 | /* release the channel */ |
| 7726 | f_rsl_chan_deact(); |
| 7727 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7728 | f_rslem_unregister(0, g_chan_nr); |
| 7729 | } |
| 7730 | testcase TC_rsl_modify_encr() runs on test_CT { |
| 7731 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7732 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 7733 | f_testmatrix_each_chan(pars, refers(f_TC_rsl_modify_encr)); |
| 7734 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7735 | |
Vadim Yanitskiy | 98c4a1a | 2021-06-04 18:46:06 +0200 | [diff] [blame] | 7736 | /* Verify RF RESource INDication messages (periodically sent over the RSL) */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 7737 | private function f_TC_rsl_rf_resource_ind(template (present) RSL_ResourceInfo info) |
Vadim Yanitskiy | 98c4a1a | 2021-06-04 18:46:06 +0200 | [diff] [blame] | 7738 | runs on test_CT { |
| 7739 | const IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
| 7740 | var ASP_RSL_Unitdata ud; |
| 7741 | timer T; |
| 7742 | |
| 7743 | /* Intave is 6 SACCH periods by default */ |
| 7744 | var float Tval := int2float(6 * 480) / 1000.0 + 0.5; |
| 7745 | |
| 7746 | T.start(Tval); |
| 7747 | alt { |
| 7748 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND(info), sid)) { |
| 7749 | setverdict(pass); |
| 7750 | } |
| 7751 | [] RSL_CCHAN.receive(tr_ASP_RSL_UD(tr_RSL_RF_RES_IND(?), sid)) -> value ud { |
| 7752 | setverdict(fail, "RF RESource INDication mismatch: ", ud.rsl); |
| 7753 | } |
| 7754 | [] RSL_CCHAN.receive { repeat; } |
| 7755 | [] T.timeout { |
| 7756 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 7757 | "Timeout waiting for RF RESource INDication"); |
| 7758 | } |
| 7759 | } |
| 7760 | } |
| 7761 | testcase TC_rsl_rf_resource_ind() runs on test_CT { |
| 7762 | var RSL_ResourceInfo info := { }; |
| 7763 | |
| 7764 | f_init(trx_nr := 0); |
| 7765 | |
| 7766 | f_init_l1ctl(); |
| 7767 | f_l1_tune(L1CTL); |
| 7768 | |
| 7769 | /* g_AllChannels contains all logical channels */ |
| 7770 | for (var integer i := 0; i < lengthof(g_AllChannels); i := i + 1) { |
| 7771 | var RslChannelNr chan_nr := g_AllChannels[i]; |
| 7772 | |
| 7773 | /* FIXME: osmo-bts does not report for Osmocom style dynamic timeslots */ |
| 7774 | if (mp_trx_pars[0].ts[chan_nr.tn].config == GSM_PCHAN_TCHH_TCHF_PDCH) |
| 7775 | { continue; } |
| 7776 | |
| 7777 | info := info & { valueof(ts_RSL_ResourceInfoItem(chan_nr, mp_interf_band)) }; |
| 7778 | } |
| 7779 | |
| 7780 | /* Align to the first interference report */ |
| 7781 | f_TC_rsl_rf_resource_ind(?); |
| 7782 | |
| 7783 | /* Test 4 consecutive messages */ |
| 7784 | for (var integer i := 0; i < 4; i := i + 1) { |
| 7785 | f_TC_rsl_rf_resource_ind(info); |
| 7786 | } |
| 7787 | |
| 7788 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 7789 | } |
| 7790 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7791 | /* Test unencrypted channel activation followed by explicit ENCR CMD later */ |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 7792 | private function f_TC_encr_cmd(charstring id) runs on ConnHdlr { |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7793 | /* L3 payload doesn't matter, as it is passed transparently */ |
| 7794 | var BIT3 l3_alg_id := f_alg_id_to_l3(g_pars.encr.alg_id); |
| 7795 | var octetstring l3 := enc_PDU_ML3_NW_MS(valueof(ts_RRM_CiphModeCmd(l3_alg_id))); |
| 7796 | var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0)); |
| 7797 | |
| 7798 | f_l1_tune(L1CTL); |
| 7799 | |
| 7800 | /* first establish a dedicated channel in the clear */ |
| 7801 | f_est_dchan(false); |
| 7802 | |
| 7803 | /* Establish ABM */ |
| 7804 | f_est_rll_mo(link_id.sapi, link_id, '23420815'O); |
| 7805 | |
| 7806 | /* then send the RSL ENCR CMD with an actual RR CIPH MOD CMD inside */ |
| 7807 | RSL.send(ts_RSL_ENCR_CMD(g_chan_nr, link_id, g_pars.encr.alg_id, g_pars.encr.key, l3)); |
| 7808 | /* expect the L3 to arrive still unencrypted on the MS side */ |
| 7809 | f_l1_exp_lapdm(tr_LAPDm_I(link_id.sapi, cr_MT_CMD, ?, ?, ?, l3)); |
| 7810 | |
| 7811 | /* configure L1 to apply ciphering */ |
| 7812 | var uint8_t alg_id := f_alg_id_to_l1ctl(g_pars.encr.alg_id); |
| 7813 | f_L1CTL_CRYPTO_REQ(L1CTL, g_pars.chan_nr, alg_id, g_pars.encr.key); |
| 7814 | |
Vadim Yanitskiy | 4d78a70 | 2018-10-03 03:59:34 +0700 | [diff] [blame] | 7815 | /* send first ciphered I-frame in response and expect it on RSL */ |
| 7816 | 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] | 7817 | |
| 7818 | /* now the BTS code should have detected the first properly encrypted uplink I-frame, |
| 7819 | * and hence enable encryption also on the downlink */ |
| 7820 | |
| 7821 | /* expect bi-directional communication work in encrypted mode */ |
| 7822 | f_unitdata_mo(link_id, f_rnd_octstring(15)); |
| 7823 | f_unitdata_mt(link_id, f_rnd_octstring(15)); |
| 7824 | |
| 7825 | /* release the channel */ |
| 7826 | f_rsl_chan_deact(); |
| 7827 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 7828 | f_rslem_unregister(0, g_chan_nr); |
| 7829 | } |
| 7830 | testcase TC_encr_cmd_a51() runs on test_CT { |
| 7831 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7832 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_1, f_rnd_octstring(8))); |
| 7833 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 7834 | } |
| 7835 | testcase TC_encr_cmd_a52() runs on test_CT { |
| 7836 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7837 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_2, f_rnd_octstring(8))); |
| 7838 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 7839 | } |
| 7840 | testcase TC_encr_cmd_a53() runs on test_CT { |
| 7841 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7842 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_3, f_rnd_octstring(8))); |
| 7843 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 7844 | } |
Eric Wild | b926039 | 2021-05-15 19:48:22 +0200 | [diff] [blame] | 7845 | testcase TC_encr_cmd_a54() runs on test_CT { |
| 7846 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 7847 | pars.encr := valueof(ts_RSL_IE_EncrInfo(RSL_ALG_ID_A5_4, f_rnd_octstring(16))); |
| 7848 | f_testmatrix_each_chan(pars, refers(f_TC_encr_cmd)); |
| 7849 | } |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7850 | |
| 7851 | private function f_assert_lapdm(octetstring enc, template LapdmFrame exp_match, charstring name := "") { |
| 7852 | var LapdmFrame lf; |
| 7853 | var octetstring reenc; |
| 7854 | |
| 7855 | /* decode the LAPDm frame */ |
| 7856 | if (ischosen(exp_match.ab)) { |
| 7857 | lf.ab := dec_LapdmFrameAB(enc); |
| 7858 | } else { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7859 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "unsupported frame type"); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 7860 | } |
| 7861 | |
| 7862 | /* check if decoder result matches expectation */ |
| 7863 | if (not match(lf, exp_match)) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7864 | 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] | 7865 | } else { |
| 7866 | log(name, ": matched"); |
| 7867 | setverdict(pass); |
| 7868 | } |
| 7869 | |
| 7870 | /* test if re-encoded frame equals original input */ |
| 7871 | reenc := enc_LapdmFrame(lf); |
| 7872 | if (enc != reenc) { |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 7873 | 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] | 7874 | } else { |
| 7875 | setverdict(pass); |
| 7876 | } |
| 7877 | } |
| 7878 | |
| 7879 | testcase TC_lapdm_selftest() runs on test_CT { |
| 7880 | f_assert_lapdm('030301'O, tr_LAPDm_UI(0, true, ''O), "ui_s0_empty"); |
| 7881 | f_assert_lapdm('0F0301'O, tr_LAPDm_UI(3, true, ''O), "ui_s3_empty"); |
| 7882 | f_assert_lapdm('013F01'O, tr_LAPDm_SABM(0, false, true, ''O), "sabm_s0_empty"); |
| 7883 | f_assert_lapdm('013F1123420815'O, tr_LAPDm_SABM(0, false, true, '23420815'O), "sabm_s0_l3"); |
| 7884 | f_assert_lapdm('03E101'O, tr_LAPDm_RR(0, true, false, 7), "rr_s0_7"); |
| 7885 | f_assert_lapdm('03000d063505'O, tr_LAPDm_I(0, true, false, 0, 0, '063505'O), "I/0/0"); |
| 7886 | f_assert_lapdm('03e00d063505'O, tr_LAPDm_I(0, true, false, 7, 0, '063505'O), "I/7/0"); |
| 7887 | } |
| 7888 | |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7889 | /*********************************************************************** |
| 7890 | * DTX Related (see GSM 05.08, section 8.3) |
| 7891 | ***********************************************************************/ |
Vadim Yanitskiy | 28a03ef | 2020-10-25 01:50:40 +0700 | [diff] [blame] | 7892 | private function f_TC_tch_sign_l2_fill_frame(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7893 | var L1ctlMessage dl; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7894 | var GsmFrameNumber first_fn; |
| 7895 | var boolean is_first_frame := true; |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7896 | var integer nfill_frames := 0; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7897 | 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] | 7898 | /* Frames numbers (mod 104) for which a fill frame is expected on TCHF if DTX is enabled. */ |
| 7899 | 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] | 7900 | const integer frame_dtx_tchf_mod := 104; |
| 7901 | /* Frame numbers (mod 104) for which a fill frame is expected at the L1SAP level, |
| 7902 | * which operates in terms of blocks rather than frames. */ |
| 7903 | var Integers required_tdma_blocks_dtx_tchf := { 52, 56 }; |
| 7904 | const integer block_dtx_tchf_mod := 26; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7905 | timer T := 5.0; |
| 7906 | |
| 7907 | f_l1_tune(L1CTL); |
| 7908 | RSL.clear; |
| 7909 | L1CTL.clear; |
| 7910 | |
| 7911 | /* activate TCHF signalling channel */ |
| 7912 | f_est_dchan(false); |
| 7913 | |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7914 | /* A template for matching dummy LAPDm func=UA frames */ |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 7915 | var template L1ctlMessage tr_fill_frame := tr_L1CTL_DATA_IND( |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7916 | chan_nr := g_chan_nr, link_id := tr_RslLinkID_DCCH(?), |
| 7917 | l2_data := f_pad_oct('030301'O, 23, '2B'O)); |
| 7918 | |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7919 | T.start; |
| 7920 | alt { |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7921 | [] L1CTL.receive(tr_fill_frame) -> value dl { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7922 | var GsmFrameNumber fn := dl.dl_info.frame_nr; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7923 | |
| 7924 | if (is_first_frame) { |
| 7925 | is_first_frame := false; |
| 7926 | first_fn := dl.dl_info.frame_nr; |
| 7927 | } |
| 7928 | |
Vadim Yanitskiy | 28a03ef | 2020-10-25 01:50:40 +0700 | [diff] [blame] | 7929 | if (g_pars.chan_mode.dtx_d) { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7930 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7931 | T.stop; |
| 7932 | f_rsl_chan_deact(); |
| 7933 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7934 | |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7935 | /* With DTX enabled we can expect at least 3 fill frames for every 104 frames. */ |
| 7936 | expected_fill_frames := 2; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7937 | |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7938 | if (nfill_frames < expected_fill_frames) { |
Vadim Yanitskiy | 76dc4d0 | 2020-10-24 22:56:46 +0700 | [diff] [blame] | 7939 | setverdict(fail, "Not enough fill frames received: ", |
| 7940 | nfill_frames, " out of ", expected_fill_frames); |
| 7941 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7942 | } else { |
| 7943 | setverdict(pass); |
| 7944 | } |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7945 | } else { |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7946 | /* On DTX TCH/F channels, fill frames occur only for specific frame numbers mod 104. |
| 7947 | * Furthermore, the L1SAP layer gives us frame numbers for the start of a block so |
| 7948 | * we should only see the subset of frames numbers which correspond to a block boundary. |
| 7949 | * TCH/F blocks are defined to start at 0,4,8,13,17,21 (modulo 26) */ |
| 7950 | for (var integer i := 0; i < lengthof(required_tdma_blocks_dtx_tchf); i := i + 1) { |
| 7951 | if (fn mod frame_dtx_tchf_mod == required_tdma_blocks_dtx_tchf[i]) { |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7952 | nfill_frames := nfill_frames + 1; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7953 | repeat; |
| 7954 | } |
| 7955 | } |
Vadim Yanitskiy | 76dc4d0 | 2020-10-24 22:56:46 +0700 | [diff] [blame] | 7956 | setverdict(fail, "Received DTX TCH fill frame with bad frame number: ", fn, |
| 7957 | " (mod ", frame_dtx_tchf_mod, ": ", fn mod frame_dtx_tchf_mod, ")", |
| 7958 | " (mod ", block_dtx_tchf_mod, ": ", fn mod block_dtx_tchf_mod, ")"); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7959 | f_rsl_chan_deact(); |
| 7960 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7961 | } |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7962 | } else { |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7963 | nfill_frames := nfill_frames + 1; |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7964 | if (fn > first_fn + frame_dtx_tchf_mod) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7965 | T.stop; |
Vadim Yanitskiy | 34ed228 | 2020-10-24 23:18:42 +0700 | [diff] [blame] | 7966 | |
| 7967 | select (g_chan_nr) { |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7968 | /* TCH/F: we expect 24 fill frames for every 104 frames. */ |
| 7969 | case (t_RslChanNr_Bm(?)) { expected_fill_frames := 24; } |
Vadim Yanitskiy | 34ed228 | 2020-10-24 23:18:42 +0700 | [diff] [blame] | 7970 | /* TCH/H: we expect 2 fill frames for every 104 frames. */ |
| 7971 | case (t_RslChanNr_Lm(?, ?)) { expected_fill_frames := 2; } |
| 7972 | /* SDCCH: we expect 5 fill frames for every 104 frames. */ |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7973 | case (t_RslChanNr_SDCCH4(?, ?)) { expected_fill_frames := 4; } |
| 7974 | case (t_RslChanNr_SDCCH8(?, ?)) { expected_fill_frames := 4; } |
Vadim Yanitskiy | 34ed228 | 2020-10-24 23:18:42 +0700 | [diff] [blame] | 7975 | case else { |
| 7976 | /* This shall not happen, just to be sure */ |
| 7977 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 7978 | } |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7979 | } |
| 7980 | |
| 7981 | f_rsl_chan_deact(); |
| 7982 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Stefan Sperling | 91d4c9d | 2018-08-09 20:03:08 +0200 | [diff] [blame] | 7983 | |
Vadim Yanitskiy | 080a17d | 2020-10-25 01:06:48 +0700 | [diff] [blame] | 7984 | if (nfill_frames >= expected_fill_frames) { |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7985 | setverdict(pass); |
| 7986 | } else { |
Vadim Yanitskiy | 76dc4d0 | 2020-10-24 22:56:46 +0700 | [diff] [blame] | 7987 | setverdict(fail, "Not enough fill frames received: ", |
| 7988 | nfill_frames, " out of ", expected_fill_frames); |
| 7989 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 7990 | } |
| 7991 | } else { |
| 7992 | repeat; |
| 7993 | } |
| 7994 | } |
| 7995 | } |
| 7996 | [] L1CTL.receive { repeat; } |
| 7997 | [] T.timeout { |
| 7998 | f_rsl_chan_deact(); |
| 7999 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Daniel Willmann | 0fcc4d3 | 2018-10-23 20:32:19 +0200 | [diff] [blame] | 8000 | 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] | 8001 | } |
| 8002 | } |
| 8003 | } |
| 8004 | |
Vadim Yanitskiy | 71c39ea | 2020-07-04 20:44:42 +0700 | [diff] [blame] | 8005 | private function f_tch_sign_l2_fill_frame(boolean dtxd) runs on test_CT { |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 8006 | var template RSL_IE_ChannelMode ch_mode; |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 8007 | var ConnHdlr vc_conn; |
| 8008 | var ConnHdlrPars pars; |
| 8009 | pars.t_guard := 60.0; |
Harald Welte | 1047406 | 2019-05-30 16:48:17 +0200 | [diff] [blame] | 8010 | f_init(); |
Vadim Yanitskiy | eaaa1d6 | 2023-05-26 18:46:25 +0700 | [diff] [blame] | 8011 | ch_mode := ts_RSL_ChanMode_SIGN(dtxd := dtxd); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 8012 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
Vadim Yanitskiy | 8fc43df | 2020-10-20 02:11:05 +0700 | [diff] [blame] | 8013 | pars := valueof(t_Pars(g_AllChannels[i], ch_mode)); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 8014 | if (dtxd) { |
| 8015 | if (i >= 4) { /* DTX is only allowed on TCH/F */ |
| 8016 | break; |
| 8017 | } |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 8018 | } |
Vadim Yanitskiy | 28a03ef | 2020-10-25 01:50:40 +0700 | [diff] [blame] | 8019 | vc_conn := f_start_handler(refers(f_TC_tch_sign_l2_fill_frame), pars); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 8020 | vc_conn.done; |
| 8021 | } |
| 8022 | } |
| 8023 | |
| 8024 | /* Verify that L2 fill frames are sent on TCH in signaling mode if |
| 8025 | * there is nothing to transmit while DTX is disabled on downlink. */ |
| 8026 | testcase TC_tch_sign_l2_fill_frame() runs on test_CT { |
| 8027 | f_tch_sign_l2_fill_frame(false); |
| 8028 | } |
| 8029 | |
| 8030 | /* Verify that particular L2 fill frames are sent on TCH in signaling mode if |
| 8031 | * there is nothing to transmit while DTX is enabled on downlink. */ |
| 8032 | testcase TC_tch_sign_l2_fill_frame_dtxd() runs on test_CT { |
| 8033 | f_tch_sign_l2_fill_frame(true); |
| 8034 | } |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 8035 | |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 8036 | testcase TC_chopped_ipa_ping() runs on test_CT { |
| 8037 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 8038 | } |
| 8039 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8040 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 8041 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_rsl_ip, mp_rsl_port, LISTEN_FOR_CLIENT); |
| 8042 | } |
| 8043 | |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8044 | |
Vadim Yanitskiy | 31a88d4 | 2023-05-31 20:01:08 +0700 | [diff] [blame] | 8045 | /* Callback function to be called by as_TC_ms_pwr_ctrl(). |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8046 | * Return value: Measurement Report to be sent (encoded octetstring). */ |
| 8047 | type function f_TC_ms_pwr_ctrl_cb(inout SacchL1Header l1h, integer num_blocks) |
| 8048 | runs on ConnHdlr return octetstring; |
| 8049 | |
| 8050 | private altstep as_TC_ms_pwr_ctrl(f_TC_ms_pwr_ctrl_cb cb, inout integer num_blocks) |
| 8051 | runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8052 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8053 | var SacchL1Header l1h; |
| 8054 | var octetstring l2; |
| 8055 | |
| 8056 | [] L1CTL.receive(tr_L1CTL_DATA_IND(g_chan_nr, tr_RslLinkID_SACCH(?))) -> value l1_dl { |
| 8057 | /* Parse the L1 SACCH header (MS Power Level & Timing Advance) */ |
| 8058 | l1h := dec_SacchL1Header(substr(l1_dl.payload.data_ind.payload, 0, 2)); |
| 8059 | log("as_TC_ms_pwr_ctrl(): Rx SACCH L1 header: ", l1h); |
| 8060 | |
| 8061 | /* Pass it to the user specified call-back function */ |
| 8062 | l2 := cb.apply(l1h, num_blocks); |
| 8063 | /* Send a Measurement Report generated by the call-back */ |
| 8064 | L1CTL.send(ts_L1CTL_DATA_REQ_SACCH(l1_dl.dl_info.chan_nr, |
| 8065 | l1_dl.dl_info.link_id, |
| 8066 | l1h, l2)); |
| 8067 | |
| 8068 | /* Shall we keep going? */ |
| 8069 | num_blocks := num_blocks - 1; |
| 8070 | log("as_TC_ms_pwr_ctrl(): ", num_blocks, " SACCH blocks remaining"); |
| 8071 | if (num_blocks > 0) { repeat; } |
| 8072 | } |
| 8073 | [] L1CTL.receive { repeat; } |
| 8074 | } |
| 8075 | |
| 8076 | private function f_TC_ms_pwr_ctrl_cb_def(inout SacchL1Header l1h, integer num_blocks) |
| 8077 | runs on ConnHdlr return octetstring { |
| 8078 | /* Command the L1 to apply received parameters */ |
| 8079 | f_L1CTL_PARAM(L1CTL, l1h.actual_ta, l1h.ms_power_lvl); |
| 8080 | |
| 8081 | /* Dummy measurement report (the results are invalid) */ |
| 8082 | return f_pad_oct('010349'O & '0615004001C0'O, 21, '00'O); |
| 8083 | } |
| 8084 | |
| 8085 | private function f_TC_ms_pwr_ctrl_cb_const(inout SacchL1Header l1h, integer num_blocks) |
| 8086 | runs on ConnHdlr return octetstring { |
| 8087 | if (l1h.ms_power_lvl != g_pars.l1_pars.ms_power_level) { |
| 8088 | setverdict(fail, "Unexpected MS Power level change: ", |
| 8089 | g_pars.l1_pars.ms_power_level, " -> ", |
| 8090 | l1h.ms_power_lvl); |
| 8091 | } |
| 8092 | |
| 8093 | return f_TC_ms_pwr_ctrl_cb_def(l1h, num_blocks); |
| 8094 | } |
| 8095 | |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 8096 | private function f_TC_ms_pwr_ctrl_cb_rssi_pwm(inout SacchL1Header l1h, integer num_blocks) |
| 8097 | runs on ConnHdlr return octetstring { |
| 8098 | /* UL RSSI oscillation driven by SACCH block number */ |
| 8099 | if (num_blocks rem 2 == 0) { |
| 8100 | f_trxc_fake_rssi(-100); |
| 8101 | } else { |
| 8102 | f_trxc_fake_rssi(-50); |
| 8103 | } |
| 8104 | |
| 8105 | /* Make sure that MS power level remains constant */ |
| 8106 | return f_TC_ms_pwr_ctrl_cb_const(l1h, num_blocks); |
| 8107 | } |
| 8108 | |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8109 | /* Make sure that MS power level remains constant when 'rx-current' equals 'rx-target' */ |
| 8110 | private function f_TC_ms_pwr_ctrl_constant(charstring id) |
| 8111 | runs on ConnHdlr { |
| 8112 | var integer num_blocks := 8; |
| 8113 | timer T := int2float(num_blocks); |
| 8114 | |
| 8115 | f_l1_tune(L1CTL); |
| 8116 | RSL.clear; |
| 8117 | |
| 8118 | /* These IEs are needed for autonomous MS power control */ |
| 8119 | var template (value) RSL_IE_List ies := { |
| 8120 | t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ |
| 8121 | ms_power := ts_RSL_IE_MS_Power(g_pars.l1_pars.ms_power_level) |
| 8122 | }), |
| 8123 | t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ |
| 8124 | ms_power_params := ts_RSL_IE_MS_Power_Parameters(''O) |
| 8125 | }) |
| 8126 | }; |
| 8127 | |
| 8128 | /* Ensure that 'rx-current' equals 'rx-target' */ |
| 8129 | f_trxc_fake_rssi(mp_uplink_power_target); |
| 8130 | |
Vadim Yanitskiy | 8a1685d | 2022-07-30 23:56:18 +0700 | [diff] [blame] | 8131 | /* Populate SACCH cache with a Measurement Report */ |
Vadim Yanitskiy | e2003d0 | 2022-08-10 17:38:07 +0700 | [diff] [blame] | 8132 | f_send_meas_rep(ts_MeasurementResults); |
Vadim Yanitskiy | 8a1685d | 2022-07-30 23:56:18 +0700 | [diff] [blame] | 8133 | |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8134 | /* Establish a dedicated channel */ |
| 8135 | f_est_dchan(more_ies := valueof(ies)); |
| 8136 | |
| 8137 | L1CTL.clear; |
| 8138 | T.start; |
| 8139 | alt { |
| 8140 | [] as_TC_ms_pwr_ctrl(refers(f_TC_ms_pwr_ctrl_cb_const), num_blocks); |
| 8141 | [] T.timeout { |
| 8142 | setverdict(fail, "Not all SACCH blocks were processed in time, ", |
| 8143 | num_blocks, " were not handled"); |
| 8144 | } |
| 8145 | } |
Vadim Yanitskiy | 6b4404a | 2021-06-17 17:22:56 +0200 | [diff] [blame] | 8146 | |
| 8147 | /* Release the channel */ |
| 8148 | f_rsl_chan_deact(); |
| 8149 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 8150 | } |
| 8151 | testcase TC_ms_pwr_ctrl_constant() runs on test_CT { |
| 8152 | var ConnHdlr vc_conn; |
| 8153 | var ConnHdlrPars pars; |
| 8154 | |
| 8155 | f_init(); |
| 8156 | |
| 8157 | /* Explicitly configure the Uplink power target (in dBm) */ |
| 8158 | f_vty_config(BTSVTY, "bts 0", "uplink-power-target " & int2str(mp_uplink_power_target)); |
| 8159 | |
| 8160 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i + 1) { |
| 8161 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 8162 | log(testcasename(), ": starting on ", pars.chan_nr); |
| 8163 | |
| 8164 | vc_conn := f_start_handler(refers(f_TC_ms_pwr_ctrl_constant), |
| 8165 | pars, trxc_comp := true); |
| 8166 | vc_conn.done; |
| 8167 | } |
| 8168 | |
| 8169 | /* No need to reset Uplink power parameters - the IUT restarts anyway */ |
| 8170 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8171 | } |
| 8172 | |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 8173 | /* Test Exponentially Weighted Moving Average (EWMA) power filtering */ |
| 8174 | private function f_TC_ms_pwr_ctrl_pf_ewma(charstring id) |
| 8175 | runs on ConnHdlr { |
| 8176 | var integer num_blocks := 16; |
| 8177 | timer T := int2float(num_blocks); |
| 8178 | |
| 8179 | f_l1_tune(L1CTL); |
| 8180 | RSL.clear; |
| 8181 | |
| 8182 | /* These IEs are needed for autonomous MS power control */ |
| 8183 | var template (value) RSL_IE_List ies := { |
| 8184 | t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ |
| 8185 | ms_power := ts_RSL_IE_MS_Power(g_pars.l1_pars.ms_power_level) |
| 8186 | }), |
| 8187 | t_RSL_IE(RSL_IE_MS_POWER_PARAM, RSL_IE_Body:{ |
| 8188 | ms_power_params := ts_RSL_IE_MS_Power_Parameters(''O) |
| 8189 | }) |
| 8190 | }; |
| 8191 | |
| 8192 | /* Ensure that 'rx-current' equals 'rx-target' */ |
| 8193 | f_trxc_fake_rssi(mp_uplink_power_target); |
| 8194 | |
Vadim Yanitskiy | 8a1685d | 2022-07-30 23:56:18 +0700 | [diff] [blame] | 8195 | /* Populate SACCH cache with a Measurement Report */ |
Vadim Yanitskiy | e2003d0 | 2022-08-10 17:38:07 +0700 | [diff] [blame] | 8196 | f_send_meas_rep(ts_MeasurementResults); |
Vadim Yanitskiy | 8a1685d | 2022-07-30 23:56:18 +0700 | [diff] [blame] | 8197 | |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 8198 | /* Establish a dedicated channel */ |
| 8199 | f_est_dchan(more_ies := valueof(ies)); |
| 8200 | |
| 8201 | L1CTL.clear; |
| 8202 | T.start; |
| 8203 | alt { |
| 8204 | [] as_TC_ms_pwr_ctrl(refers(f_TC_ms_pwr_ctrl_cb_rssi_pwm), num_blocks); |
| 8205 | [] T.timeout { |
| 8206 | setverdict(fail, "Not all SACCH blocks were processed in time, ", |
| 8207 | num_blocks, " were not handled"); |
| 8208 | } |
| 8209 | } |
Vadim Yanitskiy | 6b4404a | 2021-06-17 17:22:56 +0200 | [diff] [blame] | 8210 | |
| 8211 | /* Release the channel */ |
| 8212 | f_rsl_chan_deact(); |
| 8213 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 8214 | } |
| 8215 | testcase TC_ms_pwr_ctrl_pf_ewma() runs on test_CT { |
| 8216 | var ConnHdlr vc_conn; |
| 8217 | var ConnHdlrPars pars; |
| 8218 | |
| 8219 | f_init(); |
| 8220 | |
| 8221 | /* Explicitly configure EWMA filtering with 80% smoothing (alpha = 0.2) */ |
| 8222 | f_vty_config(BTSVTY, "bts 0", "uplink-power-filtering algo ewma beta 80"); |
| 8223 | /* Explicitly configure the Uplink power range (target and delte) */ |
| 8224 | f_vty_config(BTSVTY, "bts 0", "uplink-power-target " & int2str(mp_uplink_power_target) |
| 8225 | & " hysteresis " & int2str(mp_uplink_power_hysteresis)); |
| 8226 | |
| 8227 | for (var integer i := 0; i < sizeof(g_AllChanTypes); i := i + 1) { |
| 8228 | pars := valueof(t_Pars(g_AllChanTypes[i], ts_RSL_ChanMode_SIGN)); |
| 8229 | log(testcasename(), ": starting on ", pars.chan_nr); |
| 8230 | |
| 8231 | vc_conn := f_start_handler(refers(f_TC_ms_pwr_ctrl_pf_ewma), |
| 8232 | pars, trxc_comp := true); |
| 8233 | vc_conn.done; |
| 8234 | } |
| 8235 | |
| 8236 | /* No need to reset Uplink power parameters - the IUT restarts anyway */ |
| 8237 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8238 | } |
| 8239 | |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8240 | private function f_TC_speech_no_rtp(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | 75ad9a6 | 2023-07-13 02:47:48 +0700 | [diff] [blame] | 8241 | var template L1ctlMessage tr_dummy_frame; |
| 8242 | var integer dummy_frame_num := 0; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8243 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8244 | timer T := 8.0; |
| 8245 | |
| 8246 | f_l1_tune(L1CTL); |
| 8247 | RSL.clear; |
| 8248 | |
| 8249 | f_est_dchan(); |
| 8250 | |
| 8251 | /* There may be a few errors right after the channel activation */ |
| 8252 | f_sleep(2.0); /* ... so let's give the L1 some time to stabilize */ |
| 8253 | L1CTL.clear; |
| 8254 | |
Vadim Yanitskiy | 75ad9a6 | 2023-07-13 02:47:48 +0700 | [diff] [blame] | 8255 | /* Expect empty TRAFFIC.ind with no bit errors and bad CRC. In the absence |
| 8256 | * of RTP, osmo-bts is transmitting dummy speech frames with inverted CRC3. |
| 8257 | * This is a beautiful hack inducing a BFI condition in the MS receiver. |
| 8258 | * See https://osmocom.org/issues/4823#note-13 for more details. */ |
| 8259 | tr_dummy_frame := tr_L1CTL_TRAFFIC_IND(g_chan_nr, tr_RslLinkID_DCCH(0)); |
| 8260 | tr_dummy_frame.dl_info.fire_crc := (1..255); /* != 0 */ |
| 8261 | tr_dummy_frame.dl_info.num_biterr := 0; |
| 8262 | tr_dummy_frame.payload := omit; |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8263 | |
| 8264 | T.start; |
| 8265 | alt { |
Vadim Yanitskiy | 75ad9a6 | 2023-07-13 02:47:48 +0700 | [diff] [blame] | 8266 | [] L1CTL.receive(tr_dummy_frame) -> value l1_dl { |
| 8267 | dummy_frame_num := dummy_frame_num + 1; |
| 8268 | log("Rx dummy TRAFFIC.ind (num ", dummy_frame_num, "): ", l1_dl); |
| 8269 | /* break the loop if we got 5 dummy frames */ |
| 8270 | if (dummy_frame_num < 5) |
| 8271 | { repeat; } |
| 8272 | } |
| 8273 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr)) -> value l1_dl { |
| 8274 | setverdict(fail, "Rx unexpected TRAFFIC.ind: ", l1_dl); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8275 | } |
| 8276 | [] as_l1_sacch(); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8277 | [] T.timeout { |
Vadim Yanitskiy | 75ad9a6 | 2023-07-13 02:47:48 +0700 | [diff] [blame] | 8278 | setverdict(fail, "Timeout waiting for TRAFFIC.ind"); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8279 | } |
| 8280 | } |
| 8281 | |
| 8282 | f_rsl_chan_deact(); |
| 8283 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
Vadim Yanitskiy | cc92ba7 | 2023-07-13 04:13:09 +0700 | [diff] [blame] | 8284 | f_rsl_chan_deact(); |
| 8285 | f_rslem_unregister(0, g_chan_nr); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8286 | } |
| 8287 | testcase TC_speech_no_rtp_tchf() runs on test_CT { |
| 8288 | var ConnHdlr vc_conn; |
| 8289 | var ConnHdlrPars pars; |
| 8290 | |
| 8291 | f_init(); |
| 8292 | |
| 8293 | /* TS1, TCH/F, V1 (FR codec) */ |
| 8294 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))); |
| 8295 | vc_conn := f_start_handler(refers(f_TC_speech_no_rtp), pars); |
| 8296 | vc_conn.done; |
Vadim Yanitskiy | 982ac2d | 2023-07-13 04:18:34 +0700 | [diff] [blame] | 8297 | |
Vadim Yanitskiy | ce65a0f | 2023-07-13 03:14:26 +0700 | [diff] [blame] | 8298 | /* TS1, TCH/F, V2 (EFR codec) */ |
| 8299 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))); |
| 8300 | vc_conn := f_start_handler(refers(f_TC_speech_no_rtp), pars); |
| 8301 | vc_conn.done; |
| 8302 | |
| 8303 | /* TODO: we don't know what's the expected behavior for TCH/AFS, so we don't test it here. |
| 8304 | * Current osmo-bts is sending FACCH/F with dummy LAPDm func=UI frames. */ |
| 8305 | |
Vadim Yanitskiy | 982ac2d | 2023-07-13 04:18:34 +0700 | [diff] [blame] | 8306 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8307 | } |
| 8308 | testcase TC_speech_no_rtp_tchh() runs on test_CT { |
| 8309 | var ConnHdlr vc_conn; |
| 8310 | var ConnHdlrPars pars; |
| 8311 | |
| 8312 | f_init(); |
| 8313 | |
| 8314 | /* TS5, TCH/H, V1 (HR codec) */ |
| 8315 | pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))); |
| 8316 | vc_conn := f_start_handler(refers(f_TC_speech_no_rtp), pars); |
| 8317 | vc_conn.done; |
Vadim Yanitskiy | 982ac2d | 2023-07-13 04:18:34 +0700 | [diff] [blame] | 8318 | |
Vadim Yanitskiy | ce65a0f | 2023-07-13 03:14:26 +0700 | [diff] [blame] | 8319 | /* TODO: we don't know what's the expected behavior for TCH/AHS, so we don't test it here. |
| 8320 | * Current osmo-bts is sending FACCH/H with dummy LAPDm func=UI frames (whenever possible). */ |
| 8321 | |
Vadim Yanitskiy | 982ac2d | 2023-07-13 04:18:34 +0700 | [diff] [blame] | 8322 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 8323 | } |
| 8324 | |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8325 | /* Verify handling of Downlink and Uplink speech frames */ |
| 8326 | private function f_TC_speech_rtp(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8327 | var L1ctlMessage l1_dl; |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8328 | var PDU_RTP rtp_pdu; |
| 8329 | var octetstring pl; |
| 8330 | timer Td, Tu; |
| 8331 | |
Vadim Yanitskiy | ece325f | 2023-05-19 19:11:42 +0700 | [diff] [blame] | 8332 | log("Testing channel mode ", g_pars.chan_mode); |
| 8333 | |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8334 | f_l1_tune(L1CTL); |
| 8335 | f_est_dchan(); |
| 8336 | |
| 8337 | /* Activate the RTP emulation */ |
| 8338 | pl := f_rnd_octstring(6); |
| 8339 | f_rtpem_activate(pl); |
| 8340 | |
| 8341 | /* Give the scheduler some time to fill up the buffers */ |
| 8342 | f_sleep(2.0); |
| 8343 | L1CTL.clear; |
| 8344 | RSL.clear; |
| 8345 | |
| 8346 | /* Make sure that Downlink frames are received at the UE */ |
| 8347 | Td.start(2.0); |
| 8348 | alt { |
| 8349 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := pl)) -> value l1_dl { |
Vadim Yanitskiy | 803af35 | 2023-07-07 21:48:45 +0700 | [diff] [blame] | 8350 | var octetstring data := l1_dl.payload.traffic_ind.data; |
| 8351 | log("TCH received (len=", lengthof(data), "): ", data); |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8352 | L1CTL.send(ts_L1CTL_TRAFFIC_REQ(g_chan_nr, l1_dl.dl_info.link_id, |
| 8353 | l1_dl.payload.traffic_ind.data)); |
| 8354 | setverdict(pass); |
| 8355 | } |
| 8356 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := ?)) -> value l1_dl { |
| 8357 | setverdict(fail, "Rx unexpected Downlink speech frame ", |
| 8358 | "(", l1_dl.payload.traffic_ind.data, ") ", |
| 8359 | "expected (", pl, ")"); |
| 8360 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8361 | } |
| 8362 | [] as_l1_sacch(); |
| 8363 | [] L1CTL.receive { repeat; } |
| 8364 | [] Td.timeout { |
| 8365 | setverdict(fail, "Timeout waiting for Downlink speech frames"); |
| 8366 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8367 | } |
| 8368 | } |
| 8369 | |
| 8370 | /* Make sure that Uplink frames are received at the BTS */ |
| 8371 | RTPEM_DATA.clear; |
| 8372 | Tu.start(2.0); |
| 8373 | alt { |
Vadim Yanitskiy | d1bbe72 | 2023-05-29 15:32:49 +0700 | [diff] [blame] | 8374 | [] as_l1_tch_loop(); |
| 8375 | [] as_l1_sacch(); |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8376 | [] RTPEM_DATA.receive(PDU_RTP:?) -> value rtp_pdu { |
| 8377 | if (rtp_pdu.data != pl) |
| 8378 | { repeat; } |
| 8379 | } |
| 8380 | [] RTPEM_DATA.receive { repeat; } |
Vadim Yanitskiy | d1bbe72 | 2023-05-29 15:32:49 +0700 | [diff] [blame] | 8381 | [] L1CTL.receive { repeat; } |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8382 | [] Tu.timeout { |
| 8383 | setverdict(fail, "Timeout waiting for Uplink speech frames"); |
| 8384 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8385 | } |
| 8386 | } |
| 8387 | |
| 8388 | f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_NONE); |
| 8389 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 8390 | f_rsl_chan_deact(); |
| 8391 | f_rslem_unregister(0, g_chan_nr); |
| 8392 | } |
| 8393 | testcase TC_speech_rtp_tchf() runs on test_CT { |
| 8394 | var ConnHdlr vc_conn; |
| 8395 | var ConnHdlrPars pars; |
| 8396 | |
| 8397 | f_init(); |
| 8398 | |
| 8399 | /* TS1, TCH/F, V1 (FR codec) */ |
| 8400 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))); |
| 8401 | vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars); |
| 8402 | vc_conn.done; |
| 8403 | |
| 8404 | /* TS1, TCH/F, V2 (EFR codec) */ |
| 8405 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))); |
| 8406 | vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars); |
| 8407 | vc_conn.done; |
| 8408 | |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 8409 | /* TS1, TCH/F, V3 (AMR codec) */ |
| 8410 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))); |
Vadim Yanitskiy | fcce705 | 2022-09-14 15:07:23 +0700 | [diff] [blame] | 8411 | pars.mr_conf := valueof(ts_RSL_MultirateCfg); |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 8412 | vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars); |
| 8413 | vc_conn.done; |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8414 | |
| 8415 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8416 | } |
| 8417 | testcase TC_speech_rtp_tchh() runs on test_CT { |
| 8418 | var ConnHdlr vc_conn; |
| 8419 | var ConnHdlrPars pars; |
| 8420 | |
| 8421 | f_init(); |
| 8422 | |
| 8423 | /* TS5, TCH/H0, V1 (HR codec) */ |
| 8424 | pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))); |
| 8425 | vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars); |
| 8426 | vc_conn.done; |
| 8427 | |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 8428 | /* TS1, TCH/H0, V3 (AMR codec) */ |
| 8429 | pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))); |
Vadim Yanitskiy | fcce705 | 2022-09-14 15:07:23 +0700 | [diff] [blame] | 8430 | pars.mr_conf := valueof(ts_RSL_MultirateCfg); |
Pau Espin Pedrol | 091c530 | 2022-09-02 18:11:12 +0200 | [diff] [blame] | 8431 | vc_conn := f_start_handler(refers(f_TC_speech_rtp), pars); |
| 8432 | vc_conn.done; |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 8433 | |
| 8434 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8435 | } |
| 8436 | |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8437 | |
| 8438 | /* Verify handling of Downlink and Uplink Osmux speech frames */ |
| 8439 | private function f_TC_speech_osmux(charstring id) runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8440 | var L1ctlMessage l1_dl; |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8441 | var OSMUX_PDU osmux_pdu; |
| 8442 | var octetstring pl; |
| 8443 | var octetstring exp_rtp_pl; |
| 8444 | timer Td, Tu; |
| 8445 | |
| 8446 | f_l1_tune(L1CTL); |
| 8447 | f_est_dchan(); |
| 8448 | |
| 8449 | /* Activate the RTP emulation */ |
| 8450 | pl := f_rnd_octstring(6); |
| 8451 | f_osmuxem_activate(pl); |
| 8452 | |
| 8453 | /* Give the scheduler some time to fill up the buffers */ |
| 8454 | f_sleep(2.0); |
| 8455 | L1CTL.clear; |
| 8456 | RSL.clear; |
| 8457 | |
| 8458 | /* we transmit using AMR_FT_2 (5.90), see t_TxHandleAMR590 in f_osmuxem_activate() */ |
| 8459 | var integer amr_ft := get_start_amr_ft(); |
| 8460 | var integer amr_pl_len := f_amrft_payload_len(amr_ft); |
| 8461 | var octetstring hdr := enc_RTP_AMR_Hdr(valueof(ts_RTP_AMR_Hdr(amr_ft, amr_ft, '1'B))); |
| 8462 | pl := f_osmux_gen_expected_rx_rtp_payload(amr_ft, pl); |
| 8463 | exp_rtp_pl := hdr & pl; |
| 8464 | |
| 8465 | /* Make sure that Downlink frames are received at the UE */ |
| 8466 | Td.start(2.0); |
| 8467 | alt { |
| 8468 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := exp_rtp_pl)) -> value l1_dl { |
Vadim Yanitskiy | 25823b7 | 2023-07-12 22:04:49 +0700 | [diff] [blame] | 8469 | var octetstring data := l1_dl.payload.traffic_ind.data; |
| 8470 | log("TCH received (len=", lengthof(data), "): ", data); |
| 8471 | L1CTL.send(ts_L1CTL_TRAFFIC_REQ(g_chan_nr, l1_dl.dl_info.link_id, data)); |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8472 | setverdict(pass); |
| 8473 | } |
| 8474 | [] L1CTL.receive(tr_L1CTL_TRAFFIC_IND(g_chan_nr, frame := ?)) -> value l1_dl { |
| 8475 | setverdict(fail, "Rx unexpected Downlink speech frame ", |
| 8476 | "(", l1_dl.payload.traffic_ind.data, ") ", |
| 8477 | "expected (", exp_rtp_pl, ")"); |
| 8478 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8479 | } |
| 8480 | [] as_l1_sacch(); |
| 8481 | [] L1CTL.receive { repeat; } |
| 8482 | [] Td.timeout { |
| 8483 | setverdict(fail, "Timeout waiting for Downlink speech frames"); |
| 8484 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8485 | } |
| 8486 | } |
| 8487 | |
| 8488 | /* Make sure that Uplink frames are received at the BTS */ |
| 8489 | OsmuxEM_DATA.clear; |
| 8490 | var template (present) OSMUX_PDU osmux_pdu_exp := tr_PDU_Osmux_AMR(cid := g_pars.loc_osmux_cid, |
| 8491 | amr_ft := amr_ft, |
| 8492 | amr_cmr := amr_ft); |
| 8493 | Tu.start(2.0); |
| 8494 | alt { |
Vadim Yanitskiy | 89264bc | 2023-07-12 22:22:00 +0700 | [diff] [blame] | 8495 | [] as_l1_tch_loop(); |
| 8496 | [] as_l1_sacch(); |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8497 | [] OsmuxEM_DATA.receive(osmux_pdu_exp) -> value osmux_pdu { |
| 8498 | var boolean matched := false; |
| 8499 | for (var integer i := 0; i < osmux_pdu.osmux_amr.header.ctr + 1; i := i + 1) { |
| 8500 | var octetstring rx_pl; |
| 8501 | rx_pl := f_osmux_amr_get_nth_amr_payload(osmux_pdu.osmux_amr, i); |
| 8502 | log("got ", rx_pl, " vs exp ", pl); |
| 8503 | if (rx_pl == pl) { |
| 8504 | matched := true; |
| 8505 | break; |
| 8506 | } |
| 8507 | } |
| 8508 | if (not matched) { |
| 8509 | repeat; |
| 8510 | } |
| 8511 | } |
| 8512 | [] OsmuxEM_DATA.receive { repeat; } |
| 8513 | [] Tu.timeout { |
| 8514 | setverdict(fail, "Timeout waiting for Uplink speech frames"); |
| 8515 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8516 | } |
| 8517 | } |
| 8518 | |
| 8519 | f_osmuxem_mode(OsmuxEM_CTRL, OSMUXEM_MODE_NONE); |
| 8520 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 8521 | f_rsl_chan_deact(); |
| 8522 | f_rslem_unregister(0, g_chan_nr); |
| 8523 | } |
| 8524 | testcase TC_speech_osmux_tchf() runs on test_CT { |
| 8525 | var ConnHdlr vc_conn; |
| 8526 | var ConnHdlrPars pars; |
| 8527 | |
| 8528 | f_init(); |
| 8529 | |
| 8530 | /* TS5, TCH/H0, V3 (AMR codec) */ |
| 8531 | pars := valueof(t_Pars(ts_RslChanNr_Bm(1), ts_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))); |
Vadim Yanitskiy | fcce705 | 2022-09-14 15:07:23 +0700 | [diff] [blame] | 8532 | pars.mr_conf := valueof(ts_RSL_MultirateCfg); |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8533 | vc_conn := f_start_handler(refers(f_TC_speech_osmux), pars); |
| 8534 | vc_conn.done; |
| 8535 | |
| 8536 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8537 | } |
| 8538 | testcase TC_speech_osmux_tchh() runs on test_CT { |
| 8539 | var ConnHdlr vc_conn; |
| 8540 | var ConnHdlrPars pars; |
| 8541 | |
| 8542 | f_init(); |
| 8543 | |
| 8544 | /* TS5, TCH/H0, V3 (AMR codec) */ |
| 8545 | pars := valueof(t_Pars(ts_RslChanNr_Lm(5, 0), ts_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))); |
Vadim Yanitskiy | fcce705 | 2022-09-14 15:07:23 +0700 | [diff] [blame] | 8546 | pars.mr_conf := valueof(ts_RSL_MultirateCfg); |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 8547 | vc_conn := f_start_handler(refers(f_TC_speech_osmux), pars); |
| 8548 | vc_conn.done; |
| 8549 | |
| 8550 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8551 | } |
| 8552 | |
Neels Hofmeyr | af9d6ae | 2021-08-15 23:18:47 +0200 | [diff] [blame] | 8553 | private function f_TC_early_immediate_assignment(charstring id) runs on ConnHdlr { |
| 8554 | var GsmFrameNumber fn; |
| 8555 | var ChannelDescription ch_desc; |
| 8556 | var integer ra := 23; |
| 8557 | |
| 8558 | f_l1_tune(L1CTL); |
| 8559 | RSL.clear; |
| 8560 | |
| 8561 | /* Send RACH request and wait for ChanReq */ |
| 8562 | fn := f_rach_req_wait_chan_rqd(ra); |
| 8563 | |
| 8564 | /* The BSC already sends the Immediate Assignment, before the channel is active. |
| 8565 | * (Also before the Channel Activation, even. I tried to write this test so that we first send the Chan Act and then the IMM |
| 8566 | * ASS, but osmo-bts-trx responds so fast that the Chan Activ ACK comes back even before titan dispatches the |
| 8567 | * IMM ASS. So move the IMM ASS even before the Chan Activ.) */ |
| 8568 | if (g_pars.fhp.enabled) { |
| 8569 | ch_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, g_pars.fhp.maio_hsn, g_pars.tsc)); |
| 8570 | } else { |
| 8571 | ch_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, mp_trx_pars[0].arfcn, g_pars.tsc)); |
| 8572 | } |
| 8573 | var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, g_pars.fhp.ma_map)); |
| 8574 | RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg))); |
| 8575 | |
| 8576 | /* Do not expect the Immediate Assignment to show up on MS side yet. Even give it one second before the BSC |
| 8577 | * requests Chan Activ, to make sure the RR IMM ASS is held back. */ |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8578 | var L1ctlMessage dl; |
Neels Hofmeyr | af9d6ae | 2021-08-15 23:18:47 +0200 | [diff] [blame] | 8579 | var GsmRrMessage rr; |
| 8580 | |
| 8581 | var template GsmRrMessage rr_imm_ass := tr_IMM_ASS(ra, fn); |
| 8582 | rr_imm_ass.payload.imm_ass.ded_or_tbf := ?; |
| 8583 | rr_imm_ass.payload.imm_ass.pkt_chan_desc := *; |
| 8584 | rr_imm_ass.payload.imm_ass.chan_desc := *; |
| 8585 | |
| 8586 | timer T := 1.0; |
| 8587 | T.start; |
| 8588 | alt { |
| 8589 | [] L1CTL.receive(tr_L1CTL_DATA_IND(t_RslChanNr_PCH_AGCH(0))) -> value dl { |
| 8590 | rr := dec_GsmRrMessage(dl.payload.data_ind.payload); |
| 8591 | if (match(rr, rr_imm_ass)) { |
| 8592 | setverdict(fail, "Expected IMM ASS to be delayed until Chan Act ACK, but it was passed to the MS immediately"); |
| 8593 | mtc.stop; |
| 8594 | } else { |
| 8595 | repeat; |
| 8596 | } |
| 8597 | } |
| 8598 | [] L1CTL.receive { repeat; } |
| 8599 | [] T.timeout; |
| 8600 | } |
| 8601 | RSL.send(ts_RSL_CHAN_ACT(g_chan_nr, g_pars.chan_mode, t_RSL_IE_ActType_IA)); |
| 8602 | RSL.receive(tr_RSL_CHAN_ACT_ACK(g_chan_nr)); |
| 8603 | |
| 8604 | /* Now expect the IMM ASS on Um */ |
| 8605 | f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn); |
| 8606 | setverdict(pass); |
| 8607 | |
| 8608 | /* Release the channel */ |
| 8609 | f_rsl_chan_deact(); |
| 8610 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 8611 | } |
| 8612 | |
| 8613 | testcase TC_early_immediate_assignment() runs on test_CT { |
| 8614 | var ConnHdlr vc_conn; |
| 8615 | var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), ts_RSL_ChanMode_SIGN)); |
| 8616 | f_init(); |
| 8617 | vc_conn := f_start_handler(refers(f_TC_early_immediate_assignment), pars); |
| 8618 | vc_conn.done; |
| 8619 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8620 | } |
| 8621 | |
Vadim Yanitskiy | d0eb659 | 2021-10-08 01:19:29 +0600 | [diff] [blame] | 8622 | private function f_TC_est_dchan(charstring id) runs on ConnHdlr { |
| 8623 | var integer ra := oct2int(f_rnd_ra_cs()); |
| 8624 | var ChannelDescription ch_desc; |
| 8625 | |
| 8626 | /* Tune the MS to BCCH */ |
| 8627 | f_l1_tune(L1CTL); |
| 8628 | |
| 8629 | /* Send RACH request and wait for ChanReq */ |
| 8630 | var GsmFrameNumber fn := f_rach_req_wait_chan_rqd(ra); |
| 8631 | |
| 8632 | /* Activate channel on the BTS side */ |
| 8633 | f_rsl_chan_act(g_pars.chan_mode); |
| 8634 | |
| 8635 | /* Craft channel description (with or without frequency hopping parameters) */ |
| 8636 | if (g_pars.fhp.enabled) { |
| 8637 | ch_desc := valueof(ts_ChanDescH1(g_pars.chan_nr, g_pars.fhp.maio_hsn, g_pars.tsc)); |
| 8638 | } else { |
| 8639 | ch_desc := valueof(ts_ChanDescH0(g_pars.chan_nr, mp_trx_pars[0].arfcn, g_pars.tsc)); |
| 8640 | } |
| 8641 | |
| 8642 | /* Send IMM.ASS via CCHAN */ |
| 8643 | var GsmRrMessage rr_msg := valueof(ts_IMM_ASS(ra, fn, 0, ch_desc, g_pars.fhp.ma_map)); |
| 8644 | RSL.send(ts_RSL_IMM_ASSIGN(enc_GsmRrMessage(rr_msg))); |
| 8645 | |
| 8646 | /* Receive IMM.ASS on the MS side */ |
| 8647 | var ImmediateAssignment imm_ass := f_L1CTL_WAIT_IMM_ASS(L1CTL, ra, fn); |
| 8648 | |
| 8649 | /* Match the Channel Description IE in received IMM.ASS */ |
| 8650 | if (not match(imm_ass.chan_desc, ch_desc)) { |
| 8651 | setverdict(fail, "Channel Description IE does not match"); |
| 8652 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8653 | } |
| 8654 | |
| 8655 | /* Tune the MS to a dedicated channel indicated in the IMM.ASS */ |
| 8656 | f_L1CTL_DM_EST_REQ_IA(L1CTL, imm_ass, g_pars.fhp.ma); |
| 8657 | |
| 8658 | /* Expect SACCH frames on Downlink */ |
| 8659 | L1CTL.clear; |
| 8660 | f_exp_sacch(true); |
| 8661 | |
| 8662 | /* We're done, deactivate and release */ |
| 8663 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 8664 | f_rsl_chan_deact(); |
| 8665 | } |
| 8666 | testcase TC_est_dchan() runs on test_CT { |
| 8667 | var ConnHdlr vc_conn; |
| 8668 | var ConnHdlrPars pars; |
| 8669 | |
| 8670 | f_init(); |
| 8671 | |
| 8672 | for (var integer i := 0; i < sizeof(g_AllChannels); i := i + 1) { |
| 8673 | pars := valueof(t_Pars(g_AllChannels[i], ts_RSL_ChanMode_SIGN)); |
| 8674 | vc_conn := f_start_handler(refers(f_TC_est_dchan), pars); |
| 8675 | vc_conn.done; |
| 8676 | } |
| 8677 | |
| 8678 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8679 | } |
| 8680 | |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8681 | private type record TopTestCase { |
| 8682 | RSL_IE_BS_Power bs_power, |
| 8683 | RSL_IE_OSMO_TopAcchCap top_cap, |
| 8684 | record of TopTestStep steps |
| 8685 | }; |
| 8686 | private type record TopTestStep { |
| 8687 | MeasurementResults meas_res optional, |
| 8688 | GsmRxLev overpower_sacch, |
| 8689 | GsmRxLev overpower_facch |
| 8690 | }; |
| 8691 | |
| 8692 | private function f_rxlev_match(template (present) RslLinkId link_id, |
| 8693 | template (present) GsmRxLev rxlev) |
| 8694 | runs on ConnHdlr { |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8695 | var L1ctlMessage dl := f_L1CTL_rx_data(L1CTL, g_chan_nr, link_id); |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8696 | if (not match(dl.dl_info.rx_level, rxlev)) { |
| 8697 | setverdict(fail, "RxLev(", link_id, ") := ", dl.dl_info.rx_level, |
| 8698 | " does not match expected RxLev := ", rxlev); |
| 8699 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8700 | } |
| 8701 | } |
| 8702 | |
| 8703 | private function f_TC_acch_overpower(charstring id) runs on ConnHdlr { |
| 8704 | var TopTestCase tc := g_pars.spec.top; |
| 8705 | var GsmRxLev rxlev_dcch; |
Vadim Yanitskiy | af0aae6 | 2023-03-18 06:49:18 +0700 | [diff] [blame] | 8706 | var L1ctlMessage dl; |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8707 | |
| 8708 | /* Wait for Pau ramping to complete */ |
| 8709 | f_sleep(6.0); |
| 8710 | |
| 8711 | f_l1_tune(L1CTL); |
| 8712 | L1CTL.clear; |
| 8713 | RSL.clear; |
| 8714 | |
| 8715 | /* Measure RxLev(BCCH), calculate RxLev(DCCH) */ |
| 8716 | dl := f_L1CTL_rx_data(L1CTL, t_RslChanNr_BCCH(0)); |
| 8717 | rxlev_dcch := dl.dl_info.rx_level - (tc.bs_power.power_level * 2); |
| 8718 | |
| 8719 | log("RxLev(BCCH) := ", dl.dl_info.rx_level); |
| 8720 | log("Expected RxLev(DCCH) := ", rxlev_dcch); |
| 8721 | |
| 8722 | /* Additional IEs for the CHANnel ACTIVation message */ |
| 8723 | var template (value) RSL_IE_List ies := { |
| 8724 | /* Employ BS power control in static mode */ |
| 8725 | t_RSL_IE(RSL_IE_MS_POWER, RSL_IE_Body:{ |
| 8726 | bs_power := tc.bs_power |
| 8727 | }), |
| 8728 | /* Indicate the given Temporary Overpower capability */ |
| 8729 | t_RSL_IE(RSL_IE_OSMO_TOP_ACCH_CAP, RSL_IE_Body:{ |
| 8730 | top_acch_cap := tc.top_cap |
| 8731 | }) |
| 8732 | }; |
| 8733 | |
| 8734 | /* Establish a dedicated channel */ |
| 8735 | f_est_dchan(more_ies := valueof(ies)); |
| 8736 | |
| 8737 | /* Give it some time to stabilize */ |
| 8738 | f_sleep(0.480 * 2.0); |
| 8739 | L1CTL.clear; |
| 8740 | RSL.clear; |
| 8741 | |
| 8742 | for (var integer i := 0; i < lengthof(tc.steps); i := i + 1) { |
| 8743 | var TopTestStep step := tc.steps[i]; |
| 8744 | var GsmRxLev rxlev_facch := rxlev_dcch + step.overpower_facch; |
| 8745 | var GsmRxLev rxlev_sacch := rxlev_dcch + step.overpower_sacch; |
| 8746 | |
| 8747 | log("Executing step[", i, "] := ", step); |
| 8748 | |
| 8749 | /* Send RR Measurement Report (if present) */ |
| 8750 | if (ispresent(step.meas_res)) { |
| 8751 | f_transceive_meas_rep(step.meas_res); |
| 8752 | f_sleep(0.480 * 2.0); |
| 8753 | L1CTL.clear; |
| 8754 | } |
| 8755 | |
| 8756 | /* Check RxLev on both FACCH and SACCH */ |
| 8757 | f_rxlev_match(tr_RslLinkID_DCCH(?), rxlev_facch); |
| 8758 | f_rxlev_match(tr_RslLinkID_SACCH(?), rxlev_sacch); |
| 8759 | |
| 8760 | setverdict(pass); |
| 8761 | } |
Vadim Yanitskiy | 6c06449 | 2023-05-31 20:01:43 +0700 | [diff] [blame] | 8762 | |
| 8763 | f_rsl_chan_deact(); |
| 8764 | f_L1CTL_DM_REL_REQ(L1CTL, g_chan_nr); |
| 8765 | f_rslem_unregister(g_pars.trx_nr, g_chan_nr); |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8766 | } |
| 8767 | testcase TC_acch_overpower_rxqual_thresh() runs on test_CT { |
| 8768 | var ConnHdlrPars pars; |
| 8769 | var ConnHdlr vc_conn; |
| 8770 | |
| 8771 | f_init(); |
| 8772 | |
| 8773 | /* Verify lower and upper RxQual thresholds */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 8774 | var template (value) TopTestCase top := { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8775 | bs_power := ts_RSL_IE_BS_Power(4), /* 4 x 2dB = 8dB */ |
| 8776 | top_cap := ts_RSL_IE_OSMO_TopAcchCap(4), /* 4dB */ |
| 8777 | steps := { |
| 8778 | /* Channel established, no overpower */ |
| 8779 | { meas_res := omit, |
| 8780 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8781 | |
| 8782 | /* Worst possible RxQual value, overpower of 4dB */ |
| 8783 | { meas_res := ts_MeasurementResults(rxq_f := 7), |
| 8784 | overpower_sacch := 4, overpower_facch := 4 }, |
| 8785 | /* Worst possible RxQual value, disabling overpower */ |
| 8786 | { meas_res := ts_MeasurementResults(rxq_f := 0), |
| 8787 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8788 | |
| 8789 | /* Lower threshold not reached, no overpower */ |
| 8790 | { meas_res := ts_MeasurementResults(rxq_f := 1), |
| 8791 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8792 | /* Lower threshold not reached, no overpower */ |
| 8793 | { meas_res := ts_MeasurementResults(rxq_f := 2), |
| 8794 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8795 | /* Lower threshold reached, overpower of 4dB */ |
| 8796 | { meas_res := ts_MeasurementResults(rxq_f := 4), |
| 8797 | overpower_sacch := 4, overpower_facch := 4 }, |
| 8798 | /* Upper threshold not reached, keeping overpower */ |
| 8799 | { meas_res := ts_MeasurementResults(rxq_f := 3), |
| 8800 | overpower_sacch := 4, overpower_facch := 4 }, |
| 8801 | /* Upper threshold reached, disabling overpower */ |
| 8802 | { meas_res := ts_MeasurementResults(rxq_f := 2), |
| 8803 | overpower_sacch := 0, overpower_facch := 0 } |
| 8804 | } |
| 8805 | }; |
| 8806 | |
| 8807 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, |
Vadim Yanitskiy | f4b7147 | 2023-06-13 19:03:38 +0700 | [diff] [blame] | 8808 | spec := { top := top }, trx_nr := 1, |
| 8809 | t_guard := 30.0)); |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8810 | vc_conn := f_start_handler(refers(f_TC_acch_overpower), pars); |
| 8811 | vc_conn.done; |
| 8812 | |
| 8813 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8814 | } |
| 8815 | testcase TC_acch_overpower_rxqual_thresh_dtx() runs on test_CT { |
| 8816 | var ConnHdlrPars pars; |
| 8817 | var ConnHdlr vc_conn; |
| 8818 | |
| 8819 | f_init(); |
| 8820 | |
| 8821 | /* Verify handling of FULL and SUB values */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 8822 | var template (value) TopTestCase top := { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8823 | bs_power := ts_RSL_IE_BS_Power(4), /* 4 x 2dB = 8dB */ |
| 8824 | top_cap := ts_RSL_IE_OSMO_TopAcchCap(4), /* 4dB */ |
| 8825 | steps := { |
| 8826 | /* Channel established, no overpower */ |
| 8827 | { meas_res := omit, |
| 8828 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8829 | |
| 8830 | /* Invalid measurement results, no overpower */ |
| 8831 | { meas_res := ts_MeasurementResults(rxq_f := 7, |
| 8832 | rxq_s := 7, |
| 8833 | valid := false), |
| 8834 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8835 | |
| 8836 | /* DTXu was in use, no overpower */ |
| 8837 | { meas_res := ts_MeasurementResults(rxq_f := 7, |
| 8838 | rxq_s := 0, |
| 8839 | dtx_used := true), |
| 8840 | overpower_sacch := 0, overpower_facch := 0 }, |
| 8841 | /* DTXu was in use, overpower of 4 dB */ |
| 8842 | { meas_res := ts_MeasurementResults(rxq_f := 0, |
| 8843 | rxq_s := 7, |
| 8844 | dtx_used := true), |
| 8845 | overpower_sacch := 4, overpower_facch := 4 } |
| 8846 | } |
| 8847 | }; |
| 8848 | |
| 8849 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, |
| 8850 | spec := { top := top }, trx_nr := 1)); |
| 8851 | vc_conn := f_start_handler(refers(f_TC_acch_overpower), pars); |
| 8852 | vc_conn.done; |
| 8853 | |
| 8854 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8855 | } |
| 8856 | testcase TC_acch_overpower_always_on_facch() runs on test_CT { |
| 8857 | var ConnHdlrPars pars; |
| 8858 | var ConnHdlr vc_conn; |
| 8859 | |
| 8860 | f_init(); |
| 8861 | |
| 8862 | /* Overpower is always on, SACCH disabled */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 8863 | var template (value) TopTestCase top := { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8864 | bs_power := ts_RSL_IE_BS_Power(4), /* 4 x 2dB = 8dB */ |
| 8865 | top_cap := ts_RSL_IE_OSMO_TopAcchCap(overpower := 4, /* 4dB */ |
| 8866 | rxqual := 0, /* always on */ |
| 8867 | sacch_enable := false), |
| 8868 | steps := { |
| 8869 | /* Channel established, FACCH overpower */ |
| 8870 | { meas_res := omit, |
| 8871 | overpower_sacch := 0, overpower_facch := 4 }, |
| 8872 | /* MS indicates good RxQual, no difference */ |
| 8873 | { meas_res := ts_MeasurementResults(rxq_f := 0), |
| 8874 | overpower_sacch := 0, overpower_facch := 4 }, |
| 8875 | /* MS indicates bad RxQual, no difference */ |
| 8876 | { meas_res := ts_MeasurementResults(rxq_f := 7), |
| 8877 | overpower_sacch := 0, overpower_facch := 4 } |
| 8878 | } |
| 8879 | }; |
| 8880 | |
| 8881 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, |
| 8882 | spec := { top := top }, trx_nr := 1)); |
| 8883 | vc_conn := f_start_handler(refers(f_TC_acch_overpower), pars); |
| 8884 | vc_conn.done; |
| 8885 | |
| 8886 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8887 | } |
| 8888 | testcase TC_acch_overpower_always_on_sacch() runs on test_CT { |
| 8889 | var ConnHdlrPars pars; |
| 8890 | var ConnHdlr vc_conn; |
| 8891 | |
| 8892 | f_init(); |
| 8893 | |
| 8894 | /* Overpower is always on, FACCH disabled */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 8895 | var template (value) TopTestCase top := { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8896 | bs_power := ts_RSL_IE_BS_Power(4), /* 4 x 2dB = 8dB */ |
| 8897 | top_cap := ts_RSL_IE_OSMO_TopAcchCap(overpower := 4, /* 4dB */ |
| 8898 | rxqual := 0, /* always on */ |
| 8899 | facch_enable := false), |
| 8900 | steps := { |
| 8901 | /* Channel established, SACCH overpower */ |
| 8902 | { meas_res := omit, |
| 8903 | overpower_sacch := 4, overpower_facch := 0 }, |
| 8904 | /* MS indicates good RxQual, no difference */ |
| 8905 | { meas_res := ts_MeasurementResults(rxq_f := 0), |
| 8906 | overpower_sacch := 4, overpower_facch := 0 }, |
| 8907 | /* MS indicates bad RxQual, no difference */ |
| 8908 | { meas_res := ts_MeasurementResults(rxq_f := 7), |
| 8909 | overpower_sacch := 4, overpower_facch := 0 } |
| 8910 | } |
| 8911 | }; |
| 8912 | |
| 8913 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, |
| 8914 | spec := { top := top }, trx_nr := 1)); |
| 8915 | vc_conn := f_start_handler(refers(f_TC_acch_overpower), pars); |
| 8916 | vc_conn.done; |
| 8917 | |
| 8918 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8919 | } |
| 8920 | testcase TC_acch_overpower_limit() runs on test_CT { |
| 8921 | var ConnHdlrPars pars; |
| 8922 | var ConnHdlr vc_conn; |
| 8923 | |
| 8924 | f_init(); |
| 8925 | |
| 8926 | /* Overpower higher than current power reduction level (2dB) */ |
Vadim Yanitskiy | d12db41 | 2022-03-12 18:05:18 +0300 | [diff] [blame] | 8927 | var template (value) TopTestCase top := { |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 8928 | bs_power := ts_RSL_IE_BS_Power(1), /* 1 x 2dB = 2dB */ |
| 8929 | top_cap := ts_RSL_IE_OSMO_TopAcchCap(overpower := 4, /* 4dB */ |
| 8930 | rxqual := 0 /* always on */), |
| 8931 | steps := { |
| 8932 | /* Channel established, ACCH overpower of 2dB */ |
| 8933 | { meas_res := omit, |
| 8934 | overpower_sacch := 2, overpower_facch := 2 }, |
| 8935 | /* MS indicates good RxQual, no difference */ |
| 8936 | { meas_res := ts_MeasurementResults(rxq_f := 0), |
| 8937 | overpower_sacch := 2, overpower_facch := 2 }, |
| 8938 | /* MS indicates bad RxQual, no difference */ |
| 8939 | { meas_res := ts_MeasurementResults(rxq_f := 7), |
| 8940 | overpower_sacch := 2, overpower_facch := 2 } |
| 8941 | } |
| 8942 | }; |
| 8943 | |
| 8944 | pars := valueof(t_Pars(t_RslChanNr_Bm(0), ts_RSL_ChanMode_SIGN, |
| 8945 | spec := { top := top }, trx_nr := 1)); |
| 8946 | vc_conn := f_start_handler(refers(f_TC_acch_overpower), pars); |
| 8947 | vc_conn.done; |
| 8948 | |
| 8949 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__); |
| 8950 | } |
| 8951 | |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 8952 | /* test generation of RLL ERR IND based on Um errors (TS 48.058 3.9) */ |
| 8953 | /* protocol error as per 44.006 */ |
| 8954 | /* link layer failure (repetition of I-frame N200 times without ACK */ |
| 8955 | /* repetition of SABM or DISC N200 times without ACK */ |
| 8956 | /* receptiom of SABM in multi-frame established state */ |
| 8957 | |
| 8958 | |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8959 | /* TODO Areas: |
| 8960 | |
| 8961 | * channel activation |
| 8962 | ** with BS_Power / MS_Power, bypassing power control loop |
| 8963 | ** on primary vs. secondary TRX |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8964 | ** with timing advance from initial activation on |
| 8965 | * mode modify |
| 8966 | ** encryption |
| 8967 | ** multirate |
| 8968 | * check DEACTIVATE SACCH |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8969 | ** unsupported algorithm |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8970 | * BS Power Control |
| 8971 | * Physical Context |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8972 | * error handling |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8973 | ** IE duplicated? |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 8974 | * PCU interface |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 8975 | ** DATA_IND from BTS->PCU |
| 8976 | ** verification of PCU-originated DATA_REQ arrival on Um/MS side |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 8977 | |
| 8978 | */ |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 8979 | |
| 8980 | control { |
Vadim Yanitskiy | d0eb659 | 2021-10-08 01:19:29 +0600 | [diff] [blame] | 8981 | execute( TC_est_dchan() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 8982 | execute( TC_chan_act_stress() ); |
| 8983 | execute( TC_chan_act_react() ); |
| 8984 | execute( TC_chan_deact_not_active() ); |
| 8985 | execute( TC_chan_act_wrong_nr() ); |
Harald Welte | 629cc6b | 2018-03-11 17:19:05 +0100 | [diff] [blame] | 8986 | execute( TC_deact_sacch() ); |
Harald Welte | ea17b91 | 2018-03-11 22:29:31 +0100 | [diff] [blame] | 8987 | execute( TC_sacch_filling() ); |
| 8988 | execute( TC_sacch_info_mod() ); |
Harald Welte | 075d84c | 2018-03-12 13:07:24 +0100 | [diff] [blame] | 8989 | execute( TC_sacch_multi() ); |
Harald Welte | 5570066 | 2018-03-12 13:15:43 +0100 | [diff] [blame] | 8990 | execute( TC_sacch_multi_chg() ); |
Harald Welte | c8d363c | 2019-05-19 20:36:48 +0200 | [diff] [blame] | 8991 | execute( TC_sacch_chan_act() ); |
Harald Welte | 8b01c79 | 2019-05-19 22:51:25 +0200 | [diff] [blame] | 8992 | execute( TC_sacch_chan_act_ho_async() ); |
| 8993 | execute( TC_sacch_chan_act_ho_sync() ); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 8994 | execute( TC_rach_content() ); |
Philipp Maier | 16ade78 | 2020-07-08 21:36:00 +0200 | [diff] [blame] | 8995 | execute( TC_rach_content_emerg() ); |
Harald Welte | 8c24c2b | 2018-02-26 08:31:31 +0100 | [diff] [blame] | 8996 | execute( TC_rach_count() ); |
Harald Welte | 54a2a2d | 2018-02-26 09:14:05 +0100 | [diff] [blame] | 8997 | execute( TC_rach_max_ta() ); |
Vadim Yanitskiy | 7c2c10c | 2019-05-31 20:42:01 +0700 | [diff] [blame] | 8998 | execute( TC_ho_rach() ); |
Vadim Yanitskiy | 1ab332f | 2022-03-12 15:31:23 +0300 | [diff] [blame] | 8999 | execute( TC_ho_physical_info() ); |
Harald Welte | 3453ab4 | 2019-05-24 21:19:58 +0200 | [diff] [blame] | 9000 | execute( TC_rach_load_idle_thresh0() ); |
| 9001 | execute( TC_rach_load_idle_below_thresh() ); |
| 9002 | execute( TC_rach_load_count() ); |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 9003 | execute( TC_meas_res_speech_tchf() ); |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 9004 | execute( TC_meas_res_speech_tchf_facch() ); |
Vadim Yanitskiy | 204b98c | 2020-10-19 14:52:48 +0700 | [diff] [blame] | 9005 | execute( TC_meas_res_speech_tchh() ); |
Philipp Maier | 149c392 | 2020-10-22 17:29:36 +0200 | [diff] [blame] | 9006 | execute( TC_meas_res_speech_tchh_facch() ); |
Vadim Yanitskiy | 780bc07 | 2020-10-20 02:16:01 +0700 | [diff] [blame] | 9007 | execute( TC_meas_res_speech_tchh_toa256() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 9008 | execute( TC_meas_res_sign_tchf() ); |
| 9009 | execute( TC_meas_res_sign_tchh() ); |
| 9010 | execute( TC_meas_res_sign_sdcch4() ); |
| 9011 | execute( TC_meas_res_sign_sdcch8() ); |
Harald Welte | 685d598 | 2018-02-27 20:42:05 +0100 | [diff] [blame] | 9012 | execute( TC_meas_res_sign_tchh_toa256() ); |
Vadim Yanitskiy | 8f6eae0 | 2021-10-26 02:49:21 +0300 | [diff] [blame] | 9013 | execute( TC_meas_res_speech_tchf_sapi3() ); |
| 9014 | execute( TC_meas_res_speech_tchh_sapi3() ); |
Pau Espin Pedrol | a2e079c | 2020-06-03 17:31:04 +0200 | [diff] [blame] | 9015 | execute( TC_tx_power_start_ramp_up_bcch() ); |
Daniel Willmann | bc61276 | 2022-12-19 15:15:52 +0100 | [diff] [blame] | 9016 | execute( TC_tx_power_down_bcch() ); |
Pau Espin Pedrol | 45fe5e0 | 2020-06-23 19:00:00 +0200 | [diff] [blame] | 9017 | execute( TC_tx_power_ramp_adm_state_change() ); |
Eric Wild | ae8f262 | 2019-06-18 17:05:11 +0200 | [diff] [blame] | 9018 | execute( TC_rsl_bs_pwr_static_ass() ); |
| 9019 | execute( TC_rsl_bs_pwr_static_power_control() ); |
Philipp Maier | 4d1e9c9 | 2018-12-20 11:11:56 +0100 | [diff] [blame] | 9020 | execute( TC_rsl_ms_pwr_ctrl() ); |
Eric Wild | 280ccb8 | 2019-06-17 11:11:52 +0200 | [diff] [blame] | 9021 | execute( TC_rsl_ms_pwr_dyn_active() ); |
Eric Wild | 095024b | 2019-06-17 15:08:57 +0200 | [diff] [blame] | 9022 | execute( TC_rsl_ms_pwr_dyn_active2() ); |
Eric Wild | 61edb7e | 2019-06-03 12:38:31 +0200 | [diff] [blame] | 9023 | execute( TC_rsl_ms_pwr_dyn_up() ); |
| 9024 | execute( TC_rsl_ms_pwr_dyn_down() ); |
| 9025 | execute( TC_rsl_ms_pwr_dyn_ass_updown() ); |
| 9026 | execute( TC_rsl_ms_pwr_dyn_max() ); |
Eric Wild | e57e1a6 | 2019-05-28 13:30:55 +0200 | [diff] [blame] | 9027 | execute( TC_rsl_chan_initial_ms_pwr() ); |
Eric Wild | 6833cc9 | 2019-05-23 19:34:44 +0200 | [diff] [blame] | 9028 | execute( TC_rsl_chan_initial_ta() ); |
Eric Wild | f1827a7 | 2019-05-28 17:37:35 +0200 | [diff] [blame] | 9029 | execute( TC_rsl_modify_encr() ); |
Vadim Yanitskiy | 98c4a1a | 2021-06-04 18:46:06 +0200 | [diff] [blame] | 9030 | execute( TC_rsl_rf_resource_ind() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 9031 | execute( TC_conn_fail_crit() ); |
Harald Welte | 68e495b | 2018-02-25 00:05:57 +0100 | [diff] [blame] | 9032 | execute( TC_paging_imsi_80percent() ); |
| 9033 | execute( TC_paging_tmsi_80percent() ); |
| 9034 | execute( TC_paging_imsi_200percent() ); |
| 9035 | execute( TC_paging_tmsi_200percent() ); |
Harald Welte | 01d982c | 2018-02-25 01:31:40 +0100 | [diff] [blame] | 9036 | execute( TC_rsl_protocol_error() ); |
| 9037 | execute( TC_rsl_mand_ie_error() ); |
| 9038 | execute( TC_rsl_ie_content_error() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 9039 | execute( TC_si_sched_default() ); |
Harald Welte | 0cae455 | 2018-03-09 22:20:26 +0100 | [diff] [blame] | 9040 | execute( TC_si_sched_1() ); |
Harald Welte | 48494ca | 2018-02-25 16:59:50 +0100 | [diff] [blame] | 9041 | execute( TC_si_sched_2bis() ); |
| 9042 | execute( TC_si_sched_2ter() ); |
| 9043 | execute( TC_si_sched_2ter_2bis() ); |
| 9044 | execute( TC_si_sched_2quater() ); |
| 9045 | execute( TC_si_sched_13() ); |
| 9046 | execute( TC_si_sched_13_2bis_2ter_2quater() ); |
Harald Welte | a871a38 | 2018-02-25 02:03:14 +0100 | [diff] [blame] | 9047 | execute( TC_ipa_dlcx_not_active() ); |
Harald Welte | a3f1df9 | 2018-02-25 12:49:55 +0100 | [diff] [blame] | 9048 | execute( TC_ipa_crcx_twice_not_active() ); |
| 9049 | execute( TC_ipa_crcx_mdcx_dlcx_not_active() ); |
Harald Welte | 3ae11da | 2018-02-25 13:36:06 +0100 | [diff] [blame] | 9050 | execute( TC_ipa_crcx_mdcx_mdcx_dlcx_not_active() ); |
Harald Welte | 9912eb5 | 2018-02-25 13:30:15 +0100 | [diff] [blame] | 9051 | execute( TC_ipa_crcx_sdcch_not_active() ); |
Vadim Yanitskiy | 866afc2 | 2022-05-01 16:08:30 +0300 | [diff] [blame] | 9052 | execute( TC_ipa_crcx_ack_addr() ); |
Harald Welte | 883340c | 2018-02-28 18:59:29 +0100 | [diff] [blame] | 9053 | |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9054 | if (mp_pcu_socket != "") { |
Philipp Maier | ca05827 | 2021-06-23 10:35:23 +0200 | [diff] [blame] | 9055 | execute( TC_paging_imsi_200percent_with_ps() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9056 | execute( TC_pcu_act_req() ); |
| 9057 | execute( TC_pcu_act_req_wrong_ts() ); |
| 9058 | execute( TC_pcu_act_req_wrong_bts() ); |
| 9059 | execute( TC_pcu_act_req_wrong_trx() ); |
| 9060 | execute( TC_pcu_deact_req() ); |
| 9061 | execute( TC_pcu_deact_req_wrong_ts() ); |
Philipp Maier | 94c0848 | 2021-02-01 17:36:05 +0100 | [diff] [blame] | 9062 | execute( TC_pcu_ver_si1() ); |
| 9063 | execute( TC_pcu_ver_si3() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9064 | execute( TC_pcu_ver_si13() ); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 9065 | if (mp_l1_supports_gprs) { |
| 9066 | execute( TC_pcu_data_req_pdtch() ); |
| 9067 | execute( TC_pcu_data_req_ptcch() ); |
Harald Welte | 7162a61 | 2019-05-26 12:56:09 +0200 | [diff] [blame] | 9068 | execute( TC_pcu_data_req_wrong_bts() ); |
| 9069 | execute( TC_pcu_data_req_wrong_trx() ); |
| 9070 | execute( TC_pcu_data_req_wrong_ts() ); |
| 9071 | execute( TC_pcu_data_req_ts_inactive() ); |
Harald Welte | ad033dc | 2019-05-25 17:28:16 +0200 | [diff] [blame] | 9072 | } |
Vadim Yanitskiy | 970b153 | 2019-10-24 15:22:19 +0700 | [diff] [blame] | 9073 | execute( TC_pcu_ptcch() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9074 | execute( TC_pcu_data_req_agch() ); |
Harald Welte | 928622b | 2019-05-26 13:22:59 +0200 | [diff] [blame] | 9075 | execute( TC_pcu_data_req_pch() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9076 | execute( TC_pcu_data_req_imm_ass_pch() ); |
| 9077 | execute( TC_pcu_rach_content() ); |
Vadim Yanitskiy | 51cbc10 | 2019-04-22 06:37:30 +0700 | [diff] [blame] | 9078 | execute( TC_pcu_ext_rach_content() ); |
Vadim Yanitskiy | a2c68e8 | 2019-07-03 13:07:20 +0700 | [diff] [blame] | 9079 | execute( TC_pcu_data_ind_lqual_cb() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9080 | execute( TC_pcu_paging_from_rsl() ); |
Harald Welte | d66c9b8 | 2019-05-25 09:03:15 +0200 | [diff] [blame] | 9081 | execute( TC_pcu_time_ind() ); |
Harald Welte | 4832c86 | 2019-05-25 14:57:18 +0200 | [diff] [blame] | 9082 | execute( TC_pcu_rts_req() ); |
Harald Welte | 07bd2d2 | 2019-05-25 11:03:30 +0200 | [diff] [blame] | 9083 | execute( TC_pcu_oml_alert() ); |
Harald Welte | eaa9a86 | 2019-05-26 23:01:08 +0200 | [diff] [blame] | 9084 | execute( TC_pcu_rr_suspend() ); |
Harald Welte | a2e0e94 | 2019-05-27 18:12:53 +0200 | [diff] [blame] | 9085 | execute( TC_pcu_socket_connect_multi() ); |
Harald Welte | c8effb7 | 2019-05-27 18:23:04 +0200 | [diff] [blame] | 9086 | execute( TC_pcu_socket_reconnect() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 9087 | execute( TC_pcu_socket_noconnect_nosi3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 9088 | execute( TC_pcu_socket_noconnect_nosi4gprs() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 9089 | execute( TC_pcu_socket_connect_si3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 9090 | execute( TC_pcu_socket_connect_si4gprs() ); |
Harald Welte | be03048 | 2019-05-27 22:29:35 +0200 | [diff] [blame] | 9091 | execute( TC_pcu_socket_disconnect_nosi3gprs() ); |
Vadim Yanitskiy | a8e83a8 | 2020-05-04 16:05:12 +0700 | [diff] [blame] | 9092 | execute( TC_pcu_socket_disconnect_nosi4gprs() ); |
Oliver Smith | f5239c7 | 2019-08-28 10:01:25 +0200 | [diff] [blame] | 9093 | execute( TC_pcu_socket_verify_info_ind() ); |
Philipp Maier | 15cd687 | 2020-01-08 13:41:41 +0100 | [diff] [blame] | 9094 | execute( TC_dyn_osmo_pdch_act_deact() ); |
| 9095 | execute( TC_dyn_osmo_pdch_double_act() ); |
| 9096 | execute( TC_dyn_ipa_pdch_act_deact() ); |
| 9097 | execute( TC_dyn_ipa_pdch_act_tchf_act_nack() ); |
Vadim Yanitskiy | 1da1fef | 2021-03-23 04:28:18 +0100 | [diff] [blame] | 9098 | execute( TC_pcu_info_ind_fh_params() ); |
| 9099 | execute( TC_pcu_socket_nsvc_ipv4() ); |
| 9100 | execute( TC_pcu_socket_nsvc_ipv6() ); |
Vadim Yanitskiy | e2a50a8 | 2021-03-23 05:58:02 +0100 | [diff] [blame] | 9101 | execute( TC_pcu_socket_two_nsvc() ); |
Vadim Yanitskiy | 83852c1 | 2021-06-18 16:18:29 +0200 | [diff] [blame] | 9102 | execute( TC_pcu_interf_ind() ); |
Pau Espin Pedrol | a14a8af | 2018-11-20 13:12:22 +0100 | [diff] [blame] | 9103 | } else { |
| 9104 | log("PCU socket path not available, skipping PCU tests"); |
| 9105 | } |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 9106 | |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 9107 | execute( TC_dyn_osmo_pdch_unsol_deact() ); |
Harald Welte | 3d04ae6 | 2018-04-04 20:29:05 +0200 | [diff] [blame] | 9108 | execute( TC_dyn_osmo_pdch_tchf_act() ); |
| 9109 | execute( TC_dyn_osmo_pdch_tchh_act() ); |
Pau Espin Pedrol | 8e57ac1 | 2021-06-29 17:04:24 +0200 | [diff] [blame] | 9110 | execute( TC_dyn_osmo_pdch_sdcch8_act() ); |
Harald Welte | 9bbbfb5 | 2018-04-05 09:33:19 +0200 | [diff] [blame] | 9111 | execute( TC_dyn_ipa_pdch_tchf_act() ); |
| 9112 | execute( TC_dyn_ipa_pdch_tchf_act_pdch_act_nack() ); |
Harald Welte | 0472ab4 | 2018-03-12 15:02:26 +0100 | [diff] [blame] | 9113 | |
| 9114 | execute( TC_rll_est_ind() ); |
| 9115 | execute( TC_rll_est_req_DCCH_3() ); |
| 9116 | execute( TC_rll_est_req_ACCH_3() ); |
| 9117 | execute( TC_rll_rel_ind_DCCH_0() ); |
| 9118 | execute( TC_rll_rel_ind_DCCH_3() ); |
| 9119 | execute( TC_rll_rel_ind_ACCH_0() ); |
| 9120 | execute( TC_rll_rel_ind_ACCH_3() ); |
| 9121 | execute( TC_rll_rel_req() ); |
| 9122 | execute( TC_rll_unit_data_req_DCCH() ); |
| 9123 | execute( TC_rll_unit_data_req_ACCH() ); |
| 9124 | execute( TC_rll_unit_data_ind_DCCH() ); |
| 9125 | execute( TC_rll_unit_data_ind_ACCH() ); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 9126 | |
| 9127 | execute( TC_chan_act_a51() ); |
| 9128 | execute( TC_chan_act_a52() ); |
| 9129 | execute( TC_chan_act_a53() ); |
Vadim Yanitskiy | 8b4e046 | 2022-08-27 19:18:17 +0700 | [diff] [blame] | 9130 | execute( TC_chan_act_a54() ); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 9131 | execute( TC_encr_cmd_a51() ); |
| 9132 | execute( TC_encr_cmd_a52() ); |
| 9133 | execute( TC_encr_cmd_a53() ); |
Vadim Yanitskiy | 8b4e046 | 2022-08-27 19:18:17 +0700 | [diff] [blame] | 9134 | execute( TC_encr_cmd_a54() ); |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 9135 | |
Harald Welte | ee25aae | 2019-05-19 14:32:37 +0200 | [diff] [blame] | 9136 | execute( TC_err_rep_wrong_mdisc() ); |
| 9137 | execute( TC_err_rep_wrong_msg_type() ); |
| 9138 | execute( TC_err_rep_wrong_sequence() ); |
| 9139 | |
Harald Welte | e613f96 | 2018-04-18 22:38:16 +0200 | [diff] [blame] | 9140 | execute( TC_lapdm_selftest() ); |
Stefan Sperling | 4880be4 | 2018-08-07 18:12:59 +0200 | [diff] [blame] | 9141 | |
| 9142 | execute( TC_tch_sign_l2_fill_frame() ); |
| 9143 | execute( TC_tch_sign_l2_fill_frame_dtxd() ); |
Stefan Sperling | 0ec1c26 | 2018-10-15 15:12:52 +0200 | [diff] [blame] | 9144 | |
| 9145 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 9146 | execute( TC_chopped_ipa_payload() ); |
Vadim Yanitskiy | c7ef030 | 2020-10-18 19:24:18 +0700 | [diff] [blame] | 9147 | |
| 9148 | execute( TC_ms_pwr_ctrl_constant() ); |
Vadim Yanitskiy | 652e60e | 2020-10-18 19:43:27 +0700 | [diff] [blame] | 9149 | execute( TC_ms_pwr_ctrl_pf_ewma() ); |
Vadim Yanitskiy | 5fa8561 | 2020-10-21 03:46:18 +0700 | [diff] [blame] | 9150 | |
| 9151 | execute( TC_speech_no_rtp_tchf() ); |
| 9152 | execute( TC_speech_no_rtp_tchh() ); |
Vadim Yanitskiy | 1868488 | 2021-07-04 04:15:58 +0200 | [diff] [blame] | 9153 | execute( TC_speech_rtp_tchf() ); |
| 9154 | execute( TC_speech_rtp_tchh() ); |
Pau Espin Pedrol | 39bfa02 | 2022-08-12 14:56:12 +0200 | [diff] [blame] | 9155 | execute( TC_speech_osmux_tchf() ); |
| 9156 | execute( TC_speech_osmux_tchh() ); |
Neels Hofmeyr | af9d6ae | 2021-08-15 23:18:47 +0200 | [diff] [blame] | 9157 | |
| 9158 | execute( TC_early_immediate_assignment() ); |
Vadim Yanitskiy | 46f1992 | 2021-10-06 02:36:22 +0600 | [diff] [blame] | 9159 | |
Vadim Yanitskiy | f9e31d2 | 2021-11-06 18:43:28 +0300 | [diff] [blame] | 9160 | execute( TC_acch_overpower_rxqual_thresh() ); |
| 9161 | execute( TC_acch_overpower_rxqual_thresh_dtx() ); |
| 9162 | execute( TC_acch_overpower_always_on_facch() ); |
| 9163 | execute( TC_acch_overpower_always_on_sacch() ); |
| 9164 | execute( TC_acch_overpower_limit() ); |
| 9165 | |
Vadim Yanitskiy | 46f1992 | 2021-10-06 02:36:22 +0600 | [diff] [blame] | 9166 | /* BEWARE: these test cases can potentially break the IUT or cause |
| 9167 | * weird/unexpected behavior. Ensure that they are executed last. */ |
| 9168 | execute( TC_dyn_osmo_pdch_tchh_race_act() ); |
| 9169 | execute( TC_dyn_osmo_pdch_sdcch8_race_act() ); |
Harald Welte | 7076738 | 2018-02-21 12:16:40 +0100 | [diff] [blame] | 9170 | } |
| 9171 | |
| 9172 | |
| 9173 | } |