Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 23 | friend module BSC_Tests_VAMOS; |
Vadim Yanitskiy | 5eb06a3 | 2022-06-23 18:39:46 +0700 | [diff] [blame] | 24 | friend module BSC_Tests_CBSP; |
Vadim Yanitskiy | 3cc065b | 2023-01-06 21:35:12 +0700 | [diff] [blame] | 25 | friend module BSC_Tests_LCLS; |
Harald Welte | 801ed1a | 2023-04-30 15:07:00 +1000 | [diff] [blame] | 26 | friend module BSC_Tests_ASCI; |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 27 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 28 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 29 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 30 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 31 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 32 | import from IPL4asp_Types all; |
| 33 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 34 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 35 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 36 | import from BSSAP_LE_Adapter all; |
| 37 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 38 | import from BSSAP_LE_Types all; |
| 39 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 40 | import from BSSAP_CodecPort all; |
| 41 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 42 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 43 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 44 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 45 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 46 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 47 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 48 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 49 | import from MGCP_Templates all; |
| 50 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 51 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 52 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 54 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 55 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 56 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 57 | import from StatsD_Types all; |
| 58 | import from StatsD_CodecPort all; |
| 59 | import from StatsD_CodecPort_CtrlFunct all; |
| 60 | import from StatsD_Checker all; |
| 61 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 62 | import from Osmocom_VTY_Functions all; |
| 63 | import from TELNETasp_PortType all; |
| 64 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 65 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 66 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 67 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 68 | import from L3_Templates all; |
| 69 | import from GSM_RR_Types all; |
| 70 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 71 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 72 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 73 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 74 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 75 | import from SCCPasp_Types all; |
| 76 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 77 | import from GSM_SystemInformation all; |
| 78 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 79 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 80 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 81 | const integer NUM_TRX := 4; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 82 | const integer NUM_BTS := 3; |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 83 | const integer NUM_BTS_CFG := 4; /* we have 4 BTS in the osmo-bsc.cfg (for inter-BSC HO tests) but use only 3 */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 84 | const integer NUM_TRX_CFG := 1; /* we support up to 4 TRX per BTS, but have only 1 TRX per BTS in osmo-bsc.cfg */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 85 | const integer NUM_MSC := 3; |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 86 | const integer NUM_MGW := 2; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 87 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 88 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 89 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 90 | const integer NUM_TCHH_PER_BTS := 2; |
| 91 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 92 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 93 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 94 | friend type record BtsTrxIdx { |
| 95 | uint8_t bts, |
| 96 | uint8_t trx |
| 97 | } |
| 98 | |
| 99 | private type record BtsParams { |
| 100 | integer trx_num, |
| 101 | integer tsc |
| 102 | } |
| 103 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 104 | /* Default Training Sequence Code expected for bts[i]: |
| 105 | * BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2. |
| 106 | * BTS 1 has BSIC 11, TSC = (BSIC & 7) = 3. |
| 107 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 108 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 109 | */ |
Harald Welte | 801ed1a | 2023-04-30 15:07:00 +1000 | [diff] [blame] | 110 | friend const BtsParams c_BtsParams[NUM_BTS_CFG] := { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 111 | /* BTS0 */ { trx_num := 1, tsc := 2 }, |
| 112 | /* BTS1 */ { trx_num := 1, tsc := 3 }, |
Vadim Yanitskiy | 7a3d293 | 2022-05-29 20:37:46 +0600 | [diff] [blame] | 113 | /* BTS2 */ { trx_num := 4, tsc := 4 }, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 114 | /* BTS3 */ { trx_num := 1, tsc := 4 } |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 115 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 116 | |
Vadim Yanitskiy | 5949470 | 2022-09-14 15:29:04 +0700 | [diff] [blame] | 117 | private const RSL_IE_Body c_mr_conf_5_90 := |
Pau Espin Pedrol | f7634dc | 2022-09-02 17:56:00 +0200 | [diff] [blame] | 118 | valueof(RSL_IE_Body:{multirate_cfg := ts_RSL_MultirateCfg(true, 0, '00000100'B /* 5,90k */)}); |
| 119 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 120 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 121 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 122 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 123 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 124 | } |
| 125 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 126 | /* Default list of counters for an 'msc' entity. */ |
| 127 | const CounterNameVals counternames_msc_mscpool := { |
| 128 | { "mscpool:subscr:new", 0 }, |
| 129 | { "mscpool:subscr:known", 0 }, |
| 130 | { "mscpool:subscr:reattach", 0 }, |
| 131 | { "mscpool:subscr:attach_lost", 0 }, |
| 132 | { "mscpool:subscr:paged", 0 } |
| 133 | }; |
| 134 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 135 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 136 | const CounterNameVals counternames_bsc_mscpool := { |
| 137 | { "mscpool:subscr:no_msc", 0 } |
| 138 | }; |
| 139 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 140 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 141 | const CounterNameVals counternames_bsc_bts_handover := { |
| 142 | { "assignment:attempted", 0 }, |
| 143 | { "assignment:completed", 0 }, |
| 144 | { "assignment:stopped", 0 }, |
| 145 | { "assignment:no_channel", 0 }, |
| 146 | { "assignment:timeout", 0 }, |
| 147 | { "assignment:failed", 0 }, |
| 148 | { "assignment:error", 0 }, |
| 149 | |
| 150 | { "handover:attempted", 0 }, |
| 151 | { "handover:completed", 0 }, |
| 152 | { "handover:stopped", 0 }, |
| 153 | { "handover:no_channel", 0 }, |
| 154 | { "handover:timeout", 0 }, |
| 155 | { "handover:failed", 0 }, |
| 156 | { "handover:error", 0 }, |
| 157 | |
| 158 | { "intra_cell_ho:attempted", 0 }, |
| 159 | { "intra_cell_ho:completed", 0 }, |
| 160 | { "intra_cell_ho:stopped", 0 }, |
| 161 | { "intra_cell_ho:no_channel", 0 }, |
| 162 | { "intra_cell_ho:timeout", 0 }, |
| 163 | { "intra_cell_ho:failed", 0 }, |
| 164 | { "intra_cell_ho:error", 0 }, |
| 165 | |
| 166 | { "intra_bsc_ho:attempted", 0 }, |
| 167 | { "intra_bsc_ho:completed", 0 }, |
| 168 | { "intra_bsc_ho:stopped", 0 }, |
| 169 | { "intra_bsc_ho:no_channel", 0 }, |
| 170 | { "intra_bsc_ho:timeout", 0 }, |
| 171 | { "intra_bsc_ho:failed", 0 }, |
| 172 | { "intra_bsc_ho:error", 0 }, |
| 173 | |
| 174 | { "interbsc_ho_out:attempted", 0 }, |
| 175 | { "interbsc_ho_out:completed", 0 }, |
| 176 | { "interbsc_ho_out:stopped", 0 }, |
| 177 | { "interbsc_ho_out:timeout", 0 }, |
| 178 | { "interbsc_ho_out:failed", 0 }, |
| 179 | { "interbsc_ho_out:error", 0 }, |
| 180 | |
| 181 | { "interbsc_ho_in:attempted", 0 }, |
| 182 | { "interbsc_ho_in:completed", 0 }, |
| 183 | { "interbsc_ho_in:stopped", 0 }, |
| 184 | { "interbsc_ho_in:no_channel", 0 }, |
| 185 | { "interbsc_ho_in:timeout", 0 }, |
| 186 | { "interbsc_ho_in:failed", 0 }, |
| 187 | { "interbsc_ho_in:error", 0 } |
| 188 | }; |
| 189 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 190 | const CounterNameVals counternames_bts_handover := { |
| 191 | { "incoming_intra_bsc_ho:attempted", 0 }, |
| 192 | { "incoming_intra_bsc_ho:completed", 0 }, |
| 193 | { "incoming_intra_bsc_ho:stopped", 0 }, |
| 194 | { "incoming_intra_bsc_ho:no_channel", 0 }, |
| 195 | { "incoming_intra_bsc_ho:timeout", 0 }, |
| 196 | { "incoming_intra_bsc_ho:failed", 0 }, |
| 197 | { "incoming_intra_bsc_ho:error", 0 } |
| 198 | }; |
| 199 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 200 | /* Set of all System Information received during one RSL port's startup. |
| 201 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 202 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 203 | */ |
| 204 | type record SystemInformationConfig { |
| 205 | SystemInformationType1 si1 optional, |
| 206 | SystemInformationType2 si2 optional, |
| 207 | SystemInformationType2bis si2bis optional, |
| 208 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 209 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 210 | SystemInformationType3 si3 optional, |
| 211 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 212 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 213 | SystemInformationType5 si5 optional, |
| 214 | SystemInformationType5bis si5bis optional, |
| 215 | SystemInformationType5ter si5ter optional, |
| 216 | SystemInformationType6 si6 optional |
| 217 | }; |
| 218 | |
| 219 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 220 | si1 := omit, |
| 221 | si2 := omit, |
| 222 | si2bis := omit, |
| 223 | si2ter := omit, |
| 224 | si2quater := omit, |
| 225 | si3 := omit, |
| 226 | si4 := omit, |
| 227 | si13 := omit, |
| 228 | si5 := omit, |
| 229 | si5bis := omit, |
| 230 | si5ter := omit, |
| 231 | si6 := omit |
| 232 | }; |
| 233 | |
| 234 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 235 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 236 | template uint3_t meas_bw := 3) |
| 237 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 238 | meas_bw_presence := '1'B, |
| 239 | meas_bw := meas_bw); |
| 240 | |
| 241 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 242 | template EUTRAN_NeighbourCells tr_EUTRAN_NeighbourCells_default(template (present) EUTRAN_CellDescs cell_desc_list := { tr_EUTRAN_CellDesc_default }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 243 | template uint3_t prio := 3, |
| 244 | template (present) uint5_t thresh_high := 20, |
| 245 | template uint5_t thresh_low := 10, |
| 246 | template uint5_t qrxlevmin := 22) |
| 247 | := tr_EUTRAN_NeighbourCells( |
| 248 | cell_desc_list := cell_desc_list, |
| 249 | prio_presence := '1'B, |
| 250 | prio := prio, |
| 251 | thresh_high := thresh_high, |
| 252 | thresh_low_presence := '1'B, |
| 253 | thresh_low := thresh_low, |
| 254 | qrxlevmin_presence := '1'B, |
| 255 | qrxlevmin := qrxlevmin); |
| 256 | |
| 257 | template SystemInformationConfig SystemInformationConfig_default := { |
| 258 | si1 := { |
| 259 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 260 | rach_control := { |
| 261 | max_retrans := RACH_MAX_RETRANS_7, |
| 262 | tx_integer := '1001'B, |
| 263 | cell_barr_access := false, |
| 264 | re_not_allowed := true, |
| 265 | acc := '0000010000000000'B |
| 266 | }, |
| 267 | rest_octets := ? |
| 268 | }, |
| 269 | si2 := { |
| 270 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 271 | ncc_permitted := '11111111'B, |
| 272 | rach_control := { |
| 273 | max_retrans := RACH_MAX_RETRANS_7, |
| 274 | tx_integer := '1001'B, |
| 275 | cell_barr_access := false, |
| 276 | re_not_allowed := true, |
| 277 | acc := '0000010000000000'B |
| 278 | } |
| 279 | }, |
| 280 | si2bis := omit, |
| 281 | si2ter := { |
| 282 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 283 | rest_octets := ? |
| 284 | }, |
| 285 | si2quater := { |
| 286 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 287 | }, |
| 288 | si3 := { |
| 289 | cell_id := 0, |
| 290 | lai := { |
| 291 | mcc_mnc := '001F01'H, |
| 292 | lac := 1 |
| 293 | }, |
| 294 | ctrl_chan_desc := { |
| 295 | msc_r99 := true, |
| 296 | att := true, |
| 297 | bs_ag_blks_res := 1, |
| 298 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 299 | si22ind := false, |
| 300 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 301 | spare := '00'B, |
| 302 | bs_pa_mfrms := 3, |
| 303 | t3212 := 30 |
| 304 | }, |
| 305 | cell_options := { |
| 306 | dn_ind := false, |
| 307 | pwrc := false, |
| 308 | dtx := MS_SHALL_USE_UL_DTX, |
| 309 | radio_link_tout_div4 := 7 |
| 310 | }, |
| 311 | cell_sel_par := { |
| 312 | cell_resel_hyst_2dB := 2, |
| 313 | ms_txpwr_max_cch := 7, |
| 314 | acs := '0'B, |
| 315 | neci := true, |
| 316 | rxlev_access_min := 0 |
| 317 | }, |
| 318 | rach_control := { |
| 319 | max_retrans := RACH_MAX_RETRANS_7, |
| 320 | tx_integer := '1001'B, |
| 321 | cell_barr_access := false, |
| 322 | re_not_allowed := true, |
| 323 | acc := '0000010000000000'B |
| 324 | }, |
| 325 | rest_octets := { |
| 326 | sel_params := { |
| 327 | presence := '0'B, |
| 328 | params := omit |
| 329 | }, |
| 330 | pwr_offset := { |
| 331 | presence := '0'B, |
| 332 | offset := omit |
| 333 | }, |
| 334 | si_2ter_ind := '1'B, |
| 335 | early_cm_ind := '0'B, |
| 336 | sched_where := { |
| 337 | presence := '0'B, |
| 338 | where := omit |
| 339 | }, |
| 340 | gprs_ind := { |
| 341 | presence := '1'B, |
| 342 | ind := { |
| 343 | ra_colour := 0, |
| 344 | si13_pos := '0'B |
| 345 | } |
| 346 | }, |
| 347 | umts_early_cm_ind := '1'B, |
| 348 | si2_quater_ind := { |
| 349 | presence := '1'B, |
| 350 | ind := '0'B |
| 351 | }, |
| 352 | iu_mode_ind := omit, |
| 353 | si21_ind := { |
| 354 | presence := '0'B, |
| 355 | pos := omit |
| 356 | } |
| 357 | } |
| 358 | }, |
| 359 | si4 := { |
| 360 | lai := { |
| 361 | mcc_mnc := '001F01'H, |
| 362 | lac := 1 |
| 363 | }, |
| 364 | cell_sel_par := { |
| 365 | cell_resel_hyst_2dB := 2, |
| 366 | ms_txpwr_max_cch := 7, |
| 367 | acs := '0'B, |
| 368 | neci := true, |
| 369 | rxlev_access_min := 0 |
| 370 | }, |
| 371 | rach_control := { |
| 372 | max_retrans := RACH_MAX_RETRANS_7, |
| 373 | tx_integer := '1001'B, |
| 374 | cell_barr_access := false, |
| 375 | re_not_allowed := true, |
| 376 | acc := '0000010000000000'B |
| 377 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 378 | cbch_chan_desc := { |
| 379 | iei := '64'O, |
| 380 | v := { |
| 381 | chan_nr := { |
| 382 | u := { |
| 383 | sdcch4 := { |
| 384 | tag := '001'B, |
| 385 | sub_chan := 2 |
| 386 | } |
| 387 | }, |
| 388 | tn := 0 |
| 389 | }, |
| 390 | tsc := 2, |
| 391 | h := false, |
| 392 | arfcn := 871, |
| 393 | maio_hsn := omit |
| 394 | } |
| 395 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 396 | cbch_mobile_alloc := omit, |
| 397 | rest_octets := { |
| 398 | sel_params := { |
| 399 | presence := '0'B, |
| 400 | params := omit |
| 401 | }, |
| 402 | pwr_offset := { |
| 403 | presence := '0'B, |
| 404 | offset := omit |
| 405 | }, |
| 406 | gprs_ind := { |
| 407 | presence := '1'B, |
| 408 | ind := { |
| 409 | ra_colour := 0, |
| 410 | si13_pos := '0'B |
| 411 | } |
| 412 | }, |
| 413 | s_presence := '0'B, |
| 414 | s := omit |
| 415 | } |
| 416 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 417 | si13 := { |
| 418 | rest_octets := { |
| 419 | presence := '1'B, |
| 420 | bcch_change_mark := ?, |
| 421 | si_change_field := '0000'B, |
| 422 | presence2 := '0'B, |
| 423 | si13_change_mark := omit, |
| 424 | gprs_ma := omit, |
| 425 | zero := '0'B, /* PBCCH not present in cell */ |
| 426 | rac := 0, |
| 427 | spgc_ccch_sup := '0'B, |
| 428 | priority_access_thr := '110'B, |
| 429 | network_control_order := '00'B, |
| 430 | gprs_cell_opts := { |
| 431 | nmo := '01'B, |
| 432 | t3168 := '011'B, |
| 433 | t3192 := '010'B, |
| 434 | drx_timer_max := '011'B, |
| 435 | access_burst_type := '0'B, |
| 436 | control_ack_type := '1'B, |
| 437 | bs_cv_max := 15, |
| 438 | pan_presence := '1'B, |
| 439 | pan_dec := 1, |
| 440 | pan_inc := 1, |
| 441 | pan_max := '111'B, |
| 442 | ext_info_presence := ?, |
| 443 | ext_info_length := *, |
| 444 | ext_info := * |
| 445 | }, |
| 446 | gprs_pwr_ctrl_params := { |
| 447 | alpha := 0, |
| 448 | t_avg_w := '10000'B, |
| 449 | t_avg_t := '10000'B, |
| 450 | pc_meas_chan := '0'B, |
| 451 | n_avg_i := '1000'B |
| 452 | } |
| 453 | } |
| 454 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 455 | si5 := { |
| 456 | bcch_freq_list := '10000000000000000000000000000000'O |
| 457 | }, |
| 458 | si5bis := omit, |
| 459 | si5ter := { |
| 460 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 461 | }, |
| 462 | si6 := { |
| 463 | cell_id := 0, |
| 464 | lai := { |
| 465 | mcc_mnc := '001F01'H, |
| 466 | lac := 1 |
| 467 | }, |
| 468 | cell_options := { |
| 469 | dtx_ext := '1'B, |
| 470 | pwrc := false, |
| 471 | dtx := '01'B, |
| 472 | radio_link_timeout := '0111'B |
| 473 | }, |
| 474 | ncc_permitted := '11111111'B, |
Vadim Yanitskiy | 348b07c | 2022-03-10 17:11:22 +0300 | [diff] [blame] | 475 | rest_octets := { |
| 476 | pch_nch_info := ?, |
| 477 | vbs_vgcs_options := ?, |
| 478 | dtm_support := '0'B, |
| 479 | rac := omit, |
| 480 | max_lapdm := omit, |
| 481 | band_ind := '0'B /* C0 ARFCN indicates 1800 band */ |
| 482 | } |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 483 | } |
| 484 | }; |
| 485 | |
| 486 | |
| 487 | /* List of all the System Information received on all RSL ports */ |
| 488 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 489 | |
| 490 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 491 | { |
| 492 | var RSL_IE_Body sysinfo_type_ie; |
| 493 | var RSL_IE_SysinfoType si_type; |
| 494 | var octetstring data; |
| 495 | |
| 496 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 497 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 498 | mtc.stop; |
| 499 | } |
| 500 | si_type := sysinfo_type_ie.sysinfo_type; |
| 501 | |
| 502 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 503 | var RSL_IE_Body bcch_ie; |
| 504 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 505 | data := bcch_ie.other.payload; |
| 506 | } |
| 507 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 508 | var RSL_IE_Body l3_ie; |
| 509 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 510 | data := l3_ie.l3_info.payload; |
| 511 | } |
| 512 | } else { |
| 513 | setverdict(fail, "Don't understand this System Information message"); |
| 514 | mtc.stop; |
| 515 | } |
| 516 | |
| 517 | var boolean handled := false; |
| 518 | |
| 519 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 520 | handled := true; |
| 521 | |
| 522 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 523 | if (not isbound(data)) { |
| 524 | si.si1 := omit; |
| 525 | } else { |
| 526 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 527 | } |
| 528 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 529 | if (not isbound(data)) { |
| 530 | si.si2 := omit; |
| 531 | } else { |
| 532 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 533 | } |
| 534 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 535 | if (not isbound(data)) { |
| 536 | si.si2bis := omit; |
| 537 | } else { |
| 538 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 539 | } |
| 540 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 541 | if (not isbound(data)) { |
| 542 | si.si2ter := omit; |
| 543 | } else { |
| 544 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 545 | } |
| 546 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 547 | if (not isbound(data)) { |
| 548 | si.si2quater := {}; |
| 549 | } else { |
| 550 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 551 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 552 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 553 | } |
| 554 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 555 | if (not isbound(data)) { |
| 556 | si.si3 := omit; |
| 557 | } else { |
| 558 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 559 | } |
| 560 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 561 | if (not isbound(data)) { |
| 562 | si.si4 := omit; |
| 563 | } else { |
| 564 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 565 | } |
| 566 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 567 | if (not isbound(data)) { |
| 568 | si.si13 := omit; |
| 569 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 570 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 571 | } |
| 572 | } else { |
| 573 | handled := false; |
| 574 | } |
| 575 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 576 | handled := true; |
| 577 | |
| 578 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 579 | if (not isbound(data)) { |
| 580 | si.si5 := omit; |
| 581 | } else { |
| 582 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 583 | } |
| 584 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 585 | if (not isbound(data)) { |
| 586 | si.si5bis := omit; |
| 587 | } else { |
| 588 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 589 | } |
| 590 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 591 | if (not isbound(data)) { |
| 592 | si.si5ter := omit; |
| 593 | } else { |
| 594 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 595 | } |
| 596 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 597 | if (not isbound(data)) { |
| 598 | si.si6 := omit; |
| 599 | } else { |
| 600 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 601 | } |
| 602 | } else { |
| 603 | handled := false; |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | if (not handled) { |
| 608 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 609 | } |
| 610 | } |
| 611 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 612 | friend function gen_l3_valid_payload(hexstring imsi := ''H) return octetstring { |
| 613 | var octetstring l3_payload; |
| 614 | if (lengthof(imsi) == 0) { |
| 615 | imsi := f_rnd_imsi('00101'H); |
| 616 | } |
| 617 | l3_payload := enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, ts_MI_LV(ts_MI_IMSI(imsi))))); |
| 618 | return l3_payload; |
| 619 | } |
| 620 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 621 | type component test_CT extends CTRL_Adapter_CT { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 622 | /* Array of per-BTS/TRX state */ |
| 623 | var BTS_State bts[NUM_BTS][NUM_TRX]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 624 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 625 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 626 | /* array of per-BTS/TRX RSL test ports */ |
| 627 | port IPA_RSL_PT IPA_RSL[NUM_BTS][NUM_TRX]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 628 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 629 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 630 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Pau Espin Pedrol | 80d4b4f | 2022-06-10 18:39:42 +0200 | [diff] [blame] | 631 | /* Configure/manage IPA_Emulation per-BTS/TRX port: */ |
| 632 | port IPA_CFG_PT IPA_CFG_PORT[NUM_BTS][NUM_TRX]; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 633 | |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 634 | var MGCP_Emulation_CT vc_MGCP[NUM_MGW]; |
| 635 | var integer g_nr_mgw; /* number of vc_MGCP to initialize */ |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 636 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 637 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 638 | /* StatsD */ |
| 639 | var StatsD_Checker_CT vc_STATSD; |
| 640 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 641 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 642 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 643 | /* for old legacy-tests only */ |
| 644 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 645 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 646 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 647 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 648 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 649 | |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 650 | var boolean g_handler_mode := false; |
| 651 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 652 | /* Osmux is enabled through VTY */ |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 653 | var boolean g_osmux_enabled_cn := false; |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 654 | var boolean g_osmux_enabled_bts := false; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 655 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 656 | /*Configure T(tias) over VTY, seconds */ |
| 657 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 658 | /*Configure T(tiar) over VTY, seconds */ |
| 659 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 660 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 661 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 662 | timer T_guard := 30.0; |
| 663 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 664 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 665 | var CounterNameValsList g_ctr_bsc; |
| 666 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 667 | |
| 668 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 669 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 670 | } |
| 671 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 672 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 673 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 674 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 675 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 676 | /* port number to which to establish the IPA OML connections */ |
| 677 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 678 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 679 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 680 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 681 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 682 | /* port number to which to listen for STATSD metrics */ |
| 683 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 684 | /* IP address at which the test binds */ |
| 685 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 686 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 687 | RAN_Configurations mp_bssap_cfg := { |
| 688 | { |
| 689 | transport := BSSAP_TRANSPORT_AoIP, |
| 690 | sccp_service_type := "mtp3_itu", |
| 691 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 692 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 693 | own_ssn := 254, |
| 694 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 695 | peer_ssn := 254, |
| 696 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 697 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 698 | }, |
| 699 | { |
| 700 | transport := BSSAP_TRANSPORT_AoIP, |
| 701 | sccp_service_type := "mtp3_itu", |
| 702 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 703 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 704 | own_ssn := 254, |
| 705 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 706 | peer_ssn := 254, |
| 707 | sio := '83'O, |
| 708 | rctx := 2 |
| 709 | }, |
| 710 | { |
| 711 | transport := BSSAP_TRANSPORT_AoIP, |
| 712 | sccp_service_type := "mtp3_itu", |
| 713 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 714 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 715 | own_ssn := 254, |
| 716 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 717 | peer_ssn := 254, |
| 718 | sio := '83'O, |
| 719 | rctx := 3 |
| 720 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 721 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 722 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 723 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 724 | phys_chan_configs phys_chan_config := { |
| 725 | "CCCH+SDCCH4+CBCH", |
| 726 | "TCH/F", |
| 727 | "TCH/F", |
| 728 | "TCH/F", |
| 729 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 730 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 731 | "PDCH", |
| 732 | "PDCH" |
| 733 | }; |
| 734 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 735 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 736 | sccp_service_type := "mtp3_itu", |
| 737 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 738 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 739 | own_ssn := 252, /* SMLC side SSN */ |
| 740 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 741 | peer_ssn := 250, /* BSC side SSN */ |
| 742 | sio := '83'O, |
| 743 | rctx := 6 |
| 744 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 745 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 746 | |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 747 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 748 | uint8_t mp_exp_ms_power_level := 7; |
Vadim Yanitskiy | 6e06801 | 2022-02-05 21:35:43 +0600 | [diff] [blame] | 749 | |
| 750 | /* Whether to check for memory leaks */ |
| 751 | boolean mp_verify_talloc_count := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 752 | } |
| 753 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 754 | friend function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 755 | |
| 756 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 757 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 758 | pars.aoip := true; |
| 759 | } else { |
| 760 | pars.aoip := false; |
| 761 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 762 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 763 | pars.mscpool.bssap_idx := bssap_idx; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 764 | pars.expect_tsc := c_BtsParams[0].tsc; |
Vadim Yanitskiy | 96bb9cb | 2021-12-10 21:14:15 +0300 | [diff] [blame] | 765 | pars.imsi := f_rnd_imsi('00101'H); |
Pau Espin Pedrol | b27653c | 2023-01-03 14:07:21 +0100 | [diff] [blame] | 766 | pars.imei := f_rnd_imei('00101'H); |
Vadim Yanitskiy | 96bb9cb | 2021-12-10 21:14:15 +0300 | [diff] [blame] | 767 | |
| 768 | log(testcasename(), ": using IMSI ", pars.imsi); |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 769 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 770 | return pars; |
| 771 | } |
| 772 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 773 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 774 | |
| 775 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 776 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 777 | log("initial msc rate counters: ", g_ctr_msc); |
| 778 | } |
| 779 | |
| 780 | private function f_ctrs_msc_add(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 9656e92 | 2020-06-30 01:27:01 +0200 | [diff] [blame] | 781 | f_counter_name_vals_list_add(g_ctr_msc, msc_nr, countername, val); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | /* f_ctrs_msc_init(); |
| 785 | * f_do_thing(on_msc := 0); |
| 786 | * f_do_thing(on_msc := 0); |
| 787 | * f_do_other(on_msc := 1); |
| 788 | * f_ctrs_msc_add(0, "thing", 2); |
| 789 | * f_ctrs_msc_add(1, "other"); |
| 790 | * f_ctrs_msc_verify(); |
| 791 | */ |
| 792 | private function f_ctrs_msc_verify() runs on test_CT { |
| 793 | log("verifying msc rate counters: ", g_ctr_msc); |
| 794 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 795 | } |
| 796 | |
| 797 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 798 | * f_ctrs_msc_init(); |
| 799 | * f_do_thing(on_msc := 0); |
| 800 | * f_do_thing(on_msc := 0); |
| 801 | * f_do_thing(on_msc := 0); |
| 802 | * f_ctrs_msc_expect(0, "thing", 3); |
| 803 | */ |
| 804 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 805 | f_ctrs_msc_add(msc_nr, countername, val); |
| 806 | f_ctrs_msc_verify(); |
| 807 | } |
| 808 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 809 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 810 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 811 | private function f_ctrs_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 812 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
Neels Hofmeyr | 4dec8cc | 2021-11-29 15:59:44 +0100 | [diff] [blame] | 813 | log("initial bts rate counters: ", g_ctr_bts); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 814 | } |
| 815 | |
| 816 | function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 817 | f_ctrs_bts_init(bts_count, counternames); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 818 | f_ctrs_bsc_init(counternames); |
| 819 | } |
| 820 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 821 | private function f_ctrs_bsc_and_bts_handover_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 822 | var CounterNameVals bts_names := counternames_bsc_bts_handover & counternames_bts_handover; |
Neels Hofmeyr | 4dec8cc | 2021-11-29 15:59:44 +0100 | [diff] [blame] | 823 | f_ctrs_bts_init(bts_count, bts_names); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 824 | f_ctrs_bsc_init(counternames_bsc_bts_handover); |
| 825 | } |
| 826 | |
| 827 | private function f_ctrs_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 828 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 829 | } |
| 830 | |
| 831 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 832 | f_ctrs_bts_add(bts_nr, countername, val); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 833 | f_ctrs_bsc_add(countername, val); |
| 834 | } |
| 835 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 836 | function f_ctrs_bts_verify() runs on test_CT { |
| 837 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 838 | } |
| 839 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 840 | /* f_ctrs_bsc_and_bts_init(); |
| 841 | * f_do_thing(on_bts := 0); |
| 842 | * f_do_thing(on_bts := 0); |
| 843 | * f_do_other(on_bts := 1); |
| 844 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 845 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 846 | * f_ctrs_bsc_and_bts_verify(); |
| 847 | */ |
| 848 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 849 | f_ctrs_bts_verify(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 850 | f_ctrs_bsc_verify(); |
| 851 | } |
| 852 | |
| 853 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 854 | * f_ctrs_bsc_and_bts_init(); |
| 855 | * f_do_thing(on_bts := 0); |
| 856 | * f_do_thing(on_bts := 0); |
| 857 | * f_do_thing(on_bts := 0); |
| 858 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 859 | */ |
| 860 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 861 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 862 | f_ctrs_bsc_and_bts_verify(); |
| 863 | } |
| 864 | |
| 865 | |
| 866 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 867 | |
| 868 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 869 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 870 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 871 | } |
| 872 | |
| 873 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 874 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 875 | } |
| 876 | |
| 877 | /* f_ctrs_bsc_init(); |
| 878 | * f_do_thing(); |
| 879 | * f_do_thing(); |
| 880 | * f_do_other(); |
| 881 | * f_ctrs_bsc_add("thing", 2); |
| 882 | * f_ctrs_bsc_add("other"); |
| 883 | * f_ctrs_bsc_verify(); |
| 884 | */ |
| 885 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 886 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 887 | } |
| 888 | |
| 889 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 890 | * f_ctrs_bsc_init(); |
| 891 | * f_do_thing(); |
| 892 | * f_ctrs_bsc_expect("thing", 1); |
| 893 | */ |
| 894 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 895 | f_ctrs_bsc_add(countername, val); |
| 896 | f_ctrs_bsc_verify(); |
| 897 | } |
| 898 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 899 | |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 900 | friend function f_shutdown_helper(boolean ho := false) runs on test_CT { |
Neels Hofmeyr | 1899749 | 2021-12-13 17:30:35 +0100 | [diff] [blame] | 901 | /* Run the subscr and conn leak test only when the VTY is initialized */ |
Vadim Yanitskiy | 6e06801 | 2022-02-05 21:35:43 +0600 | [diff] [blame] | 902 | if (BSCVTY.checkstate("Mapped") and mp_verify_talloc_count) { |
Neels Hofmeyr | 1899749 | 2021-12-13 17:30:35 +0100 | [diff] [blame] | 903 | f_verify_talloc_count(BSCVTY, {"struct bsc_subscr", "struct gsm_subscriber_connection"}); |
| 904 | } |
| 905 | |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 906 | /* Reset handover related configuration */ |
| 907 | if (ho) { |
| 908 | f_bts_0_cfg(BSCVTY, |
| 909 | {"no neighbors", |
| 910 | "neighbor-list mode manual-si5", |
| 911 | "neighbor-list add arfcn 100", |
| 912 | "neighbor-list add arfcn 200", |
| 913 | "si5 neighbor-list add arfcn 10", |
| 914 | "si5 neighbor-list add arfcn 20", |
| 915 | "handover algorithm 1"}); |
| 916 | } |
| 917 | |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 918 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 919 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 920 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 921 | } |
| 922 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 923 | private function f_legacy_bssap_reset(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 924 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 925 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 926 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 927 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 928 | ts_BSSMAP_Reset(0, g_osmux_enabled_cn))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 929 | T.start; |
| 930 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 931 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 932 | tr_BSSMAP_ResetAck(g_osmux_enabled_cn))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 933 | log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 934 | } |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 935 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled_cn))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 936 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 937 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 938 | ts_BSSMAP_ResetAck(g_osmux_enabled_cn))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 939 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 940 | repeat; |
| 941 | } |
| 942 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 943 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 944 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 945 | /* If we received a RESET after ours was sent, it |
| 946 | may be a race condition where the other peer beacame |
| 947 | available after we sent it, but we are in a desired |
| 948 | state anyway, so go forward. */ |
| 949 | if (not reset_received) { |
| 950 | setverdict(fail); |
| 951 | } |
| 952 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 953 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 954 | } |
| 955 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 956 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 957 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 958 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 959 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 960 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 961 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 962 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 963 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 964 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 965 | } |
| 966 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 967 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 968 | * \param clnt IPA_Client for which to establish |
| 969 | * \param bsc_host IP address / hostname of the BSC |
| 970 | * \param bsc_port TCP port number of the BSC |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 971 | * \param idx BTS/TRX index values |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 972 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 973 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, |
| 974 | BtsTrxIdx idx := {0, 0}, boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 975 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 976 | timer T := 10.0; |
| 977 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 978 | clnt.id := "IPA-BTS" & int2str(idx.bts) & "-TRX" & int2str(idx.trx) & "-RSL"; |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 979 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA") alive; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 980 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 981 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 982 | clnt.ccm_pars.unit_id := int2str(1234 + idx.bts) & "/0/" & int2str(idx.trx); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 983 | if (handler_mode) { |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 984 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL") alive; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 985 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[idx.bts]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 986 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 987 | |
| 988 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Pau Espin Pedrol | 80d4b4f | 2022-06-10 18:39:42 +0200 | [diff] [blame] | 989 | connect(clnt.vc_IPA:CFG_PORT, self:IPA_CFG_PORT[idx.bts][idx.trx]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 990 | if (handler_mode) { |
| 991 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 992 | } else { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 993 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[idx.bts][idx.trx]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 994 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 995 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 996 | var integer local_port := 10000 + idx.bts * 1000 + idx.trx; |
| 997 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", local_port, clnt.ccm_pars)); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 998 | if (handler_mode) { |
| 999 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 1000 | return; |
| 1001 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1002 | |
| 1003 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 1004 | T.start; |
| 1005 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1006 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1007 | T.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1008 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1009 | [] IPA_RSL[idx.bts][idx.trx].receive(ASP_IPA_Event:?) { repeat } |
| 1010 | [] IPA_RSL[idx.bts][idx.trx].receive { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1011 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1012 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1013 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1014 | } |
| 1015 | } |
| 1016 | } |
| 1017 | |
Pau Espin Pedrol | 80d4b4f | 2022-06-10 18:39:42 +0200 | [diff] [blame] | 1018 | function f_ipa_rsl_stop(inout IPA_Client clnt, BtsTrxIdx idx := {0, 0}) runs on test_CT { |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 1019 | var IPL4asp_Types.Result res := { |
| 1020 | errorCode := omit, |
| 1021 | connId := omit, |
| 1022 | os_error_code := omit, |
| 1023 | os_error_text := omit |
| 1024 | }; |
| 1025 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 1026 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 1027 | return; |
| 1028 | } |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 1029 | |
| 1030 | /* Alive components don't finish sockets (TCP FIN) when they are |
| 1031 | * stopped. Hence, we need to manually call close() on them to make sure |
| 1032 | * the IUT knows about it. */ |
Pau Espin Pedrol | 80d4b4f | 2022-06-10 18:39:42 +0200 | [diff] [blame] | 1033 | f_ipa_cfg_disconnect(IPA_CFG_PORT[idx.bts][idx.trx], res); |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 1034 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 1035 | clnt.vc_IPA.stop; |
| 1036 | if (isbound(clnt.vc_RSL)) { |
| 1037 | clnt.vc_RSL.stop; |
| 1038 | } |
| 1039 | } |
| 1040 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1041 | /* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1042 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 1043 | timer T := secs_max; |
| 1044 | T.start; |
| 1045 | while (true) { |
| 1046 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 1047 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 1048 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 1049 | * until all MO's are initialized */ |
| 1050 | T.start(1.0); |
| 1051 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1052 | return; |
| 1053 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 1054 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1055 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 1056 | setverdict(fail, "Timeout waiting for BTS" & int2str(bts_nr) & " oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1057 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1058 | } |
| 1059 | } |
| 1060 | } |
| 1061 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1062 | /* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1063 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1064 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 1065 | [] T_guard.timeout { |
| 1066 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1067 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 1068 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1069 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 1070 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled_cn))) -> value ud_ind { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1071 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 1072 | ts_BSSMAP_ResetAck(g_osmux_enabled_cn))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 1073 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1074 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1075 | } |
| 1076 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1077 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 1078 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled_cn))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1079 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1080 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1081 | } |
| 1082 | } |
| 1083 | |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 1084 | function f_init_mgcp(integer mgw_nr, charstring id) runs on test_CT { |
| 1085 | id := id & "-MGCP-" & int2str(mgw_nr); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1086 | |
| 1087 | var MGCPOps ops := { |
| 1088 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 1089 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 1090 | }; |
| 1091 | var MGCP_conn_parameters mgcp_pars := { |
| 1092 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 1093 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1094 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 1095 | mgw_udp_port := 2427 + mgw_nr, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 1096 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
Pau Espin Pedrol | 36eeaf7 | 2022-10-20 16:50:31 +0200 | [diff] [blame] | 1097 | the one with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1098 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1099 | }; |
| 1100 | |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 1101 | vc_MGCP[mgw_nr] := MGCP_Emulation_CT.create(id) alive; |
| 1102 | vc_MGCP[mgw_nr].start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1103 | } |
| 1104 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1105 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 1106 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 1107 | * OsmuxCID IE. |
| 1108 | */ |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 1109 | private function f_vty_allow_osmux_cn(boolean allow) runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1110 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 1111 | if (allow) { |
| 1112 | f_vty_transceive(BSCVTY, "osmux on"); |
| 1113 | } else { |
| 1114 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1115 | } |
| 1116 | f_vty_transceive(BSCVTY, "exit"); |
| 1117 | f_vty_transceive(BSCVTY, "exit"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1118 | } |
| 1119 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1120 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1121 | if (BSCVTY.checkstate("Mapped")) { |
| 1122 | /* skip initialization if already executed once */ |
| 1123 | return; |
| 1124 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1125 | map(self:BSCVTY, system:BSCVTY); |
| 1126 | f_vty_set_prompts(BSCVTY); |
| 1127 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1128 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1129 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1130 | } |
| 1131 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1132 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1133 | { |
| 1134 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1135 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1136 | } |
| 1137 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1138 | } |
| 1139 | |
| 1140 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1141 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1142 | |
| 1143 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1144 | [] IPA_RSL[rsl_idx][0].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1145 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1146 | repeat; |
| 1147 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1148 | [] IPA_RSL[rsl_idx][0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1149 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1150 | repeat; |
| 1151 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1152 | [] IPA_RSL[rsl_idx][0].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1153 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1154 | repeat; |
| 1155 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1156 | [] IPA_RSL[rsl_idx][0].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1157 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1158 | repeat; |
| 1159 | } |
| 1160 | |
| 1161 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1162 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1163 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1164 | repeat; |
| 1165 | } |
| 1166 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1167 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1168 | repeat; |
| 1169 | } |
| 1170 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1171 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1172 | repeat; |
| 1173 | } |
| 1174 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1175 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1176 | repeat; |
| 1177 | } |
| 1178 | } |
| 1179 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1180 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1181 | private type record of boolean my_BooleanList; |
| 1182 | |
| 1183 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1184 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1185 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1186 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1187 | for (var integer msc_nr := 0; msc_nr < sizeof(allow_attach_list); msc_nr := msc_nr+1) { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1188 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1189 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1190 | * stepping into that config node. */ |
| 1191 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1192 | continue; |
| 1193 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1194 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1195 | if (allow_attach_list[msc_nr]) { |
| 1196 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1197 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1198 | } else { |
| 1199 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1200 | } |
| 1201 | f_vty_transceive(pt, "exit"); |
| 1202 | f_vty_transceive(pt, "exit"); |
| 1203 | } |
| 1204 | } |
| 1205 | |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 1206 | private function f_bssap_idx_init(integer bssap_idx) runs on test_CT { |
| 1207 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1208 | * MSC-side BSSAP emulation */ |
| 1209 | if (g_handler_mode) { |
| 1210 | var RanOps ranops := MSC_RanOps; |
| 1211 | ranops.use_osmux := g_osmux_enabled_cn; |
| 1212 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1213 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1214 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1215 | } else { |
| 1216 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1217 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1218 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1219 | f_legacy_bssap_reset(); |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | private function f_bssap_idx_disconnect(integer bssap_idx) runs on test_CT { |
| 1224 | f_ran_adapter_cleanup(g_bssap[bssap_idx]); |
| 1225 | } |
| 1226 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1227 | /* global initialization function |
| 1228 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1229 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1230 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1231 | */ |
Pau Espin Pedrol | 9b94149 | 2022-08-08 18:26:17 +0200 | [diff] [blame] | 1232 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 1233 | integer nr_msc := 1, integer nr_mgw := 1, float guard_timeout := 30.0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1234 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1235 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1236 | if (g_initialized) { |
| 1237 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1238 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1239 | g_initialized := true; |
| 1240 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1241 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1242 | activate(as_Tguard()); |
| 1243 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1244 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 9b94149 | 2022-08-08 18:26:17 +0200 | [diff] [blame] | 1245 | f_vty_allow_osmux_cn(g_osmux_enabled_cn); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1246 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1247 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1248 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1249 | |
Neels Hofmeyr | 9db8e0e | 2021-08-23 20:45:58 +0200 | [diff] [blame] | 1250 | /* Make sure each MSC's internal state is "DISCONNECTED" at first */ |
| 1251 | for (bssap_idx := 0; bssap_idx < NUM_MSC; bssap_idx := bssap_idx+1) { |
| 1252 | f_vty_transceive(BSCVTY, "msc " & int2str(bssap_idx) & " bssmap reset", strict := false); |
| 1253 | } |
| 1254 | |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 1255 | g_handler_mode := handler_mode; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1256 | for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) { |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1257 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 1258 | f_bssap_idx_init(bssap_idx); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1259 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1260 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1261 | if (mp_enable_lcs_tests) { |
| 1262 | if (handler_mode) { |
| 1263 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1264 | } else { |
| 1265 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1266 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1267 | } |
| 1268 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1269 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1270 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1271 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1272 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1273 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1274 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1275 | |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 1276 | g_nr_mgw := nr_mgw; |
| 1277 | for (var integer i := 0; i < g_nr_mgw; i := i+1) { |
| 1278 | f_init_mgcp(i, "VirtMGW"); |
| 1279 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1280 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1281 | for (var integer i := 0; i < nr_bts; i := i+1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1282 | f_init_bts(i, c_BtsParams[i].trx_num, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1283 | } |
Neels Hofmeyr | 9c0f9c8 | 2022-01-23 01:20:28 +0100 | [diff] [blame] | 1284 | |
| 1285 | /* Emit a marker to appear in the SUT's own logging output */ |
| 1286 | f_logp(BSCVTY, testcasename() & "() start"); |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1287 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1288 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1289 | function f_init_bts(integer bts_idx := 0, |
| 1290 | integer trx_num := NUM_TRX_CFG, |
| 1291 | boolean handler_mode := false) |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1292 | runs on test_CT { |
| 1293 | /* wait until osmo-bts-omldummy has respawned */ |
| 1294 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1295 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1296 | /* start RSL connection(s) */ |
| 1297 | for (var integer trx_idx := 0; trx_idx < trx_num; trx_idx := trx_idx + 1) { |
| 1298 | f_ipa_rsl_start(bts[bts_idx][trx_idx].rsl, |
| 1299 | mp_bsc_ip, mp_bsc_rsl_port, |
| 1300 | {bts_idx, trx_idx}, handler_mode); |
| 1301 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1302 | /* wait until BSC tells us "connected" */ |
| 1303 | f_wait_oml(bts_idx, "connected", 5.0); |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1304 | |
| 1305 | /* Set up BTS with VTY commands: */ |
Pau Espin Pedrol | 4e43183 | 2023-02-08 12:43:47 +0100 | [diff] [blame] | 1306 | f_vty_enter_cfg_bts(BSCVTY, bts_idx); |
| 1307 | if (g_osmux_enabled_bts) { |
| 1308 | f_vty_transceive(BSCVTY, "osmux on"); |
| 1309 | } else { |
| 1310 | f_vty_transceive(BSCVTY, "osmux off"); |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1311 | } |
Pau Espin Pedrol | 4e43183 | 2023-02-08 12:43:47 +0100 | [diff] [blame] | 1312 | f_vty_transceive(BSCVTY, "end"); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1313 | } |
| 1314 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1315 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, |
| 1316 | integer trx_num := NUM_TRX_CFG, |
| 1317 | boolean handler_mode := false, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1318 | template SystemInformationConfig expect_si) |
| 1319 | runs on test_CT { |
| 1320 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1321 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1322 | f_init_bts(bts_idx, trx_num, handler_mode); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1323 | |
| 1324 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1325 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1326 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1327 | */ |
| 1328 | f_sleep(5.0); |
| 1329 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1330 | |
| 1331 | deactivate(sysinfo); |
| 1332 | |
| 1333 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1334 | setverdict(pass); |
| 1335 | } else { |
| 1336 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1337 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1338 | setverdict(fail, "received SI does not match expectations"); |
| 1339 | return; |
| 1340 | } |
| 1341 | } |
| 1342 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1343 | /* expect to receive a RSL message matching a specified template on a given BTS / TRX */ |
| 1344 | function f_exp_ipa_rx(template (present) RSL_Message t_rx, |
| 1345 | BtsTrxIdx idx := {0, 0}, |
| 1346 | float Tval := 2.0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1347 | runs on test_CT return RSL_Message { |
| 1348 | var ASP_RSL_Unitdata rx_rsl_ud; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1349 | timer T := Tval; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1350 | |
| 1351 | T.start; |
| 1352 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1353 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(t_rx, ?)) -> value rx_rsl_ud { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1354 | T.stop; |
| 1355 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1356 | [] IPA_RSL[idx.bts][idx.trx].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1357 | [] T.timeout { |
| 1358 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1359 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1360 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1361 | } |
| 1362 | return rx_rsl_ud.rsl; |
| 1363 | } |
| 1364 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1365 | /* helper function to transmit RSL on a given BTS/stream */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1366 | function f_ipa_tx(template (value) RSL_Message t_tx, |
| 1367 | BtsTrxIdx idx := {0, 0}, |
| 1368 | IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1369 | runs on test_CT { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1370 | IPA_RSL[idx.bts][idx.trx].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1371 | } |
| 1372 | |
| 1373 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1374 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1375 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1376 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1377 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1378 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1379 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1380 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1381 | f_ipa_tx(ts_RSL_CHAN_RQD('23'O, 23)); |
| 1382 | rsl_unused := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1383 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1384 | } |
| 1385 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1386 | const CounterNameVals counternames_bts_chreq := { |
| 1387 | { "chreq:total", 0 }, |
| 1388 | { "chreq:attempted_emerg", 0 }, |
| 1389 | { "chreq:attempted_call", 0 }, |
| 1390 | { "chreq:attempted_location_upd", 0 }, |
| 1391 | { "chreq:attempted_pag", 0 }, |
| 1392 | { "chreq:attempted_pdch", 0 }, |
| 1393 | { "chreq:attempted_other", 0 }, |
| 1394 | { "chreq:attempted_unknown", 0 }, |
| 1395 | { "chreq:successful", 0 }, |
| 1396 | { "chreq:successful_emerg", 0 }, |
| 1397 | { "chreq:successful_call", 0 }, |
| 1398 | { "chreq:successful_location_upd", 0 }, |
| 1399 | { "chreq:successful_pag", 0 }, |
| 1400 | { "chreq:successful_pdch", 0 }, |
| 1401 | { "chreq:successful_other", 0 }, |
| 1402 | { "chreq:successful_unknown", 0 }, |
| 1403 | { "chreq:no_channel", 0 }, |
| 1404 | { "chreq:max_delay_exceeded", 0 } |
| 1405 | }; |
| 1406 | |
| 1407 | /* verify the "chreq:*" counters */ |
| 1408 | private function f_chan_act_counter(OCT1 ra, charstring chreq_ctr_suffix) runs on test_CT |
| 1409 | { |
| 1410 | var GsmFrameNumber fn := 23; |
| 1411 | |
| 1412 | f_logp(BSCVTY, "f_chan_act_counter(" & chreq_ctr_suffix & ")"); |
| 1413 | |
| 1414 | var RSL_Message rx_rsl; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1415 | f_ipa_tx(ts_RSL_CHAN_RQD(ra, fn)); |
| 1416 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1417 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1418 | |
| 1419 | f_ctrs_bts_add(0, "chreq:total"); |
| 1420 | f_ctrs_bts_add(0, "chreq:attempted_" & chreq_ctr_suffix); |
| 1421 | f_ctrs_bts_verify(); |
| 1422 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1423 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 1424 | rx_rsl := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1425 | |
| 1426 | f_ctrs_bts_add(0, "chreq:successful"); |
| 1427 | f_ctrs_bts_add(0, "chreq:successful_" & chreq_ctr_suffix); |
| 1428 | f_ctrs_bts_verify(); |
| 1429 | |
| 1430 | /* test is done, release RSL Conn Fail Ind to clean up */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1431 | f_ipa_tx(ts_RSL_CONN_FAIL_IND(chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1432 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), Tval := 10.0); |
| 1433 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1434 | f_sleep(1.0); |
| 1435 | } |
| 1436 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1437 | testcase TC_chan_act_counter() runs on test_CT { |
| 1438 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1439 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1440 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1441 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1442 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1443 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1444 | f_vty_allow_emerg_bts(true, 0); |
| 1445 | |
| 1446 | f_ctrs_bts_init(1, counternames_bts_chreq); |
| 1447 | |
| 1448 | /* emergency call: RA & 0xe0 == 0xa0 --> CHREQ_T_EMERG_CALL */ |
| 1449 | f_chan_act_counter('a3'O, "emerg"); |
| 1450 | |
| 1451 | /* voice TCH/H: RA & 0xf0 == 0x40 --> CHREQ_T_VOICE_CALL_TCH_H */ |
| 1452 | f_chan_act_counter('43'O, "call"); |
| 1453 | |
| 1454 | /* LU: RA & 0xf0 == 0x00 --> CHREQ_T_LOCATION_UPD */ |
| 1455 | f_chan_act_counter('03'O, "location_upd"); |
| 1456 | |
| 1457 | /* Paging: RA & 0xf0 == 0x20 --> CHREQ_T_PAG_R_TCH_F */ |
| 1458 | f_chan_act_counter('23'O, "pag"); |
| 1459 | /* Paging: RA & 0xf0 == 0x30 --> CHREQ_T_PAG_R_TCH_FH */ |
| 1460 | f_chan_act_counter('33'O, "pag"); |
| 1461 | |
| 1462 | /* LU: RA & 0xfc == 0x78 --> CHREQ_T_PDCH_TWO_PHASE */ |
| 1463 | /* no PCU, so PDCH not allowed. Skip this test for now. */ |
| 1464 | /* f_chan_act_counter('7b'O, "pdch"); */ |
| 1465 | |
| 1466 | /* LU: RA & 0xf0 == 0x10 --> CHREQ_T_SDCCH */ |
| 1467 | f_chan_act_counter('13'O, "other"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1468 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1469 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1470 | } |
| 1471 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1472 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1473 | private function f_TC_chan_act_ack_noest(OCT1 ra := '23'O) runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1474 | var RSL_Message rx_rsl; |
| 1475 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1476 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1477 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1478 | |
| 1479 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1480 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), Tval := T3101_MAX); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1481 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1482 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1483 | } |
| 1484 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1485 | /* Normal variant */ |
| 1486 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1487 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1488 | f_TC_chan_act_ack_noest(); |
| 1489 | } |
| 1490 | |
| 1491 | /* Emergency call variant */ |
| 1492 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1493 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1494 | f_init(1); |
| 1495 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1496 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1497 | } |
| 1498 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1499 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1500 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1501 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1502 | |
| 1503 | var RSL_Message rx_rsl; |
| 1504 | var GsmRrMessage rr; |
| 1505 | |
| 1506 | f_init(1); |
| 1507 | f_vty_allow_emerg_bts(false, 0); |
| 1508 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1509 | IPA_RSL[0][0].clear; |
| 1510 | f_ipa_tx(ts_RSL_CHAN_RQD('A5'O, 23)); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1511 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1512 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1513 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1514 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1515 | setverdict(pass); |
| 1516 | } else { |
| 1517 | setverdict(fail, "immediate assignment not rejected"); |
| 1518 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1519 | |
| 1520 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1521 | } |
| 1522 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1523 | /* Test behavior if MSC never answers to CR */ |
| 1524 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1525 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1526 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1527 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1528 | var ASP_RSL_Unitdata rx_rsl_ud; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1529 | var octetstring l3_payload := gen_l3_valid_payload(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1530 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1531 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1532 | |
| 1533 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1534 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1535 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1536 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1537 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1538 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1539 | |
| 1540 | /* expect BSC to disable the channel again if there's no response from MSC */ |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1541 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1542 | f_expect_chan_rel(chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1543 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | /* Test behavior if MSC answers with CREF to CR */ |
| 1547 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1548 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1549 | var RSL_Message rx_rsl; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1550 | var octetstring l3_payload := gen_l3_valid_payload(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1551 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1552 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1553 | |
| 1554 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1555 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1556 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1557 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1558 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1559 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1560 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1561 | |
| 1562 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1563 | f_expect_chan_rel(chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1564 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1565 | } |
| 1566 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1567 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1568 | testcase TC_chan_act_nack() runs on test_CT { |
| 1569 | var RSL_Message rx_rsl; |
| 1570 | var integer chact_nack; |
| 1571 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1572 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1573 | |
| 1574 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1575 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1576 | f_ipa_tx(ts_RSL_CHAN_RQD('33'O, 33)); |
| 1577 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1578 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1579 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1580 | f_ipa_tx(ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1581 | |
| 1582 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1583 | f_sleep(0.5); |
| 1584 | |
| 1585 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1586 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1587 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1588 | } |
| 1589 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1590 | /* Test for channel exhaustion due to RACH overload */ |
| 1591 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1592 | var ASP_RSL_Unitdata rsl_ud; |
| 1593 | var integer i; |
| 1594 | var integer chreq_total, chreq_nochan; |
| 1595 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1596 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1597 | |
| 1598 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1599 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1600 | |
Neels Hofmeyr | 85fa37f | 2021-10-06 13:50:38 +0200 | [diff] [blame] | 1601 | /* GSM 44.018 Table 9.1.8.2: |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1602 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1603 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1604 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1605 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1606 | } |
| 1607 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1608 | IPA_RSL[0][0].clear; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1609 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1610 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1611 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1612 | |
| 1613 | /* now expect additional channel activations to fail */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1614 | f_ipa_tx(ts_RSL_CHAN_RQD('42'O, 42)); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1615 | |
| 1616 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1617 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1618 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1619 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1620 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1621 | var GsmRrMessage rr; |
| 1622 | /* match on IMM ASS REJ */ |
| 1623 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1624 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1625 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1626 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS+1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1627 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1628 | chreq_nochan+1); |
| 1629 | setverdict(pass); |
| 1630 | } else { |
| 1631 | repeat; |
| 1632 | } |
| 1633 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1634 | [] IPA_RSL[0][0].receive { repeat; } |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1635 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1636 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1637 | } |
| 1638 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1639 | /* Test channel deactivation due to silence from MS */ |
| 1640 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1641 | var RslChannelNr chan_nr; |
| 1642 | |
| 1643 | f_init(1); |
| 1644 | |
| 1645 | /* Request for a dedicated channel */ |
| 1646 | chan_nr := f_chreq_act_ack('23'O); |
| 1647 | |
| 1648 | /* Wait some time until the channel is released */ |
| 1649 | f_sleep(2.0); |
| 1650 | |
| 1651 | /* Expect CHANnel RELease */ |
| 1652 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1653 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1654 | log("Received CHANnel RELease"); |
| 1655 | setverdict(pass); |
| 1656 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1657 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1658 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1659 | * Assignment Reject since a dedicated channel was |
| 1660 | * already allocated, and Immediate Assignment was |
| 1661 | * already sent. */ |
| 1662 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1663 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1664 | [] IPA_RSL[0][0].receive { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1665 | setverdict(fail, "Unexpected RSL message!"); |
| 1666 | } |
| 1667 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1668 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1669 | } |
| 1670 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1671 | /*********************************************************************** |
| 1672 | * Assignment Testing |
| 1673 | ***********************************************************************/ |
| 1674 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1675 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1676 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1677 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1678 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1679 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1680 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1681 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1682 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1683 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1684 | } |
| 1685 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1686 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1687 | testcase TC_assignment_cic_only(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1688 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1689 | var RSL_Message rx_rsl; |
| 1690 | var DchanTuple dt; |
| 1691 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1692 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1693 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1694 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1695 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1696 | /* send assignment without AoIP IEs */ |
| 1697 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1698 | } else { |
Pau Espin Pedrol | 3560979 | 2023-01-03 16:56:59 +0100 | [diff] [blame] | 1699 | /* Send assignment without CIC in IPA case */ |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1700 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1701 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1702 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1703 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1704 | alt { |
| 1705 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1706 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1707 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1708 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1709 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1710 | setverdict(pass); |
| 1711 | } |
| 1712 | [] BSSAP.receive { repeat; } |
| 1713 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1714 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1715 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1716 | } |
| 1717 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1718 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | b522e1c | 2023-09-28 13:38:50 +0200 | [diff] [blame] | 1719 | function f_gen_ass_req(boolean osmux_enabled := false, uint8_t ass_cid := 0, integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1720 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | b522e1c | 2023-09-28 13:38:50 +0200 | [diff] [blame] | 1721 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(ass_cid)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1722 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1723 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1724 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1725 | if (osmux_enabled) { |
| 1726 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1727 | } else { |
| 1728 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1729 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1730 | } else { |
Pau Espin Pedrol | b522e1c | 2023-09-28 13:38:50 +0200 | [diff] [blame] | 1731 | var BIT8 ass_cid_bit := int2bit(ass_cid, 8); |
| 1732 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(bit2int(ass_cid_bit >> 5), |
| 1733 | bit2int(ass_cid_bit and4b '00011111'B))); |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1734 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1735 | } |
| 1736 | return ass_cmd; |
| 1737 | } |
| 1738 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1739 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 1740 | template (value) BSSMAP_IE_CellIdentifier cell_id_source := ts_CellID_LAC_CI(1, 1), |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1741 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1742 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1743 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1744 | |
| 1745 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1746 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
Vadim Yanitskiy | 35c9a33 | 2022-03-16 20:26:35 +0300 | [diff] [blame] | 1747 | var template (omit) BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1748 | var template (omit) BSSMAP_IE_KC128 kc128 := omit; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1749 | if (ispresent(enc)) { |
| 1750 | var TestHdlrEncrParams v_enc := valueof(enc); |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 1751 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg_permitted)); |
| 1752 | if (ispresent(v_enc.enc_alg_chosen)) { |
| 1753 | chosenEncryptionAlgorithm := valueof( |
| 1754 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
| 1755 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg_chosen)), 1))); |
| 1756 | } |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1757 | if (ispresent(v_enc.enc_kc128)) { |
| 1758 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1759 | } |
| 1760 | } |
| 1761 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1762 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1763 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1764 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 1765 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, |
| 1766 | cell_id_source := cell_id_source, |
| 1767 | oldToNewBSSIEs := oldToNewBSSIEs, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1768 | encryptionInformation := encryptionInformation, |
| 1769 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
Neels Hofmeyr | 9fe1320 | 2022-03-04 00:05:43 +0100 | [diff] [blame] | 1770 | kC128 := kc128, |
| 1771 | /* on AoIP, allow "all" codecs (until we add more concise |
| 1772 | * tests) */ |
| 1773 | codecList := ts_BSSMAP_IE_CodecList( |
| 1774 | {ts_CodecAMR_F, ts_CodecAMR_H, |
| 1775 | ts_CodecEFR, ts_CodecFR, ts_CodecHR}))); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1776 | } else { |
| 1777 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 1778 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, |
| 1779 | cell_id_source := cell_id_source, |
| 1780 | oldToNewBSSIEs := oldToNewBSSIEs, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1781 | encryptionInformation := encryptionInformation, |
| 1782 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1783 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1784 | } |
| 1785 | return ho_req; |
| 1786 | } |
| 1787 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1788 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1789 | function f_gen_exp_compl(integer bssap_idx := 0) |
| 1790 | runs on MSC_ConnHdlr return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1791 | var template PDU_BSSAP exp_compl; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1792 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1793 | var template BSSMAP_IE_Osmo_OsmuxCID exp_osmux_cid := omit; |
| 1794 | if (g_pars.use_osmux_cn) { |
| 1795 | var template (present) INT1 exp_cid := ?; |
| 1796 | if (isbound(g_media.mgcp_conn[0].local_osmux_cid) and isbound(g_media.mgcp_conn[1].local_osmux_cid)) { |
| 1797 | exp_cid := (g_media.mgcp_conn[0].local_osmux_cid, g_media.mgcp_conn[1].local_osmux_cid); |
| 1798 | } else if (isbound(g_media.mgcp_conn[0].local_osmux_cid)) { |
| 1799 | exp_cid := g_media.mgcp_conn[0].local_osmux_cid; |
| 1800 | } else if (isbound(g_media.mgcp_conn[1].local_osmux_cid)) { |
| 1801 | exp_cid := g_media.mgcp_conn[1].local_osmux_cid; |
| 1802 | } |
| 1803 | exp_osmux_cid := tr_OsmuxCID(exp_cid); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1804 | } |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1805 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, exp_osmux_cid); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1806 | } else { |
| 1807 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 1808 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1809 | } |
| 1810 | return exp_compl; |
| 1811 | } |
| 1812 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1813 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1814 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1815 | runs on test_CT return DchanTuple { |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1816 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1817 | var RSL_Message rx_rsl; |
| 1818 | var DchanTuple dt; |
| 1819 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1820 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1821 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 1822 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1823 | /* send assignment without AoIP IEs */ |
| 1824 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1825 | alt { |
| 1826 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1827 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1828 | setverdict(pass); |
| 1829 | } else { |
| 1830 | setverdict(fail, fail_text); |
| 1831 | } |
| 1832 | } |
| 1833 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1834 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1835 | setverdict(pass); |
| 1836 | } else { |
| 1837 | setverdict(fail, fail_text); |
| 1838 | } |
| 1839 | } |
| 1840 | [] BSSAP.receive { repeat; } |
| 1841 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1842 | return dt; |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1843 | } |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1844 | |
Oliver Smith | 545492d | 2023-04-19 13:05:30 +0200 | [diff] [blame] | 1845 | private function f_tc_assignment_csd(charstring data_rate_str, OCT1 data_rate, boolean transp := true) runs on MSC_ConnHdlr { |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1846 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1847 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Oliver Smith | bc392a8 | 2023-04-17 14:06:42 +0200 | [diff] [blame] | 1848 | var SDP_FIELD_PayloadType pt_csd := PT_CSD; |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1849 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1850 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1851 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecCSData})); |
| 1852 | |
Oliver Smith | 545492d | 2023-04-19 13:05:30 +0200 | [diff] [blame] | 1853 | /* Non-transparent service (3GPP TS 48.008 § 3.2.2.11, oct 5, bit 7) */ |
| 1854 | if (not transp) { |
| 1855 | data_rate := data_rate or4b '40'O; |
| 1856 | } |
| 1857 | |
Oliver Smith | cb61791 | 2023-04-18 11:29:10 +0200 | [diff] [blame] | 1858 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := data_rate; |
| 1859 | |
| 1860 | log("-----------------------------------------------"); |
| 1861 | log("Assignment req with data rate: " & data_rate_str); |
| 1862 | log("-----------------------------------------------"); |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1863 | |
| 1864 | f_establish_fully(ass_cmd, exp_compl); |
Oliver Smith | bc392a8 | 2023-04-17 14:06:42 +0200 | [diff] [blame] | 1865 | |
| 1866 | if (g_media.bts.rtp_pt != enum2int(pt_csd)) { |
| 1867 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, log2str("unexpected RTP payload type: ", g_media.bts.rtp_pt)); |
| 1868 | } |
| 1869 | |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1870 | f_perform_clear(); |
Oliver Smith | ace447a | 2023-05-08 14:07:21 +0200 | [diff] [blame] | 1871 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1872 | } |
Oliver Smith | cb61791 | 2023-04-18 11:29:10 +0200 | [diff] [blame] | 1873 | private function f_tc_assignment_csd_all(charstring id) runs on MSC_ConnHdlr { |
| 1874 | /* Data rates that require multi-slot HSCSD assignment are not tested |
Oliver Smith | 545492d | 2023-04-19 13:05:30 +0200 | [diff] [blame] | 1875 | * on purpose (not supported): T_32k0, T_28k8, NT_43k5, NT_29k0 */ |
Oliver Smith | cb61791 | 2023-04-18 11:29:10 +0200 | [diff] [blame] | 1876 | f_tc_assignment_csd("T_14k4", GSM0808_DATA_RATE_TRANSP_14k4); |
| 1877 | f_tc_assignment_csd("T_9k6", GSM0808_DATA_RATE_TRANSP_9k6); |
| 1878 | f_tc_assignment_csd("T_4k8", GSM0808_DATA_RATE_TRANSP_4k8); |
| 1879 | f_tc_assignment_csd("T_2k4", GSM0808_DATA_RATE_TRANSP_2k4); |
| 1880 | f_tc_assignment_csd("T_1k2", GSM0808_DATA_RATE_TRANSP_1k2); |
| 1881 | f_tc_assignment_csd("T_600", GSM0808_DATA_RATE_TRANSP_600); |
| 1882 | f_tc_assignment_csd("T_1200_75", GSM0808_DATA_RATE_TRANSP_1200_75); |
Oliver Smith | 545492d | 2023-04-19 13:05:30 +0200 | [diff] [blame] | 1883 | |
| 1884 | f_tc_assignment_csd("NT_12000_6000", GSM0808_DATA_RATE_NON_TRANSP_12000_6000, false); |
| 1885 | f_tc_assignment_csd("NT_14k5", GSM0808_DATA_RATE_NON_TRANSP_14k5, false); |
| 1886 | f_tc_assignment_csd("NT_12k0", GSM0808_DATA_RATE_NON_TRANSP_12k0, false); |
| 1887 | f_tc_assignment_csd("NT_6k0", GSM0808_DATA_RATE_NON_TRANSP_6k0, false); |
Oliver Smith | cb61791 | 2023-04-18 11:29:10 +0200 | [diff] [blame] | 1888 | } |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1889 | testcase TC_assignment_csd() runs on test_CT { |
Vadim Yanitskiy | 02c086f | 2023-09-22 15:32:41 +0700 | [diff] [blame] | 1890 | var MSC_ConnHdlr vc_conn; |
| 1891 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Oliver Smith | dd00275 | 2023-02-21 13:35:00 +0100 | [diff] [blame] | 1892 | |
Vadim Yanitskiy | 02c086f | 2023-09-22 15:32:41 +0700 | [diff] [blame] | 1893 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 1894 | |
| 1895 | f_init(1, true, guard_timeout := 120.0); |
| 1896 | f_sleep(1.0); |
| 1897 | vc_conn := f_start_handler(refers(f_tc_assignment_csd_all), pars); |
| 1898 | vc_conn.done; |
| 1899 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1900 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1901 | } |
| 1902 | |
| 1903 | testcase TC_assignment_ctm() runs on test_CT { |
| 1904 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1905 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1906 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1907 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1908 | var DchanTuple dt := f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 1909 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1910 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1911 | } |
| 1912 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1913 | type record DchanTuple { |
| 1914 | integer sccp_conn_id, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1915 | RslChannelNr rsl_chan_nr, |
| 1916 | BtsTrxIdx idx |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1917 | } |
| 1918 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 1919 | type record of DchanTuple DchanTuples; |
| 1920 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1921 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1922 | private function f_chreq_act_ack(OCT1 ra := '23'O, |
| 1923 | GsmFrameNumber fn := 23, |
| 1924 | BtsTrxIdx idx := {0, 0}) |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1925 | runs on test_CT return RslChannelNr { |
| 1926 | var RSL_Message rx_rsl; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1927 | f_ipa_tx(ts_RSL_CHAN_RQD(ra, fn), {idx.bts, 0}); |
| 1928 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), idx); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1929 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1930 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10), idx); |
| 1931 | rx_rsl := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0), {idx.bts, 0}); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1932 | return chan_nr; |
| 1933 | } |
| 1934 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1935 | /* helper function to establish a dedicated channel via BTS and MSC */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1936 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3, |
| 1937 | BtsTrxIdx idx := {0, 0}) |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1938 | runs on test_CT return DchanTuple { |
| 1939 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1940 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1941 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1942 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1943 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn, idx); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1944 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1945 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3), idx); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1946 | |
| 1947 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1948 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1949 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1950 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1951 | dt.idx := idx; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1952 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1953 | } |
| 1954 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1955 | /* Like f_est_dchan(), but for the first lchan of a dynamic timeslot: first ACK the deactivation of PDCH. */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1956 | function f_est_dchan_dyn(OCT1 ra, GsmFrameNumber fn, octetstring l3, |
| 1957 | BtsTrxIdx idx := {0, 0}) |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1958 | runs on test_CT return DchanTuple { |
| 1959 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1960 | var DchanTuple dt; |
| 1961 | |
| 1962 | /* Send CHAN RQD */ |
| 1963 | var RSL_Message rx_rsl; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1964 | f_ipa_tx(ts_RSL_CHAN_RQD(ra, fn), {idx.bts, 0}); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1965 | |
| 1966 | /* The dyn TS first deactivates PDCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1967 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), idx, Tval := T3101_MAX); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1968 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1969 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr), idx); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1970 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1971 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), idx); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1972 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1973 | |
| 1974 | /* Now activates the signalling channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1975 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, fn+10), idx); |
| 1976 | rx_rsl := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0), {idx.bts, 0}); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1977 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1978 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3), idx); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1979 | |
| 1980 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1981 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1982 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1983 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1984 | dt.idx := idx; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1985 | return dt; |
| 1986 | } |
| 1987 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1988 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1989 | private function f_exp_chan_rel_and_clear(DchanTuple dt) |
| 1990 | runs on test_CT { |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1991 | var RSL_Message rx_rsl; |
| 1992 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1993 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), dt.idx, Tval := T3101_MAX); |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1994 | /* respond with CHAN REL ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 1995 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr), dt.idx); |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1996 | |
| 1997 | /* expect Clear Complete from BSC */ |
| 1998 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1999 | |
| 2000 | /* MSC disconnects as instructed. */ |
| 2001 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2002 | } |
| 2003 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2004 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 2005 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 2006 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2007 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2008 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2009 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2010 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2011 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2012 | |
| 2013 | /* simulate RLL REL IND */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2014 | f_ipa_tx(ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2015 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 2016 | /* expect Clear Request on MSC side */ |
| 2017 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 2018 | |
| 2019 | /* Instruct BSC to clear channel */ |
| 2020 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 2021 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2022 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2023 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2024 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 2025 | |
| 2026 | /* wait for SCCP emulation to do its job */ |
| 2027 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2028 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2029 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 2033 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 2034 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2035 | var DchanTuple dt; |
| 2036 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2037 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2038 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2039 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2040 | |
Vadim Yanitskiy | 01d0a90 | 2022-12-14 22:41:42 +0700 | [diff] [blame] | 2041 | /* Sending CONN FAIL IND immediately may trigger a race condition. |
| 2042 | * Give the BSC some time to process a new SCCP connection (OS#5823). */ |
| 2043 | f_sleep(0.2); |
| 2044 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2045 | /* simulate CONN FAIL IND */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2046 | f_ipa_tx(ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2047 | /* TODO: different cause values? */ |
| 2048 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2049 | /* expect Clear Request from BSC */ |
| 2050 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 2051 | |
| 2052 | /* Instruct BSC to clear channel */ |
| 2053 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 2054 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2055 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 2056 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2057 | f_exp_chan_rel_and_clear(dt); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2058 | |
| 2059 | /* wait for SCCP emulation to do its job */ |
| 2060 | f_sleep(1.0); |
| 2061 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2062 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2063 | } |
| 2064 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2065 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 2066 | /* See also https://www.osmocom.org/issues/3182 */ |
| 2067 | testcase TC_early_conn_fail() runs on test_CT { |
| 2068 | var RSL_Message rx_rsl; |
| 2069 | var DchanTuple dt; |
| 2070 | |
| 2071 | f_init(1); |
| 2072 | |
| 2073 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 2074 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_ra_cs(), 23); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2075 | |
| 2076 | /* BTS->BSC: simulate CONN FAIL IND */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2077 | f_ipa_tx(ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2078 | |
| 2079 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2080 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), Tval := 10.0); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2081 | |
| 2082 | /* BTS<-BSC: respond with CHAN REL ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2083 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2084 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2085 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2086 | } |
| 2087 | |
| 2088 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 2089 | /* See also https://www.osmocom.org/issues/3182 */ |
| 2090 | testcase TC_late_conn_fail() runs on test_CT { |
| 2091 | var RSL_Message rx_rsl; |
| 2092 | var DchanTuple dt; |
| 2093 | |
| 2094 | f_init(1); |
| 2095 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2096 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2097 | |
| 2098 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 2099 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 2100 | |
| 2101 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2102 | rx_rsl := f_exp_ipa_rx(tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2103 | |
| 2104 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2105 | f_ipa_tx(ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2106 | |
| 2107 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2108 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), Tval := 10.0); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2109 | /* BTS->BSC: respond with CHAN REL ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2110 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2111 | |
| 2112 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 2113 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 2114 | |
| 2115 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 2116 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2117 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2118 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2119 | } |
| 2120 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2121 | private function f_TC_stats_conn_fail(charstring id) runs on MSC_ConnHdlr { |
| 2122 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2123 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2124 | |
| 2125 | f_statsd_reset(); |
| 2126 | |
Oliver Smith | 15890b4 | 2023-03-08 14:12:28 +0100 | [diff] [blame] | 2127 | /* Establish SDCCH (invalid DataIndicator for exp_fail) */ |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2128 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
Oliver Smith | 15890b4 | 2023-03-08 14:12:28 +0100 | [diff] [blame] | 2129 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := 'ff'O; |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2130 | f_establish_fully(ass_cmd, exp_fail); |
| 2131 | |
| 2132 | /* Expect stats to be 0 */ |
| 2133 | var StatsDExpects expect := { |
| 2134 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 0, max := 0}, |
| 2135 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 0, max := 0} |
| 2136 | }; |
| 2137 | f_statsd_expect(expect); |
| 2138 | |
| 2139 | /* Simulate CONN FAIL IND on SDCCH */ |
| 2140 | RSL.send(ts_ASP_RSL_UD( |
| 2141 | ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL), |
| 2142 | IPAC_PROTO_RSL_TRX0)); |
| 2143 | |
Neels Hofmeyr | 58be48a | 2021-09-07 18:39:21 +0200 | [diff] [blame] | 2144 | f_sleep(1.0); |
| 2145 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2146 | /* Expect stats to be 1 */ |
| 2147 | expect := { |
| 2148 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 1, max := 1}, |
| 2149 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 1, max := 1} |
| 2150 | }; |
| 2151 | f_statsd_expect(expect); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 2152 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 2153 | f_perform_clear(); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2154 | } |
| 2155 | testcase TC_stats_conn_fail() runs on test_CT { |
| 2156 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2157 | var MSC_ConnHdlr vc_conn; |
| 2158 | |
| 2159 | f_init(1, true); |
| 2160 | f_sleep(1.0); |
| 2161 | |
| 2162 | vc_conn := f_start_handler(refers(f_TC_stats_conn_fail), pars); |
| 2163 | vc_conn.done; |
| 2164 | |
| 2165 | f_shutdown_helper(); |
| 2166 | } |
| 2167 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2168 | function f_expect_chan_rel(RslChannelNr rsl_chan_nr, |
| 2169 | BtsTrxIdx idx := {0, 0}, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2170 | boolean expect_deact_sacch := true, |
| 2171 | boolean expect_rr_chan_rel := true, |
| 2172 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2173 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2174 | template CellSelIndValue expect_cells := omit, |
Vadim Yanitskiy | bc7c35a | 2022-03-16 19:50:06 +0300 | [diff] [blame] | 2175 | template (present) RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2176 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2177 | |
| 2178 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2179 | var boolean got_deact_sacch := false; |
| 2180 | var boolean got_rr_chan_rel := false; |
| 2181 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2182 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2183 | var RSL_IE_Body l3_ie; |
| 2184 | var PDU_ML3_NW_MS l3; |
| 2185 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2186 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 2187 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2188 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2189 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2190 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2191 | repeat; |
| 2192 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2193 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2194 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2195 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2196 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 2197 | setverdict(fail, "cannot find L3"); |
| 2198 | mtc.stop; |
| 2199 | } |
| 2200 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 2201 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2202 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2203 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 2204 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 2205 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2206 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 2207 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2208 | setverdict(pass); |
| 2209 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2210 | log("EXPECTED CELLS: ", expect_cells); |
| 2211 | setverdict(fail, "Received cells list on RR Channel Release does not match expectations"); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2212 | } |
| 2213 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2214 | |
Vadim Yanitskiy | bc7c35a | 2022-03-16 19:50:06 +0300 | [diff] [blame] | 2215 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 2216 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 2217 | if (match(got_cause, expect_rr_cause)) { |
| 2218 | setverdict(pass); |
| 2219 | } else { |
| 2220 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 2221 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2222 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2223 | repeat; |
| 2224 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2225 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2226 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2227 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2228 | if (handle_rll_rel) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2229 | f_ipa_tx(ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2230 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2231 | repeat; |
| 2232 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2233 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2234 | /* respond with CHAN REL ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2235 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2236 | } |
| 2237 | /* ignore any user data */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2238 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2239 | repeat; |
| 2240 | } |
| 2241 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2242 | |
| 2243 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 2244 | " got_rll_rel_req=", got_rll_rel_req); |
| 2245 | |
| 2246 | if (expect_deact_sacch != got_deact_sacch) { |
| 2247 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 2248 | } |
| 2249 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 2250 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 2251 | } |
| 2252 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 2253 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 2254 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2255 | } |
| 2256 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2257 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 2258 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 2259 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2260 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2261 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2262 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2263 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2264 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2265 | |
| 2266 | /* Instruct BSC to clear channel */ |
| 2267 | var BssmapCause cause := 0; |
| 2268 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2269 | |
| 2270 | /* expect Clear Complete from BSC on A */ |
| 2271 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2272 | /* release the SCCP connection */ |
| 2273 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2274 | } |
| 2275 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2276 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2277 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2278 | } |
| 2279 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2280 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 2281 | var BSSAP_N_DATA_ind rx_di; |
| 2282 | var DchanTuple dt; |
| 2283 | |
| 2284 | f_init(1); |
| 2285 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2286 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2287 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2288 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2289 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 2290 | |
| 2291 | /* Instruct BSC to clear channel */ |
| 2292 | var BssmapCause cause := 0; |
| 2293 | if (tx_csfb_ind) { |
| 2294 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2295 | } else { |
| 2296 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2297 | } |
| 2298 | |
| 2299 | /* expect Clear Complete from BSC on A */ |
| 2300 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2301 | /* release the SCCP connection */ |
| 2302 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2303 | } |
| 2304 | |
| 2305 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 2306 | SystemInformationConfig_default, use that: */ |
| 2307 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 2308 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2309 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2310 | f_shutdown_helper(); |
| 2311 | } |
| 2312 | |
| 2313 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 2314 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 2315 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2316 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 2317 | Indicator or not shouldn't matter at all. */ |
| 2318 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 2319 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 2320 | } |
| 2321 | |
| 2322 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 2323 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2324 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2325 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 2326 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 2327 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 2328 | } |
| 2329 | |
| 2330 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 2331 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2332 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 2333 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 2334 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 2335 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2336 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 2337 | var BSSAP_N_DATA_ind rx_di; |
| 2338 | var DchanTuple dt; |
| 2339 | |
| 2340 | f_init(1); |
| 2341 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2342 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2343 | |
| 2344 | /* Instruct BSC to clear channel */ |
| 2345 | var BssmapCause cause := 0; |
| 2346 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2347 | |
| 2348 | /* expect Clear Complete from BSC on A */ |
| 2349 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2350 | /* release the SCCP connection */ |
| 2351 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2352 | } |
| 2353 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2354 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2355 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2356 | } |
| 2357 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2358 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 2359 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2360 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2361 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2362 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2363 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2364 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2365 | |
| 2366 | /* release the SCCP connection */ |
| 2367 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2368 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2369 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2370 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2371 | } |
| 2372 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2373 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2374 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2375 | var DchanTuple dt; |
| 2376 | |
| 2377 | f_init(1); |
| 2378 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2379 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2380 | |
| 2381 | /* release the SCCP connection */ |
| 2382 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2383 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2384 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2385 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2386 | } |
| 2387 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2388 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2389 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2390 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2391 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2392 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2393 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2394 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2395 | |
| 2396 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2397 | IPA_RSL[0][0].clear; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2398 | |
| 2399 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 2400 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled_cn))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2401 | interleave { |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 2402 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled_cn))) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2403 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2404 | } |
| 2405 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2406 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2407 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2408 | } |
| 2409 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2410 | /* Verify T(iar) triggers and releases the channel */ |
| 2411 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2412 | var DchanTuple dt; |
| 2413 | |
| 2414 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2415 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2416 | T(iar) >= T(ias)*2 */ |
| 2417 | g_bsc_sccp_timer_ias := 2; |
| 2418 | g_bsc_sccp_timer_iar := 5; |
| 2419 | |
| 2420 | f_init(1); |
| 2421 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2422 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2423 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2424 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2425 | } |
| 2426 | |
Vadim Yanitskiy | bc7c35a | 2022-03-16 19:50:06 +0300 | [diff] [blame] | 2427 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, |
| 2428 | template (present) RR_Cause expect_rr_cause) |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2429 | runs on test_CT |
| 2430 | { |
| 2431 | var DchanTuple dt; |
| 2432 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2433 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2434 | var BssmapCause cause := 0; |
| 2435 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2436 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2437 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2438 | } |
| 2439 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2440 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2441 | } |
| 2442 | |
| 2443 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2444 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2445 | f_init(1); |
| 2446 | |
| 2447 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2448 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2449 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2450 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2451 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2452 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
Vadim Yanitskiy | e18aebb | 2021-01-03 13:10:43 +0100 | [diff] [blame] | 2453 | |
| 2454 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2455 | } |
| 2456 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2457 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2458 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2459 | timer T := 2.0; |
| 2460 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2461 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2462 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2463 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2464 | var octetstring l3_payload := gen_l3_valid_payload(); |
| 2465 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2466 | |
| 2467 | T.start; |
| 2468 | alt { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2469 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) { |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2470 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2471 | } |
| 2472 | [] BSSAP.receive {} |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2473 | [] IPA_RSL[0][0].receive {} |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2474 | [] T.timeout {} |
| 2475 | } |
| 2476 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2477 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2481 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2482 | var RslChannelNr chan_nr; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2483 | var octetstring l3_payload; |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2484 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2485 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2486 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2487 | chan_nr := f_chreq_act_ack(); |
| 2488 | l3_payload := gen_l3_valid_payload(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2489 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2490 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3_payload)); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2491 | |
| 2492 | timer T := 2.0; |
| 2493 | T.start; |
| 2494 | alt { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2495 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) { |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2496 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2497 | } |
| 2498 | [] BSSAP.receive { repeat; } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2499 | [] IPA_RSL[0][0].receive { repeat; } |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2500 | [] T.timeout {} |
| 2501 | } |
| 2502 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2503 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2504 | } |
| 2505 | |
| 2506 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2507 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2508 | timer T := 2.0; |
| 2509 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2510 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2511 | |
| 2512 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2513 | var octetstring l3_payload := gen_l3_valid_payload(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2514 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2515 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3_payload)); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2516 | |
| 2517 | T.start; |
| 2518 | alt { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2519 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) { |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2520 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2521 | } |
| 2522 | [] BSSAP.receive { repeat; } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2523 | [] IPA_RSL[0][0].receive { repeat; } |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2524 | [] T.timeout {} |
| 2525 | } |
| 2526 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2527 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2528 | } |
| 2529 | |
| 2530 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2531 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2532 | timer T := 2.0; |
| 2533 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2534 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2535 | |
| 2536 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2537 | var octetstring l3_payload := gen_l3_valid_payload(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2538 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2539 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3_payload)); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2540 | |
| 2541 | T.start; |
| 2542 | alt { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2543 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) { |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2544 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2545 | } |
| 2546 | [] BSSAP.receive { repeat; } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2547 | [] IPA_RSL[0][0].receive { repeat; } |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2548 | [] T.timeout {} |
| 2549 | } |
| 2550 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2551 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2552 | } |
| 2553 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2554 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2555 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2556 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2557 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2558 | |
| 2559 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2560 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2561 | |
| 2562 | f_establish_fully(ass_cmd, exp_compl); |
| 2563 | |
| 2564 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2565 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2566 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2567 | BSSAP.receive(PDU_BSSAP:{ |
| 2568 | discriminator := '1'B, |
| 2569 | spare := '0000000'B, |
| 2570 | dlci := 'C3'O, |
| 2571 | lengthIndicator := ?, |
| 2572 | pdu := { dtap := '0904'O } |
| 2573 | }); |
| 2574 | |
| 2575 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2576 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2577 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2578 | var template (value) RslLinkId link_id; |
| 2579 | var template (value) OCT1 dlci; |
| 2580 | |
| 2581 | if (i mod 2 == 0) { |
| 2582 | /* SAPI0 on FACCH or SDCCH */ |
| 2583 | link_id := ts_RslLinkID_DCCH(0); |
| 2584 | dlci := '80'O; |
| 2585 | } else { |
| 2586 | /* SAPI3 on SACCH */ |
| 2587 | link_id := ts_RslLinkID_SACCH(3); |
| 2588 | dlci := 'C3'O; |
| 2589 | } |
| 2590 | |
| 2591 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2592 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2593 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2594 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2595 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 2596 | f_perform_clear(); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2597 | } |
| 2598 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2599 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2600 | var MSC_ConnHdlr vc_conn; |
| 2601 | |
| 2602 | f_init(1, true); |
| 2603 | f_sleep(1.0); |
| 2604 | |
| 2605 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2606 | vc_conn.done; |
| 2607 | |
| 2608 | f_shutdown_helper(); |
| 2609 | } |
| 2610 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2611 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
Vadim Yanitskiy | 35c9a33 | 2022-03-16 20:26:35 +0300 | [diff] [blame] | 2612 | template (present) myBSSMAP_Cause cause := ?, |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2613 | template (present) BIT2 cc := ?, |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2614 | float T_val := 2.0) |
| 2615 | runs on test_CT { |
| 2616 | var BSSAP_N_DATA_ind rx_di; |
| 2617 | timer T; |
| 2618 | |
Vadim Yanitskiy | 35c9a33 | 2022-03-16 20:26:35 +0300 | [diff] [blame] | 2619 | var template (present) BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2620 | var template (present) PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2621 | |
| 2622 | T.start(T_val); |
| 2623 | alt { |
| 2624 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2625 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2626 | if (not match(rx_cause, tr_cause)) { |
| 2627 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2628 | rx_cause, " vs expected ", tr_cause); |
| 2629 | } |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2630 | |
| 2631 | /* Who ever on the earth decided to define this field as two separate bits?!? */ |
| 2632 | var BIT2 rx_cc := rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c2 |
| 2633 | & rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c1; |
| 2634 | if (not match(rx_cc, cc)) { |
| 2635 | setverdict(fail, "Rx unexpected Control Channel type: ", |
| 2636 | rx_cc, " vs expected ", cc); |
| 2637 | } |
| 2638 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2639 | setverdict(pass); |
| 2640 | } |
| 2641 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2642 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2643 | } |
| 2644 | [] T.timeout { |
| 2645 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2646 | } |
| 2647 | } |
| 2648 | } |
| 2649 | |
| 2650 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2651 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2652 | var RSL_Message rx_rsl; |
| 2653 | var DchanTuple dt; |
| 2654 | |
| 2655 | f_init(1); |
| 2656 | |
| 2657 | /* MS establishes a SAPI=0 link on DCCH */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2658 | dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2659 | |
| 2660 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2661 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(gen_l3_valid_payload(), '03'O))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2662 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2663 | rx_rsl := f_exp_ipa_rx(tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2664 | |
| 2665 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2666 | f_ipa_tx(ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2667 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2668 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2669 | |
| 2670 | /* Clean up the connection */ |
| 2671 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2672 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2673 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2674 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2675 | } |
| 2676 | |
| 2677 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2678 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2679 | var RSL_Message rx_rsl; |
| 2680 | var DchanTuple dt; |
| 2681 | |
| 2682 | f_init(1); |
| 2683 | |
| 2684 | /* MS establishes a SAPI=0 link on DCCH */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2685 | dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2686 | |
| 2687 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2688 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(gen_l3_valid_payload(), '03'O))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2689 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2690 | rx_rsl := f_exp_ipa_rx(tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2691 | |
| 2692 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2693 | f_ipa_tx(ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2694 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2695 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2696 | |
| 2697 | /* Clean up the connection */ |
| 2698 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2699 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2700 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2701 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2702 | } |
| 2703 | |
| 2704 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2705 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2706 | var RSL_Message rx_rsl; |
| 2707 | var DchanTuple dt; |
| 2708 | |
| 2709 | f_init(1); |
| 2710 | |
| 2711 | /* MS establishes a SAPI=0 link on DCCH */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2712 | dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2713 | |
| 2714 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2715 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(gen_l3_valid_payload(), '03'O))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2716 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2717 | rx_rsl := f_exp_ipa_rx(tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2718 | |
| 2719 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2720 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2721 | |
| 2722 | /* Clean up the connection */ |
| 2723 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2724 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2725 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2726 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2727 | } |
| 2728 | |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2729 | /* Check DLCI CC (Control Channel type) bits in SAPI N Reject */ |
| 2730 | testcase TC_rll_sapi_n_reject_dlci_cc() runs on test_CT { |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2731 | var RSL_Message rx_rsl; |
| 2732 | var DchanTuple dt; |
| 2733 | |
| 2734 | f_init(1); |
| 2735 | |
| 2736 | /* MS establishes a SAPI=0 link on DCCH */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2737 | dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2738 | |
| 2739 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2740 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(gen_l3_valid_payload(), '03'O))); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2741 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2742 | rx_rsl := f_exp_ipa_rx(tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2743 | |
| 2744 | /* MS sends unexpected ERROR INDication on DCCH/ACCH SAPI=3 */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2745 | f_ipa_tx(ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
Pau Espin Pedrol | 121f27f | 2022-01-12 12:02:10 +0100 | [diff] [blame] | 2746 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, '10'B); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2747 | |
| 2748 | /* Clean up the connection */ |
| 2749 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2750 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2751 | |
| 2752 | f_shutdown_helper(); |
| 2753 | } |
| 2754 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2755 | testcase TC_si_default() runs on test_CT { |
| 2756 | f_init(0); |
| 2757 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2758 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2759 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2760 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2761 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2762 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2763 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2764 | { |
| 2765 | select (earfcn_index) { |
| 2766 | case (0) { |
| 2767 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2768 | return 111; |
| 2769 | } |
| 2770 | case (1) { |
| 2771 | return 1; |
| 2772 | } |
| 2773 | case (2) { |
| 2774 | return 0; |
| 2775 | } |
| 2776 | case (3) { |
| 2777 | return 65535; |
| 2778 | } |
| 2779 | case else { |
| 2780 | return 23 * (earfcn_index - 3); |
| 2781 | } |
| 2782 | } |
| 2783 | } |
| 2784 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2785 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2786 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2787 | |
| 2788 | f_init(0); |
| 2789 | |
| 2790 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2791 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2792 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2793 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2794 | } |
| 2795 | |
| 2796 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2797 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2798 | if (not istemplatekind(expect_cells, "omit")) { |
| 2799 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2800 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2801 | var BSSAP_N_DATA_ind rx_di; |
| 2802 | var DchanTuple dt; |
| 2803 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 2804 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2805 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2806 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2807 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2808 | |
| 2809 | /* Instruct BSC to clear channel */ |
| 2810 | var BssmapCause cause := 0; |
| 2811 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2812 | |
| 2813 | /* expect Clear Complete from BSC on A */ |
| 2814 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2815 | /* release the SCCP connection */ |
| 2816 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2817 | } |
| 2818 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2819 | f_expect_chan_rel(dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := expect_cells); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2820 | } |
| 2821 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2822 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2823 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list del earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i))}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2824 | } |
| 2825 | } |
| 2826 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2827 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2828 | { |
| 2829 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2830 | var integer si2quater_count := (count + 2) / 3; |
| 2831 | |
| 2832 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2833 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2834 | var integer index := i / 3; |
| 2835 | var integer earfcn_index := i mod 3; |
| 2836 | if (index >= lengthof(si2quater)) { |
| 2837 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2838 | } |
| 2839 | si2quater[index].rel_additions.rel5.rel6.rel7.rel8.prio_eutran_params_desc.desc.eutran_params_desc.desc.repeated_neigh_cells[0].cell_desc_list[earfcn_index] := tr_EUTRAN_CellDesc_default(e_arfcn := earfcn); |
| 2840 | } |
| 2841 | |
| 2842 | return si2quater; |
| 2843 | } |
| 2844 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2845 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2846 | { |
| 2847 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2848 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2849 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2850 | for (var integer i := 0; i < count; i := i + 1) { |
| 2851 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2852 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2853 | } |
| 2854 | |
| 2855 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2856 | } |
| 2857 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2858 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2859 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2860 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2861 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2862 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2863 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2864 | } |
| 2865 | |
| 2866 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2867 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2868 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2869 | } |
| 2870 | |
| 2871 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2872 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2873 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2874 | } |
| 2875 | |
| 2876 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2877 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2878 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2879 | } |
| 2880 | |
| 2881 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2882 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2883 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2884 | } |
| 2885 | |
| 2886 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2887 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2888 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2889 | } |
| 2890 | |
| 2891 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2892 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2893 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2894 | } |
| 2895 | |
| 2896 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2897 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2898 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2899 | } |
| 2900 | |
| 2901 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2902 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2903 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2904 | } |
| 2905 | |
| 2906 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2907 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2908 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2909 | } |
| 2910 | |
| 2911 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2912 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2913 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2914 | } |
| 2915 | |
| 2916 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2917 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2918 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2919 | } |
| 2920 | |
| 2921 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2922 | * 48 EARFCNs. */ |
| 2923 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2924 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2925 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2926 | f_init(0); |
| 2927 | |
| 2928 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2929 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2930 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2931 | } |
| 2932 | |
| 2933 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2934 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2935 | var charstring vty_error; |
| 2936 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2937 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2938 | f_vty_transceive(BSCVTY, "end"); |
| 2939 | |
| 2940 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2941 | log("Got expected VTY error: ", vty_error); |
| 2942 | setverdict(pass); |
| 2943 | } else { |
| 2944 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2945 | } |
| 2946 | |
| 2947 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2948 | |
| 2949 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2950 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list del earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i))}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2951 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2952 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2953 | } |
| 2954 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2955 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2956 | { |
| 2957 | var uint8_t count := 0; |
| 2958 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2959 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2960 | count := count + 1; |
| 2961 | } |
| 2962 | } |
| 2963 | return count; |
| 2964 | } |
| 2965 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2966 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2967 | { |
| 2968 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2969 | var SystemInformationType1 last_si1; |
| 2970 | |
| 2971 | timer T := 30.0; |
| 2972 | T.start; |
| 2973 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2974 | [] IPA_RSL[rsl_idx][0].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2975 | tr_RSL_BCCH_INFO, |
| 2976 | tr_RSL_NO_SACCH_FILL, |
| 2977 | tr_RSL_SACCH_FILL))) -> value rx_rsl_ud { |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2978 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2979 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2980 | repeat; |
| 2981 | } |
| 2982 | last_si1 := g_system_information[rsl_idx].si1; |
| 2983 | g_system_information[rsl_idx].si1 := omit; |
| 2984 | T.stop; |
| 2985 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 2986 | [] IPA_RSL[rsl_idx][0].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2987 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2988 | } |
| 2989 | return last_si1; |
| 2990 | } |
| 2991 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2992 | /* verify ACC rotate feature */ |
| 2993 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2994 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2995 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2996 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2997 | var uint8_t count; |
| 2998 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2999 | |
| 3000 | f_init(0, guard_timeout := 60.0); |
| 3001 | |
| 3002 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 3003 | "access-control-class-rotate 3", |
| 3004 | "access-control-class-rotate-quantum 1"}); |
| 3005 | |
| 3006 | /* Init and get first sysinfo */ |
| 3007 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 3008 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 3009 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 3010 | last_si1 := f_recv_next_si1(0); |
| 3011 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 3012 | count := f_acc09_count_allowed(acc); |
| 3013 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 3014 | |
| 3015 | if (count != 3) { |
| 3016 | log("RSL: EXPECTED SI ACC len=3"); |
| 3017 | setverdict(fail, "received SI does not match expectations"); |
| 3018 | break; |
| 3019 | } |
| 3020 | |
| 3021 | for (var integer j := 0; j < 10; j := j + 1) { |
| 3022 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 3023 | times_allowed[j] := times_allowed[j] + 1; |
| 3024 | } |
| 3025 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 3026 | } |
| 3027 | |
| 3028 | for (var integer j := 0; j < 10; j := j + 1) { |
| 3029 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 3030 | if (j != 5 and times_allowed[j] < 3) { |
| 3031 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 3032 | } else if (j == 5 and times_allowed[j] > 0) { |
| 3033 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 3034 | } |
| 3035 | } |
| 3036 | |
| 3037 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 3038 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3039 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 3040 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 3041 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 3042 | /* verify ACC startup ramp+rotate feature */ |
| 3043 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 3044 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 3045 | var SystemInformationType1 last_si1; |
| 3046 | var AccessControlClass acc; |
| 3047 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 3048 | var uint8_t count; |
| 3049 | var uint8_t prev_count; |
| 3050 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 3051 | |
| 3052 | f_init(0, guard_timeout := 80.0); |
| 3053 | |
| 3054 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 3055 | "access-control-class-rotate 0", |
| 3056 | "access-control-class-rotate-quantum 1", |
| 3057 | "access-control-class-ramping", |
| 3058 | "access-control-class-ramping-step-interval 5", |
| 3059 | "access-control-class-ramping-step-size 5"}); |
| 3060 | |
| 3061 | /* Init and get first sysinfo */ |
| 3062 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 3063 | last_si1 := g_system_information[0].si1; |
| 3064 | acc := last_si1.rach_control.acc; |
| 3065 | count := f_acc09_count_allowed(acc); |
| 3066 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 3067 | while (count > 0) { |
| 3068 | last_si1 := f_recv_next_si1(0); |
| 3069 | acc := last_si1.rach_control.acc; |
| 3070 | count := f_acc09_count_allowed(acc); |
| 3071 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 3072 | } |
| 3073 | |
| 3074 | /* Increase adm subset size, we should see ramping start up */ |
| 3075 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 3076 | prev_count := 0; |
| 3077 | while (true) { |
| 3078 | last_si1 := f_recv_next_si1(0); |
| 3079 | acc := last_si1.rach_control.acc; |
| 3080 | count := f_acc09_count_allowed(acc); |
| 3081 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 3082 | |
| 3083 | if (prev_count > count) { |
| 3084 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 3085 | break; |
| 3086 | } |
| 3087 | |
| 3088 | if (count == 9) { |
| 3089 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 3090 | } |
| 3091 | |
| 3092 | prev_count := count; |
| 3093 | } |
| 3094 | |
| 3095 | setverdict(pass); |
| 3096 | |
| 3097 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 3098 | "rach access-control-class 4 allowed", |
| 3099 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3100 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 3101 | } |
| 3102 | |
Oliver Smith | 45a6dd3 | 2023-09-27 10:52:50 +0200 | [diff] [blame] | 3103 | /* Verify NCC Permitted in System Information Type 2 |
| 3104 | * 3GPP TS 44.018 § 10.5.2.27 */ |
| 3105 | testcase TC_si2_ncc_permitted() runs on test_CT { |
| 3106 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 3107 | timer T := 5.0; |
| 3108 | var BIT8 exp; |
| 3109 | |
| 3110 | f_init_vty(); |
| 3111 | |
| 3112 | /* Set NCC Permitted to 6 7 8 */ |
| 3113 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 3114 | f_vty_transceive(BSCVTY, "ncc-permitted 6 7 8"); |
| 3115 | f_vty_transceive(BSCVTY, "end"); |
| 3116 | exp := '11100000'B; |
| 3117 | |
| 3118 | f_init(1); |
| 3119 | T.start; |
| 3120 | |
| 3121 | /* Check value in SI 2 */ |
| 3122 | alt { |
| 3123 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_2))) -> value rx_rsl_ud { |
| 3124 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 3125 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 3126 | |
| 3127 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_2) { |
| 3128 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 3129 | repeat; |
| 3130 | } |
| 3131 | |
| 3132 | if (si.payload.si2.ncc_permitted != exp) { |
| 3133 | setverdict(fail, "NCC Permitted is ", si.payload.si2.ncc_permitted, " but expected ", exp); |
| 3134 | break; |
| 3135 | } |
| 3136 | |
| 3137 | } |
| 3138 | [] IPA_RSL[0][0].receive { repeat; } |
| 3139 | [] T.timeout { |
| 3140 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI2)"); |
| 3141 | } |
| 3142 | } |
| 3143 | |
| 3144 | /* Reset NCC Permitted to default (all permitted). This is already |
| 3145 | * getting tested in TC_si_default(). */ |
| 3146 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 3147 | f_vty_transceive(BSCVTY, "ncc-permitted all"); |
| 3148 | f_vty_transceive(BSCVTY, "end"); |
| 3149 | |
| 3150 | f_shutdown_helper(); |
| 3151 | } |
| 3152 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3153 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 3154 | var charstring ctrl_resp; |
| 3155 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3156 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3157 | |
| 3158 | /* See https://osmocom.org/issues/2729 */ |
| 3159 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3160 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3161 | } |
| 3162 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3163 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 3164 | var charstring ctrl_resp; |
| 3165 | |
| 3166 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3167 | |
| 3168 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3169 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3170 | } |
| 3171 | |
Neels Hofmeyr | 0bc470d | 2021-08-21 13:37:13 +0200 | [diff] [blame] | 3172 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 3173 | private function f_tc_stat_num_msc_connected_msc_connhdlr(integer expect_num_msc_connected) runs on MSC_ConnHdlr { |
| 3174 | g_pars := f_gen_test_hdlr_pars(); |
| 3175 | var StatsDExpects expect := { |
| 3176 | { name := "TTCN3.bsc.0.num_msc.connected", mtype := "g", min := expect_num_msc_connected, max := expect_num_msc_connected }, |
| 3177 | { name := "TTCN3.bsc.0.num_msc.total", mtype := "g", min := NUM_MSC, max := NUM_MSC } |
| 3178 | }; |
| 3179 | f_statsd_expect(expect); |
| 3180 | } |
| 3181 | |
| 3182 | private function f_tc_stat_num_msc_connected_test_ct(void_fn tc_fn, integer nr_msc) runs on test_CT |
| 3183 | { |
| 3184 | var MSC_ConnHdlr vc_conn; |
| 3185 | |
| 3186 | f_init(nr_bts := 1, handler_mode := true, nr_msc := nr_msc); |
| 3187 | f_sleep(1.0); |
| 3188 | vc_conn := f_start_handler(tc_fn); |
| 3189 | vc_conn.done; |
| 3190 | |
| 3191 | /* Also verify stat exposed on CTRL interface */ |
| 3192 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:connected", int2str(nr_msc)); |
| 3193 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:total", int2str(NUM_MSC)); |
| 3194 | |
| 3195 | f_shutdown_helper(); |
| 3196 | } |
| 3197 | |
| 3198 | /* Verify that when 1 MSC is active, that num_msc:connected reports 1. */ |
| 3199 | private function f_tc_stat_num_msc_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 3200 | f_tc_stat_num_msc_connected_msc_connhdlr(1); |
| 3201 | } |
| 3202 | testcase TC_stat_num_msc_connected_1() runs on test_CT { |
| 3203 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_1), 1); |
| 3204 | } |
| 3205 | |
| 3206 | /* Verify that when 2 MSCs are active, that num_msc:connected reports 2. */ |
| 3207 | private function f_tc_stat_num_msc_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 3208 | f_tc_stat_num_msc_connected_msc_connhdlr(2); |
| 3209 | } |
| 3210 | testcase TC_stat_num_msc_connected_2() runs on test_CT { |
| 3211 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_2), 2); |
| 3212 | } |
| 3213 | |
| 3214 | /* Verify that when 3 MSCs are active, that num_msc:connected reports 3. */ |
| 3215 | private function f_tc_stat_num_msc_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 3216 | f_tc_stat_num_msc_connected_msc_connhdlr(3); |
| 3217 | } |
| 3218 | testcase TC_stat_num_msc_connected_3() runs on test_CT { |
| 3219 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_3), 3); |
| 3220 | } |
| 3221 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3222 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 3223 | private function f_tc_stat_num_bts_connected_msc_connhdlr(integer expect_num_bts_connected) runs on MSC_ConnHdlr { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3224 | var integer num_trx_connected := 0; |
| 3225 | var integer num_trx_total := 0; |
| 3226 | |
| 3227 | for (var integer i := 0; i < lengthof(c_BtsParams); i := i + 1) { |
| 3228 | var integer trx_num := c_BtsParams[i].trx_num; |
| 3229 | num_trx_total := num_trx_total + trx_num; |
| 3230 | if (i < expect_num_bts_connected) { |
| 3231 | num_trx_connected := num_trx_connected + trx_num; |
| 3232 | } |
| 3233 | } |
| 3234 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3235 | var StatsDExpects expect := { |
| 3236 | { name := "TTCN3.bsc.0.num_bts.oml_connected", mtype := "g", min := expect_num_bts_connected, max := NUM_BTS_CFG }, |
| 3237 | { name := "TTCN3.bsc.0.num_bts.all_trx_rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 3238 | { name := "TTCN3.bsc.0.num_bts.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG }, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3239 | { name := "TTCN3.bsc.0.num_trx.rsl_connected", mtype := "g", min := num_trx_connected, max := num_trx_connected }, |
| 3240 | { name := "TTCN3.bsc.0.num_trx.total", mtype := "g", min := num_trx_total, max := num_trx_total } |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3241 | }; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3242 | |
| 3243 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3244 | f_statsd_expect(expect); |
| 3245 | } |
| 3246 | |
| 3247 | private function f_tc_stat_num_bts_connected_test_ct(void_fn tc_fn, integer nr_bts) runs on test_CT { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3248 | var integer num_trx_connected := 0; |
| 3249 | var integer num_trx_total := 0; |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3250 | var MSC_ConnHdlr vc_conn; |
| 3251 | |
| 3252 | f_init(nr_bts := nr_bts, handler_mode := true, nr_msc := 1); |
| 3253 | f_sleep(1.0); |
| 3254 | vc_conn := f_start_handler(tc_fn); |
| 3255 | vc_conn.done; |
| 3256 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3257 | for (var integer i := 0; i < lengthof(c_BtsParams); i := i + 1) { |
| 3258 | var integer trx_num := c_BtsParams[i].trx_num; |
| 3259 | num_trx_total := num_trx_total + trx_num; |
| 3260 | if (i < nr_bts) { |
| 3261 | num_trx_connected := num_trx_connected + trx_num; |
| 3262 | } |
| 3263 | } |
| 3264 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3265 | /* Also verify stat exposed on CTRL interface */ |
| 3266 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:all_trx_rsl_connected", int2str(nr_bts)); |
| 3267 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:total", int2str(NUM_BTS_CFG)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3268 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:rsl_connected", int2str(num_trx_connected)); |
| 3269 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:total", int2str(num_trx_total)); |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3270 | |
Neels Hofmeyr | a41ae30 | 2021-09-06 22:06:02 +0200 | [diff] [blame] | 3271 | /* Verify rf_states exposed on CTRL interface */ |
| 3272 | var charstring expect_net_rf_states := ""; |
| 3273 | for (var integer i := 0; i < NUM_BTS_CFG; i := i + 1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3274 | var charstring expect_bts_rf_states := ""; |
| 3275 | |
| 3276 | for (var integer j := 0; j < c_BtsParams[i].trx_num; j := j + 1) { |
| 3277 | expect_bts_rf_states := expect_bts_rf_states & |
| 3278 | int2str(i) & "," & int2str(j) & ","; |
| 3279 | if (i < NUM_BTS) { |
| 3280 | /* In these tests, OML for the first NUM_BTS are always connected via osmo-bts-omldummy */ |
| 3281 | expect_bts_rf_states := expect_bts_rf_states & "operational,unlocked,"; |
| 3282 | } else { |
| 3283 | /* For remaining i < NUM_BTS_CFG, OML is not connected, i.e. inoperational */ |
| 3284 | expect_bts_rf_states := expect_bts_rf_states & "inoperational,locked,"; |
| 3285 | } |
| 3286 | /* The RF policy is still global in osmo-bsc, i.e. always "on" */ |
| 3287 | expect_bts_rf_states := expect_bts_rf_states & "on,"; |
| 3288 | if (i < nr_bts) { |
| 3289 | /* For BTS where RSL is connected, the RSL state will be "up" */ |
| 3290 | expect_bts_rf_states := expect_bts_rf_states & "rsl-up;"; |
| 3291 | } else { |
| 3292 | expect_bts_rf_states := expect_bts_rf_states & "rsl-down;"; |
| 3293 | } |
Neels Hofmeyr | a41ae30 | 2021-09-06 22:06:02 +0200 | [diff] [blame] | 3294 | } |
| 3295 | |
| 3296 | f_ctrl_get_exp(IPA_CTRL, "bts." & int2str(i) & ".rf_states", expect_bts_rf_states); |
| 3297 | expect_net_rf_states := expect_net_rf_states & expect_bts_rf_states; |
| 3298 | } |
| 3299 | f_ctrl_get_exp(IPA_CTRL, "rf_states", expect_net_rf_states); |
| 3300 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3301 | f_shutdown_helper(); |
| 3302 | } |
| 3303 | |
| 3304 | /* Verify that when 1 BTS is connected, that num_{bts,trx}:*_connected reports 1. */ |
| 3305 | private function f_tc_stat_num_bts_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 3306 | f_tc_stat_num_bts_connected_msc_connhdlr(1); |
| 3307 | } |
| 3308 | testcase TC_stat_num_bts_connected_1() runs on test_CT { |
| 3309 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_1), 1); |
| 3310 | } |
| 3311 | |
| 3312 | /* Verify that when 2 BTS is connected, that num_{bts,trx}:*_connected reports 2. */ |
| 3313 | private function f_tc_stat_num_bts_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 3314 | f_tc_stat_num_bts_connected_msc_connhdlr(2); |
| 3315 | } |
| 3316 | testcase TC_stat_num_bts_connected_2() runs on test_CT { |
| 3317 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_2), 2); |
| 3318 | } |
| 3319 | |
| 3320 | /* Verify that when 3 BTS is connected, that num_{bts,trx}:*_connected reports 3. */ |
| 3321 | private function f_tc_stat_num_bts_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 3322 | f_tc_stat_num_bts_connected_msc_connhdlr(3); |
| 3323 | } |
| 3324 | testcase TC_stat_num_bts_connected_3() runs on test_CT { |
| 3325 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_3), 3); |
| 3326 | } |
| 3327 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3328 | testcase TC_ctrl() runs on test_CT { |
| 3329 | var charstring ctrl_resp; |
| 3330 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3331 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3332 | |
| 3333 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 3334 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 3335 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 3336 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 3337 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3338 | |
| 3339 | var integer bts_nr := 0; |
| 3340 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 3341 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 3342 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 3343 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 3344 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 3345 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 3346 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 3347 | |
| 3348 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 3349 | f_sleep(2.0); |
| 3350 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 3351 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 3352 | } |
| 3353 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 3354 | |
| 3355 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 3356 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3357 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 3358 | } |
| 3359 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3360 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 3361 | "location-state" over the SCCPlite IPA conn */ |
| 3362 | testcase TC_ctrl_location() runs on test_CT { |
| 3363 | var MSC_ConnHdlr vc_conn; |
| 3364 | var integer bts_nr := 0; |
| 3365 | |
| 3366 | f_init(1, true); |
| 3367 | f_sleep(1.0); |
| 3368 | |
| 3369 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 3370 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3371 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 3372 | |
| 3373 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 3374 | f_sleep(2.0); |
| 3375 | |
| 3376 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 3377 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3378 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 3379 | |
| 3380 | /* should match the one from config */ |
| 3381 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 3382 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3383 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3384 | } |
| 3385 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3386 | |
| 3387 | /*********************************************************************** |
| 3388 | * Paging Testing |
| 3389 | ***********************************************************************/ |
| 3390 | |
| 3391 | type record Cell_Identity { |
| 3392 | GsmMcc mcc, |
| 3393 | GsmMnc mnc, |
| 3394 | GsmLac lac, |
| 3395 | GsmCellId ci |
| 3396 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 3397 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3398 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3399 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3400 | type set of integer BtsIdList; |
| 3401 | |
| 3402 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 3403 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 3404 | if (bts_id == bts_ids[j]) { |
| 3405 | return true; |
| 3406 | } |
| 3407 | } |
| 3408 | return false; |
| 3409 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3410 | |
| 3411 | /* core paging test helper function; used by most paging test cases */ |
| 3412 | private function f_pageing_helper(hexstring imsi, |
| 3413 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3414 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3415 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3416 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3417 | { |
| 3418 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3419 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3420 | var RSL_Message rx_rsl; |
| 3421 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3422 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3423 | |
| 3424 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3425 | |
| 3426 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 3427 | for (i := 0; i < NUM_BTS; i := i + 1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3428 | IPA_RSL[i][0].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3429 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3430 | |
| 3431 | if (isvalue(rsl_chneed)) { |
| 3432 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 3433 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 3434 | } else { |
| 3435 | bssmap_chneed := omit; |
| 3436 | } |
| 3437 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3438 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 3439 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3440 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3441 | if (not istemplatekind(tmsi, "omit")) { |
| 3442 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3443 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3444 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3445 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3446 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3447 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3448 | rx_rsl := f_exp_ipa_rx(tr_RSL_PAGING_CMD(mi), idx := {bts_ids[i], 0}); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3449 | /* check channel type, paging group */ |
| 3450 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 3451 | setverdict(fail, "Paging for wrong paging group"); |
| 3452 | } |
| 3453 | if (ispresent(rsl_chneed) and |
| 3454 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 3455 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 3456 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3457 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 3458 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3459 | /* do a quick check on all not-included BTSs if they received paging */ |
| 3460 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3461 | timer T := 0.1; |
| 3462 | if (f_bts_in_list(i, bts_ids)) { |
| 3463 | continue; |
| 3464 | } |
| 3465 | T.start; |
| 3466 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3467 | [] IPA_RSL[i][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(mi))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3468 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 3469 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3470 | [] IPA_RSL[i][0].receive { repeat; } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3471 | [] T.timeout { } |
| 3472 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3473 | } |
| 3474 | |
| 3475 | setverdict(pass); |
| 3476 | } |
| 3477 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3478 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3479 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3480 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 3481 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 3482 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3483 | /* PAGING by IMSI + TMSI */ |
| 3484 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 3485 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3486 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 3487 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3488 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3489 | } |
| 3490 | |
| 3491 | /* PAGING by IMSI + TMSI */ |
| 3492 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 3493 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3494 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3495 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, 'A1B2C301'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3496 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3497 | } |
| 3498 | |
| 3499 | /* Paging with different "channel needed' values */ |
| 3500 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 3501 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3502 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3503 | f_pageing_helper('001010100000002'H, cid_list, c_BtsId_all, RSL_CHANNEED_ANY, 'A1B2C302'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3504 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3505 | } |
| 3506 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 3507 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3508 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3509 | f_pageing_helper('001010100000003'H, cid_list, c_BtsId_all, RSL_CHANNEED_SDCCH, 'A1B2C303'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3510 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3511 | } |
| 3512 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 3513 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3514 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3515 | f_pageing_helper('001010000000004'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_F, 'A1B2C304'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3516 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3517 | } |
| 3518 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 3519 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3520 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3521 | f_pageing_helper('001010000000005'H, cid_list, c_BtsId_all, RSL_CHANNEED_TCH_ForH, 'A1B2C305'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3522 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3523 | } |
| 3524 | |
| 3525 | /* Paging by CGI */ |
| 3526 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 3527 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3528 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(cid.mcc, cid.mnc, cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3529 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3530 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3531 | } |
| 3532 | |
| 3533 | /* Paging by LAC+CI */ |
| 3534 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 3535 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3536 | cid_list := { cIl_LAC_CI := { ts_BSSMAP_CI_LAC_CI(cid.lac, cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3537 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3538 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3539 | } |
| 3540 | |
| 3541 | /* Paging by CI */ |
| 3542 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 3543 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3544 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3545 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3546 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3547 | } |
| 3548 | |
| 3549 | /* Paging by LAI */ |
| 3550 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 3551 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3552 | cid_list := { cIl_LAI := { ts_BSSMAP_CI_LAI(cid.mcc, cid.mnc, cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3553 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3554 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3555 | } |
| 3556 | |
| 3557 | /* Paging by LAC */ |
| 3558 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 3559 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3560 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3561 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3562 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | /* Paging by "all in BSS" */ |
| 3566 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 3567 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3568 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3569 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3570 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3571 | } |
| 3572 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3573 | /* Paging by PLMN+LAC+RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3574 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 3575 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3576 | cid_list := { cIl_PLMN_LAC_RNC := { ts_BSSMAP_CI_PLMN_LAC_RNC(cid.mcc, cid.mnc, cid.lac, 12) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3577 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3578 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3579 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3580 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3581 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3582 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 3583 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3584 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3585 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3586 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3587 | } |
| 3588 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3589 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3590 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 3591 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3592 | cid_list := { cIl_LAC_RNC := { ts_BSSMAP_CI_LAC_RNC(cid.lac, 14) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3593 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3594 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3595 | } |
| 3596 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3597 | /* Paging on multiple cells (multiple entries in list): Verify all of them page */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3598 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 3599 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3600 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 3601 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3602 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3603 | } |
| 3604 | |
| 3605 | /* Paging on empty list: Verify none of them page */ |
| 3606 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3607 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3608 | cid_list := { cIl_LAC := { } }; |
| 3609 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3610 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3611 | } |
| 3612 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3613 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3614 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3615 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3616 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3617 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3618 | f_shutdown_helper(); |
| 3619 | } |
| 3620 | |
Pau Espin Pedrol | 07657ae | 2023-01-03 12:08:05 +0100 | [diff] [blame] | 3621 | /* Send paging response containing invalid (wrongly formatted) MobileIdentity IE. */ |
| 3622 | testcase TC_paging_imsi_nochan_ci_resp_invalid_mi() runs on test_CT { |
| 3623 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3624 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3625 | var DchanTuple dt; |
| 3626 | var octetstring rr_pag_resp := '06270003535992617965720000'O; |
| 3627 | /* { 06 27 } is { GSM48_PDISC_RR, GSM48_MT_RR_PAG_RESP } |
| 3628 | * see 3GPP TS 44.018, table 9.1.25.1 |
| 3629 | * { 00 } or { 01 } is CKSN + Spare Half Octet, not important |
| 3630 | * { 03 53 59 92 } is Mobile Station Classmark |
| 3631 | * { 61 79 65 72 00 00 } is the invalid Mobile Identity IE (3GPP TS 24.008, 10.5.1.4), |
| 3632 | * Length is 0x61 (97 in decimal). |
| 3633 | */ |
| 3634 | |
| 3635 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
| 3636 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
| 3637 | |
| 3638 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3639 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3640 | dt.idx := {0, 0}; |
| 3641 | |
| 3642 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3643 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), rr_pag_resp)); |
| 3644 | |
| 3645 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3646 | timer T := 5.0; |
| 3647 | T.start; |
| 3648 | alt { |
| 3649 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) -> value rx_c_ind { |
| 3650 | setverdict(pass); |
| 3651 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 3652 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 3653 | } |
| 3654 | [] BSSAP.receive { |
| 3655 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3656 | } |
| 3657 | [] T.timeout { |
| 3658 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3659 | } |
| 3660 | } |
| 3661 | |
| 3662 | f_perform_clear_test_ct(dt); |
| 3663 | f_shutdown_helper(); |
| 3664 | } |
| 3665 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3666 | /* Verify paging retransmission interval + count */ |
| 3667 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3668 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3669 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3670 | /* Verify PCH load */ |
| 3671 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3672 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3673 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3674 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3675 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3676 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3677 | |
| 3678 | /* tell BSC there is no paging space anymore */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3679 | f_ipa_tx(ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3680 | f_sleep(0.2); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3681 | IPA_RSL[0][0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3682 | |
| 3683 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3684 | * there would be 8 retransmissions during 4 seconds */ |
| 3685 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3686 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3687 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3688 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3689 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3690 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3691 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3692 | [] T_retrans.timeout { |
| 3693 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3694 | f_ipa_tx(ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3695 | T_retrans.start; |
| 3696 | repeat; |
| 3697 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3698 | [] T.timeout { |
| 3699 | setverdict(pass); |
| 3700 | } |
| 3701 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3702 | |
| 3703 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3704 | } |
| 3705 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3706 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3707 | testcase TC_paging_counter() runs on test_CT { |
| 3708 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3709 | timer T := 4.0; |
| 3710 | var integer i; |
| 3711 | var integer paging_attempted_bsc; |
| 3712 | var integer paging_attempted_bts[NUM_BTS]; |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3713 | var integer paging_expired_bsc; |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3714 | var integer paging_expired_bts[NUM_BTS]; |
| 3715 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3716 | |
| 3717 | f_init(); |
| 3718 | |
| 3719 | /* read counters before paging */ |
| 3720 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
Pau Espin Pedrol | 4e43183 | 2023-02-08 12:43:47 +0100 | [diff] [blame] | 3721 | paging_expired_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired"); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3722 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3723 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3724 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3725 | } |
| 3726 | |
| 3727 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3728 | |
| 3729 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3730 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3731 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3732 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3733 | paging_attempted_bts[i]+1); |
| 3734 | } |
| 3735 | |
| 3736 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3737 | f_sleep(12.0); |
Pau Espin Pedrol | 4e43183 | 2023-02-08 12:43:47 +0100 | [diff] [blame] | 3738 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired", paging_expired_bsc+1); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3739 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3740 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3741 | paging_expired_bts[i]+1); |
| 3742 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3743 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3744 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3745 | } |
| 3746 | |
| 3747 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3748 | /* Verify paging stops after A-RESET */ |
| 3749 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3750 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3751 | timer T := 3.0; |
| 3752 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3753 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3754 | |
| 3755 | /* Perform a BSSMAP Reset and wait for ACK */ |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 3756 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled_cn))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3757 | alt { |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 3758 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled_cn))) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3759 | [] BSSAP.receive { repeat; } |
| 3760 | } |
| 3761 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3762 | /* Wait to avoid a possible race condition if a paging message is |
| 3763 | * received right before the reset ACK. */ |
| 3764 | f_sleep(0.2); |
| 3765 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3766 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3767 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3768 | IPA_RSL[i][0].clear; |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3769 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3770 | |
| 3771 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3772 | T.start; |
| 3773 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3774 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3775 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3776 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3777 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3778 | [] IPA_RSL[1][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3779 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3780 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3781 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3782 | [] IPA_RSL[2][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3783 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3784 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3785 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3786 | [] T.timeout { |
| 3787 | setverdict(pass); |
| 3788 | } |
| 3789 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3790 | |
| 3791 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3792 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3793 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3794 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3795 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3796 | * pick the first configured MSC. This behavior is required in order to make |
| 3797 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3798 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3799 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3800 | */ |
| 3801 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3802 | |
| 3803 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3804 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3805 | |
| 3806 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3807 | var DchanTuple dt; |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 3808 | var PDU_ML3_MS_NW l3 := valueof(ts_PAG_RESP(ts_MI_IMSI_LV('001010008880018'H))); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3809 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3810 | |
| 3811 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3812 | dt.rsl_chan_nr := f_chreq_act_ack(); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3813 | dt.idx := {0, 0}; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3814 | |
| 3815 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
Pau Espin Pedrol | e8a5101 | 2023-01-03 11:59:59 +0100 | [diff] [blame] | 3816 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), rr_pag_resp)); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3817 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3818 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3819 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3820 | T.start; |
| 3821 | alt { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3822 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) -> value rx_c_ind { |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3823 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3824 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 3825 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3826 | } |
| 3827 | [] BSSAP.receive { |
| 3828 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3829 | } |
| 3830 | [] T.timeout { |
| 3831 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3832 | } |
| 3833 | } |
| 3834 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3835 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3836 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3837 | } |
| 3838 | |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3839 | /* Verify BSC can schedule N paging requests under one minute if BTS buffer is good enough */ |
| 3840 | function f_TC_paging_Nreq(integer num_subscribers, boolean send_pag_load_ind) runs on test_CT { |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3841 | var ASP_RSL_Unitdata rx_rsl_ud; |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3842 | var Hexstrings imsis := {}; |
| 3843 | var Booleans rx_paging_done := {}; |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3844 | var integer rx_paging_num := 0; |
| 3845 | var integer i; |
| 3846 | timer T_rx := 60.0; |
| 3847 | timer T_load_ind := 1.0; |
| 3848 | |
| 3849 | for (i := 0; i < num_subscribers; i := i + 1) { |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3850 | imsis := imsis & {f_gen_imsi(i)}; |
| 3851 | rx_paging_done := rx_paging_done & { false }; |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | f_init(1, guard_timeout := 100.0); |
| 3855 | |
| 3856 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3857 | IPA_RSL[0][0].clear; |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3858 | if (send_pag_load_ind) { |
| 3859 | /* Tell there's plenty of space at the BTS (UINT16_MAX): */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3860 | f_ipa_tx(ts_RSL_PAGING_LOAD_IND(65535)); |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3861 | } |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3862 | |
| 3863 | for (i := 0; i < num_subscribers; i := i + 1) { |
Pau Espin Pedrol | d3339a7 | 2022-05-03 11:59:15 +0200 | [diff] [blame] | 3864 | /* Page on LAC-CI of BTS0: */ |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3865 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
Pau Espin Pedrol | d3339a7 | 2022-05-03 11:59:15 +0200 | [diff] [blame] | 3866 | ts_BSSMAP_Paging(imsis[i], valueof(ts_BSSMAP_CIL_LAC_CI({ts_BSSMAP_CI_LAC_CI(1, 0)})), |
| 3867 | omit, omit))); |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3868 | } |
| 3869 | |
| 3870 | T_rx.start; |
| 3871 | T_load_ind.start; |
| 3872 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3873 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?), IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3874 | var hexstring imsi := rx_rsl_ud.rsl.ies[2].body.ms_identity.mobileIdentityV.oddEvenInd_identity.imsi.digits; |
| 3875 | var hexstring imsi_suffix := substr(imsi, lengthof(imsi)-6, 6); |
| 3876 | var charstring imsi_str := hex2str(imsi_suffix); |
| 3877 | var integer imsi_idx := str2int(imsi_str); |
| 3878 | if (rx_paging_done[imsi_idx] == false) { |
| 3879 | rx_paging_done[imsi_idx] := true; |
| 3880 | rx_paging_num := rx_paging_num + 1; |
Pau Espin Pedrol | ef7ef63 | 2022-04-25 13:34:57 +0200 | [diff] [blame] | 3881 | } else { |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3882 | setverdict(fail, "Retrans of ", imsi_str, " happened before Rx initial trans for all reqs. rx_paging_num=", rx_paging_num); |
Pau Espin Pedrol | ef7ef63 | 2022-04-25 13:34:57 +0200 | [diff] [blame] | 3883 | mtc.stop; |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3884 | } |
| 3885 | if (rx_paging_num < num_subscribers) { |
| 3886 | repeat; |
| 3887 | } |
| 3888 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3889 | [] IPA_RSL[0][0].receive { repeat; } |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3890 | [] T_load_ind.timeout { |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3891 | log("[CCH Load Ind timer] received paging requests so far: ", rx_paging_num); |
| 3892 | if (send_pag_load_ind) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3893 | f_ipa_tx(ts_RSL_PAGING_LOAD_IND(40)); |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3894 | } |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3895 | T_load_ind.start; |
| 3896 | repeat; |
| 3897 | } |
| 3898 | [] T_rx.timeout { |
| 3899 | setverdict(fail, "Timeout expecting paging requests, so far ", rx_paging_num); |
| 3900 | mtc.stop; |
| 3901 | } |
| 3902 | } |
| 3903 | |
Pau Espin Pedrol | d3339a7 | 2022-05-03 11:59:15 +0200 | [diff] [blame] | 3904 | /* Drop OML connection to have all paging requests flushed: */ |
| 3905 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 3906 | |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3907 | f_shutdown_helper(); |
| 3908 | } |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 3909 | /* Verify BSC can schedule 500 paging requests under one minute if BTS buffer is good enough */ |
| 3910 | testcase TC_paging_500req() runs on test_CT { |
| 3911 | f_TC_paging_Nreq(500, true); |
| 3912 | } |
| 3913 | /* Same as TC_paging_500req, but without sending CCCH Load Indication, which |
| 3914 | * means BTS is always under CCH Load Threshold, aka capable of sending tons of requests. |
| 3915 | * Since No CCCH Load Ind, BSC uses a conservative estimation of BTS load, which |
| 3916 | * for current config yields ~8req/sec, so 480req/min maximum. */ |
| 3917 | testcase TC_paging_450req_no_paging_load_ind() runs on test_CT { |
| 3918 | f_TC_paging_Nreq(450, false); |
| 3919 | } |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 3920 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3921 | /* Test RSL link drop causes counter increment */ |
| 3922 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3923 | var integer rsl_fail; |
| 3924 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3925 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3926 | |
| 3927 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3928 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3929 | f_ipa_rsl_stop(bts[0][0].rsl); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3930 | |
| 3931 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3932 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3933 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3934 | } |
| 3935 | |
| 3936 | /* TODO: Test OML link drop causes counter increment */ |
| 3937 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3938 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3939 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3940 | var IPA_Client client; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3941 | timer T := 10.0; |
| 3942 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3943 | client.id := "IPA-BTS0-TRX0-RSL"; |
| 3944 | client.vc_IPA := IPA_Emulation_CT.create(client.id & "-IPA") alive; |
| 3945 | client.ccm_pars := c_IPA_default_ccm_pars; |
| 3946 | client.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 3947 | client.ccm_pars.unit_id := "99/0/0"; /* value which is unknown at BTS */ |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3948 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3949 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3950 | |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 3951 | f_init_mgcp(0, "VirtMGW"); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3952 | |
| 3953 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3954 | map(client.vc_IPA:IPA_PORT, system:IPA); |
| 3955 | connect(client.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0][0]); |
| 3956 | client.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, client.ccm_pars)); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3957 | |
| 3958 | /* wait for IPA OML link to connect and then disconnect */ |
| 3959 | T.start; |
| 3960 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3961 | [] IPA_RSL[0][0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3962 | T.stop; |
| 3963 | return true; |
| 3964 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 3965 | [] IPA_RSL[0][0].receive { repeat } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3966 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3967 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3968 | } |
| 3969 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3970 | return false; |
| 3971 | } |
| 3972 | |
| 3973 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3974 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3975 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3976 | setverdict(pass); |
| 3977 | } else { |
| 3978 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3979 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3980 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3981 | } |
| 3982 | |
| 3983 | |
| 3984 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3985 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3986 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3987 | setverdict(pass); |
| 3988 | } else { |
| 3989 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3990 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3991 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3992 | } |
| 3993 | |
| 3994 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3995 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3996 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3997 | ***********************************************************************/ |
| 3998 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3999 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 4000 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4001 | import from RSL_Emulation all; |
| 4002 | import from MSC_ConnectionHandler all; |
| 4003 | |
| 4004 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 4005 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 4006 | /* helper function to create and connect a MSC_ConnHdlr component |
| 4007 | * TODO: allow connecting to TRX1..N, not only TRX0 */ |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 4008 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0, integer mgwpool_idx := 0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4009 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 4010 | connect(vc_conn:RSL, bts[0][0].rsl.vc_RSL:CLIENT_PT); |
| 4011 | connect(vc_conn:RSL_PROC, bts[0][0].rsl.vc_RSL:RSL_PROC); |
| 4012 | if (isvalue(bts[1][0])) { |
| 4013 | connect(vc_conn:RSL1, bts[1][0].rsl.vc_RSL:CLIENT_PT); |
| 4014 | connect(vc_conn:RSL1_PROC, bts[1][0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 4015 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 4016 | if (isvalue(bts[2][0])) { |
| 4017 | connect(vc_conn:RSL2, bts[2][0].rsl.vc_RSL:CLIENT_PT); |
| 4018 | connect(vc_conn:RSL2_PROC, bts[2][0].rsl.vc_RSL:RSL_PROC); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4019 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4020 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 4021 | if (mp_enable_lcs_tests) { |
| 4022 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 4023 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 4024 | } |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4025 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 4026 | connect(vc_conn:MGCP_PROC, vc_MGCP[mgwpool_idx]:MGCP_PROC); |
| 4027 | connect(vc_conn:MGCP, vc_MGCP[mgwpool_idx]:MGCP_CLIENT); |
| 4028 | connect(vc_conn:MGCP_MULTI, vc_MGCP[mgwpool_idx]:MGCP_CLIENT_MULTI); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 4029 | } |
| 4030 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 4031 | function f_start_handler_create(template (omit) TestHdlrParams pars := omit) |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 4032 | runs on test_CT return MSC_ConnHdlr { |
| 4033 | var charstring id := testcasename(); |
| 4034 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4035 | var integer bssap_idx := 0; |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 4036 | var integer mgwpool_idx := 0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4037 | if (isvalue(pars)) { |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 4038 | var TestHdlrParams pars_val := valueof(pars); |
| 4039 | bssap_idx := pars_val.mscpool.bssap_idx; |
| 4040 | mgwpool_idx := pars_val.mgwpool_idx; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4041 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 4042 | vc_conn := MSC_ConnHdlr.create(id); |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 4043 | f_connect_handler(vc_conn, bssap_idx, mgwpool_idx); |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 4044 | return vc_conn; |
| 4045 | } |
| 4046 | |
| 4047 | function f_start_handler_run(MSC_ConnHdlr vc_conn, void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 4048 | runs on test_CT return MSC_ConnHdlr { |
| 4049 | var charstring id := testcasename(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4050 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4051 | return vc_conn; |
| 4052 | } |
| 4053 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 4054 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 4055 | runs on test_CT return MSC_ConnHdlr { |
| 4056 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 4057 | } |
| 4058 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4059 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 4060 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 4061 | runs on MSC_ConnHdlr { |
| 4062 | if (isvalue(pars)) { |
| 4063 | g_pars := valueof(pars); |
| 4064 | } |
| 4065 | fn.apply(id); |
| 4066 | } |
| 4067 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 4068 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 4069 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 4070 | f_vty_transceive(BSCVTY, "network"); |
| 4071 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 4072 | f_vty_transceive(BSCVTY, "exit"); |
| 4073 | f_vty_transceive(BSCVTY, "exit"); |
| 4074 | } |
| 4075 | |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 4076 | const charstring VTY_A5_DEFAULT := "0 1 3"; |
| 4077 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 4078 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 4079 | /* keep in sync with docker-playground.git ttcn3-bsc-test/osmo-bsc.cfg */ |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 4080 | f_vty_encryption_a5(VTY_A5_DEFAULT); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 4081 | } |
| 4082 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4083 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 4084 | private function f_tc_ciph_mode_a5(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4085 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4086 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4087 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 4088 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 4089 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 4090 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 4091 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4092 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 4093 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4094 | f_perform_clear(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4095 | } |
| 4096 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 4097 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4098 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4099 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 4100 | |
| 4101 | f_init(1, true); |
| 4102 | f_sleep(1.0); |
| 4103 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4104 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4105 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4106 | } |
| 4107 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 4108 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4109 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4110 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 4111 | |
| 4112 | f_init(1, true); |
| 4113 | f_sleep(1.0); |
| 4114 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4115 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4116 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4117 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 4118 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 4119 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 4120 | var MSC_ConnHdlr vc_conn; |
| 4121 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4122 | |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 4123 | pars.encr := f_encr_params('05'O, '04'O); /* A5/0 and A5/2 (0x01|0x04)*/ |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 4124 | |
| 4125 | f_init(1, true); |
| 4126 | f_vty_encryption_a5("0 1 2 3"); |
| 4127 | f_sleep(1.0); |
| 4128 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4129 | vc_conn.done; |
| 4130 | f_vty_encryption_a5_reset(); |
| 4131 | f_shutdown_helper(); |
| 4132 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 4133 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 4134 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 4135 | var MSC_ConnHdlr vc_conn; |
| 4136 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4137 | |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 4138 | pars.encr := f_encr_params('06'O, '02'O); /* A5/1 and A5/2 (0x02|0x04)*/ |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 4139 | |
| 4140 | f_init(1, true); |
| 4141 | f_vty_encryption_a5("1 2"); |
| 4142 | f_sleep(1.0); |
| 4143 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4144 | vc_conn.done; |
| 4145 | f_vty_encryption_a5_reset(); |
| 4146 | f_shutdown_helper(); |
| 4147 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4148 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 4149 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4150 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4151 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 4152 | |
| 4153 | f_init(1, true); |
| 4154 | f_sleep(1.0); |
| 4155 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4156 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4157 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4158 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 4159 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 4160 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 4161 | var MSC_ConnHdlr vc_conn; |
| 4162 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4163 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4164 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 4165 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 4166 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 4167 | f_sleep(1.0); |
| 4168 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 4169 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 4170 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 4171 | f_shutdown_helper(); |
| 4172 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4173 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 4174 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 4175 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4176 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 4177 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4178 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4179 | |
| 4180 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4181 | f_perform_clear(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4182 | } |
| 4183 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 4184 | var MSC_ConnHdlr vc_conn; |
| 4185 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4186 | |
| 4187 | f_init(1, true); |
| 4188 | f_sleep(1.0); |
| 4189 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 4190 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4191 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4192 | } |
| 4193 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4194 | |
| 4195 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4196 | private function f_tc_assignment_fr_a5(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4197 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4198 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4199 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4200 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4201 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 73cd271 | 2017-12-17 00:44:52 +0100 | [diff] [blame] | 4202 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4203 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4204 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4205 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4206 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 4207 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4208 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4209 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4210 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 4211 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4212 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4213 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4214 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4215 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4216 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4217 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4218 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4219 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4220 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4221 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 4222 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4223 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4224 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 4225 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4226 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4227 | } |
| 4228 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 4229 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4230 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4231 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4232 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 4233 | f_init(1, true); |
| 4234 | f_sleep(1.0); |
| 4235 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4236 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4237 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4238 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 4239 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 4240 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 4241 | var MSC_ConnHdlr vc_conn; |
| 4242 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4243 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 4244 | |
| 4245 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4246 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 4247 | f_sleep(1.0); |
| 4248 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 4249 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4250 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 4251 | f_shutdown_helper(); |
| 4252 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 4253 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 4254 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 4255 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 4256 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4257 | var MSC_ConnHdlr vc_conn; |
| 4258 | |
| 4259 | f_init(1, true); |
| 4260 | f_sleep(1.0); |
| 4261 | |
| 4262 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 4263 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 4264 | vc_conn.done; |
| 4265 | f_shutdown_helper(); |
| 4266 | } |
| 4267 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4268 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 4269 | private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4270 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4271 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4272 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4273 | |
| 4274 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4275 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 4276 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4277 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4278 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4279 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4280 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 4281 | var MSC_ConnHdlr vc_conn; |
| 4282 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 4283 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4284 | f_sleep(1.0); |
| 4285 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4286 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_1_codec_missing)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4287 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4288 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4289 | } |
| 4290 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4291 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 4292 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 4293 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4294 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4295 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4296 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4297 | |
| 4298 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 4299 | |
| 4300 | var BSSMAP_FIELD_CodecType codecType; |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4301 | |
| 4302 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 4303 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 4304 | |
| 4305 | f_create_chan_and_exp(); |
| 4306 | /* we should now have a COMPL_L3 at the MSC */ |
| 4307 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4308 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 4309 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4310 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4311 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4312 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 4313 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4314 | var MSC_ConnHdlr vc_conn; |
| 4315 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 4316 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4317 | f_sleep(1.0); |
| 4318 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 4319 | pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 4320 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4321 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4322 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4323 | } |
| 4324 | |
| 4325 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4326 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4327 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4328 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4329 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4330 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4331 | |
| 4332 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4333 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4334 | |
| 4335 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 4336 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 4337 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4338 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 4339 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 4340 | }; |
| 4341 | f_statsd_expect(expect); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4342 | f_perform_clear(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4343 | } |
| 4344 | |
| 4345 | testcase TC_assignment_sign() runs on test_CT { |
| 4346 | var MSC_ConnHdlr vc_conn; |
| 4347 | |
| 4348 | f_init(1, true); |
| 4349 | f_sleep(1.0); |
| 4350 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4351 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4352 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4353 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4354 | } |
| 4355 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4356 | /*********************************************************************** |
| 4357 | * Codec (list) testing |
| 4358 | ***********************************************************************/ |
| 4359 | |
| 4360 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 4361 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 4362 | return boolean { |
| 4363 | select (a_elem.codecType) { |
| 4364 | case (GSM_FR) { |
| 4365 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 4366 | return true; |
| 4367 | } |
| 4368 | } |
| 4369 | case (GSM_HR) { |
| 4370 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 4371 | return true; |
| 4372 | } |
| 4373 | } |
| 4374 | case (GSM_EFR) { |
| 4375 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 4376 | return true; |
| 4377 | } |
| 4378 | } |
| 4379 | case (FR_AMR) { |
| 4380 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 4381 | return true; |
| 4382 | } |
| 4383 | } |
| 4384 | case (HR_AMR) { |
| 4385 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 4386 | return true; |
| 4387 | } |
| 4388 | } |
| 4389 | case else { } |
| 4390 | } |
| 4391 | return false; |
| 4392 | } |
| 4393 | |
| 4394 | /* check if the given rsl_mode is compatible with the a_list */ |
| 4395 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 4396 | return boolean { |
| 4397 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 4398 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 4399 | return true; |
| 4400 | } |
| 4401 | } |
| 4402 | return false; |
| 4403 | } |
| 4404 | |
| 4405 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 4406 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4407 | return BSSMAP_IE_ChannelType { |
| 4408 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 4409 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 4410 | select (a_elem.codecType) { |
| 4411 | case (GSM_FR) { |
| 4412 | ret.channelRateAndType := ChRate_TCHF; |
| 4413 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 4414 | } |
| 4415 | case (GSM_HR) { |
| 4416 | ret.channelRateAndType := ChRate_TCHH; |
| 4417 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 4418 | } |
| 4419 | case (GSM_EFR) { |
| 4420 | ret.channelRateAndType := ChRate_TCHF; |
| 4421 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 4422 | } |
| 4423 | case (FR_AMR) { |
| 4424 | ret.channelRateAndType := ChRate_TCHF; |
| 4425 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 4426 | } |
| 4427 | case (HR_AMR) { |
| 4428 | ret.channelRateAndType := ChRate_TCHH; |
| 4429 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 4430 | } |
| 4431 | case else { |
| 4432 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4433 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4434 | } |
| 4435 | } |
| 4436 | return ret; |
| 4437 | } |
| 4438 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4439 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 4440 | return template RSL_IE_Body { |
| 4441 | var template RSL_IE_Body mode_ie := { |
| 4442 | chan_mode := { |
| 4443 | len := ?, |
| 4444 | reserved := ?, |
| 4445 | dtx_d := ?, |
| 4446 | dtx_u := ?, |
| 4447 | spd_ind := RSL_SPDI_SPEECH, |
| 4448 | ch_rate_type := -, |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4449 | u := { speech := - } |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4450 | } |
| 4451 | } |
| 4452 | |
| 4453 | select (a_elem.codecType) { |
| 4454 | case (GSM_FR) { |
| 4455 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4456 | mode_ie.chan_mode.u.speech := RSL_CMOD_SP_GSM1; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4457 | } |
| 4458 | case (GSM_HR) { |
| 4459 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4460 | mode_ie.chan_mode.u.speech := RSL_CMOD_SP_GSM1; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4461 | } |
| 4462 | case (GSM_EFR) { |
| 4463 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4464 | mode_ie.chan_mode.u.speech := RSL_CMOD_SP_GSM2; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4465 | } |
| 4466 | case (FR_AMR) { |
| 4467 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4468 | mode_ie.chan_mode.u.speech := RSL_CMOD_SP_GSM3; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4469 | } |
| 4470 | case (HR_AMR) { |
| 4471 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
Oliver Smith | 0033b12 | 2023-02-28 13:30:53 +0100 | [diff] [blame] | 4472 | mode_ie.chan_mode.u.speech := RSL_CMOD_SP_GSM3; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4473 | } |
| 4474 | } |
| 4475 | return mode_ie; |
| 4476 | } |
| 4477 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4478 | type record CodecListTest { |
| 4479 | BSSMAP_IE_SpeechCodecList codec_list, |
| 4480 | charstring id |
| 4481 | } |
| 4482 | type record of CodecListTest CodecListTests |
| 4483 | |
| 4484 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4485 | f_assignment_codec(id); |
| 4486 | } |
| 4487 | |
| 4488 | private function f_assignment_codec(charstring id, boolean do_perform_clear := true) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 4489 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux_cn); |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 4490 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4491 | |
| 4492 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4493 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4494 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4495 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 4496 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4497 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 4498 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 4499 | g_pars.expect_mr_s0_s7; |
| 4500 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4501 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4502 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4503 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4504 | log("expecting ASS COMPL like this: ", exp_compl); |
| 4505 | |
| 4506 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4507 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4508 | if (not g_pars.expect_channel_mode_modify) { |
| 4509 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 4510 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4511 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4512 | var RSL_IE_Body mode_ie; |
| 4513 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 4514 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4515 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4516 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4517 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4518 | if (not match(mode_ie, t_mode_ie)) { |
| 4519 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 4520 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4521 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4522 | |
| 4523 | var RSL_IE_Body mr_conf; |
| 4524 | if (g_pars.expect_mr_conf_ie != omit) { |
| 4525 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 4526 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 4527 | mtc.stop; |
| 4528 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4529 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4530 | |
| 4531 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
Vadim Yanitskiy | 8b18937 | 2022-09-14 17:31:17 +0700 | [diff] [blame] | 4532 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. ", |
| 4533 | "Expected: ", g_pars.expect_mr_conf_ie, ", got: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4534 | } |
| 4535 | } else { |
| 4536 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 4537 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 4538 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 4539 | mtc.stop; |
| 4540 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4541 | } |
| 4542 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4543 | |
| 4544 | if (do_perform_clear) { |
| 4545 | f_perform_clear(); |
| 4546 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4547 | } |
| 4548 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4549 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 4550 | |
| 4551 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4552 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4553 | |
| 4554 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4555 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4556 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4557 | } |
| 4558 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4559 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4560 | log("expecting ASS FAIL like this: ", exp_fail); |
| 4561 | |
| 4562 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4563 | f_perform_clear(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4564 | } |
| 4565 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4566 | const CounterNameVals counternames_bsc_bts_assignment := { |
| 4567 | { "assignment:attempted", 0 }, |
| 4568 | { "assignment:completed", 0 }, |
| 4569 | { "assignment:stopped", 0 }, |
| 4570 | { "assignment:no_channel", 0 }, |
| 4571 | { "assignment:timeout", 0 }, |
| 4572 | { "assignment:failed", 0 }, |
| 4573 | { "assignment:error", 0 } |
| 4574 | }; |
| 4575 | |
| 4576 | const CounterNameVals counternames_bts_assignment := { |
| 4577 | { "assignment:attempted_sign", 0 }, |
| 4578 | { "assignment:attempted_speech", 0 }, |
| 4579 | { "assignment:completed_sign", 0 }, |
| 4580 | { "assignment:completed_speech", 0 }, |
| 4581 | { "assignment:stopped_sign", 0 }, |
| 4582 | { "assignment:stopped_speech", 0 }, |
| 4583 | { "assignment:no_channel_sign", 0 }, |
| 4584 | { "assignment:no_channel_speech", 0 }, |
| 4585 | { "assignment:timeout_sign", 0 }, |
| 4586 | { "assignment:timeout_speech", 0 }, |
| 4587 | { "assignment:failed_sign", 0 }, |
| 4588 | { "assignment:failed_speech", 0 }, |
| 4589 | { "assignment:error_sign", 0 }, |
| 4590 | { "assignment:error_speech", 0 } |
| 4591 | }; |
| 4592 | |
| 4593 | function f_ctrs_bsc_and_bts_assignment_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 4594 | var CounterNameVals bts_names := counternames_bsc_bts_assignment & counternames_bts_assignment; |
| 4595 | f_ctrs_bts_init(bts_count, bts_names); |
| 4596 | f_ctrs_bsc_init(counternames_bsc_bts_assignment); |
| 4597 | } |
| 4598 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4599 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4600 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4601 | var MSC_ConnHdlr vc_conn; |
| 4602 | |
| 4603 | f_init(1, true); |
| 4604 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4605 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4606 | |
| 4607 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4608 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4609 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4610 | |
| 4611 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4612 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4613 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4614 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4615 | f_ctrs_bts_verify(); |
| 4616 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4617 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4618 | } |
| 4619 | |
| 4620 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4621 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4622 | var MSC_ConnHdlr vc_conn; |
| 4623 | |
| 4624 | f_init(1, true); |
| 4625 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4626 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4627 | |
| 4628 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4629 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4630 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4631 | |
| 4632 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4633 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4634 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4635 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4636 | f_ctrs_bts_verify(); |
| 4637 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4638 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4639 | } |
| 4640 | |
| 4641 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4642 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4643 | var MSC_ConnHdlr vc_conn; |
| 4644 | |
| 4645 | f_init(1, true); |
| 4646 | f_sleep(1.0); |
| 4647 | |
| 4648 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4649 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4650 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4651 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4652 | } |
| 4653 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4654 | /* Allow 5,90k only (current default config) */ |
| 4655 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4656 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4657 | "amr-config 12_2k forbidden", |
| 4658 | "amr-config 10_2k forbidden", |
| 4659 | "amr-config 7_95k forbidden", |
| 4660 | "amr-config 7_40k forbidden", |
| 4661 | "amr-config 6_70k forbidden", |
| 4662 | "amr-config 5_90k allowed", |
| 4663 | "amr-config 5_15k forbidden", |
| 4664 | "amr-config 4_75k forbidden" |
| 4665 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4666 | } |
| 4667 | |
| 4668 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 4669 | * ("Config-NB-Code = 1") */ |
| 4670 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4671 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4672 | "amr-config 12_2k allowed", |
| 4673 | "amr-config 10_2k forbidden", |
| 4674 | "amr-config 7_95k forbidden", |
| 4675 | "amr-config 7_40k allowed", |
| 4676 | "amr-config 6_70k forbidden", |
| 4677 | "amr-config 5_90k allowed", |
| 4678 | "amr-config 5_15k forbidden", |
| 4679 | "amr-config 4_75k allowed" |
| 4680 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4681 | } |
| 4682 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4683 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 4684 | var charstring tch; |
| 4685 | if (fr) { |
| 4686 | tch := "tch-f"; |
| 4687 | } else { |
| 4688 | tch := "tch-h"; |
| 4689 | } |
| 4690 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 4691 | } |
| 4692 | |
| 4693 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 4694 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 4695 | f_vty_amr_start_mode_set(fr, "auto"); |
| 4696 | } |
| 4697 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4698 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4699 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4700 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4701 | |
| 4702 | /* Note: This setups the codec configuration. The parameter payload in |
| 4703 | * mr_conf must be consistant with the parameter codecElements in pars |
| 4704 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4705 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4706 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4707 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
Vadim Yanitskiy | 5949470 | 2022-09-14 15:29:04 +0700 | [diff] [blame] | 4708 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4709 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4710 | f_init(1, true); |
| 4711 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4712 | f_vty_amr_start_mode_set(true, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4713 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4714 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4715 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4716 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4717 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4718 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4719 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4720 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4721 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4722 | f_ctrs_bts_verify(); |
| 4723 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4724 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4725 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4726 | } |
| 4727 | |
| 4728 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4729 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4730 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4731 | |
| 4732 | /* See note above */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4733 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4734 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4735 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
Vadim Yanitskiy | 5949470 | 2022-09-14 15:29:04 +0700 | [diff] [blame] | 4736 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4737 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4738 | f_init(1, true); |
| 4739 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4740 | f_vty_amr_start_mode_set(false, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4741 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4742 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4743 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4744 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4745 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4746 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4747 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4748 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4749 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4750 | f_ctrs_bts_verify(); |
| 4751 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4752 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4753 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4754 | } |
| 4755 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4756 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 4757 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 4758 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4759 | var MSC_ConnHdlr vc_conn; |
| 4760 | |
| 4761 | f_init(1, true); |
| 4762 | f_sleep(1.0); |
| 4763 | |
| 4764 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 4765 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 4766 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 4767 | f_disable_all_sdcch(); |
| 4768 | f_disable_all_tch_h(); |
| 4769 | |
| 4770 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4771 | pars.expect_channel_mode_modify := true; |
| 4772 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4773 | vc_conn.done; |
| 4774 | |
| 4775 | f_enable_all_sdcch(); |
| 4776 | f_enable_all_tch(); |
| 4777 | f_shutdown_helper(); |
| 4778 | } |
| 4779 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4780 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 4781 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 4782 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4783 | var MSC_ConnHdlr vc_conn; |
| 4784 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4785 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4786 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4787 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
Vadim Yanitskiy | 36fe958 | 2022-09-14 15:25:04 +0700 | [diff] [blame] | 4788 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
| 4789 | pars.expect_mr_conf_ie.multirate_cfg.icmi := false; /* expect ICMI=0, smod=00: */ |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4790 | |
| 4791 | f_init(1, true); |
| 4792 | f_sleep(1.0); |
| 4793 | |
| 4794 | /* First set nonzero start mode bits */ |
| 4795 | f_vty_amr_start_mode_set(true, "4"); |
| 4796 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4797 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4798 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4799 | f_vty_amr_start_mode_set(true, "auto"); |
| 4800 | |
| 4801 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4802 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4803 | |
| 4804 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4805 | f_vty_amr_start_mode_set(true, "1"); |
| 4806 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4807 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4808 | } |
| 4809 | |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4810 | function f_TC_assignment_codec_amr(boolean fr, RSL_IE_MultirateCfg mr_cfg, |
| 4811 | bitstring s8_s0, bitstring exp_s8_s0, |
| 4812 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4813 | runs on test_CT { |
| 4814 | |
| 4815 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4816 | var MSC_ConnHdlr vc_conn; |
| 4817 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4818 | if (fr) { |
| 4819 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4820 | } else { |
| 4821 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4822 | } |
| 4823 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4824 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4825 | pars.expect_mr_conf_ie := { multirate_cfg := mr_cfg }; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4826 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4827 | |
| 4828 | f_init(1, true); |
| 4829 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4830 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4831 | f_sleep(1.0); |
| 4832 | |
| 4833 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4834 | vc_conn.done; |
| 4835 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4836 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4837 | } |
| 4838 | |
| 4839 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4840 | runs on test_CT { |
| 4841 | |
| 4842 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4843 | var MSC_ConnHdlr vc_conn; |
| 4844 | |
| 4845 | if (fr) { |
| 4846 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4847 | } else { |
| 4848 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4849 | } |
| 4850 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4851 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4852 | |
| 4853 | f_init(1, true); |
| 4854 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4855 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4856 | f_sleep(1.0); |
| 4857 | |
| 4858 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4859 | vc_conn.done; |
| 4860 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4861 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4862 | } |
| 4863 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4864 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4865 | * set. */ |
| 4866 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4867 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '10010101'B, |
| 4868 | params := '20882208'O)); |
| 4869 | f_TC_assignment_codec_amr(true, mr_cfg, '00000011'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4870 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4871 | } |
| 4872 | |
| 4873 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4874 | * rates set. */ |
| 4875 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4876 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00010101'B, |
| 4877 | params := '208820'O)); |
| 4878 | f_TC_assignment_codec_amr(false, mr_cfg, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4879 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4880 | } |
| 4881 | |
| 4882 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4883 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4884 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4885 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '10010101'B, |
| 4886 | params := '20882208'O)); |
| 4887 | f_TC_assignment_codec_amr(true, mr_cfg, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4888 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4889 | } |
| 4890 | |
| 4891 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4892 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4893 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4894 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00010101'B, |
| 4895 | params := '208820'O)); |
| 4896 | f_TC_assignment_codec_amr(false, mr_cfg, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4897 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4898 | } |
| 4899 | |
| 4900 | /* The following block of tests selects more and more rates until all four |
| 4901 | * possible rates are in the active set (full rate) */ |
| 4902 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4903 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00000001'B)); |
| 4904 | f_TC_assignment_codec_amr(true, mr_cfg, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4905 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4906 | } |
| 4907 | |
| 4908 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4909 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00000101'B, |
| 4910 | params := '2080'O)); |
| 4911 | f_TC_assignment_codec_amr(true, mr_cfg, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4912 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4913 | } |
| 4914 | |
| 4915 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4916 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00010101'B, |
| 4917 | params := '208820'O)); |
| 4918 | f_TC_assignment_codec_amr(true, mr_cfg, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4919 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4920 | } |
| 4921 | |
| 4922 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4923 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '10010101'B, |
| 4924 | params := '20882208'O)); |
| 4925 | f_TC_assignment_codec_amr(true, mr_cfg, '10010101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4926 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4927 | } |
| 4928 | |
| 4929 | /* The following block of tests selects more and more rates until all three |
| 4930 | * possible rates are in the active set (half rate) */ |
| 4931 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4932 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00000001'B)); |
| 4933 | f_TC_assignment_codec_amr(false, mr_cfg, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4934 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4935 | } |
| 4936 | |
| 4937 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4938 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00000101'B, |
| 4939 | params := '2080'O)); |
| 4940 | f_TC_assignment_codec_amr(false, mr_cfg, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4941 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4942 | } |
| 4943 | |
| 4944 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4945 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00010101'B, |
| 4946 | params := '208820'O)); |
| 4947 | f_TC_assignment_codec_amr(false, mr_cfg, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4948 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4949 | } |
| 4950 | |
| 4951 | /* The following block tests what happens when the MSC does offer rate |
| 4952 | * configurations that are not supported by the BSC. Normally such situations |
| 4953 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4954 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4955 | * to offer rates that are not applicable anyway. */ |
| 4956 | |
| 4957 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4958 | /* Try to include 12,2k in into the active set even though the channel |
| 4959 | * is half rate only. The BSC is expected to remove the 12,0k */ |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4960 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '00010101'B, |
| 4961 | params := '208820'O)); |
| 4962 | f_TC_assignment_codec_amr(false, mr_cfg, '10010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4963 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4964 | } |
| 4965 | |
| 4966 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4967 | /* See what happens when all rates are selected at once. Since then |
| 4968 | * Also S1 is selected, this setting will be prefered and we should |
| 4969 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4970 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '10010101'B, |
| 4971 | params := '20882208'O)); |
| 4972 | f_TC_assignment_codec_amr(true, mr_cfg, '11111111'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4973 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4974 | } |
| 4975 | |
| 4976 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4977 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4978 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4979 | * 5,90k, and 4,75k, into the active set. */ |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 4980 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(codec_modes := '10010101'B, |
| 4981 | params := '20882208'O)); |
| 4982 | f_TC_assignment_codec_amr(true, mr_cfg, '11111101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4983 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4984 | } |
| 4985 | |
| 4986 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4987 | /* Try to select no rates at all */ |
| 4988 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4989 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4990 | } |
| 4991 | |
| 4992 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4993 | /* Try to select only unsupported rates */ |
| 4994 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4995 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4996 | } |
| 4997 | |
| 4998 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4999 | /* Try to select 12,2k for half rate */ |
| 5000 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5001 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 5002 | } |
| 5003 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 5004 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 5005 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(icmi := false, |
| 5006 | codec_modes := '10010101'B, |
| 5007 | params := '20882208'O)); |
| 5008 | f_TC_assignment_codec_amr(true, mr_cfg, '11111111'B, '00000010'B, start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5009 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 5010 | } |
| 5011 | |
| 5012 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 5013 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(icmi := false, |
| 5014 | codec_modes := '00010101'B, |
| 5015 | params := '208820'O)); |
| 5016 | f_TC_assignment_codec_amr(false, mr_cfg, '10010101'B, '00010101'B, |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 5017 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5018 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 5019 | } |
| 5020 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 5021 | testcase TC_assignment_codec_amr_f_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 5022 | /* "amr tch-f modes 0 2 4 7" => total 4 modes and start mode 4 => '11'B on the wire */ |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 5023 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(start_mode := 3, |
| 5024 | codec_modes := '10010101'B, |
| 5025 | params := '20882208'O)); |
| 5026 | f_TC_assignment_codec_amr(true, mr_cfg, '11111111'B, '00000010'B, start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5027 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 5028 | } |
| 5029 | |
| 5030 | testcase TC_assignment_codec_amr_h_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 5031 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
Vadim Yanitskiy | 3998c03 | 2022-09-14 17:19:44 +0700 | [diff] [blame] | 5032 | var RSL_IE_MultirateCfg mr_cfg := valueof(ts_RSL_MultirateCfg(start_mode := 2, |
| 5033 | codec_modes := '00010101'B, |
| 5034 | params := '208820'O)); |
| 5035 | f_TC_assignment_codec_amr(false, mr_cfg, '10010101'B, '00010101'B, start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5036 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 5037 | } |
| 5038 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5039 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 5040 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 5041 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 5042 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 5043 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 borken"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5044 | } |
| 5045 | |
| 5046 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 5047 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 5048 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 borken"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5049 | } |
| 5050 | |
| 5051 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 5052 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 5053 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 5054 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 5055 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 5056 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 5057 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 1 unused"); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5058 | } |
| 5059 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 5060 | private function f_disable_all_sdcch() runs on test_CT { |
| 5061 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 5062 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 5063 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 5064 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 5065 | } |
| 5066 | |
| 5067 | private function f_enable_all_sdcch() runs on test_CT { |
| 5068 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 5069 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 5070 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 5071 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 5072 | } |
| 5073 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5074 | /* Allow HR only */ |
| 5075 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 5076 | g_pars := f_gen_test_hdlr_pars(); |
| 5077 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5078 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5079 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5080 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 5081 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 5082 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 5083 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5084 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5085 | } |
| 5086 | |
| 5087 | /* Allow FR only */ |
| 5088 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 5089 | g_pars := f_gen_test_hdlr_pars(); |
| 5090 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5091 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5092 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5093 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 5094 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 5095 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5096 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5097 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5098 | } |
| 5099 | |
| 5100 | /* Allow HR only (expect assignment failure) */ |
| 5101 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 5102 | g_pars := f_gen_test_hdlr_pars(); |
| 5103 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5104 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 5105 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5106 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 5107 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 5108 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 5109 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5110 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5111 | } |
| 5112 | |
| 5113 | /* Allow FR only (expect assignment failure) */ |
| 5114 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 5115 | g_pars := f_gen_test_hdlr_pars(); |
| 5116 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5117 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 5118 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5119 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 5120 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 5121 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5122 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5123 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5124 | } |
| 5125 | |
| 5126 | /* Allow FR and HR, but prefer FR */ |
| 5127 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 5128 | g_pars := f_gen_test_hdlr_pars(); |
| 5129 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5130 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5131 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5132 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 5133 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 5134 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 5135 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 5136 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5137 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5138 | } |
| 5139 | |
| 5140 | /* Allow FR and HR, but prefer HR */ |
| 5141 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 5142 | g_pars := f_gen_test_hdlr_pars(); |
| 5143 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5144 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5145 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5146 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 5147 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 5148 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 5149 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 5150 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5151 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5152 | } |
| 5153 | |
| 5154 | /* Allow FR and HR, but prefer FR */ |
| 5155 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 5156 | g_pars := f_gen_test_hdlr_pars(); |
| 5157 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5158 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5159 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5160 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 5161 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 5162 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 5163 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 5164 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5165 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5166 | } |
| 5167 | |
| 5168 | /* Allow FR and HR, but prefer HR */ |
| 5169 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 5170 | g_pars := f_gen_test_hdlr_pars(); |
| 5171 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5172 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5173 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5174 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 5175 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 5176 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 5177 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 5178 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5179 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5180 | } |
| 5181 | |
| 5182 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 5183 | * to work without conflicts */ |
| 5184 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 5185 | var MSC_ConnHdlr vc_conn; |
| 5186 | f_init(1, true); |
| 5187 | f_sleep(1.0); |
| 5188 | f_enable_all_tch(); |
| 5189 | f_disable_all_tch_f(); |
| 5190 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 5191 | vc_conn.done; |
| 5192 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5193 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5194 | } |
| 5195 | |
| 5196 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 5197 | * to fail. */ |
| 5198 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 5199 | var MSC_ConnHdlr vc_conn; |
| 5200 | f_init(1, true); |
| 5201 | f_sleep(1.0); |
| 5202 | f_enable_all_tch(); |
| 5203 | f_disable_all_tch_f(); |
| 5204 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 5205 | vc_conn.done; |
| 5206 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5207 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5208 | } |
| 5209 | |
| 5210 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 5211 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 5212 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 5213 | var MSC_ConnHdlr vc_conn; |
| 5214 | f_init(1, true); |
| 5215 | f_sleep(1.0); |
| 5216 | f_enable_all_tch(); |
| 5217 | f_disable_all_tch_f(); |
| 5218 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 5219 | vc_conn.done; |
| 5220 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5221 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5222 | } |
| 5223 | |
| 5224 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 5225 | * are exhausted, this is expected to work without conflicts. */ |
| 5226 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 5227 | var MSC_ConnHdlr vc_conn; |
| 5228 | f_init(1, true); |
| 5229 | f_sleep(1.0); |
| 5230 | f_enable_all_tch(); |
| 5231 | f_disable_all_tch_f(); |
| 5232 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 5233 | vc_conn.done; |
| 5234 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5235 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5236 | } |
| 5237 | |
| 5238 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 5239 | * to work without conflicts */ |
| 5240 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 5241 | var MSC_ConnHdlr vc_conn; |
| 5242 | f_init(1, true); |
| 5243 | f_sleep(1.0); |
| 5244 | f_enable_all_tch(); |
| 5245 | f_disable_all_tch_h(); |
| 5246 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 5247 | vc_conn.done; |
| 5248 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5249 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5250 | } |
| 5251 | |
| 5252 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 5253 | * to fail. */ |
| 5254 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 5255 | var MSC_ConnHdlr vc_conn; |
| 5256 | f_init(1, true); |
| 5257 | f_sleep(1.0); |
| 5258 | f_enable_all_tch(); |
| 5259 | f_disable_all_tch_h(); |
| 5260 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 5261 | vc_conn.done; |
| 5262 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5263 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5264 | } |
| 5265 | |
| 5266 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 5267 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 5268 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 5269 | var MSC_ConnHdlr vc_conn; |
| 5270 | f_init(1, true); |
| 5271 | f_sleep(1.0); |
| 5272 | f_enable_all_tch(); |
| 5273 | f_disable_all_tch_h(); |
| 5274 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 5275 | vc_conn.done; |
| 5276 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5277 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5278 | } |
| 5279 | |
| 5280 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 5281 | * are exhausted, this is expected to work without conflicts. */ |
| 5282 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 5283 | var MSC_ConnHdlr vc_conn; |
| 5284 | f_init(1, true); |
| 5285 | f_sleep(1.0); |
| 5286 | f_enable_all_tch(); |
| 5287 | f_disable_all_tch_h(); |
| 5288 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 5289 | vc_conn.done; |
| 5290 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5291 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5292 | } |
| 5293 | |
| 5294 | /* Allow FR and HR, but prefer HR */ |
| 5295 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 5296 | g_pars := f_gen_test_hdlr_pars(); |
| 5297 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5298 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5299 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5300 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 5301 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 5302 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 5303 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 5304 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5305 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5306 | } |
| 5307 | |
| 5308 | /* Allow FR and HR, but prefer FR */ |
| 5309 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 5310 | g_pars := f_gen_test_hdlr_pars(); |
| 5311 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5312 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5313 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5314 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 5315 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 5316 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 5317 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 5318 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5319 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5320 | } |
| 5321 | |
| 5322 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 5323 | * HR, which is the prefered type, is selected. */ |
| 5324 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 5325 | var MSC_ConnHdlr vc_conn; |
| 5326 | f_init(1, true); |
| 5327 | f_sleep(1.0); |
| 5328 | f_enable_all_tch(); |
| 5329 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 5330 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5331 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5332 | } |
| 5333 | |
| 5334 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 5335 | * FR, which is the prefered type, is selected. */ |
| 5336 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 5337 | var MSC_ConnHdlr vc_conn; |
| 5338 | f_init(1, true); |
| 5339 | f_sleep(1.0); |
| 5340 | f_enable_all_tch(); |
| 5341 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 5342 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5343 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5344 | } |
| 5345 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5346 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 5347 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 5348 | g_pars := f_gen_test_hdlr_pars(); |
| 5349 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 5350 | |
| 5351 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 5352 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 5353 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 5354 | var template uint3_t tsc := ?; |
| 5355 | |
| 5356 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 5357 | f_create_bssmap_exp(l3_enc); |
| 5358 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 5359 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 5360 | |
| 5361 | /* we should now have a COMPL_L3 at the MSC */ |
| 5362 | timer T := 10.0; |
| 5363 | T.start; |
| 5364 | alt { |
| 5365 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 5366 | [] T.timeout { |
| 5367 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 5368 | } |
| 5369 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5370 | |
| 5371 | f_perform_clear(); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5372 | } |
| 5373 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 5374 | var MSC_ConnHdlr vc_conn; |
| 5375 | f_init(1, true); |
| 5376 | f_sleep(1.0); |
| 5377 | f_disable_all_sdcch(); |
| 5378 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 5379 | vc_conn.done; |
| 5380 | f_enable_all_sdcch(); |
| 5381 | f_shutdown_helper(); |
| 5382 | } |
| 5383 | |
| 5384 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 5385 | expected that no TCH will be selected for signalling and assigment will fail |
| 5386 | because it's dictated by VTY config */ |
| 5387 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 5388 | var RSL_Message rsl_unused, rsl_msg; |
| 5389 | var GsmRrMessage rr; |
| 5390 | f_init(1, false); |
| 5391 | f_sleep(1.0); |
| 5392 | f_vty_allow_tch_for_signalling(false, 0); |
| 5393 | f_disable_all_sdcch(); |
| 5394 | |
| 5395 | /* RA containing reason=LU */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 5396 | f_ipa_tx(ts_RSL_CHAN_RQD('02'O, 2342)); |
| 5397 | rsl_msg := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5398 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 5399 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 5400 | setverdict(fail, "Expected reject"); |
| 5401 | } |
| 5402 | |
| 5403 | f_vty_allow_tch_for_signalling(true, 0); |
| 5404 | f_enable_all_sdcch(); |
| 5405 | f_shutdown_helper(); |
| 5406 | } |
| 5407 | |
| 5408 | /* Request a voice channel with all SDCCH exhausted, it is |
| 5409 | * expected that TCH channel will be allocated since the VTY option is only |
| 5410 | * aimed at signalling requests */ |
| 5411 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 5412 | g_pars := f_gen_test_hdlr_pars(); |
| 5413 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 5414 | |
| 5415 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 5416 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 5417 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 5418 | var template uint3_t tsc := ?; |
| 5419 | |
| 5420 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 5421 | f_create_bssmap_exp(l3_enc); |
| 5422 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 5423 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 5424 | |
| 5425 | /* we should now have a COMPL_L3 at the MSC */ |
| 5426 | timer T := 10.0; |
| 5427 | T.start; |
| 5428 | alt { |
| 5429 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 5430 | [] T.timeout { |
| 5431 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 5432 | } |
| 5433 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5434 | f_perform_clear(); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5435 | } |
| 5436 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 5437 | var MSC_ConnHdlr vc_conn; |
| 5438 | f_init(1, true); |
| 5439 | f_sleep(1.0); |
| 5440 | f_vty_allow_tch_for_signalling(false, 0); |
| 5441 | f_disable_all_sdcch(); |
| 5442 | |
| 5443 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 5444 | vc_conn.done; |
| 5445 | |
| 5446 | f_vty_allow_tch_for_signalling(true, 0); |
| 5447 | f_enable_all_sdcch(); |
| 5448 | f_shutdown_helper(); |
| 5449 | } |
| 5450 | |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 5451 | /* Test Osmux setup BSC<->MSC */ |
| 5452 | testcase TC_assignment_osmux_cn() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5453 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5454 | var MSC_ConnHdlr vc_conn; |
| 5455 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5456 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 5457 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 5458 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
Vadim Yanitskiy | b9bf00f | 2022-09-14 15:35:37 +0700 | [diff] [blame] | 5459 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 5460 | pars.use_osmux_cn := true; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5461 | |
Pau Espin Pedrol | 9b94149 | 2022-08-08 18:26:17 +0200 | [diff] [blame] | 5462 | g_osmux_enabled_cn := true; |
| 5463 | f_init(1, true); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5464 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5465 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5466 | |
| 5467 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5468 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5469 | |
| 5470 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 5471 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5472 | } |
| 5473 | |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 5474 | /* Test Osmux setup BTS<->BSC */ |
| 5475 | testcase TC_assignment_osmux_bts() runs on test_CT { |
| 5476 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5477 | var MSC_ConnHdlr vc_conn; |
| 5478 | |
| 5479 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 5480 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 5481 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
Vadim Yanitskiy | 5949470 | 2022-09-14 15:29:04 +0700 | [diff] [blame] | 5482 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 5483 | pars.use_osmux_bts := true; |
| 5484 | |
| 5485 | g_osmux_enabled_bts := true; |
| 5486 | f_init(1, true); |
| 5487 | f_sleep(1.0); |
| 5488 | f_vty_amr_start_mode_set(false, "1"); |
| 5489 | |
| 5490 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5491 | vc_conn.done; |
| 5492 | |
| 5493 | f_vty_amr_start_mode_restore(false); |
| 5494 | f_shutdown_helper(); |
| 5495 | } |
| 5496 | |
Pau Espin Pedrol | cd6077f | 2022-09-19 20:23:37 +0200 | [diff] [blame] | 5497 | /* Test non-AMR codecs still work fine as RTP when Osmux is enabled BTS<->BSC<->MSC */ |
| 5498 | testcase TC_assignment_codec_hr_osmux_on() runs on test_CT { |
| 5499 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5500 | var MSC_ConnHdlr vc_conn; |
| 5501 | |
| 5502 | g_osmux_enabled_cn := true; |
| 5503 | g_osmux_enabled_bts := true; |
| 5504 | f_init(1, true); |
| 5505 | f_sleep(1.0); |
| 5506 | f_ctrs_bsc_and_bts_assignment_init(1); |
| 5507 | |
| 5508 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 5509 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5510 | vc_conn.done; |
| 5511 | |
| 5512 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 5513 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 5514 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 5515 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 5516 | f_ctrs_bts_verify(); |
| 5517 | |
| 5518 | f_shutdown_helper(); |
| 5519 | } |
| 5520 | |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 5521 | /* Test Osmux setup BTS<->BSC<->MSC */ |
| 5522 | testcase TC_assignment_osmux() runs on test_CT { |
| 5523 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5524 | var MSC_ConnHdlr vc_conn; |
| 5525 | |
| 5526 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 5527 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 5528 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
Vadim Yanitskiy | 5949470 | 2022-09-14 15:29:04 +0700 | [diff] [blame] | 5529 | pars.expect_mr_conf_ie := c_mr_conf_5_90; |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 5530 | pars.use_osmux_cn := true; |
| 5531 | pars.use_osmux_bts := true; |
| 5532 | |
| 5533 | g_osmux_enabled_cn := true; |
| 5534 | g_osmux_enabled_bts := true; |
| 5535 | f_init(1, true); |
| 5536 | f_sleep(1.0); |
| 5537 | f_vty_amr_start_mode_set(false, "1"); |
| 5538 | |
| 5539 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5540 | vc_conn.done; |
| 5541 | |
| 5542 | f_vty_amr_start_mode_restore(false); |
| 5543 | f_shutdown_helper(); |
| 5544 | } |
| 5545 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5546 | /* test the procedure of the MSC requesting a Classmark Update: |
| 5547 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 5548 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5549 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 5550 | g_pars := f_gen_test_hdlr_pars(); |
| 5551 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5552 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5553 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5554 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5555 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 5556 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 5557 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5558 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 5559 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 5560 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5561 | |
| 5562 | f_perform_clear(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5563 | } |
| 5564 | testcase TC_classmark() runs on test_CT { |
| 5565 | var MSC_ConnHdlr vc_conn; |
| 5566 | f_init(1, true); |
| 5567 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5568 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5569 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5570 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5571 | } |
| 5572 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5573 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 5574 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 5575 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 5576 | g_pars := f_gen_test_hdlr_pars(); |
| 5577 | f_MscConnHdlr_init_vty(); |
| 5578 | |
| 5579 | f_create_chan_and_exp(); |
| 5580 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5581 | |
| 5582 | /* Send CommonID */ |
| 5583 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 5584 | |
| 5585 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 5586 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 5587 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 5588 | |
| 5589 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5590 | |
| 5591 | f_perform_clear(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5592 | } |
| 5593 | testcase TC_common_id() runs on test_CT { |
| 5594 | var MSC_ConnHdlr vc_conn; |
| 5595 | f_init(1, true); |
| 5596 | f_sleep(1.0); |
| 5597 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 5598 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5599 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5600 | } |
| 5601 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5602 | private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 5603 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5604 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5605 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5606 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5607 | /* send the single message we want to send */ |
| 5608 | f_rsl_send_l3(l3); |
| 5609 | } |
| 5610 | |
| 5611 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 5612 | timer T := sec; |
| 5613 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5614 | T.start; |
| 5615 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5616 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 5617 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5618 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5619 | } |
| 5620 | [] T.timeout { |
| 5621 | setverdict(pass); |
| 5622 | } |
| 5623 | } |
| 5624 | } |
| 5625 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5626 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5627 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 5628 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 5629 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5630 | f_perform_clear(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5631 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5632 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 5633 | var MSC_ConnHdlr vc_conn; |
| 5634 | f_init(1, true); |
| 5635 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5636 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5637 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5638 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5639 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5640 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5641 | |
| 5642 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5643 | private function f_tc_unsol_ass_compl(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5644 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 5645 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5646 | f_perform_clear(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5647 | } |
| 5648 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 5649 | var MSC_ConnHdlr vc_conn; |
| 5650 | f_init(1, true); |
| 5651 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5652 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5653 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5654 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5655 | } |
| 5656 | |
| 5657 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5658 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5659 | private function f_tc_unsol_ho_fail(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5660 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 5661 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5662 | f_perform_clear(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5663 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5664 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 5665 | var MSC_ConnHdlr vc_conn; |
| 5666 | f_init(1, true); |
| 5667 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5668 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5669 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5670 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5671 | } |
| 5672 | |
| 5673 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5674 | /* short message from MS should be ignored */ |
| 5675 | private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 5676 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5677 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5678 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5679 | |
| 5680 | /* send short message */ |
| 5681 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 5682 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5683 | f_perform_clear(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5684 | } |
| 5685 | testcase TC_err_82_short_msg() runs on test_CT { |
| 5686 | var MSC_ConnHdlr vc_conn; |
| 5687 | f_init(1, true); |
| 5688 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5689 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5690 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5691 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5692 | } |
| 5693 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5694 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 5695 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
Andreas Eversberg | 9ff96e6 | 2023-07-25 12:37:42 +0200 | [diff] [blame] | 5696 | f_est_single_l3(ts_RRM_DTM_ASS_FAIL('00'O)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5697 | timer T := 3.0 |
| 5698 | alt { |
| 5699 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 5700 | setverdict(pass); |
| 5701 | } |
| 5702 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 5703 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5704 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5705 | f_perform_clear(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5706 | } |
| 5707 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 5708 | var MSC_ConnHdlr vc_conn; |
| 5709 | f_init(1, true); |
| 5710 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5711 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5712 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5713 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5714 | } |
| 5715 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5716 | /*********************************************************************** |
| 5717 | * Handover |
| 5718 | ***********************************************************************/ |
| 5719 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5720 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 5721 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 5722 | runs on test_CT { |
| 5723 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5724 | " timeslot "&int2str(ts_nr)&" "; |
| 5725 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 5726 | } |
| 5727 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5728 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5729 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 5730 | uint8_t bts_nr, uint8_t trx_nr, |
| 5731 | in RslChannelNr chan_nr) |
| 5732 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5733 | /* FIXME: resolve those from component-global state */ |
| 5734 | var integer ts_nr := chan_nr.tn; |
| 5735 | var integer ss_nr; |
| 5736 | if (ischosen(chan_nr.u.ch0)) { |
| 5737 | ss_nr := 0; |
| 5738 | } else if (ischosen(chan_nr.u.lm)) { |
| 5739 | ss_nr := chan_nr.u.lm.sub_chan; |
| 5740 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 5741 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 5742 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 5743 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 5744 | } else { |
| 5745 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5746 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5747 | } |
| 5748 | |
| 5749 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5750 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5751 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5752 | } |
| 5753 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5754 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 5755 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 5756 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 5757 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 5758 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5759 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 5760 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 5761 | { |
| 5762 | f_vty_ss_action(pt, "handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5763 | } |
| 5764 | |
| 5765 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 5766 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 5767 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5768 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5769 | |
| 5770 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5771 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5772 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5773 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5774 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5775 | |
| 5776 | var HandoverState hs := { |
| 5777 | rr_ho_cmpl_seen := false, |
| 5778 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5779 | old_chan_nr := -, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 5780 | expect_target_tsc := c_BtsParams[1].tsc |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5781 | }; |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5782 | /* issue hand-over command on VTY, from BTS 0 to BTS 1 */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5783 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5784 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5785 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5786 | |
| 5787 | /* From the MGW perspective, a handover is is characterized by |
| 5788 | * performing one MDCX operation with the MGW. So we expect to see |
| 5789 | * one more MDCX during handover. */ |
| 5790 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5791 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5792 | alt { |
| 5793 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5794 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5795 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 5796 | /* Since this is an internal handover we expect the BSC to inform the |
| 5797 | * MSC about the event */ |
| 5798 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 5799 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5800 | /* Check the amount of MGCP transactions is still consistant with the |
| 5801 | * test expectation */ |
| 5802 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5803 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5804 | var RSL_Message chan_act := f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr); |
| 5805 | |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5806 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 5807 | * g_chan_nr to the new lchan that was handed over to. It lives in bts 1, so look it up at RSL1_PROC. */ |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5808 | f_verify_encr_info(chan_act); |
| 5809 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 5810 | f_chan_act_verify_tsc(chan_act, c_BtsParams[1].tsc); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5811 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5812 | f_perform_clear(RSL1, RSL1_PROC); |
| 5813 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5814 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5815 | } |
| 5816 | |
| 5817 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5818 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5819 | var MSC_ConnHdlr vc_conn; |
| 5820 | f_init(2, true); |
| 5821 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5822 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 5823 | pars.expect_tsc := c_BtsParams[0].tsc; |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5824 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5825 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5826 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5827 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5828 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5829 | |
| 5830 | /* from f_establish_fully() */ |
| 5831 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5832 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5833 | /* from handover */ |
| 5834 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5835 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5836 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5837 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5838 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5839 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5840 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 5841 | f_shutdown_helper(ho := true); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5842 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5843 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5844 | function f_tc_ho_int_a5(OCT1 encr_alg, charstring enc_a5 := "0 1 3") runs on test_CT { |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5845 | var MSC_ConnHdlr vc_conn; |
| 5846 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5847 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5848 | |
| 5849 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5850 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5851 | f_sleep(1.0); |
| 5852 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5853 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5854 | |
| 5855 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 5856 | vc_conn.done; |
| 5857 | |
| 5858 | /* from f_establish_fully() */ |
| 5859 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5860 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5861 | /* from handover */ |
| 5862 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5863 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5864 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5865 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5866 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5867 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5868 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5869 | f_vty_encryption_a5_reset(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 5870 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5871 | } |
| 5872 | |
| 5873 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 5874 | f_tc_ho_int_a5('01'O); |
| 5875 | } |
| 5876 | |
| 5877 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 5878 | f_tc_ho_int_a5('02'O); |
| 5879 | } |
| 5880 | |
| 5881 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 5882 | f_tc_ho_int_a5('08'O); |
| 5883 | } |
| 5884 | |
| 5885 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5886 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5887 | } |
| 5888 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5889 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 5890 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 5891 | g_pars := f_gen_test_hdlr_pars(); |
| 5892 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5893 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5894 | |
| 5895 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5896 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5897 | |
| 5898 | f_establish_fully(ass_cmd, exp_compl); |
| 5899 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 5900 | |
| 5901 | var HandoverState hs := { |
| 5902 | rr_ho_cmpl_seen := false, |
| 5903 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5904 | old_chan_nr := -, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 5905 | expect_target_tsc := c_BtsParams[1].tsc |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5906 | }; |
| 5907 | /* issue hand-over command on VTY */ |
| 5908 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 5909 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5910 | f_rslem_suspend(RSL1_PROC); |
| 5911 | |
| 5912 | /* From the MGW perspective, a handover is is characterized by |
| 5913 | * performing one MDCX operation with the MGW. So we expect to see |
| 5914 | * one more MDCX during handover. */ |
| 5915 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5916 | |
| 5917 | var RSL_Message rsl; |
| 5918 | var PDU_ML3_NW_MS l3; |
| 5919 | var RslChannelNr new_chan_nr; |
| 5920 | var GsmArfcn arfcn; |
| 5921 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5922 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5923 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5924 | setverdict(fail, "Expected handoverCommand"); |
| 5925 | mtc.stop; |
| 5926 | } |
| 5927 | } |
| 5928 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5929 | new_chan_nr, arfcn); |
| 5930 | |
| 5931 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5932 | |
| 5933 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5934 | * before performing a hand-over */ |
| 5935 | f_rslem_resume(RSL1_PROC); |
| 5936 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5937 | |
| 5938 | f_sleep(1.0); |
| 5939 | |
| 5940 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5941 | * and the old lchan reports a Radio Link Failure. */ |
| 5942 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5943 | |
| 5944 | var PDU_BSSAP rx_clear_request; |
| 5945 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5946 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5947 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5948 | |
| 5949 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5950 | |
| 5951 | var MgcpCommand mgcp; |
| 5952 | interleave { |
| 5953 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5954 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5955 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5956 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5957 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5958 | } |
| 5959 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5960 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5961 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5962 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5963 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5964 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 5965 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 5966 | } |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5967 | } |
| 5968 | |
| 5969 | f_sleep(0.5); |
| 5970 | setverdict(pass); |
| 5971 | } |
| 5972 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5973 | var MSC_ConnHdlr vc_conn; |
| 5974 | f_init(2, true); |
| 5975 | f_sleep(1.0); |
| 5976 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5977 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5978 | |
| 5979 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5980 | vc_conn.done; |
| 5981 | |
| 5982 | /* from f_establish_fully() */ |
| 5983 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5984 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5985 | /* from handover */ |
| 5986 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5987 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5988 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5989 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5990 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5991 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:stopped"); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5992 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 5993 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5994 | } |
| 5995 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5996 | /* Expecting MGCP to DLCX the endpoint's two connections: towards BTS and towards MSC */ |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5997 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5998 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5999 | var template MgcpResponse mgcp_resp; |
| 6000 | var MGCP_RecvFrom mrf; |
| 6001 | var template MgcpMessage msg_resp; |
| 6002 | var template MgcpMessage msg_dlcx := { |
| 6003 | command := tr_DLCX() |
| 6004 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6005 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 6006 | if (g_pars.aoip) { |
| 6007 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6008 | log("Got first DLCX: ", mgcp); |
| 6009 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 6010 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6011 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6012 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 6013 | log("Got second DLCX: ", mgcp); |
| 6014 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 6015 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 6016 | } else { |
| 6017 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 6018 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 6019 | log("Got first DLCX: ", mrf.msg.command); |
| 6020 | msg_resp := { |
| 6021 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 6022 | } |
| 6023 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 6024 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6025 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6026 | } |
| 6027 | |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 6028 | private function f_ho_out_of_this_bsc(template (omit) BSSMAP_oldToNewBSSIEs exp_oldToNewBSSIEs := omit, |
| 6029 | boolean skip_meas_rep := false) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6030 | |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 6031 | if (not skip_meas_rep) { |
| 6032 | var NcellReports neighbor_rep := { |
| 6033 | { rxlev := 20, bcch_freq := 0, bsic := 11 } |
| 6034 | }; |
| 6035 | var octetstring l3_mr := enc_GsmRrL3Message(valueof(ts_MEAS_REP(true, 8, 8, reps := neighbor_rep))); |
| 6036 | RSL.send(ts_RSL_MEAS_RES(g_chan_nr, 0, ts_RSL_IE_UplinkMeas, ts_RSL_IE_BS_Power(0), ts_RSL_IE_L1Info, |
| 6037 | l3_mr, 0)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6038 | |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 6039 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
| 6040 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6041 | |
| 6042 | f_sleep(0.5); |
| 6043 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 6044 | * the other BSS and comes back with a BSSMAP Handover Command |
| 6045 | * containing an RR Handover Command coming from the target BSS... */ |
| 6046 | |
| 6047 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 6048 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 6049 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 6050 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 6051 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 6052 | |
| 6053 | /* expect the Handover Command to go out on RR */ |
| 6054 | var RSL_Message rsl_ho_cmd |
| 6055 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 6056 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 6057 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 6058 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 6059 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 6060 | setverdict(fail); |
| 6061 | } else { |
| 6062 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 6063 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 6064 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 6065 | setverdict(fail); |
| 6066 | } else { |
| 6067 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 6068 | setverdict(pass); |
| 6069 | } |
| 6070 | } |
| 6071 | |
| 6072 | /* When the other BSS has reported a completed handover, this side is |
| 6073 | * torn down. */ |
| 6074 | |
| 6075 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 6076 | var BssmapCause cause := enum2int(cause_val); |
| 6077 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6078 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6079 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 6080 | |
| 6081 | interleave { |
| 6082 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 6083 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 6084 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6085 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 6086 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6087 | } |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 6088 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6089 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6090 | } |
| 6091 | |
| 6092 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 6093 | g_pars := f_gen_test_hdlr_pars(); |
| 6094 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 6095 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6096 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6097 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6098 | f_establish_fully(ass_req, exp_compl); |
| 6099 | |
| 6100 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6101 | } |
| 6102 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 6103 | var MSC_ConnHdlr vc_conn; |
| 6104 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 6105 | f_init_vty(); |
| 6106 | f_bts_0_cfg(BSCVTY, |
| 6107 | {"neighbor-list mode automatic", |
| 6108 | "handover 1", |
| 6109 | "handover algorithm 2", |
| 6110 | "handover2 window rxlev averaging 1", |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6111 | "no neighbors", |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 6112 | "neighbor lac 99 arfcn 123 bsic any"}); |
| 6113 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6114 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6115 | f_init(1, true); |
| 6116 | f_sleep(1.0); |
| 6117 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6118 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6119 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6120 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 6121 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6122 | |
| 6123 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6124 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6125 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6126 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 6127 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6128 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 6129 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6130 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6131 | } |
| 6132 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 6133 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 6134 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 6135 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 6136 | octetstring l3 := '0123456789'O) |
| 6137 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 6138 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 6139 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 6140 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 6141 | var template PDU_BSSAP exp_data := { |
| 6142 | discriminator := '1'B, |
| 6143 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 6144 | dlci := dlci, |
| 6145 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 6146 | pdu := { |
| 6147 | dtap := l3 |
| 6148 | } |
| 6149 | }; |
| 6150 | BSSAP.receive(exp_data); |
| 6151 | setverdict(pass); |
| 6152 | } |
| 6153 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 6154 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 6155 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 6156 | template (value) OCT1 dlci := '00'O, |
| 6157 | octetstring l3 := '0123456789'O) |
| 6158 | runs on MSC_ConnHdlr { |
| 6159 | BSSAP.send(PDU_BSSAP:{ |
| 6160 | discriminator := '1'B, |
| 6161 | spare := '0000000'B, |
| 6162 | dlci := dlci, |
| 6163 | lengthIndicator := lengthof(l3), |
| 6164 | pdu := { |
| 6165 | dtap := l3 |
| 6166 | } |
| 6167 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 6168 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 6169 | setverdict(pass); |
| 6170 | } |
| 6171 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6172 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 6173 | * simply never sends a BSSMAP Handover Command. */ |
| 6174 | private function f_tc_ho_out_fail_no_msc_response(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 6175 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6176 | |
| 6177 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 6178 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6179 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6180 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6181 | f_establish_fully(ass_req, exp_compl); |
| 6182 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6183 | f_bts_0_cfg(BSCVTY, {"no neighbor lac 99", "neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6184 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 6185 | |
| 6186 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 6187 | |
| 6188 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 6189 | * Let's give it a bit extra. */ |
| 6190 | f_sleep(15.0); |
| 6191 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 6192 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6193 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6194 | f_perform_clear(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6195 | } |
| 6196 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 6197 | var MSC_ConnHdlr vc_conn; |
| 6198 | |
| 6199 | f_init(1, true); |
| 6200 | f_sleep(1.0); |
| 6201 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6202 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6203 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6204 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 6205 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6206 | |
| 6207 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6208 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6209 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6210 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6211 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6212 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6213 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6214 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6215 | } |
| 6216 | |
| 6217 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 6218 | * RR Handover Failure. */ |
| 6219 | private function f_tc_ho_out_fail_rr_ho_failure(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 6220 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6221 | |
| 6222 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 6223 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6224 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6225 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6226 | f_establish_fully(ass_req, exp_compl); |
| 6227 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6228 | f_bts_0_cfg(BSCVTY, {"no neighbor lac 99", "neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6229 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 6230 | |
| 6231 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 6232 | |
| 6233 | f_sleep(0.5); |
| 6234 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 6235 | * the other BSS and comes back with a BSSMAP Handover Command |
| 6236 | * containing an RR Handover Command coming from the target BSS... */ |
| 6237 | |
| 6238 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 6239 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 6240 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 6241 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 6242 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 6243 | |
| 6244 | /* expect the Handover Command to go out on RR */ |
| 6245 | var RSL_Message rsl_ho_cmd |
| 6246 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 6247 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 6248 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 6249 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 6250 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 6251 | setverdict(fail); |
| 6252 | } else { |
| 6253 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 6254 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 6255 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 6256 | setverdict(fail); |
| 6257 | } else { |
| 6258 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 6259 | setverdict(pass); |
| 6260 | } |
| 6261 | } |
| 6262 | |
| 6263 | f_sleep(0.2); |
| 6264 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6265 | |
| 6266 | /* Should tell the MSC about the failure */ |
| 6267 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6268 | |
| 6269 | f_sleep(1.0); |
| 6270 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 6271 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6272 | f_sleep(1.0); |
| 6273 | |
| 6274 | setverdict(pass); |
| 6275 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6276 | f_perform_clear(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6277 | } |
| 6278 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 6279 | var MSC_ConnHdlr vc_conn; |
| 6280 | |
| 6281 | f_init(1, true); |
| 6282 | f_sleep(1.0); |
| 6283 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6284 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6285 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6286 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 6287 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6288 | |
| 6289 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6290 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6291 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6292 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6293 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6294 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 6295 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6296 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6297 | } |
| 6298 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 6299 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 6300 | * (neither BSSMAP Clear Command for success nor RR Handover Failure). 48.008 3.1.5.3.3 "Abnormal Conditions" applies |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 6301 | * and the lchan is released. */ |
| 6302 | private function f_tc_ho_out_fail_no_result_after_ho_cmd(charstring id) runs on MSC_ConnHdlr { |
Daniel Willmann | 3b59eb5 | 2018-10-29 15:40:55 +0100 | [diff] [blame] | 6303 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6304 | |
| 6305 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 6306 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6307 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6308 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6309 | f_establish_fully(ass_req, exp_compl); |
| 6310 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6311 | f_bts_0_cfg(BSCVTY, {"no neighbor lac 99", "neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6312 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 6313 | |
| 6314 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 6315 | |
| 6316 | f_sleep(0.5); |
| 6317 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 6318 | * the other BSS and comes back with a BSSMAP Handover Command |
| 6319 | * containing an RR Handover Command coming from the target BSS... */ |
| 6320 | |
| 6321 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 6322 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 6323 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 6324 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 6325 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 6326 | |
| 6327 | /* expect the Handover Command to go out on RR */ |
| 6328 | var RSL_Message rsl_ho_cmd |
| 6329 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 6330 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 6331 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 6332 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 6333 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 6334 | setverdict(fail); |
| 6335 | } else { |
| 6336 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 6337 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 6338 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 6339 | setverdict(fail); |
| 6340 | } else { |
| 6341 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 6342 | setverdict(pass); |
| 6343 | } |
| 6344 | } |
| 6345 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 6346 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 6347 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 6348 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6349 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6350 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 6351 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 6352 | log("Got BSSMAP Clear Request"); |
| 6353 | /* Instruct BSC to clear channel */ |
| 6354 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6355 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6356 | |
| 6357 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6358 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 6359 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6360 | log("Got Deact SACCH"); |
| 6361 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 6362 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 6363 | log("Got RR Release"); |
| 6364 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 6365 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6366 | log("Got RF Chan Rel"); |
| 6367 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 6368 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6369 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6370 | } |
| 6371 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6372 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6373 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6374 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6375 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6376 | setverdict(pass); |
| 6377 | f_sleep(1.0); |
| 6378 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 6379 | testcase TC_ho_out_fail_no_result_after_ho_cmd() runs on test_CT { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6380 | var MSC_ConnHdlr vc_conn; |
| 6381 | |
| 6382 | f_init(1, true); |
| 6383 | f_sleep(1.0); |
| 6384 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6385 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6386 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 6387 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_result_after_ho_cmd)); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6388 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6389 | |
| 6390 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6391 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6392 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6393 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6394 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6395 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6396 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6397 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6398 | } |
| 6399 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6400 | private function f_ho_into_this_bsc(charstring id, template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6401 | var PDU_BSSAP rx_bssap; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6402 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6403 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6404 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6405 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6406 | * before we get started. */ |
| 6407 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6408 | f_rslem_register(0, new_chan_nr); |
| 6409 | g_chan_nr := new_chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 6410 | var uint3_t expect_target_tsc := c_BtsParams[0].tsc; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6411 | f_sleep(1.0); |
| 6412 | |
| 6413 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6414 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Neels Hofmeyr | 2677b87 | 2022-04-12 01:44:43 +0200 | [diff] [blame] | 6415 | var default as_media := activate(as_Media()); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6416 | |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 6417 | var PDU_BSSAP ho_req := f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
| 6418 | cell_id_source := g_pars.cell_id_source, |
| 6419 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 6420 | enc := g_pars.encr); |
| 6421 | if (g_pars.inter_bsc_ho_in__ho_req_in_initial_sccp_cr) { |
| 6422 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, ho_req)); |
| 6423 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 6424 | } else { |
| 6425 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, omit)); |
| 6426 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 6427 | BSSAP.send(ho_req); |
| 6428 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6429 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6430 | alt { |
| 6431 | [] BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap { |
| 6432 | if (g_pars.expect_ho_fail) { |
| 6433 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6434 | "Expected Handover Request to fail, but got Handover Request Ack") |
| 6435 | } |
| 6436 | } |
| 6437 | [] BSSAP.receive(tr_BSSMAP_HandoverFailure) -> value rx_bssap { |
| 6438 | if (not g_pars.expect_ho_fail) { |
| 6439 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6440 | "Expected Handover Request to succeed, but got Handover Failure") |
| 6441 | } |
| 6442 | // TODO: evaluate correct cause value. But osmo-bsc doesn't seem to send meaningful causes yet! |
| 6443 | // For now just accept any cause. |
| 6444 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6445 | setverdict(pass); |
| 6446 | return; |
| 6447 | } |
| 6448 | } |
| 6449 | |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 6450 | if (g_pars.expect_ho_fail_lchan_est) { |
| 6451 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6452 | setverdict(pass); |
Oliver Smith | a1cbec5 | 2023-02-21 12:44:12 +0100 | [diff] [blame] | 6453 | |
| 6454 | /* When we let MGCP MDCX run into a timeout, it's still in the |
| 6455 | * queue and additionally after BSSAP HandoverFailure, two DLCX |
Oliver Smith | 30eb882 | 2023-03-06 12:31:53 +0100 | [diff] [blame] | 6456 | * get sent (for AoIP, for SCCPlite one DLCX). */ |
Oliver Smith | a1cbec5 | 2023-02-21 12:44:12 +0100 | [diff] [blame] | 6457 | if (g_pars.ignore_mgw_mdcx) { |
Oliver Smith | 30eb882 | 2023-03-06 12:31:53 +0100 | [diff] [blame] | 6458 | if (g_pars.aoip) { |
| 6459 | MGCP.receive(tr_MDCX); |
| 6460 | MGCP.receive(tr_DLCX); |
| 6461 | MGCP.receive(tr_DLCX); |
| 6462 | } else { |
| 6463 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any({command := tr_MDCX})); |
| 6464 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any({command := tr_DLCX})); |
| 6465 | } |
Oliver Smith | a1cbec5 | 2023-02-21 12:44:12 +0100 | [diff] [blame] | 6466 | } |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 6467 | return; |
| 6468 | } |
| 6469 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6470 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6471 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 6472 | /* we're sure that the channel activation is done now, verify the parameters in it */ |
| 6473 | var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 6474 | f_verify_encr_info(chan_act); |
| 6475 | f_chan_act_verify_tsc(chan_act, expect_target_tsc); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6476 | |
Neels Hofmeyr | 46e16e5 | 2022-02-23 17:04:00 +0100 | [diff] [blame] | 6477 | if (ispresent(rx_bssap.pdu.bssmap.handoverRequestAck.codecList)) { |
| 6478 | if (not g_pars.aoip) { |
| 6479 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6480 | "handoverRequestAck: Expected no Speech Codec List (BSS Supported), because this is not AoIP"); |
| 6481 | } |
| 6482 | /* TODO: check actual codecs? */ |
| 6483 | } else { |
| 6484 | if (g_pars.aoip) { |
| 6485 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6486 | "handoverRequestAck: Expected Speech Codec List (BSS Supported), but none found"); |
| 6487 | } |
| 6488 | } |
| 6489 | |
| 6490 | if (ispresent(rx_bssap.pdu.bssmap.handoverRequestAck.speechCodec)) { |
| 6491 | if (not g_pars.aoip) { |
| 6492 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6493 | "handoverRequestAck: Expected no Speech Codec (Chosen), because this is not AoIP"); |
| 6494 | } |
| 6495 | /* TODO: check actual codec? */ |
| 6496 | } else { |
| 6497 | if (g_pars.aoip) { |
| 6498 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6499 | "handoverRequestAck: Expected Speech Codec (Chosen), but none found"); |
| 6500 | } |
| 6501 | } |
| 6502 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6503 | var octetstring ho_command_str; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6504 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6505 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6506 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6507 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6508 | |
| 6509 | var GsmArfcn arfcn; |
| 6510 | var RslChannelNr actual_new_chan_nr; |
| 6511 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6512 | actual_new_chan_nr, arfcn); |
| 6513 | |
| 6514 | if (actual_new_chan_nr != new_chan_nr) { |
| 6515 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6516 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6517 | setverdict(fail); |
| 6518 | return; |
| 6519 | } |
| 6520 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6521 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 6522 | var uint3_t got_tsc := rr_chan_desc_tsc(ho_command.msgs.rrm.handoverCommand.channelDescription2); |
| 6523 | if (not match(got_tsc, expect_target_tsc)) { |
| 6524 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 6525 | expect_target_tsc, " got ", got_tsc); |
| 6526 | mtc.stop; |
| 6527 | } else { |
| 6528 | log("handoverCommand: verified TSC = ", got_tsc); |
| 6529 | } |
| 6530 | |
Vadim Yanitskiy | 634f75d | 2022-03-14 17:04:45 +0300 | [diff] [blame] | 6531 | /* Check the Cipher Mode Setting IE (shall be present during inter-RAT handover) */ |
| 6532 | if (ispresent(ho_command.msgs.rrm.handoverCommand.cipherModeSetting)) { |
| 6533 | var CipherModeSetting_TV cms := ho_command.msgs.rrm.handoverCommand.cipherModeSetting; |
| 6534 | var template (present) CipherModeSetting_TV tr_cms := { |
| 6535 | sC := '0'B, /* no ciphering by default */ |
| 6536 | algorithmIdentifier := '000'B, |
| 6537 | elementIdentifier := ? |
| 6538 | }; |
| 6539 | if (ispresent(g_pars.encr) and g_pars.encr.enc_alg_expect != '01'O) { /* A5/N */ |
| 6540 | tr_cms.algorithmIdentifier := f_cipher_mode_bssmap_to_rr(g_pars.encr.enc_alg_expect); |
| 6541 | tr_cms.sC := '1'B; |
| 6542 | } |
| 6543 | if (not match(cms, tr_cms)) { |
| 6544 | setverdict(fail, "RR Handover Command: unexpected Cipher Mode Setting IE: ", |
| 6545 | cms, ", expected: ", tr_cms); |
| 6546 | } |
| 6547 | } else { |
| 6548 | setverdict(fail, "RR Handover Command: Cipher Mode Setting IE is not present"); |
| 6549 | } |
| 6550 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6551 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6552 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6553 | * the new lchan with a Handover RACH: */ |
| 6554 | |
| 6555 | /* send handover detect */ |
| 6556 | |
| 6557 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6558 | |
| 6559 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6560 | |
| 6561 | /* send handover complete over the new channel */ |
| 6562 | |
| 6563 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 6564 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 6565 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 6566 | |
| 6567 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Neels Hofmeyr | 2677b87 | 2022-04-12 01:44:43 +0200 | [diff] [blame] | 6568 | deactivate(as_media); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6569 | setverdict(pass); |
| 6570 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6571 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6572 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6573 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6574 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 6575 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 6576 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6577 | } |
| 6578 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6579 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6580 | } else { |
| 6581 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6582 | } |
| 6583 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6584 | if (g_pars.expect_ho_fail) { |
| 6585 | f_perform_clear_no_lchan(); |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 6586 | } else if (g_pars.expect_ho_fail_lchan_est) { |
| 6587 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6588 | f_perform_clear_no_lchan(); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6589 | } else { |
| 6590 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
| 6591 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6592 | setverdict(pass); |
| 6593 | } |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6594 | function f_tc_ho_into_this_bsc_main(TestHdlrParams pars, charstring vty_a5_cfg := VTY_A5_DEFAULT) runs on test_CT { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6595 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6596 | |
| 6597 | f_init(1, true); |
| 6598 | f_sleep(1.0); |
| 6599 | |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6600 | f_vty_encryption_a5(vty_a5_cfg); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6601 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6602 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6603 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6604 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6605 | |
| 6606 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 6607 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6608 | |
| 6609 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6610 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6611 | if (pars.expect_ho_fail) { |
| 6612 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6613 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:failed"); |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 6614 | } else if (pars.expect_ho_fail_lchan_est) { |
| 6615 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6616 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6617 | } else { |
| 6618 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 6619 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 6620 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6621 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6622 | |
| 6623 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6624 | } |
| 6625 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6626 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 6627 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6628 | f_tc_ho_into_this_bsc_main(pars); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6629 | f_shutdown_helper(ho := true); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6630 | } |
| 6631 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6632 | function f_tc_ho_into_this_bsc_a5(TestHdlrEncrParams encr, charstring vty_a5_cfg := VTY_A5_DEFAULT, |
| 6633 | boolean expect_fail := false) runs on test_CT { |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6634 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6635 | pars.encr := encr; |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6636 | pars.expect_ho_fail := expect_fail; |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6637 | f_tc_ho_into_this_bsc_main(pars, vty_a5_cfg); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6638 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6639 | } |
| 6640 | |
| 6641 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6642 | f_tc_ho_into_this_bsc_a5(f_encr_params('01'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6643 | } |
| 6644 | |
| 6645 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6646 | f_tc_ho_into_this_bsc_a5(f_encr_params('02'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6647 | } |
| 6648 | |
| 6649 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6650 | f_tc_ho_into_this_bsc_a5(f_encr_params('08'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6651 | } |
| 6652 | |
| 6653 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6654 | f_tc_ho_into_this_bsc_a5(f_encr_params('10'O, kc128 := true), "3 4"); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6655 | } |
| 6656 | |
Neels Hofmeyr | 1951be2 | 2022-02-16 16:21:07 +0100 | [diff] [blame] | 6657 | /* Report: in inter-BSC incoming handover, when the MSC omits the Chosen Encryption Algorithm IE in the Handover Request |
| 6658 | * message, then osmo-bsc starts an unencrypted lchan even if A5/0 is not permitted. |
| 6659 | * |
| 6660 | * This test verifies that the Encryption Information is present in the Channel Activation when the Chosen Enc Alg is |
| 6661 | * omitted. |
| 6662 | * |
| 6663 | * Related: SYS#5839 |
| 6664 | */ |
| 6665 | testcase TC_ho_into_this_bsc_a5_1_3_no_chosen_enc_alg() runs on test_CT { |
| 6666 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '0a'O, alg_expect := '08'O, alg_chosen := omit)); |
| 6667 | } |
| 6668 | |
| 6669 | testcase TC_ho_into_this_bsc_a5_1_3() runs on test_CT { |
| 6670 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '0a'O, alg_expect := '08'O)); |
| 6671 | } |
| 6672 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6673 | /* Send a permitted algo mask that does not intersect with osmo-bsc.cfg */ |
| 6674 | testcase TC_ho_into_this_bsc_a5_mismatch() runs on test_CT { |
| 6675 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '18'O, alg_expect := '10'O), "0 1", |
| 6676 | expect_fail := true); // 0x18 = A5/3 and A5/4 |
| 6677 | } |
| 6678 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6679 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 6680 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6681 | pars.host_aoip_tla := "::6"; |
| 6682 | f_tc_ho_into_this_bsc_main(pars); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6683 | f_shutdown_helper(ho := true); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6684 | } |
| 6685 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6686 | /* Similar to TC_ho_into_this_bsc, but when in SRVCC, HO Req contains "Old BSS |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6687 | to New BSS Information" IE with "Last Used E-UTRAN PLMN Id", which, when the |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6688 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 6689 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 6690 | neighbors. */ |
| 6691 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 6692 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6693 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6694 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6695 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 6696 | |
| 6697 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6698 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6699 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6700 | f_shutdown_helper(ho := true); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6701 | } |
| 6702 | |
Vadim Yanitskiy | 634f75d | 2022-03-14 17:04:45 +0300 | [diff] [blame] | 6703 | /* Same as TC_srvcc_eutran_to_geran, but enables ciphering on the target channel. */ |
| 6704 | testcase TC_srvcc_eutran_to_geran_a5_3() runs on test_CT { |
| 6705 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6706 | pars.encr := f_encr_params('08'O); /* only A5/3 */ |
| 6707 | pars.last_used_eutran_plmn := '323454'O; |
| 6708 | pars.exp_fast_return := true; |
| 6709 | f_tc_ho_into_this_bsc_main(pars); |
| 6710 | |
| 6711 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6712 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6713 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6714 | f_shutdown_helper(ho := true); |
Vadim Yanitskiy | 634f75d | 2022-03-14 17:04:45 +0300 | [diff] [blame] | 6715 | } |
| 6716 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6717 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 6718 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 6719 | list when the channel is released. */ |
| 6720 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 6721 | f_init_vty(); |
| 6722 | f_vty_allow_srvcc_fast_return(true, 0) |
| 6723 | |
| 6724 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6725 | pars.last_used_eutran_plmn := '323454'O; |
| 6726 | pars.exp_fast_return := false; |
| 6727 | f_tc_ho_into_this_bsc_main(pars); |
| 6728 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6729 | f_shutdown_helper(); |
| 6730 | } |
| 6731 | |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 6732 | /* Same as TC_srvcc_eutran_to_geran, but using SAI as serving Cell Identifier. SYS#5838 */ |
| 6733 | testcase TC_srvcc_eutran_to_geran_src_sai() runs on test_CT { |
| 6734 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6735 | pars.last_used_eutran_plmn := '323454'O; |
| 6736 | pars.cell_id_source := valueof(ts_CellID_SAI('123456'O, 300, 444)); |
| 6737 | f_tc_ho_into_this_bsc_main(pars); |
| 6738 | |
| 6739 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6740 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6741 | f_ctrs_bsc_and_bts_verify(); |
| 6742 | f_shutdown_helper(); |
| 6743 | } |
| 6744 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6745 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 6746 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 6747 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 6748 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 6749 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 6750 | setverdict(pass); |
| 6751 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6752 | |
| 6753 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 6754 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6755 | var MSC_ConnHdlr vc_conn; |
| 6756 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6757 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6758 | f_init_vty(); |
| 6759 | f_bts_0_cfg(BSCVTY, |
| 6760 | {"neighbor-list mode automatic", |
| 6761 | "handover 1", |
| 6762 | "handover algorithm 2", |
| 6763 | "handover2 window rxlev averaging 1", |
| 6764 | "no neighbors", |
| 6765 | "neighbor lac 99 arfcn 123 bsic any"}); |
| 6766 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6767 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6768 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6769 | if (disable_fast_return) { |
| 6770 | f_vty_allow_srvcc_fast_return(true, 0); |
| 6771 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6772 | f_sleep(1.0); |
| 6773 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6774 | f_ctrs_bsc_and_bts_handover_init(); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6775 | |
| 6776 | pars.last_used_eutran_plmn := '323454'O; |
| 6777 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6778 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 6779 | |
| 6780 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 6781 | vc_conn.done; |
| 6782 | |
| 6783 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 6784 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 6785 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 6786 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 6787 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 6788 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed", 1); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 6789 | |
| 6790 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 6791 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6792 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6793 | |
| 6794 | if (disable_fast_return) { |
| 6795 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6796 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6797 | f_shutdown_helper(); |
| 6798 | } |
| 6799 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6800 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 6801 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 6802 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 6803 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 6804 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 6805 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 6806 | } |
| 6807 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 6808 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 6809 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 6810 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 6811 | } |
| 6812 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6813 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 6814 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6815 | f_rslem_register(0, new_chan_nr); |
| 6816 | g_chan_nr := new_chan_nr; |
| 6817 | f_sleep(1.0); |
| 6818 | |
| 6819 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6820 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6821 | activate(as_Media()); |
| 6822 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6823 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6824 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6825 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6826 | |
| 6827 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6828 | |
| 6829 | var PDU_BSSAP rx_bssap; |
| 6830 | var octetstring ho_command_str; |
| 6831 | |
| 6832 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6833 | |
| 6834 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6835 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6836 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6837 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6838 | |
| 6839 | var GsmArfcn arfcn; |
| 6840 | var RslChannelNr actual_new_chan_nr; |
| 6841 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6842 | actual_new_chan_nr, arfcn); |
| 6843 | |
| 6844 | if (actual_new_chan_nr != new_chan_nr) { |
| 6845 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6846 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6847 | setverdict(fail); |
| 6848 | return; |
| 6849 | } |
| 6850 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6851 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 6852 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 6853 | f_sleep(1.0); |
| 6854 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6855 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6856 | * tells the MS to handover to the new lchan. In this case, the MS |
| 6857 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 6858 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 6859 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 6860 | * BSSMAP Clear Command: */ |
| 6861 | |
| 6862 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6863 | var BssmapCause cause := enum2int(cause_val); |
| 6864 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6865 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6866 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6867 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6868 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6869 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6870 | setverdict(pass); |
| 6871 | f_sleep(1.0); |
| 6872 | |
| 6873 | setverdict(pass); |
| 6874 | } |
| 6875 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 6876 | var MSC_ConnHdlr vc_conn; |
| 6877 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6878 | |
| 6879 | f_init(1, true); |
| 6880 | f_sleep(1.0); |
| 6881 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6882 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6883 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6884 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6885 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6886 | |
| 6887 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 6888 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6889 | |
| 6890 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6891 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6892 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6893 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6894 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6895 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6896 | } |
| 6897 | |
| 6898 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 6899 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6900 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6901 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6902 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6903 | * before we get started. */ |
| 6904 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6905 | f_rslem_register(0, new_chan_nr); |
| 6906 | g_chan_nr := new_chan_nr; |
| 6907 | f_sleep(1.0); |
| 6908 | |
| 6909 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6910 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6911 | activate(as_Media()); |
| 6912 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6913 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6914 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6915 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6916 | |
| 6917 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6918 | |
| 6919 | var PDU_BSSAP rx_bssap; |
| 6920 | var octetstring ho_command_str; |
| 6921 | |
| 6922 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6923 | |
| 6924 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6925 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6926 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6927 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6928 | |
| 6929 | var GsmArfcn arfcn; |
| 6930 | var RslChannelNr actual_new_chan_nr; |
| 6931 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6932 | actual_new_chan_nr, arfcn); |
| 6933 | |
| 6934 | if (actual_new_chan_nr != new_chan_nr) { |
| 6935 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6936 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6937 | setverdict(fail); |
| 6938 | return; |
| 6939 | } |
| 6940 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6941 | |
| 6942 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6943 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6944 | * the new lchan with a Handover RACH: */ |
| 6945 | |
| 6946 | /* send handover detect */ |
| 6947 | |
| 6948 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6949 | |
| 6950 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6951 | |
| 6952 | /* The MSC chooses to clear the connection now, maybe we got the |
| 6953 | * Handover RACH on the new cell but the MS still signaled Handover |
| 6954 | * Failure to the old BSS? */ |
| 6955 | |
| 6956 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6957 | var BssmapCause cause := enum2int(cause_val); |
| 6958 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6959 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6960 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6961 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6962 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6963 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6964 | f_sleep(1.0); |
| 6965 | } |
| 6966 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 6967 | var MSC_ConnHdlr vc_conn; |
| 6968 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6969 | |
| 6970 | f_init(1, true); |
| 6971 | f_sleep(1.0); |
| 6972 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6973 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6974 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6975 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6976 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6977 | |
| 6978 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 6979 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6980 | |
| 6981 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6982 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6983 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6984 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6985 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 6986 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6987 | } |
| 6988 | |
| 6989 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 6990 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 6991 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6992 | f_rslem_register(0, new_chan_nr); |
| 6993 | g_chan_nr := new_chan_nr; |
| 6994 | f_sleep(1.0); |
| 6995 | |
| 6996 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6997 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Oliver Smith | 735b47c | 2023-02-15 16:03:54 +0100 | [diff] [blame] | 6998 | activate(as_Media()); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6999 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7000 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7001 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 7002 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7003 | |
| 7004 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 7005 | |
| 7006 | var PDU_BSSAP rx_bssap; |
| 7007 | var octetstring ho_command_str; |
| 7008 | |
| 7009 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 7010 | |
| 7011 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 7012 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 7013 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 7014 | log("L3 Info in HO Request Ack is ", ho_command); |
| 7015 | |
| 7016 | var GsmArfcn arfcn; |
| 7017 | var RslChannelNr actual_new_chan_nr; |
| 7018 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 7019 | actual_new_chan_nr, arfcn); |
| 7020 | |
| 7021 | if (actual_new_chan_nr != new_chan_nr) { |
| 7022 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 7023 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 7024 | setverdict(fail); |
| 7025 | return; |
| 7026 | } |
| 7027 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 7028 | |
| 7029 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 7030 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 7031 | * on the new lchan. */ |
| 7032 | |
| 7033 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 7034 | |
| 7035 | /* Did osmo-bsc also send a Clear Request? */ |
| 7036 | timer T := 0.5; |
| 7037 | T.start; |
| 7038 | alt { |
| 7039 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 7040 | [] T.timeout { } |
| 7041 | } |
| 7042 | |
| 7043 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 7044 | * asked for it, this is a Handover Failure after all). */ |
| 7045 | |
| 7046 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 7047 | var BssmapCause cause := enum2int(cause_val); |
| 7048 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7049 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 7050 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 7051 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7052 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 7053 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7054 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7055 | } |
| 7056 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 7057 | var MSC_ConnHdlr vc_conn; |
| 7058 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7059 | |
Oliver Smith | d49f46d | 2023-03-08 12:23:13 +0100 | [diff] [blame] | 7060 | pars.fail_on_dlcx := false; |
| 7061 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7062 | f_init(1, true); |
| 7063 | f_sleep(1.0); |
| 7064 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7065 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7066 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7067 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7068 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7069 | |
| 7070 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 7071 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7072 | |
| 7073 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7074 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7075 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 7076 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 7077 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7078 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7079 | } |
| 7080 | |
| 7081 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 7082 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 7083 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7084 | f_rslem_register(0, new_chan_nr); |
| 7085 | g_chan_nr := new_chan_nr; |
| 7086 | f_sleep(1.0); |
| 7087 | |
| 7088 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 7089 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Oliver Smith | 735b47c | 2023-02-15 16:03:54 +0100 | [diff] [blame] | 7090 | activate(as_Media()); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7091 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7092 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7093 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 7094 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7095 | |
| 7096 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 7097 | |
| 7098 | var PDU_BSSAP rx_bssap; |
| 7099 | var octetstring ho_command_str; |
| 7100 | |
| 7101 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 7102 | |
| 7103 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 7104 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 7105 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 7106 | log("L3 Info in HO Request Ack is ", ho_command); |
| 7107 | |
| 7108 | var GsmArfcn arfcn; |
| 7109 | var RslChannelNr actual_new_chan_nr; |
| 7110 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 7111 | actual_new_chan_nr, arfcn); |
| 7112 | |
| 7113 | if (actual_new_chan_nr != new_chan_nr) { |
| 7114 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 7115 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 7116 | setverdict(fail); |
| 7117 | return; |
| 7118 | } |
| 7119 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 7120 | |
| 7121 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 7122 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 7123 | * on the new lchan. */ |
| 7124 | |
| 7125 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 7126 | |
| 7127 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7128 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 7129 | |
| 7130 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7131 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 7132 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7133 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 7134 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 7135 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7136 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 7137 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7138 | f_sleep(1.0); |
| 7139 | } |
| 7140 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 7141 | var MSC_ConnHdlr vc_conn; |
| 7142 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7143 | |
Oliver Smith | 735b47c | 2023-02-15 16:03:54 +0100 | [diff] [blame] | 7144 | pars.fail_on_dlcx := false; |
| 7145 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7146 | f_init(1, true); |
| 7147 | f_sleep(1.0); |
| 7148 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7149 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7150 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7151 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7152 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7153 | |
| 7154 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 7155 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7156 | |
| 7157 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7158 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7159 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 7160 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 7161 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7162 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7163 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7164 | |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 7165 | testcase TC_ho_in_fail_mgw_mdcx_timeout() runs on test_CT { |
| 7166 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7167 | |
| 7168 | pars.ignore_mgw_mdcx := true; |
| 7169 | pars.expect_ho_fail_lchan_est := true; |
| 7170 | |
| 7171 | f_tc_ho_into_this_bsc_main(pars); |
| 7172 | f_shutdown_helper(ho := true); |
| 7173 | } |
| 7174 | |
Oliver Smith | 4eed06f | 2023-02-15 15:43:19 +0100 | [diff] [blame] | 7175 | testcase TC_ho_in_fail_ipa_crcx_timeout() runs on test_CT { |
| 7176 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7177 | |
| 7178 | pars.ignore_ipa_media := true; |
| 7179 | pars.expect_ho_fail_lchan_est := true; |
| 7180 | pars.fail_on_dlcx := false; |
| 7181 | |
| 7182 | f_tc_ho_into_this_bsc_main(pars); |
| 7183 | f_shutdown_helper(ho := true); |
| 7184 | } |
| 7185 | |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 7186 | /* An incoming inter-BSC HO can either issue the Handover Request message attached to the initial SCCP N-Connect (as in |
| 7187 | * the other tests we have so far), or the first CR can be "empty" with the BSSAP request following later. Test the |
| 7188 | * empty N-Connect case. */ |
| 7189 | testcase TC_ho_into_this_bsc_sccp_cr_without_bssap() runs on test_CT { |
| 7190 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7191 | pars.inter_bsc_ho_in__ho_req_in_initial_sccp_cr := false; |
| 7192 | f_tc_ho_into_this_bsc_main(pars); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7193 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 7194 | } |
| 7195 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7196 | type record of charstring Commands; |
| 7197 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7198 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7199 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7200 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7201 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7202 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7203 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7204 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7205 | } |
| 7206 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 7207 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 7208 | { |
| 7209 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 7210 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 7211 | f_vty_transceive(pt, cmds[i]); |
| 7212 | } |
| 7213 | f_vty_transceive(pt, "end"); |
| 7214 | } |
| 7215 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7216 | private function f_probe_for_handover(charstring log_label, |
| 7217 | charstring log_descr, |
| 7218 | charstring handover_vty_cmd, |
| 7219 | boolean expect_handover, |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 7220 | boolean is_inter_bsc_handover := false, |
| 7221 | template uint3_t expect_target_tsc := ?) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7222 | runs on MSC_ConnHdlr |
| 7223 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 7224 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 7225 | * lchans to be established on bts 1 or bts 2. */ |
| 7226 | f_rslem_suspend(RSL1_PROC); |
| 7227 | f_rslem_suspend(RSL2_PROC); |
| 7228 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7229 | var RSL_Message rsl; |
| 7230 | |
| 7231 | var charstring log_msg := " (expecting handover)" |
| 7232 | if (not expect_handover) { |
| 7233 | log_msg := " (expecting NO handover)"; |
| 7234 | } |
| 7235 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 7236 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 7237 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7238 | timer T := 2.0; |
| 7239 | T.start; |
| 7240 | |
| 7241 | alt { |
| 7242 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 7243 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 7244 | log("Rx L3 from net: ", l3); |
| 7245 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 7246 | var RslChannelNr new_chan_nr; |
| 7247 | var GsmArfcn arfcn; |
| 7248 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 7249 | new_chan_nr, arfcn); |
| 7250 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 7251 | log(l3.msgs.rrm.handoverCommand); |
| 7252 | |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 7253 | /* Verify correct TSC in handoverCommand */ |
| 7254 | var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.handoverCommand.channelDescription2); |
| 7255 | if (not match(got_tsc, expect_target_tsc)) { |
| 7256 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 7257 | expect_target_tsc, " got ", got_tsc); |
| 7258 | mtc.stop; |
| 7259 | } else { |
| 7260 | log("handoverCommand: verified TSC = ", got_tsc, " (matches ", |
| 7261 | expect_target_tsc, ")"); |
| 7262 | } |
| 7263 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7264 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 7265 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 7266 | * anyway. */ |
| 7267 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 7268 | f_rslem_resume(RSL1_PROC); |
| 7269 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 7270 | f_rslem_resume(RSL2_PROC); |
| 7271 | |
| 7272 | if (expect_handover and not is_inter_bsc_handover) { |
| 7273 | setverdict(pass); |
| 7274 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 7275 | } else { |
| 7276 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 7277 | & log_label & ": " & log_descr); |
| 7278 | } |
| 7279 | |
| 7280 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 7281 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 7282 | * Handover Failure. */ |
| 7283 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 7284 | |
| 7285 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 7286 | f_sleep(0.5); |
| 7287 | RSL1.clear; |
| 7288 | RSL2.clear; |
| 7289 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 7290 | break; |
| 7291 | } else { |
| 7292 | repeat; |
| 7293 | } |
| 7294 | } |
| 7295 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 7296 | if (expect_handover and is_inter_bsc_handover) { |
| 7297 | setverdict(pass); |
| 7298 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 7299 | } else { |
| 7300 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 7301 | & log_label & ": " & log_descr); |
| 7302 | } |
| 7303 | |
| 7304 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 7305 | |
| 7306 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 7307 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 7308 | * setting a short timeout and waiting is the only way. */ |
| 7309 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 7310 | f_sleep(1.5); |
| 7311 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 7312 | |
| 7313 | break; |
| 7314 | } |
| 7315 | [] T.timeout { |
| 7316 | if (expect_handover) { |
| 7317 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 7318 | & log_label & ": " & log_descr); |
| 7319 | } else { |
| 7320 | setverdict(pass); |
| 7321 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 7322 | } |
| 7323 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 7324 | break; |
| 7325 | } |
| 7326 | } |
| 7327 | |
| 7328 | f_rslem_resume(RSL1_PROC); |
| 7329 | f_rslem_resume(RSL2_PROC); |
| 7330 | f_sleep(3.0); |
| 7331 | RSL.clear; |
| 7332 | |
| 7333 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 7334 | } |
| 7335 | |
| 7336 | /* Test the effect of various neighbor configuration scenarios: |
| 7337 | * |
| 7338 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 7339 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 7340 | */ |
| 7341 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 7342 | g_pars := f_gen_test_hdlr_pars(); |
| 7343 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 7344 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7345 | |
| 7346 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 7347 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 7348 | |
| 7349 | /* Establish lchan at bts 0 */ |
| 7350 | f_establish_fully(ass_cmd, exp_compl); |
| 7351 | |
| 7352 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 7353 | f_vty_enter_cfg_network(BSCVTY); |
| 7354 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 7355 | f_vty_transceive(BSCVTY, "end"); |
| 7356 | } |
| 7357 | |
| 7358 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 7359 | f_tc_ho_neighbor_config_start(); |
| 7360 | |
| 7361 | /* |
| 7362 | * bts 0 ARFCN 871 BSIC 10 |
| 7363 | * bts 1 ARFCN 871 BSIC 11 |
| 7364 | * bts 2 ARFCN 871 BSIC 12 |
| 7365 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7366 | */ |
| 7367 | |
| 7368 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7369 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7370 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 7371 | "handover any to arfcn 871 bsic 11", |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7372 | true, expect_target_tsc := c_BtsParams[1].tsc); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7373 | |
| 7374 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 7375 | "handover any to arfcn 13 bsic 39", |
| 7376 | false); |
| 7377 | |
| 7378 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 7379 | "handover any to arfcn 871 bsic 12", |
| 7380 | false); |
| 7381 | |
| 7382 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 7383 | "handover any to arfcn 871 bsic 11", |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7384 | true, expect_target_tsc := c_BtsParams[1].tsc); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7385 | |
| 7386 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7387 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7388 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 7389 | var MSC_ConnHdlr vc_conn; |
| 7390 | f_init(3, true, guard_timeout := 60.0); |
| 7391 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7392 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7393 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 7394 | vc_conn.done; |
| 7395 | |
| 7396 | /* f_tc_ho_neighbor_config_start() */ |
| 7397 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7398 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7399 | |
| 7400 | /* 1.a */ |
| 7401 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7402 | * handover quickly by sending a Handover Failure message. */ |
| 7403 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7404 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7405 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7406 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7407 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 7408 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7409 | |
| 7410 | /* 1.b */ |
| 7411 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7412 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7413 | |
| 7414 | /* 1.c */ |
| 7415 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7416 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7417 | |
| 7418 | /* 1.d */ |
| 7419 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7420 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7421 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7422 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7423 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 7424 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7425 | |
| 7426 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7427 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7428 | } |
| 7429 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7430 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 7431 | f_tc_ho_neighbor_config_start(); |
| 7432 | |
| 7433 | /* |
| 7434 | * bts 0 ARFCN 871 BSIC 10 |
| 7435 | * bts 1 ARFCN 871 BSIC 11 |
| 7436 | * bts 2 ARFCN 871 BSIC 12 |
| 7437 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7438 | */ |
| 7439 | |
| 7440 | log("f_tc_ho_neighbor_config: 2. explicit local neighbor: 'neighbor bts 1'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7441 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7442 | f_sleep(0.5); |
| 7443 | |
| 7444 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 7445 | "handover any to arfcn 871 bsic 11", |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7446 | true, expect_target_tsc := c_BtsParams[1].tsc); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7447 | |
| 7448 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 7449 | "handover any to arfcn 871 bsic 12", |
| 7450 | false); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7451 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7452 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7453 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 7454 | var MSC_ConnHdlr vc_conn; |
| 7455 | f_init(3, true, guard_timeout := 50.0); |
| 7456 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7457 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7458 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 7459 | vc_conn.done; |
| 7460 | |
| 7461 | /* f_tc_ho_neighbor_config_start() */ |
| 7462 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7463 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7464 | |
| 7465 | /* 2.a */ |
| 7466 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7467 | * handover quickly by sending a Handover Failure message. */ |
| 7468 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7469 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7470 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7471 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7472 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 7473 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7474 | |
| 7475 | /* 2.b */ |
| 7476 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7477 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7478 | |
| 7479 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7480 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7481 | } |
| 7482 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7483 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 7484 | f_tc_ho_neighbor_config_start(); |
| 7485 | |
| 7486 | /* |
| 7487 | * bts 0 ARFCN 871 BSIC 10 |
| 7488 | * bts 1 ARFCN 871 BSIC 11 |
| 7489 | * bts 2 ARFCN 871 BSIC 12 |
| 7490 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7491 | */ |
| 7492 | |
| 7493 | log("f_tc_ho_neighbor_config: 3. explicit local neighbor: 'neighbor bts 2'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7494 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7495 | f_sleep(0.5); |
| 7496 | |
| 7497 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 7498 | "handover any to arfcn 871 bsic 11", |
| 7499 | false); |
| 7500 | f_probe_for_handover("3.b", "HO to bts 2 works, explicitly listed as neighbor; no ambiguity because bts 3 is not listed as neighbor", |
| 7501 | "handover any to arfcn 871 bsic 12", |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7502 | true, expect_target_tsc := c_BtsParams[2].tsc); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7503 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7504 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7505 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 7506 | var MSC_ConnHdlr vc_conn; |
| 7507 | f_init(3, true, guard_timeout := 50.0); |
| 7508 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7509 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7510 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 7511 | vc_conn.done; |
| 7512 | |
| 7513 | /* f_tc_ho_neighbor_config_start() */ |
| 7514 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7515 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7516 | |
| 7517 | /* 3.a */ |
| 7518 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7519 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7520 | |
| 7521 | /* 3.b */ |
| 7522 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7523 | * handover quickly by sending a Handover Failure message. */ |
| 7524 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7525 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7526 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7527 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7528 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 7529 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7530 | |
| 7531 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7532 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7533 | } |
| 7534 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7535 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 7536 | f_tc_ho_neighbor_config_start(); |
| 7537 | |
| 7538 | /* |
| 7539 | * bts 0 ARFCN 871 BSIC 10 |
| 7540 | * bts 1 ARFCN 871 BSIC 11 |
| 7541 | * bts 2 ARFCN 871 BSIC 12 |
| 7542 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7543 | */ |
| 7544 | |
| 7545 | log("f_tc_ho_neighbor_config: 4. explicit remote neighbor: 'neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7546 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor lac 99 arfcn 123 bsic 45"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7547 | f_sleep(0.5); |
| 7548 | |
| 7549 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 7550 | "handover any to arfcn 871 bsic 11", |
| 7551 | false); |
| 7552 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 7553 | "handover any to arfcn 871 bsic 12", |
| 7554 | false); |
| 7555 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 7556 | "handover any to arfcn 123 bsic 45", |
| 7557 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7558 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7559 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7560 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 7561 | var MSC_ConnHdlr vc_conn; |
| 7562 | f_init(3, true, guard_timeout := 50.0); |
| 7563 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7564 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7565 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 7566 | vc_conn.done; |
| 7567 | |
| 7568 | /* f_tc_ho_neighbor_config_start() */ |
| 7569 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7570 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7571 | |
| 7572 | /* 4.a */ |
| 7573 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7574 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7575 | |
| 7576 | /* 4.b */ |
| 7577 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7578 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7579 | |
| 7580 | /* 4.c */ |
| 7581 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7582 | * handover quickly by timing out after the Handover Required message */ |
| 7583 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7584 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7585 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7586 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7587 | |
| 7588 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7589 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7590 | } |
| 7591 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7592 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 7593 | f_tc_ho_neighbor_config_start(); |
| 7594 | |
| 7595 | /* |
| 7596 | * bts 0 ARFCN 871 BSIC 10 |
| 7597 | * bts 1 ARFCN 871 BSIC 11 |
| 7598 | * bts 2 ARFCN 871 BSIC 12 |
| 7599 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7600 | */ |
| 7601 | |
| 7602 | log("f_tc_ho_neighbor_config: 5. explicit remote neighbor re-using ARFCN+BSIC: 'neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7603 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor lac 99 arfcn 871 bsic 12"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7604 | f_sleep(0.5); |
| 7605 | |
| 7606 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 7607 | "handover any to arfcn 871 bsic 12", |
| 7608 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7609 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7610 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7611 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 7612 | var MSC_ConnHdlr vc_conn; |
| 7613 | f_init(3, true); |
| 7614 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7615 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7616 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 7617 | vc_conn.done; |
| 7618 | |
| 7619 | /* f_tc_ho_neighbor_config_start() */ |
| 7620 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7621 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7622 | |
| 7623 | /* 5 */ |
| 7624 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7625 | * handover quickly by timing out after the Handover Required message */ |
| 7626 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7627 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7628 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7629 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7630 | |
| 7631 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7632 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7633 | } |
| 7634 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7635 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 7636 | f_tc_ho_neighbor_config_start(); |
| 7637 | |
| 7638 | /* |
| 7639 | * bts 0 ARFCN 871 BSIC 10 |
| 7640 | * bts 1 ARFCN 871 BSIC 11 |
| 7641 | * bts 2 ARFCN 871 BSIC 12 |
| 7642 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7643 | */ |
| 7644 | |
| 7645 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 7646 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7647 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 871 bsic 12"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7648 | f_sleep(0.5); |
| 7649 | |
| 7650 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 7651 | "handover any to arfcn 871 bsic 12", |
| 7652 | false); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7653 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7654 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7655 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 7656 | var MSC_ConnHdlr vc_conn; |
| 7657 | f_init(3, true); |
| 7658 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7659 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7660 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 7661 | vc_conn.done; |
| 7662 | |
| 7663 | /* f_tc_ho_neighbor_config_start() */ |
| 7664 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7665 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7666 | |
| 7667 | /* 6.a */ |
| 7668 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7669 | * handover quickly by timing out after the Handover Required message */ |
| 7670 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7671 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7672 | |
| 7673 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7674 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7675 | } |
| 7676 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7677 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 7678 | f_tc_ho_neighbor_config_start(); |
| 7679 | |
| 7680 | /* |
| 7681 | * bts 0 ARFCN 871 BSIC 10 |
| 7682 | * bts 1 ARFCN 871 BSIC 11 |
| 7683 | * bts 2 ARFCN 871 BSIC 12 |
| 7684 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7685 | */ |
| 7686 | |
| 7687 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 7688 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7689 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 123 bsic 45"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7690 | f_sleep(0.5); |
| 7691 | |
| 7692 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 7693 | "handover any to arfcn 871 bsic 12", |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7694 | true, expect_target_tsc := c_BtsParams[2].tsc); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7695 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 7696 | "handover any to arfcn 123 bsic 45", |
| 7697 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7698 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7699 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7700 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 7701 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 7702 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7703 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7704 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7705 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 7706 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7707 | |
| 7708 | /* f_tc_ho_neighbor_config_start() */ |
| 7709 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7710 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7711 | |
| 7712 | /* 7.a */ |
| 7713 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7714 | * handover quickly by sending a Handover Failure message. */ |
| 7715 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7716 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7717 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7718 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7719 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 7720 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7721 | |
| 7722 | /* 7.b */ |
| 7723 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7724 | * handover quickly by timing out after the Handover Required message */ |
| 7725 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7726 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7727 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7728 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7729 | |
| 7730 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 7731 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7732 | } |
| 7733 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7734 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7735 | * BSSMAP Reset just because of that. */ |
| 7736 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 7737 | var default d; |
| 7738 | var integer i; |
| 7739 | var DchanTuple dt; |
| 7740 | |
| 7741 | f_init(); |
| 7742 | |
| 7743 | /* Wait for initial BSSMAP Reset to pass */ |
| 7744 | f_sleep(4.0); |
| 7745 | |
| 7746 | d := activate(no_bssmap_reset()); |
| 7747 | |
| 7748 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7749 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7750 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 7751 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7752 | /* Since we're doing a lot of runs, give each one a fresh |
| 7753 | * T_guard from the top. */ |
| 7754 | T_guard.start; |
| 7755 | |
| 7756 | /* Setup a BSSAP connection and clear it right away. This is |
| 7757 | * the MSC telling the BSC about a planned release, it's not an |
| 7758 | * erratic loss of a connection. */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 7759 | dt := f_est_dchan(int2oct(i,1), 23+i, gen_l3_valid_payload()); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7760 | |
| 7761 | /* MSC disconnects (RLSD). */ |
| 7762 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 7763 | } |
| 7764 | |
| 7765 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7766 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7767 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7768 | f_sleep(4.0); |
| 7769 | |
| 7770 | deactivate(d); |
| 7771 | f_shutdown_helper(); |
| 7772 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 7773 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7774 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7775 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 7776 | * the MSC. */ |
| 7777 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 7778 | var default d; |
| 7779 | var integer i; |
| 7780 | var DchanTuple dt; |
| 7781 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7782 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 7783 | var BssmapCause cause := enum2int(cause_val); |
| 7784 | |
| 7785 | f_init(); |
| 7786 | |
| 7787 | /* Wait for initial BSSMAP Reset to pass */ |
| 7788 | f_sleep(4.0); |
| 7789 | |
| 7790 | d := activate(no_bssmap_reset()); |
| 7791 | |
| 7792 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7793 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7794 | * Let's do it some more times for good measure. */ |
| 7795 | for (i := 0; i < 8; i := i+1) { |
| 7796 | /* Since we're doing a lot of runs, give each one a fresh |
| 7797 | * T_guard from the top. */ |
| 7798 | T_guard.start; |
| 7799 | |
| 7800 | /* Setup a BSSAP connection and clear it right away. This is |
| 7801 | * the MSC telling the BSC about a planned release, it's not an |
| 7802 | * erratic loss of a connection. */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 7803 | dt := f_est_dchan(int2oct(i,1), 23+i, gen_l3_valid_payload()); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7804 | |
| 7805 | /* Instruct BSC to clear channel */ |
| 7806 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7807 | |
| 7808 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7809 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7810 | } |
| 7811 | |
| 7812 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7813 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7814 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7815 | f_sleep(4.0); |
| 7816 | |
| 7817 | deactivate(d); |
| 7818 | f_shutdown_helper(); |
| 7819 | } |
| 7820 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7821 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7822 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 7823 | * Release Ind on RSL. */ |
| 7824 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 7825 | var default d; |
| 7826 | var integer i; |
| 7827 | var DchanTuple dt; |
| 7828 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7829 | var integer j; |
| 7830 | |
| 7831 | f_init(); |
| 7832 | |
| 7833 | /* Wait for initial BSSMAP Reset to pass */ |
| 7834 | f_sleep(4.0); |
| 7835 | |
| 7836 | d := activate(no_bssmap_reset()); |
| 7837 | |
| 7838 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7839 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7840 | * Let's do it some more times for good measure. */ |
| 7841 | for (i := 0; i < 8; i := i+1) { |
| 7842 | /* Since we're doing a lot of runs, give each one a fresh |
| 7843 | * T_guard from the top. */ |
| 7844 | T_guard.start; |
| 7845 | |
| 7846 | /* Setup a BSSAP connection and clear it right away. This is |
| 7847 | * the MSC telling the BSC about a planned release, it's not an |
| 7848 | * erratic loss of a connection. */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 7849 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload()); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7850 | |
| 7851 | /* simulate RLL REL IND */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7852 | f_ipa_tx(ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7853 | |
| 7854 | /* expect Clear Request on MSC side */ |
| 7855 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 7856 | |
| 7857 | /* Instruct BSC to clear channel */ |
| 7858 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 7859 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7860 | |
| 7861 | /* expect BSC to disable the channel */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7862 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7863 | } |
| 7864 | |
| 7865 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7866 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7867 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7868 | f_sleep(4.0); |
| 7869 | |
| 7870 | deactivate(d); |
| 7871 | f_shutdown_helper(); |
| 7872 | } |
| 7873 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7874 | /*********************************************************************** |
| 7875 | * IPA style dynamic PDCH |
| 7876 | ***********************************************************************/ |
| 7877 | |
| 7878 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7879 | template (omit) RSL_Cause nack := omit) |
| 7880 | runs on test_CT { |
| 7881 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7882 | var RSL_Message rsl_unused; |
| 7883 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7884 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 7885 | /* expect the BSC to issue the related RSL command */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7886 | rsl_unused := f_exp_ipa_rx(tr_RSL_IPA_PDCH_ACT(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7887 | if (istemplatekind(nack, "omit")) { |
| 7888 | /* respond with a related acknowledgement */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7889 | f_ipa_tx(ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7890 | } else { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7891 | f_ipa_tx(ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7892 | } |
| 7893 | } |
| 7894 | |
| 7895 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7896 | template (omit) RSL_Cause nack := omit) |
| 7897 | runs on test_CT { |
| 7898 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7899 | var RSL_Message rsl_unused; |
| 7900 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7901 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 7902 | /* expect the BSC to issue the related RSL command */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7903 | rsl_unused := f_exp_ipa_rx(tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7904 | if (istemplatekind(nack, "omit")) { |
| 7905 | /* respond with a related acknowledgement */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7906 | f_ipa_tx(ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7907 | } else { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7908 | f_ipa_tx(ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7909 | } |
| 7910 | } |
| 7911 | |
| 7912 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 7913 | runs on test_CT return charstring { |
| 7914 | var charstring cmd, resp; |
| 7915 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 7916 | return f_vty_transceive_match_regexp_retry(BSCVTY, cmd, "*\((*)\)*", 0, 4, 1.0); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7917 | } |
| 7918 | |
| 7919 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7920 | template charstring exp) |
| 7921 | runs on test_CT { |
| 7922 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 7923 | if (not match(mode, exp)) { |
| 7924 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 7925 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7926 | } |
| 7927 | } |
| 7928 | |
| 7929 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 7930 | runs on test_CT { |
| 7931 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 7932 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 7933 | f_vty_transceive(BSCVTY, "end"); |
| 7934 | } |
| 7935 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7936 | |
| 7937 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 7938 | var integer i; |
| 7939 | for (i := 0; i < 8; i := i + 1) { |
| 7940 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 7941 | } |
| 7942 | } |
| 7943 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7944 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 7945 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 7946 | private const charstring PDCH_MODE := "PDCH mode"; |
| 7947 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7948 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7949 | |
| 7950 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 7951 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 7952 | var RSL_Message rsl_unused; |
| 7953 | |
| 7954 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7955 | f_init_vty(); |
| 7956 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7957 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7958 | |
| 7959 | f_init(1, false); |
| 7960 | f_sleep(1.0); |
| 7961 | |
| 7962 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7963 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7964 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7965 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7966 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 7967 | rsl_unused := f_exp_ipa_rx(tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7968 | f_ipa_tx(ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7969 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7970 | log("TCH/F_PDCH pchan, PDCH ACT was ACKed, so now in PDCH mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7971 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7972 | |
| 7973 | /* De-activate it via VTY */ |
| 7974 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7975 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7976 | log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7977 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7978 | |
| 7979 | /* re-activate it via VTY */ |
| 7980 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 7981 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7982 | log("TCH/F_PDCH pchan, PDCH ACT via VTY, so now in PDCH mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7983 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7984 | |
| 7985 | /* and finally de-activate it again */ |
| 7986 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7987 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7988 | log("TCH/F_PDCH pchan, PDCH DEACT via VTY, so now back in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7989 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7990 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7991 | /* clean up config */ |
| 7992 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7993 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7994 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7995 | } |
| 7996 | |
| 7997 | /* Test IPA PDCH activation NACK */ |
| 7998 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 7999 | var RSL_Message rsl_unused; |
| 8000 | |
| 8001 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8002 | f_init_vty(); |
| 8003 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 8004 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8005 | |
| 8006 | f_init(1, false); |
| 8007 | f_sleep(1.0); |
| 8008 | |
| 8009 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 8010 | |
| 8011 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 8012 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8013 | rsl_unused := f_exp_ipa_rx(tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 8014 | f_ipa_tx(ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8015 | f_sleep(1.0); |
| 8016 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 8017 | |
| 8018 | /* De-activate it via VTY */ |
| 8019 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 8020 | f_sleep(1.0); |
| 8021 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 8022 | |
| 8023 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 8024 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 8025 | f_sleep(1.0); |
| 8026 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 8027 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 8028 | /* clean up config */ |
| 8029 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 8030 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8031 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8032 | } |
| 8033 | |
| 8034 | |
| 8035 | /*********************************************************************** |
| 8036 | * Osmocom style dynamic PDCH |
| 8037 | ***********************************************************************/ |
| 8038 | |
| 8039 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 8040 | template (omit) RSL_Cause nack := omit) |
| 8041 | runs on test_CT { |
| 8042 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 8043 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 8044 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8045 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 8046 | /* expect the BSC to issue the related RSL command */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8047 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT(chan_nr, ?)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8048 | if (istemplatekind(nack, "omit")) { |
| 8049 | /* respond with a related acknowledgement */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8050 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8051 | } else { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8052 | f_ipa_tx(ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8053 | } |
| 8054 | } |
| 8055 | |
| 8056 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 8057 | template (omit) RSL_Cause nack := omit) |
| 8058 | runs on test_CT { |
| 8059 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 8060 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 8061 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8062 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 8063 | /* expect the BSC to issue the related RSL command */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8064 | rsl_unused := f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8065 | if (istemplatekind(nack, "omit")) { |
| 8066 | /* respond with a related acknowledgement */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8067 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8068 | } else { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8069 | //f_ipa_tx(ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8070 | } |
| 8071 | } |
| 8072 | |
| 8073 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 8074 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 8075 | var RSL_Message rsl_unused; |
| 8076 | |
| 8077 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8078 | f_init_vty(); |
| 8079 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 8080 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8081 | |
| 8082 | f_init(1, false); |
| 8083 | f_sleep(1.0); |
| 8084 | |
| 8085 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 8086 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 8087 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8088 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 8089 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8090 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8091 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8092 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8093 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 8094 | log("TCH/F_TCH/H_PDCH requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8095 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 8096 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 8097 | /* clean up config */ |
| 8098 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 8099 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8100 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8101 | } |
| 8102 | |
| 8103 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 8104 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 8105 | var RSL_Message rsl_unused; |
| 8106 | |
| 8107 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8108 | f_init_vty(); |
| 8109 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 8110 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8111 | |
| 8112 | f_init(1, false); |
| 8113 | f_sleep(1.0); |
| 8114 | |
| 8115 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 8116 | |
| 8117 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 8118 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8119 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8120 | |
| 8121 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8122 | f_ipa_tx(ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8123 | f_sleep(1.0); |
| 8124 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 8125 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 8126 | /* clean up config */ |
| 8127 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 8128 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8129 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8130 | } |
| 8131 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8132 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 8133 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 8134 | var RSL_Message rsl_unused, rsl_msg; |
| 8135 | var DchanTuple dt; |
| 8136 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 8137 | |
| 8138 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8139 | f_init_vty(); |
| 8140 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 8141 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8142 | |
| 8143 | f_init(1, false); |
| 8144 | f_sleep(1.0); |
| 8145 | |
| 8146 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 8147 | |
| 8148 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 8149 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 8150 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8151 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8152 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8153 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8154 | f_sleep(1.0); |
| 8155 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 8156 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 8157 | |
| 8158 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 8159 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8160 | var DchanTuples sdcch_cleanup := {}; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8161 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 8162 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8163 | dt := f_est_dchan('23'O, i, gen_l3_valid_payload()); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8164 | sdcch_cleanup := sdcch_cleanup & { dt }; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8165 | } |
| 8166 | |
| 8167 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8168 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 8169 | rsl_unused := f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 8170 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8171 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8172 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8173 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8174 | dt.idx := {0, 0}; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8175 | |
| 8176 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8177 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 8178 | rsl_msg := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8179 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 8180 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8181 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8182 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 8183 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 8184 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 8185 | |
| 8186 | /* Instruct BSC to clear channel */ |
| 8187 | var BssmapCause cause := 0; |
| 8188 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8189 | f_exp_chan_rel_and_clear(dt); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8190 | |
| 8191 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8192 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
| 8193 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8194 | f_sleep(1.0); |
| 8195 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 8196 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8197 | /* Clean up SDCCH lchans */ |
| 8198 | for (i := 0; i < lengthof(sdcch_cleanup); i := i + 1) { |
| 8199 | f_perform_clear_test_ct(sdcch_cleanup[i]); |
| 8200 | } |
| 8201 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8202 | /* clean up config */ |
| 8203 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 8204 | |
| 8205 | f_shutdown_helper(); |
| 8206 | } |
| 8207 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8208 | /* Validate all 8 subslots of a dynamics TS configured as SDCCH8 are used */ |
| 8209 | testcase TC_dyn_ts_sdcch8_all_subslots_used() runs on test_CT { |
| 8210 | var ASP_RSL_Unitdata rsl_ud; |
| 8211 | var integer i; |
| 8212 | var integer chreq_total, chreq_nochan; |
| 8213 | |
| 8214 | f_init_vty(); |
| 8215 | for (i := 1; i < 8; i := i + 1) { |
| 8216 | if (i == 2) { |
| 8217 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 8218 | } else { |
| 8219 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 8220 | } |
| 8221 | } |
| 8222 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8223 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8224 | f_init(1, guard_timeout := 60.0); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8225 | |
| 8226 | /* The dyn TS want to activate PDCH mode, ACK that. */ |
| 8227 | var RslChannelNr chan_nr; |
| 8228 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8229 | f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
| 8230 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8231 | |
| 8232 | f_sleep(1.0); |
| 8233 | |
| 8234 | /* Exhaust all dedicated SDCCH lchans. |
| 8235 | /* GSM 44.018 Table 9.1.8.2: |
| 8236 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 8237 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8238 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8239 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8240 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8241 | } |
| 8242 | |
| 8243 | /* Only the dyn TS is still available. Its first lchan gets converted to SDCCH8 */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8244 | chan_cleanup := chan_cleanup & { f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8245 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 8246 | for (i := 0; i < 7; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8247 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8248 | } |
| 8249 | |
| 8250 | /* Clean up SDCCH lchans */ |
| 8251 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 8252 | f_perform_clear_test_ct(chan_cleanup[i]); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 8253 | } |
| 8254 | |
| 8255 | /* clean up config */ |
| 8256 | f_ts_reset_chcomb(0); |
| 8257 | |
| 8258 | f_shutdown_helper(); |
| 8259 | } |
| 8260 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8261 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 8262 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 8263 | it as TCH directly instead. SYS#5309. */ |
| 8264 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 8265 | var RSL_Message rsl_unused, rsl_msg; |
| 8266 | var DchanTuple dt; |
| 8267 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 8268 | var integer i; |
| 8269 | |
| 8270 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8271 | f_init_vty(); |
| 8272 | for (i := 1; i < 8; i := i + 1) { |
| 8273 | if (i == 6) { |
| 8274 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 8275 | } else { |
| 8276 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 8277 | } |
| 8278 | } |
| 8279 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8280 | |
| 8281 | f_init(1, false); |
| 8282 | f_sleep(1.0); |
| 8283 | |
| 8284 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 8285 | |
| 8286 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 8287 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 8288 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8289 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8290 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8291 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8292 | f_sleep(1.0); |
| 8293 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 8294 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 8295 | |
| 8296 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 8297 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8298 | var DchanTuples chan_cleanup := {}; |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 8299 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 8300 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8301 | dt := f_est_dchan(ra, i, gen_l3_valid_payload()); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8302 | chan_cleanup := chan_cleanup & { dt }; |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8303 | } |
| 8304 | |
| 8305 | /* Now the dyn ts is selected. First PDCH is released, then TCH chan is activated */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8306 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(oct2int(ra) + i, 1), 2342)); |
| 8307 | rsl_unused := f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 8308 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8309 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8310 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8311 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8312 | dt.idx := {0, 0}; |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8313 | |
| 8314 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8315 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 8316 | rsl_msg := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8317 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 8318 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8319 | f_ipa_tx(ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8320 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 8321 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 8322 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 8323 | |
| 8324 | /* Instruct BSC to clear channel */ |
| 8325 | var BssmapCause cause := 0; |
| 8326 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8327 | f_exp_chan_rel_and_clear(dt); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8328 | |
| 8329 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8330 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
| 8331 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8332 | f_sleep(1.0); |
| 8333 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 8334 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8335 | /* Clean up SDCCH lchans */ |
| 8336 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 8337 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 8338 | } |
| 8339 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 8340 | /* clean up config */ |
| 8341 | f_ts_reset_chcomb(0); |
| 8342 | /* TODO: clean up other channels? */ |
| 8343 | |
| 8344 | f_shutdown_helper(); |
| 8345 | } |
| 8346 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8347 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 8348 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 8349 | var RSL_Message rsl_unused, rsl_msg; |
| 8350 | var DchanTuple dt; |
| 8351 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 8352 | var GsmRrMessage rr; |
| 8353 | |
| 8354 | /* change Timeslot 6 before f_init() starts RSL */ |
| 8355 | f_init_vty(); |
| 8356 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 8357 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8358 | |
| 8359 | f_init(1, false); |
| 8360 | f_sleep(1.0); |
| 8361 | |
| 8362 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 8363 | |
| 8364 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 8365 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 8366 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8367 | rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8368 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8369 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8370 | f_sleep(1.0); |
| 8371 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 8372 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 8373 | |
| 8374 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 8375 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8376 | var DchanTuples chan_cleanup := {}; |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8377 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 8378 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 8379 | dt := f_est_dchan('23'O, i, gen_l3_valid_payload()); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8380 | chan_cleanup := chan_cleanup & { dt }; |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8381 | } |
| 8382 | |
| 8383 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8384 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 8385 | rsl_unused := f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 8386 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8387 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8388 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8389 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8390 | dt.idx := {0, 0}; |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8391 | |
| 8392 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8393 | f_ipa_tx(ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 8394 | rsl_msg := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8395 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 8396 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 8397 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 8398 | } |
| 8399 | |
| 8400 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 8401 | |
| 8402 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8403 | /* rsl_unused := f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
| 8404 | * f_ipa_tx(ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8405 | * f_sleep(1.0); |
| 8406 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 8407 | */ |
| 8408 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8409 | /* Clean up SDCCH lchans */ |
| 8410 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 8411 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 8412 | } |
| 8413 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 8414 | /* clean up config */ |
| 8415 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 8416 | |
| 8417 | f_shutdown_helper(); |
| 8418 | } |
| 8419 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8420 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 8421 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port, mp_bsc_ctrl_port}; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8422 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 8423 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 8424 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8425 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8426 | } |
| 8427 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8428 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 8429 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 8430 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 8431 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 8432 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 8433 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8434 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8435 | } |
| 8436 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8437 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 8438 | the BTS does autonomous MS power control loop */ |
| 8439 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 8440 | var MSC_ConnHdlr vc_conn; |
| 8441 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8442 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 8443 | pars.exp_ms_power_params := true; |
| 8444 | |
| 8445 | f_init(1, true); |
| 8446 | f_sleep(1.0); |
| 8447 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 8448 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8449 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8450 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8451 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 8452 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 8453 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 8454 | f_init(1); |
| 8455 | |
| 8456 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 8457 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 8458 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 8459 | |
| 8460 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
Vadim Yanitskiy | 35c9a33 | 2022-03-16 20:26:35 +0300 | [diff] [blame] | 8461 | var template (present) RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 8462 | chan_nr := t_RslChanNr_BCCH(0), |
| 8463 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 8464 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8465 | var RSL_Message unused := f_exp_ipa_rx(tr_rsl_pdu); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 8466 | |
| 8467 | /* Additionally verify the applied value over the CTRL interface */ |
| 8468 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 8469 | if (cred != int2str(red)) { |
| 8470 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 8471 | cred, " (expected ", red, ")"); |
| 8472 | } |
| 8473 | } |
| 8474 | |
| 8475 | f_shutdown_helper(); |
| 8476 | } |
| 8477 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8478 | /*********************************************************************** |
| 8479 | * MSC Pooling |
| 8480 | ***********************************************************************/ |
| 8481 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8482 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 8483 | ts_MI_TMSI_LV(tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v, nri_bitlen := nri_bitlen)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8484 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8485 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 8486 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8487 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8488 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8489 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8490 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8491 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8492 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8493 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 8494 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8495 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8496 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8497 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8498 | break; |
| 8499 | } |
| 8500 | } |
| 8501 | } |
| 8502 | |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8503 | private altstep as_mgcp_ack_all_dlcx() runs on MSC_ConnHdlr { |
| 8504 | var MgcpCommand mgcp_cmd; |
Oliver Smith | ab7354b | 2023-05-08 11:34:30 +0200 | [diff] [blame] | 8505 | var template MgcpMessage msg_dlcx := { |
| 8506 | command := tr_DLCX |
| 8507 | } |
| 8508 | var MGCP_RecvFrom mrf; |
| 8509 | |
| 8510 | [g_pars.aoip] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8511 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 8512 | repeat; |
| 8513 | } |
Oliver Smith | ab7354b | 2023-05-08 11:34:30 +0200 | [diff] [blame] | 8514 | |
| 8515 | [not g_pars.aoip] MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 8516 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, MgcpMessage:{ |
| 8517 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 8518 | })); |
| 8519 | repeat; |
| 8520 | } |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8521 | } |
| 8522 | |
| 8523 | private altstep as_rsl_ack_all_rel_req() runs on MSC_ConnHdlr { |
| 8524 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 8525 | [] RSL.receive(tr_RSL_REL_REQ(g_chan_nr, ?)) { |
| 8526 | RSL.send(ts_RSL_REL_CONF(g_chan_nr, main_dcch)); |
| 8527 | repeat; |
| 8528 | } |
| 8529 | } |
| 8530 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8531 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
Neels Hofmeyr | 8f4db54 | 2023-11-22 04:15:10 +0100 | [diff] [blame] | 8532 | template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE, |
| 8533 | boolean send_rel_ack := true) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 8534 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8535 | var default ack_dlcx := activate(as_mgcp_ack_all_dlcx()); |
| 8536 | var default ack_rel_req := activate(as_rsl_ack_all_rel_req()); |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8537 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8538 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8539 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8540 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8541 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8542 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8543 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8544 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8545 | } |
| 8546 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8547 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8548 | /* Also drop the SCCP connection */ |
| 8549 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8550 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 8551 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8552 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 8f4db54 | 2023-11-22 04:15:10 +0100 | [diff] [blame] | 8553 | if (send_rel_ack) { |
| 8554 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8555 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
| 8556 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8557 | } |
| 8558 | } |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8559 | deactivate(ack_dlcx); |
| 8560 | deactivate(ack_rel_req); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8561 | } |
| 8562 | |
Neels Hofmeyr | c3c6ee6 | 2022-01-26 01:22:12 +0100 | [diff] [blame] | 8563 | friend function f_perform_clear_no_rr_rel(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC) |
| 8564 | runs on MSC_ConnHdlr { |
| 8565 | var default ack_dlcx := activate(as_mgcp_ack_all_dlcx()); |
| 8566 | var default ack_rel_req := activate(as_rsl_ack_all_rel_req()); |
| 8567 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
| 8568 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8569 | interleave { |
| 8570 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8571 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8572 | } |
| 8573 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 8574 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
| 8575 | /* Also drop the SCCP connection */ |
| 8576 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8577 | } |
| 8578 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 8579 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8580 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8581 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
| 8582 | } |
| 8583 | } |
| 8584 | deactivate(ack_dlcx); |
| 8585 | deactivate(ack_rel_req); |
| 8586 | } |
| 8587 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 8588 | friend function f_perform_clear_no_lchan() |
| 8589 | runs on MSC_ConnHdlr { |
| 8590 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
| 8591 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8592 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 8593 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
| 8594 | /* Also drop the SCCP connection */ |
| 8595 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8596 | } |
| 8597 | |
Vadim Yanitskiy | 65d879d | 2022-06-23 18:15:39 +0700 | [diff] [blame] | 8598 | friend function f_perform_clear_test_ct(DchanTuple dt) |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8599 | runs on test_CT |
| 8600 | { |
| 8601 | /* Instruct BSC to clear channel */ |
| 8602 | var BssmapCause cause := 0; |
| 8603 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 8604 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8605 | } |
| 8606 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8607 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 8608 | template PDU_ML3_MS_NW l3_info, boolean do_clear := true, boolean expect_bssmap_l3 := true) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8609 | runs on MSC_ConnHdlr { |
| 8610 | timer T := 10.0; |
| 8611 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 8612 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8613 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8614 | f_create_bssmap_exp(l3_enc); |
| 8615 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8616 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 8617 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8618 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8619 | */ |
| 8620 | var RSL_Message rx_rsl; |
| 8621 | var GsmRrMessage rr; |
| 8622 | |
| 8623 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8624 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8625 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8626 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8627 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 8628 | */ |
| 8629 | timer Tt := 10.0; |
| 8630 | |
| 8631 | /* request a channel to be established */ |
| 8632 | Tt.start; |
| 8633 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8634 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8635 | Tt.stop; |
| 8636 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8637 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8638 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 8639 | mtc.stop; |
| 8640 | } |
| 8641 | [] Tt.timeout { |
| 8642 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 8643 | mtc.stop; |
| 8644 | } |
| 8645 | } |
| 8646 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 8647 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8648 | rsl_pt.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8649 | |
| 8650 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8651 | if (expect_bssmap_l3) { |
| 8652 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 8653 | var template PDU_BSSAP exp_l3_compl; |
| 8654 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 8655 | if (g_pars.aoip == false) { |
| 8656 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 8657 | } else { |
| 8658 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 8659 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8660 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8661 | var PDU_BSSAP bssap; |
| 8662 | T.start; |
| 8663 | alt { |
| 8664 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 8665 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 8666 | log("rx exp_l3_compl = ", bssap); |
| 8667 | } |
| 8668 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 8669 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 8670 | } |
| 8671 | [] T.timeout { |
| 8672 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 8673 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8674 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8675 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8676 | /* start ciphering, if requested */ |
| 8677 | if (ispresent(g_pars.encr)) { |
| 8678 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8679 | f_cipher_mode(g_pars.encr, rsl_pt := rsl_pt, rsl_proc_pt := rsl_proc_pt); |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8680 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8681 | } |
| 8682 | |
| 8683 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8684 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8685 | } |
| 8686 | setverdict(pass); |
| 8687 | f_sleep(1.0); |
| 8688 | } |
| 8689 | |
| 8690 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 8691 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8692 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8693 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8694 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8695 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8696 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8697 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8698 | } |
| 8699 | } |
| 8700 | |
| 8701 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 8702 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 8703 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8704 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 8705 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 8706 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(ts_MI_IMSI_LV('001010000000003'H)) ); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8707 | f_perform_compl_l3(RSL, RSL_PROC, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8708 | } |
| 8709 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 8710 | |
| 8711 | f_init(1, true); |
| 8712 | f_sleep(1.0); |
| 8713 | var MSC_ConnHdlr vc_conn; |
| 8714 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8715 | |
| 8716 | f_ctrs_msc_init(); |
| 8717 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8718 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 8719 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8720 | |
| 8721 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8722 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8723 | } |
| 8724 | |
| 8725 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 8726 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8727 | * just as well using only RSL. */ |
| 8728 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 8729 | |
| 8730 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8731 | f_sleep(1.0); |
| 8732 | |
| 8733 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8734 | * would be randomly affected by which other tests ran before this. */ |
| 8735 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8736 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8737 | f_ctrs_msc_init(); |
| 8738 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8739 | var MSC_ConnHdlr vc_conn1; |
| 8740 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8741 | pars1.mscpool.rsl_idx := 0; |
| 8742 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 8743 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8744 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8745 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8746 | |
| 8747 | var MSC_ConnHdlr vc_conn2; |
| 8748 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8749 | pars2.mscpool.rsl_idx := 1; |
| 8750 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8751 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8752 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8753 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8754 | |
| 8755 | /* Test round-robin wrap to the first MSC */ |
| 8756 | var MSC_ConnHdlr vc_conn3; |
| 8757 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8758 | pars3.mscpool.rsl_idx := 2; |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 8759 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_IMSI_LV('001010000000003'H))); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8760 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8761 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8762 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8763 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8764 | } |
| 8765 | |
| 8766 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 8767 | * (configured in osmo-bsc.cfg). */ |
| 8768 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8769 | * just as well using only RSL. */ |
| 8770 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 8771 | |
| 8772 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8773 | f_sleep(1.0); |
| 8774 | |
| 8775 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8776 | * would be randomly affected by which other tests ran before this. */ |
| 8777 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8778 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8779 | f_ctrs_msc_init(); |
| 8780 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8781 | var MSC_ConnHdlr vc_conn1; |
| 8782 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8783 | pars1.mscpool.rsl_idx := 0; |
| 8784 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8785 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8786 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8787 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8788 | |
| 8789 | var MSC_ConnHdlr vc_conn2; |
| 8790 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8791 | pars2.mscpool.rsl_idx := 1; |
| 8792 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8793 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8794 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8795 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8796 | |
| 8797 | /* Test round-robin wrap to the first MSC */ |
| 8798 | var MSC_ConnHdlr vc_conn3; |
| 8799 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8800 | pars3.mscpool.rsl_idx := 2; |
| 8801 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8802 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8803 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8804 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8805 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8806 | } |
| 8807 | |
| 8808 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 8809 | * (configured in osmo-bsc.cfg). In this case, one of the MSC also has the NULL-NRI as part of its owned NRIs, but the |
| 8810 | * NULL-NRI setting is stronger than that. */ |
| 8811 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8812 | * just as well using only RSL. */ |
| 8813 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 8814 | |
| 8815 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8816 | f_sleep(1.0); |
| 8817 | |
| 8818 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8819 | * would be randomly affected by which other tests ran before this. */ |
| 8820 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8821 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8822 | f_ctrs_msc_init(); |
| 8823 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8824 | var MSC_ConnHdlr vc_conn1; |
| 8825 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8826 | pars1.mscpool.rsl_idx := 0; |
| 8827 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8828 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8829 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8830 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8831 | |
| 8832 | var MSC_ConnHdlr vc_conn2; |
| 8833 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8834 | pars2.mscpool.rsl_idx := 1; |
| 8835 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8836 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8837 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8838 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8839 | |
| 8840 | /* Test round-robin wrap to the first MSC */ |
| 8841 | var MSC_ConnHdlr vc_conn3; |
| 8842 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8843 | pars3.mscpool.rsl_idx := 2; |
| 8844 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8845 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8846 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8847 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8848 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8849 | } |
| 8850 | |
| 8851 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 8852 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 8853 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8854 | * just as well using only RSL. */ |
| 8855 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 8856 | |
| 8857 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8858 | f_sleep(1.0); |
| 8859 | |
| 8860 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8861 | * would be randomly affected by which other tests ran before this. */ |
| 8862 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8863 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8864 | f_ctrs_msc_init(); |
| 8865 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8866 | var MSC_ConnHdlr vc_conn1; |
| 8867 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8868 | pars1.mscpool.rsl_idx := 0; |
| 8869 | /* An NRI that is not assigned to any MSC */ |
| 8870 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 8871 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8872 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8873 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8874 | |
| 8875 | var MSC_ConnHdlr vc_conn2; |
| 8876 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8877 | pars2.mscpool.rsl_idx := 1; |
| 8878 | /* An NRI that is not assigned to any MSC */ |
| 8879 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 8880 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8881 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8882 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8883 | |
| 8884 | /* Test round-robin wrap to the first MSC */ |
| 8885 | var MSC_ConnHdlr vc_conn3; |
| 8886 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8887 | pars3.mscpool.rsl_idx := 2; |
| 8888 | /* An NRI that is not assigned to any MSC */ |
| 8889 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 8890 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8891 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8892 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8893 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8894 | } |
| 8895 | |
| 8896 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 8897 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 8898 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8899 | * just as well using only RSL. */ |
| 8900 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 8901 | |
| 8902 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8903 | f_sleep(1.0); |
| 8904 | |
| 8905 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8906 | * would be randomly affected by which other tests ran before this. */ |
| 8907 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8908 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8909 | f_ctrs_msc_init(); |
| 8910 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8911 | var MSC_ConnHdlr vc_conn1; |
| 8912 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8913 | pars1.mscpool.rsl_idx := 0; |
| 8914 | /* An NRI that is assigned to an unconnected MSC */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 8915 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_TMSI_NRI_LV(512))); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8916 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8917 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8918 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8919 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8920 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8921 | |
| 8922 | var MSC_ConnHdlr vc_conn2; |
| 8923 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8924 | pars2.mscpool.rsl_idx := 1; |
| 8925 | /* An NRI that is assigned to an unconnected MSC */ |
| 8926 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 8927 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8928 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8929 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8930 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 8931 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8932 | |
| 8933 | /* Test round-robin wrap to the first MSC */ |
| 8934 | var MSC_ConnHdlr vc_conn3; |
| 8935 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8936 | pars3.mscpool.rsl_idx := 2; |
| 8937 | /* An NRI that is assigned to an unconnected MSC */ |
| 8938 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 8939 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8940 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8941 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8942 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8943 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8944 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8945 | } |
| 8946 | |
| 8947 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 8948 | * osmo-bsc.cfg). */ |
| 8949 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8950 | * just as well using only RSL. */ |
| 8951 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 8952 | |
| 8953 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8954 | f_sleep(1.0); |
| 8955 | |
| 8956 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 8957 | * this is not using round-robin. */ |
| 8958 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8959 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8960 | f_ctrs_msc_init(); |
| 8961 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8962 | var MSC_ConnHdlr vc_conn1; |
| 8963 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8964 | pars1.mscpool.rsl_idx := 0; |
| 8965 | /* An NRI of the second MSC's range (256-511) */ |
| 8966 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 8967 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8968 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8969 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8970 | |
| 8971 | var MSC_ConnHdlr vc_conn2; |
| 8972 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8973 | pars2.mscpool.rsl_idx := 1; |
| 8974 | /* An NRI of the second MSC's range (256-511) */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 8975 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_TMSI_NRI_LV(260))); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8976 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8977 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8978 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8979 | |
| 8980 | var MSC_ConnHdlr vc_conn3; |
| 8981 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8982 | pars3.mscpool.rsl_idx := 2; |
| 8983 | /* An NRI of the second MSC's range (256-511) */ |
| 8984 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 8985 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8986 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8987 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8988 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8989 | } |
| 8990 | |
| 8991 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 8992 | * while a round-robin remains unaffected by that. */ |
| 8993 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8994 | * just as well using only RSL. */ |
| 8995 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 8996 | |
| 8997 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8998 | f_sleep(1.0); |
| 8999 | |
| 9000 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 9001 | * this is not using round-robin. */ |
| 9002 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 9003 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9004 | f_ctrs_msc_init(); |
| 9005 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9006 | var MSC_ConnHdlr vc_conn1; |
| 9007 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 9008 | pars1.mscpool.rsl_idx := 0; |
| 9009 | /* An NRI of the third MSC's range (512-767) */ |
| 9010 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 9011 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9012 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9013 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9014 | |
| 9015 | var MSC_ConnHdlr vc_conn2; |
| 9016 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 9017 | pars2.mscpool.rsl_idx := 1; |
| 9018 | /* An NRI of the third MSC's range (512-767) */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9019 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_TMSI_NRI_LV(678))); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9020 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9021 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9022 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9023 | |
| 9024 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 9025 | var MSC_ConnHdlr vc_conn3; |
| 9026 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 9027 | pars3.mscpool.rsl_idx := 2; |
| 9028 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 9029 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 9030 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9031 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9032 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9033 | } |
| 9034 | |
| 9035 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 9036 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 9037 | * just as well using only RSL. */ |
| 9038 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 9039 | |
| 9040 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 9041 | f_sleep(1.0); |
| 9042 | |
| 9043 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 9044 | * instead, and hits msc 0. */ |
| 9045 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 9046 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9047 | f_ctrs_msc_init(); |
| 9048 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9049 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 9050 | var MSC_ConnHdlr vc_conn1; |
| 9051 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9052 | pars1.mscpool.rsl_idx := 0; |
| 9053 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 9054 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9055 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9056 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9057 | |
| 9058 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 9059 | var MSC_ConnHdlr vc_conn2; |
| 9060 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 9061 | pars2.mscpool.rsl_idx := 1; |
| 9062 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 9063 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9064 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9065 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9066 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9067 | } |
| 9068 | |
| 9069 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 9070 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 9071 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 9072 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 9073 | //cid_list := { cIl_allInBSS := ''O }; |
| 9074 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 9075 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 9076 | var BSSAP_N_UNITDATA_req paging; |
| 9077 | var hexstring imsi := '001010000000123'H; |
| 9078 | |
| 9079 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9080 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 9081 | paging := valueof(ts_BSSAP_UNITDATA_req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9082 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 9083 | BSSAP.send(paging); |
| 9084 | |
| 9085 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 9086 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 9087 | * channel number is picked here. */ |
| 9088 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 9089 | f_rslem_register(0, new_chan_nr); |
| 9090 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 9091 | f_rslem_unregister(0, new_chan_nr); |
| 9092 | |
| 9093 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 9094 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9095 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(ts_MI_IMSI_LV(imsi)) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9096 | f_sleep(1.0); |
| 9097 | } |
| 9098 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 9099 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 9100 | f_sleep(1.0); |
| 9101 | |
| 9102 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 9103 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 9104 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 9105 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9106 | f_ctrs_msc_init(); |
| 9107 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9108 | var MSC_ConnHdlr vc_conn1; |
| 9109 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9110 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 9111 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 9112 | pars1.sccp_addr_msc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_own; |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9113 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 9114 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9115 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9116 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9117 | } |
| 9118 | |
| 9119 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 9120 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 9121 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 9122 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 9123 | //cid_list := { cIl_allInBSS := ''O }; |
| 9124 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 9125 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 9126 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 9127 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9128 | var BSSAP_N_UNITDATA_req paging; |
| 9129 | |
| 9130 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9131 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 9132 | paging := valueof(ts_BSSAP_UNITDATA_req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9133 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 9134 | BSSAP.send(paging); |
| 9135 | |
| 9136 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 9137 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 9138 | * channel number is picked here. */ |
| 9139 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 9140 | f_rslem_register(0, new_chan_nr); |
| 9141 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 9142 | f_rslem_unregister(0, new_chan_nr); |
| 9143 | |
| 9144 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 9145 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 9146 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9147 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(ts_MI_TMSI_NRI_LV(nri_v)) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9148 | f_sleep(1.0); |
| 9149 | } |
| 9150 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 9151 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 9152 | f_sleep(1.0); |
| 9153 | |
| 9154 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 9155 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 9156 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 9157 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9158 | f_ctrs_msc_init(); |
| 9159 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9160 | var MSC_ConnHdlr vc_conn1; |
| 9161 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9162 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 9163 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 9164 | pars1.sccp_addr_msc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_own; |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9165 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 9166 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9167 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9168 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9169 | } |
| 9170 | |
| 9171 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 9172 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 9173 | * just as well using only RSL. */ |
| 9174 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 9175 | |
| 9176 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 9177 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 9178 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 9179 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9180 | |
| 9181 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 9182 | * would be randomly affected by which other tests ran before this. */ |
| 9183 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 9184 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9185 | f_ctrs_msc_init(); |
| 9186 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9187 | var MSC_ConnHdlr vc_conn1; |
| 9188 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9189 | pars1.mscpool.rsl_idx := 0; |
| 9190 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 9191 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9192 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9193 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9194 | |
| 9195 | var MSC_ConnHdlr vc_conn2; |
| 9196 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 9197 | pars2.mscpool.rsl_idx := 1; |
| 9198 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 9199 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9200 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9201 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9202 | |
| 9203 | var MSC_ConnHdlr vc_conn3; |
| 9204 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9205 | pars3.mscpool.rsl_idx := 2; |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9206 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_IMSI_LV('001010000000003'H))); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9207 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 9208 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9209 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9210 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9211 | } |
| 9212 | |
| 9213 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 9214 | * TMSI NRI. */ |
| 9215 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 9216 | |
| 9217 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 9218 | f_sleep(1.0); |
| 9219 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 9220 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 9221 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 9222 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9223 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 9224 | * would be randomly affected by which other tests ran before this. */ |
| 9225 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 9226 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9227 | f_ctrs_msc_init(); |
| 9228 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9229 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 9230 | var MSC_ConnHdlr vc_conn1; |
| 9231 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 9232 | pars1.mscpool.rsl_idx := 0; |
| 9233 | /* An NRI of the second MSC's range (256-511) */ |
| 9234 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 9235 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9236 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9237 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9238 | |
| 9239 | var MSC_ConnHdlr vc_conn2; |
| 9240 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9241 | pars2.mscpool.rsl_idx := 1; |
| 9242 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 9243 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9244 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9245 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9246 | |
| 9247 | var MSC_ConnHdlr vc_conn3; |
| 9248 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 9249 | pars3.mscpool.rsl_idx := 2; |
| 9250 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 9251 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 9252 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 9253 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9254 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9255 | } |
| 9256 | |
Neels Hofmeyr | 2bdc6b6 | 2023-04-05 02:45:19 +0200 | [diff] [blame] | 9257 | /* When an MSC point-code gets an SCCP N-PCSTATE saying it is unreachable, immediately mark the MSC as unusable. */ |
| 9258 | testcase TC_mscpool_sccp_n_pcstate_detaches_msc() runs on test_CT { |
| 9259 | |
| 9260 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 9261 | f_sleep(1.0); |
| 9262 | |
| 9263 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 9264 | * would be randomly affected by which other tests ran before this. */ |
| 9265 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 9266 | |
| 9267 | f_ctrs_msc_init(); |
| 9268 | |
| 9269 | var MSC_ConnHdlr vc_conn1; |
| 9270 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9271 | pars1.mscpool.rsl_idx := 0; |
| 9272 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 9273 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9274 | vc_conn1.done; |
| 9275 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
| 9276 | |
| 9277 | var MSC_ConnHdlr vc_conn2; |
| 9278 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 9279 | pars2.mscpool.rsl_idx := 1; |
| 9280 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 9281 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9282 | vc_conn2.done; |
| 9283 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
| 9284 | |
| 9285 | f_logp(BSCVTY, "disconnecting msc0"); |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 9286 | f_bssap_idx_disconnect(0); |
Neels Hofmeyr | 2bdc6b6 | 2023-04-05 02:45:19 +0200 | [diff] [blame] | 9287 | |
| 9288 | /* Now round-robin would wrap to the first MSC, but since the first MSC is disconnected, it wraps around to msc |
| 9289 | * 2 again. */ |
| 9290 | var MSC_ConnHdlr vc_conn3; |
| 9291 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 9292 | pars3.mscpool.rsl_idx := 2; |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9293 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_IMSI_LV('001010000000003'H))); |
Neels Hofmeyr | 2bdc6b6 | 2023-04-05 02:45:19 +0200 | [diff] [blame] | 9294 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 9295 | vc_conn3.done; |
| 9296 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
| 9297 | f_shutdown_helper(); |
| 9298 | } |
| 9299 | |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 9300 | /* When an MSC point-code gets an SCCP N-PCSTATE saying it is now reachable, immediately trigger RESET and bring up the |
| 9301 | * MSC. */ |
| 9302 | testcase TC_mscpool_sccp_n_pcstate_attaches_msc() runs on test_CT { |
| 9303 | |
| 9304 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 1); |
| 9305 | f_sleep(1.0); |
| 9306 | |
| 9307 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 9308 | * would be randomly affected by which other tests ran before this. */ |
| 9309 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 9310 | |
| 9311 | f_ctrs_msc_init(); |
| 9312 | |
| 9313 | /* There is only one MSC, round robin stays on msc0 */ |
| 9314 | var MSC_ConnHdlr vc_conn1; |
| 9315 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9316 | pars1.mscpool.rsl_idx := 0; |
| 9317 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('0010100230000001'H)), '00F110'O)); |
| 9318 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 9319 | vc_conn1.done; |
| 9320 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
| 9321 | |
| 9322 | var MSC_ConnHdlr vc_conn2; |
| 9323 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 9324 | pars2.mscpool.rsl_idx := 1; |
| 9325 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010023000002'H)))); |
| 9326 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 9327 | vc_conn2.done; |
| 9328 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
| 9329 | |
| 9330 | f_logp(BSCVTY, "connecting msc1"); |
| 9331 | f_vty_msc_allow_attach(BSCVTY, { true, true }); |
| 9332 | f_bssap_idx_init(1); |
| 9333 | f_sleep(1.0); |
| 9334 | |
| 9335 | /* This time round-robin wraps to the second MSC, because it is now online. */ |
| 9336 | var MSC_ConnHdlr vc_conn4; |
| 9337 | var TestHdlrParams pars4 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 9338 | pars4.mscpool.rsl_idx := 2; |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 9339 | pars4.mscpool.l3_info := valueof(ts_PAG_RESP(ts_MI_IMSI_LV('001010023000003'H))); |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 9340 | vc_conn4 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars4); |
| 9341 | vc_conn4.done; |
| 9342 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
| 9343 | |
| 9344 | f_shutdown_helper(); |
| 9345 | } |
| 9346 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9347 | /* Allow/Deny emergency calls globally via VTY */ |
| 9348 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 9349 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 9350 | if (allow) { |
| 9351 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 9352 | } else { |
| 9353 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 9354 | } |
| 9355 | f_vty_transceive(BSCVTY, "exit"); |
| 9356 | f_vty_transceive(BSCVTY, "exit"); |
| 9357 | } |
| 9358 | |
| 9359 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 9360 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 9361 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 9362 | if (allow) { |
| 9363 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 9364 | } else { |
| 9365 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 9366 | } |
| 9367 | f_vty_transceive(BSCVTY, "exit"); |
| 9368 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 9369 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9370 | } |
| 9371 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 9372 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 9373 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 9374 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 9375 | if (allow) { |
| 9376 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 9377 | } else { |
| 9378 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 9379 | } |
| 9380 | f_vty_transceive(BSCVTY, "exit"); |
| 9381 | f_vty_transceive(BSCVTY, "exit"); |
| 9382 | f_vty_transceive(BSCVTY, "exit"); |
| 9383 | } |
| 9384 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 9385 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 9386 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 9387 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 9388 | if (allow) { |
| 9389 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 9390 | } else { |
| 9391 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 9392 | } |
| 9393 | f_vty_transceive(BSCVTY, "exit"); |
| 9394 | f_vty_transceive(BSCVTY, "exit"); |
| 9395 | f_vty_transceive(BSCVTY, "exit"); |
| 9396 | } |
| 9397 | |
Pau Espin Pedrol | 3560979 | 2023-01-03 16:56:59 +0100 | [diff] [blame] | 9398 | /* Begin assignment procedure and send an EMERGENCY SETUP (RR) */ |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9399 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 9400 | var PDU_ML3_MS_NW emerg_setup; |
| 9401 | var octetstring emerg_setup_enc; |
| 9402 | var RSL_Message emerg_setup_data_ind; |
| 9403 | |
| 9404 | f_establish_fully(omit, omit); |
| 9405 | |
| 9406 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 9407 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 9408 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 9409 | |
| 9410 | RSL.send(emerg_setup_data_ind); |
| 9411 | } |
| 9412 | |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 9413 | /* expect EmergencySetup on BSSAP after calling f_assignment_emerg_setup() */ |
| 9414 | private function f_assignment_emerg_setup_exp_bssap() |
| 9415 | runs on MSC_ConnHdlr { |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9416 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 9417 | var PDU_ML3_MS_NW emerg_setup; |
| 9418 | timer T := 3.0; |
| 9419 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9420 | T.start; |
| 9421 | alt { |
| 9422 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 9423 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 9424 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 9425 | setverdict(fail, "no emergency setup"); |
| 9426 | } |
| 9427 | } |
| 9428 | [] BSSAP.receive { |
| 9429 | setverdict(fail, "unexpected BSSAP message!"); |
| 9430 | } |
| 9431 | [] T.timeout { |
| 9432 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 9433 | } |
| 9434 | } |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 9435 | } |
| 9436 | |
Pau Espin Pedrol | 14076d3 | 2023-01-03 17:07:59 +0100 | [diff] [blame] | 9437 | private function f_assignment_emerg_setup_voice() |
| 9438 | runs on MSC_ConnHdlr { |
| 9439 | /* Go on with voice call assignment */ |
| 9440 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 9441 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9442 | |
| 9443 | /* Below speechOrDataIndicator and codecList are copied from an emergency call captured during tests. |
| 9444 | * They seem a bit weird (AMR-WB, and the order differ between speechId_DataIndicator and the codecList), but |
| 9445 | * seems a good idea to see how osmo-bsc reacts to this. */ |
| 9446 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := { |
| 9447 | elementIdentifier := '0B'O, /* overwritten */ |
| 9448 | lengthIndicator := 0, /* overwritten */ |
| 9449 | speechOrDataIndicator := '0001'B, /* speech */ |
| 9450 | spare1_4 := '0000'B, |
| 9451 | channelRateAndType := ChRate_TCHForH_Fpref, |
| 9452 | speechId_DataIndicator := 'c2918105'O |
| 9453 | }; |
| 9454 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ |
| 9455 | ts_CodecHR, ts_CodecAMR_WB, ts_CodecEFR, ts_CodecFR})); |
| 9456 | |
| 9457 | f_rslem_dchan_queue_enable(); |
| 9458 | |
| 9459 | var ExpectCriteria mgcpcrit := { |
| 9460 | connid := omit, |
| 9461 | endpoint := omit, |
| 9462 | transid := omit |
| 9463 | }; |
| 9464 | f_create_mgcp_expect(mgcpcrit); |
| 9465 | |
| 9466 | BSSAP.send(ass_cmd); |
| 9467 | |
| 9468 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
Oliver Smith | ce2dd69 | 2023-04-17 10:25:50 +0200 | [diff] [blame] | 9469 | st.rtp_stream := true; |
Pau Espin Pedrol | 14076d3 | 2023-01-03 17:07:59 +0100 | [diff] [blame] | 9470 | st.is_assignment := false; |
| 9471 | alt { |
| 9472 | [] as_modify(st); |
| 9473 | [] as_Media(); |
| 9474 | [st.modify_done] BSSAP.receive(exp_compl) { |
| 9475 | setverdict(pass); |
| 9476 | } |
| 9477 | } |
| 9478 | |
| 9479 | /* Voice call carries on ... */ |
| 9480 | f_sleep(2.0); |
| 9481 | } |
| 9482 | |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 9483 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 9484 | * CALLS are permitted by the BSC config. */ |
| 9485 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 9486 | |
Pau Espin Pedrol | 14076d3 | 2023-01-03 17:07:59 +0100 | [diff] [blame] | 9487 | /* Make sure the CHAN RQD indicates an emergency call (0b101xxxxx). The difference is that osmo-bsc directly |
| 9488 | * assigns a TCH lchan and establishing voice for the emergency call will use Mode Modify, not reassignment to |
| 9489 | * another lchan. */ |
| 9490 | g_pars.ra := f_rnd_ra_emerg(); |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 9491 | f_assignment_emerg_setup(); |
| 9492 | f_assignment_emerg_setup_exp_bssap(); |
Pau Espin Pedrol | 14076d3 | 2023-01-03 17:07:59 +0100 | [diff] [blame] | 9493 | f_assignment_emerg_setup_voice(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9494 | |
| 9495 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 9496 | f_perform_clear(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9497 | } |
| 9498 | |
| 9499 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 9500 | * forbidden by the BSC config. */ |
| 9501 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 9502 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 9503 | timer T := 3.0; |
| 9504 | |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 9505 | f_assignment_emerg_setup(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9506 | |
| 9507 | T.start; |
| 9508 | alt { |
| 9509 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 9510 | setverdict(pass); |
| 9511 | } |
| 9512 | [] RSL.receive { |
| 9513 | setverdict(fail, "unexpected RSL message!"); |
| 9514 | } |
| 9515 | [] T.timeout { |
| 9516 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 9517 | } |
| 9518 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 9519 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
Neels Hofmeyr | c3c6ee6 | 2022-01-26 01:22:12 +0100 | [diff] [blame] | 9520 | f_perform_clear_no_rr_rel(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9521 | } |
| 9522 | |
| 9523 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 9524 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 9525 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9526 | var MSC_ConnHdlr vc_conn; |
| 9527 | |
| 9528 | f_init(1, true); |
| 9529 | f_sleep(1.0); |
| 9530 | |
| 9531 | f_vty_allow_emerg_msc(true); |
| 9532 | f_vty_allow_emerg_bts(true, 0); |
| 9533 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 9534 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9535 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9536 | } |
| 9537 | |
Pau Espin Pedrol | b27653c | 2023-01-03 14:07:21 +0100 | [diff] [blame] | 9538 | /* Test MO emergency call using MobileIdentity=IMEI (possible for emergency |
| 9539 | * calls from phones without SIM card). |
| 9540 | * 3GPP TS 24.008 section 10.5.1.4, OS#5849 */ |
| 9541 | testcase TC_assignment_emerg_setup_allow_imei() runs on test_CT { |
| 9542 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9543 | var MSC_ConnHdlr vc_conn; |
| 9544 | |
| 9545 | /* Remove IMSI set by f_gen_test_hdlr_pars(), then IMEI will be used to place the call */ |
| 9546 | pars.imsi := omit; |
| 9547 | |
| 9548 | f_init(1, true); |
| 9549 | f_sleep(1.0); |
| 9550 | |
| 9551 | f_vty_allow_emerg_msc(true); |
| 9552 | f_vty_allow_emerg_bts(true, 0); |
| 9553 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 9554 | vc_conn.done; |
| 9555 | f_shutdown_helper(); |
| 9556 | } |
| 9557 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9558 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 9559 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 9560 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9561 | var MSC_ConnHdlr vc_conn; |
| 9562 | |
| 9563 | f_init(1, true); |
| 9564 | f_sleep(1.0); |
| 9565 | |
| 9566 | f_vty_allow_emerg_msc(false); |
| 9567 | f_vty_allow_emerg_bts(true, 0); |
Pau Espin Pedrol | 6b869f4 | 2023-01-17 12:06:03 +0100 | [diff] [blame] | 9568 | /* Make sure the CHAN RQD indicates an emergency call (0b101xxxxx): */ |
| 9569 | pars.ra := f_rnd_ra_emerg(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9570 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 9571 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9572 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9573 | } |
| 9574 | |
Pau Espin Pedrol | 6b869f4 | 2023-01-17 12:06:03 +0100 | [diff] [blame] | 9575 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS. |
| 9576 | * The RACH req (and hence CHAN RQD) indicate other than emergency call. |
| 9577 | * Hence BSC only learns about it being an emergency call later during call setup. |
| 9578 | * If interested in the ra="emergency call" + deny bts policy case, |
| 9579 | * see TC_chan_rqd_emerg_deny. |
| 9580 | */ |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9581 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 9582 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9583 | var MSC_ConnHdlr vc_conn; |
| 9584 | |
| 9585 | /* Note: This simulates a spec violation by the MS, correct MS |
| 9586 | * implementations would not try to establish an emergency call because |
| 9587 | * the system information tells in advance that emergency calls are |
Pau Espin Pedrol | 6b869f4 | 2023-01-17 12:06:03 +0100 | [diff] [blame] | 9588 | * not allowed */ |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9589 | |
| 9590 | f_init(1, true); |
| 9591 | f_sleep(1.0); |
| 9592 | |
| 9593 | f_vty_allow_emerg_msc(true); |
| 9594 | f_vty_allow_emerg_bts(false, 0); |
Pau Espin Pedrol | 6b869f4 | 2023-01-17 12:06:03 +0100 | [diff] [blame] | 9595 | /* Note: Here we implicitly leave default g_pars.ra which is different than "emergency call" */ |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9596 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 9597 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9598 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9599 | } |
| 9600 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9601 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 9602 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 9603 | * emergency call */ |
| 9604 | testcase TC_emerg_premption() runs on test_CT { |
| 9605 | var ASP_RSL_Unitdata rsl_ud; |
| 9606 | var integer i; |
| 9607 | var integer chreq_total, chreq_nochan; |
| 9608 | var RSL_Message rx_rsl; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 9609 | var octetstring l3_payload := gen_l3_valid_payload(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9610 | |
| 9611 | f_init(1); |
| 9612 | f_sleep(1.0); |
| 9613 | |
| 9614 | f_vty_allow_emerg_msc(true); |
| 9615 | f_vty_allow_emerg_bts(true, 0); |
| 9616 | |
| 9617 | /* Fill up all channels on the BTS */ |
| 9618 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 9619 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 9620 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Neels Hofmeyr | 32ef591 | 2022-04-24 00:29:04 +0200 | [diff] [blame] | 9621 | f_chreq_act_ack('33'O, i); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9622 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9623 | IPA_RSL[0][0].clear; |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9624 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 9625 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 9626 | |
Neels Hofmeyr | ace698c | 2022-04-24 00:30:21 +0200 | [diff] [blame] | 9627 | /* Send EST IND for the first TCH, so we get to test the RR release cause */ |
| 9628 | var RslChannelNr first_tch := valueof(t_RslChanNr_Bm(1)); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 9629 | f_ipa_tx(ts_RSL_EST_IND(first_tch, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | ace698c | 2022-04-24 00:30:21 +0200 | [diff] [blame] | 9630 | |
Neels Hofmeyr | de564b1 | 2022-04-24 23:11:46 +0200 | [diff] [blame] | 9631 | /* Accept BSSAP conn, so we get to test the Clear Request cause */ |
| 9632 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 9633 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | de564b1 | 2022-04-24 23:11:46 +0200 | [diff] [blame] | 9634 | var integer sccp_conn_id := rx_c_ind.connectionId; |
| 9635 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9636 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9637 | /* Send Channel request for emegergency call */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9638 | f_ipa_tx(ts_RSL_CHAN_RQD('A5'O, 23)); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9639 | |
| 9640 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9641 | f_expect_chan_rel(first_tch, expect_rr_chan_rel := true, expect_rll_rel_req := false, |
Neels Hofmeyr | ace698c | 2022-04-24 00:30:21 +0200 | [diff] [blame] | 9642 | expect_rr_cause := GSM48_RR_CAUSE_PREMPTIVE_REL); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9643 | |
Neels Hofmeyr | de564b1 | 2022-04-24 23:11:46 +0200 | [diff] [blame] | 9644 | /* Also expect a BSSMAP Clear Request with PREEMPTION */ |
| 9645 | var BSSAP_N_DATA_ind rx_clear_req; |
| 9646 | const myBSSMAP_Cause preemption := GSM0808_CAUSE_PREEMPTION; |
| 9647 | BSSAP.receive(tr_BSSAP_DATA_ind(sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_clear_req; |
| 9648 | log("XXX ", rx_clear_req); |
| 9649 | if (rx_clear_req.userData.pdu.bssmap.clearRequest.cause.causeValue != int2bit(enum2int(preemption), 7)) { |
| 9650 | setverdict(fail, "BSSMAP Clear Request: expected cause PREEMPTION"); |
| 9651 | } |
| 9652 | |
Neels Hofmeyr | 32ef591 | 2022-04-24 00:29:04 +0200 | [diff] [blame] | 9653 | /* Expect the BSC to send activate/assign the channel for the emergency call */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9654 | rx_rsl := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 32ef591 | 2022-04-24 00:29:04 +0200 | [diff] [blame] | 9655 | if (first_tch != rx_rsl.ies[0].body.chan_nr) { |
| 9656 | setverdict(fail, "different TCH lchan activated than expected"); |
| 9657 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9658 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(first_tch, 33)); |
| 9659 | rx_rsl := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 9660 | |
Neels Hofmeyr | de564b1 | 2022-04-24 23:11:46 +0200 | [diff] [blame] | 9661 | /* complete the BSSMAP Clear to satisfy the conn leak check */ |
| 9662 | BSSAP.send(ts_BSSAP_DATA_req(sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(preemption)))); |
| 9663 | BSSAP.receive(tr_BSSAP_DATA_ind(sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 9664 | BSSAP.send(ts_BSSAP_DISC_req(sccp_conn_id, 0)); |
| 9665 | } |
| 9666 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 9667 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9668 | } |
| 9669 | |
| 9670 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 9671 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9672 | private type record FHParamsTs { |
| 9673 | boolean enabled, |
| 9674 | uint6_t hsn, |
| 9675 | uint6_t maio, |
| 9676 | ArfcnList ma |
| 9677 | }; |
| 9678 | |
| 9679 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9680 | private type record FHParamsTrx { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9681 | GsmBandArfcn arfcn, |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9682 | FHParamsTs ts[8] |
| 9683 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9684 | |
| 9685 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 9686 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 9687 | runs on test_CT return FHParamsTrx { |
| 9688 | var FHParamsTrx fhp; |
| 9689 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9690 | /* Generate a random ARFCN in the range of 0 - 3. This ARFCN will |
| 9691 | * fall in the GSM900 band. */ |
| 9692 | fhp.arfcn.arfcn := f_rnd_int(3); |
| 9693 | fhp.arfcn.pcs := false; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9694 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9695 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 9696 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9697 | fhp.ts[tn].enabled := false; |
| 9698 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9699 | continue; |
| 9700 | } |
| 9701 | |
| 9702 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9703 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 9704 | fhp.ts[tn].maio := f_rnd_int(64); |
| 9705 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9706 | |
| 9707 | /* Random Mobile Allocation (hopping channels) */ |
| 9708 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 9709 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 9710 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9711 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9712 | } |
| 9713 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9714 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9715 | } |
| 9716 | |
| 9717 | log("f_TC_fh_params_gen(): ", fhp); |
| 9718 | return fhp; |
| 9719 | } |
| 9720 | |
| 9721 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 9722 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 9723 | { |
| 9724 | var template (present) ChannelDescription tr_cd; |
| 9725 | var template (present) MaioHsn tr_maio_hsn; |
| 9726 | var uint3_t tn := cd.chan_nr.tn; |
| 9727 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9728 | if (fhp.ts[tn].enabled) { |
| 9729 | tr_maio_hsn := tr_HsnMaio(fhp.ts[tn].hsn, fhp.ts[tn].maio); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9730 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 9731 | } else { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9732 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9733 | } |
| 9734 | |
| 9735 | if (not match(cd, tr_cd)) { |
| 9736 | setverdict(fail, "Channel Description IE does not match: ", |
| 9737 | cd, " vs expected ", tr_cd); |
| 9738 | } |
| 9739 | } |
| 9740 | |
| 9741 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 9742 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 9743 | in MobileAllocationLV ma) |
| 9744 | { |
| 9745 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 9746 | |
| 9747 | if (not match(ma, tr_ma)) { |
| 9748 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 9749 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 9750 | } else { |
| 9751 | setverdict(pass); |
| 9752 | } |
| 9753 | } |
| 9754 | |
| 9755 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 9756 | in MobileAllocationLV ma) |
| 9757 | return template MobileAllocationLV { |
| 9758 | /* Mobile Allocation IE is expected to be empty if hopping is not enabled */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9759 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9760 | return { len := 0, ma := ''B }; |
| 9761 | } |
| 9762 | |
| 9763 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 9764 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 9765 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9766 | |
| 9767 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9768 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 9769 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 9770 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9771 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9772 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9773 | } |
| 9774 | } |
| 9775 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9776 | /* Take ARFCN of the TRX itself into account */ |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9777 | full_mask[fhp.arfcn.arfcn] := '1'B; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9778 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9779 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9780 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9781 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9782 | } |
| 9783 | |
| 9784 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 9785 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9786 | if (full_mask[i] != '1'B) |
| 9787 | { continue; } |
| 9788 | |
| 9789 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 9790 | if (slot_mask[i] == '1'B) { |
| 9791 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9792 | } else { |
| 9793 | ma_mask := ma_mask & '0'B; |
| 9794 | } |
| 9795 | } |
| 9796 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 9797 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 9798 | if (full_mask[0] == '1'B) { |
| 9799 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 9800 | if (slot_mask[0] == '1'B) { |
| 9801 | ma_mask := ma_mask & '1'B; |
| 9802 | } else { |
| 9803 | ma_mask := ma_mask & '0'B; |
| 9804 | } |
| 9805 | } |
| 9806 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9807 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 9808 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9809 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 9810 | |
| 9811 | return { len := ma_mask_len, ma := ma_mask }; |
| 9812 | } |
| 9813 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9814 | /* Configure the appropriate band for a given arfcn, exc */ |
| 9815 | private function f_TC_set_band_by_arfcn(integer bts_nr, GsmBandArfcn arfcn) runs on test_CT |
| 9816 | { |
| 9817 | var charstring band; |
| 9818 | var GsmBandArfcn arfcn_ := valueof(ts_GsmBandArfcn(arfcn.arfcn, arfcn.pcs, false)); |
| 9819 | |
| 9820 | select (arfcn_) { |
| 9821 | case (tr_GsmBandArfcn((259..293), false, ?)) { band := "GSM450"; } |
| 9822 | case (tr_GsmBandArfcn((306..340), false, ?)) { band := "GSM480"; } |
| 9823 | case (tr_GsmBandArfcn((438..511), false, ?)) { band := "GSM750"; } |
| 9824 | case (tr_GsmBandArfcn((128..251), false, ?)) { band := "GSM850"; } |
| 9825 | case (tr_GsmBandArfcn((0..124), false, ?)) { band := "GSM900"; } |
| 9826 | case (tr_GsmBandArfcn((955..1023), false, ?)) { band := "GSM900"; } |
| 9827 | case (tr_GsmBandArfcn((512..885), false, ?)) { band := "DCS1800"; } |
| 9828 | case (tr_GsmBandArfcn((512..810), true, ?)) { band := "PCS1900"; } |
| 9829 | case else { return; } |
| 9830 | } |
| 9831 | |
| 9832 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 9833 | f_vty_transceive(BSCVTY, "band " & band); |
| 9834 | f_vty_transceive(BSCVTY, "end"); |
| 9835 | } |
| 9836 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9837 | /* Configure the hopping parameters in accordance with the given record */ |
| 9838 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 9839 | uint8_t bts_nr := 0, |
| 9840 | uint8_t trx_nr := 0) |
| 9841 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9842 | |
| 9843 | f_TC_set_band_by_arfcn(bts_nr, fhp.arfcn); |
| 9844 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9845 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 9846 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 9847 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9848 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9849 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9850 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9851 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 9852 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9853 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9854 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 9855 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9856 | continue; |
| 9857 | } |
| 9858 | |
| 9859 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9860 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 9861 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9862 | |
| 9863 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9864 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9865 | f_vty_transceive(BSCVTY, "hopping arfcn add " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9866 | } |
| 9867 | |
| 9868 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 9869 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9870 | } |
| 9871 | |
| 9872 | f_vty_transceive(BSCVTY, "end"); |
| 9873 | } |
| 9874 | |
| 9875 | /* Disable frequency hopping on all timeslots */ |
| 9876 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 9877 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9878 | uint8_t trx_nr := 0, |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9879 | GsmBandArfcn arfcn := {pcs := false, arfcn := 871}) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9880 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9881 | |
| 9882 | f_TC_set_band_by_arfcn(bts_nr, arfcn); |
| 9883 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9884 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 9885 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 9886 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9887 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9888 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9889 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9890 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 9891 | |
| 9892 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9893 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9894 | f_vty_transceive(BSCVTY, "hopping arfcn del " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9895 | } |
| 9896 | |
| 9897 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 9898 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9899 | } |
| 9900 | |
| 9901 | f_vty_transceive(BSCVTY, "end"); |
| 9902 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9903 | } |
| 9904 | |
| 9905 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 9906 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 9907 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 9908 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9909 | var RSL_Message rsl_msg; |
| 9910 | var RSL_IE_Body ie; |
| 9911 | |
| 9912 | f_init_vty(); |
| 9913 | |
| 9914 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9915 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9916 | |
| 9917 | f_init(1); |
| 9918 | |
| 9919 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 9920 | for (var integer i := 0; i < 9; i := i + 1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9921 | f_ipa_tx(ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 9922 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9923 | |
| 9924 | /* Make sure that Channel Identification IE is present */ |
| 9925 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 9926 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9927 | continue; |
| 9928 | } |
| 9929 | |
| 9930 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9931 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 9932 | |
| 9933 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 9934 | if (ie.chan_ident.ma.v.len != 0) { |
| 9935 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 9936 | ie.chan_ident.ma, ", despite it shall be"); |
| 9937 | continue; |
| 9938 | } |
| 9939 | } |
| 9940 | |
| 9941 | /* Disable frequency hopping */ |
| 9942 | f_TC_fh_params_unset(fhp); |
| 9943 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9944 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9945 | } |
| 9946 | |
| 9947 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 9948 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 9949 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9950 | var RSL_Message rsl_msg; |
| 9951 | var RSL_IE_Body ie; |
| 9952 | |
| 9953 | f_init_vty(); |
| 9954 | |
| 9955 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9956 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9957 | |
| 9958 | f_init(1); |
| 9959 | |
| 9960 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 9961 | for (var integer i := 0; i < 9; i := i + 1) { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9962 | f_ipa_tx(ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 9963 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9964 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 9965 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 9966 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9967 | |
| 9968 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 9969 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 9970 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 9971 | continue; |
| 9972 | } |
| 9973 | |
| 9974 | /* Decode the actual Immediate Assignment message */ |
| 9975 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 9976 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 9977 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 9978 | continue; |
| 9979 | } |
| 9980 | |
| 9981 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9982 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 9983 | |
| 9984 | /* Make sure that the Mobile Allocation IE matches */ |
| 9985 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 9986 | rr_msg.payload.imm_ass.mobile_allocation); |
| 9987 | } |
| 9988 | |
| 9989 | /* Disable frequency hopping */ |
| 9990 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9991 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9992 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9993 | } |
| 9994 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9995 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 9996 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 9997 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9998 | var RSL_Message rsl_msg; |
| 9999 | var RSL_IE_Body ie; |
| 10000 | |
| 10001 | f_init_vty(); |
| 10002 | |
| 10003 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 10004 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10005 | |
| 10006 | f_init(1); |
| 10007 | |
| 10008 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 10009 | vc_MGCP[0].stop; |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10010 | |
| 10011 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10012 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 10013 | |
| 10014 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 10015 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 10016 | for (var integer i := 0; i < 3; i := i + 1) { |
| 10017 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 10018 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10019 | |
| 10020 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 10021 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10022 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10023 | |
| 10024 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10025 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 10026 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10027 | |
| 10028 | /* Make sure that L3 Information IE is present */ |
| 10029 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 10030 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 10031 | continue; |
| 10032 | } |
| 10033 | |
| 10034 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 10035 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 10036 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 10037 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 10038 | continue; |
| 10039 | } |
| 10040 | |
| 10041 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 10042 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 10043 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 10044 | |
| 10045 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 10046 | if (chan_desc.h and not ispresent(l3_msg.payload.ass_cmd.cell_chan_desc)) { |
Vadim Yanitskiy | 38d069d | 2020-09-02 17:18:57 +0700 | [diff] [blame] | 10047 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10048 | continue; |
| 10049 | } |
| 10050 | |
| 10051 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 10052 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 10053 | if (chan_desc.h and ma_present) { |
| 10054 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 10055 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 10056 | } else if (chan_desc.h and not ma_present) { |
| 10057 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 10058 | continue; |
| 10059 | } else if (not chan_desc.h and ma_present) { |
| 10060 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 10061 | continue; |
| 10062 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10063 | |
| 10064 | f_perform_clear_test_ct(dt); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10065 | } |
| 10066 | |
| 10067 | /* Give the IUT some time to release all channels */ |
| 10068 | f_sleep(3.0); |
| 10069 | |
| 10070 | /* Disable frequency hopping */ |
| 10071 | f_TC_fh_params_unset(fhp); |
| 10072 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 10073 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10074 | } |
| 10075 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10076 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 10077 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 10078 | runs on test_CT { |
| 10079 | var RSL_Message rsl_msg; |
| 10080 | var RSL_IE_Body ie; |
| 10081 | var DchanTuple dt; |
| 10082 | |
| 10083 | /* Establish a dedicated channel, so we can trigger handover */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 10084 | dt := f_est_dchan(f_rnd_ra_cs(), 23, gen_l3_valid_payload()); |
Vadim Yanitskiy | c18ff47 | 2021-11-18 20:15:37 +0300 | [diff] [blame] | 10085 | f_sleep(0.5); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10086 | |
| 10087 | /* Trigger handover from BTS0 to BTS1 */ |
| 10088 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 10089 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 10090 | |
| 10091 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10092 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), idx := {1, 0}); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10093 | |
| 10094 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10095 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33), idx := {1, 0}); |
| 10096 | rsl_msg := f_exp_ipa_rx(tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10097 | |
| 10098 | /* Make sure that L3 Information IE is present */ |
| 10099 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 10100 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 10101 | return; |
| 10102 | } |
| 10103 | |
| 10104 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 10105 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 10106 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 10107 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 10108 | return; |
| 10109 | } |
| 10110 | |
| 10111 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 10112 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 10113 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 10114 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 10115 | return; |
| 10116 | } |
| 10117 | |
| 10118 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 10119 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 10120 | |
| 10121 | /* Make sure that Cell Channel Description IE is present */ |
| 10122 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 10123 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 10124 | return; |
| 10125 | } |
| 10126 | |
| 10127 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 10128 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 10129 | if (ma_present) { |
| 10130 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 10131 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 10132 | } else { |
| 10133 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 10134 | return; |
| 10135 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10136 | |
| 10137 | f_perform_clear_test_ct(dt); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10138 | } |
| 10139 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 10140 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 10141 | |
| 10142 | f_init_vty(); |
| 10143 | |
| 10144 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 10145 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 10146 | |
| 10147 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 10148 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 10149 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 10150 | |
| 10151 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 10152 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 10153 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 10154 | |
| 10155 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 10156 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 10157 | |
| 10158 | f_init(2); |
| 10159 | |
| 10160 | f_TC_fh_params_handover_cmd(fhp); |
| 10161 | |
| 10162 | /* Disable frequency hopping on BTS1 */ |
| 10163 | f_TC_fh_params_unset(fhp, 1); |
| 10164 | |
| 10165 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 10166 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 10167 | |
| 10168 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 10169 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 10170 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 10171 | |
| 10172 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 10173 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 10174 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 10175 | |
| 10176 | f_shutdown_helper(); |
| 10177 | } |
| 10178 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10179 | /* Verify the hopping parameters in System Information Type 4 */ |
| 10180 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 10181 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 10182 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10183 | timer T := 5.0; |
| 10184 | |
| 10185 | f_init_vty(); |
| 10186 | |
| 10187 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 10188 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 10189 | |
| 10190 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 10191 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 10192 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 10193 | |
| 10194 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 10195 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 10196 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 10197 | |
| 10198 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 10199 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10200 | |
| 10201 | f_init(1); |
| 10202 | |
| 10203 | T.start; |
| 10204 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10205 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10206 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 10207 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 10208 | |
| 10209 | /* Make sure that what we decoded is System Information Type 4 */ |
| 10210 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 10211 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 10212 | repeat; |
| 10213 | } |
| 10214 | |
| 10215 | /* Make sure that CBCH Channel Description IE is present */ |
| 10216 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 10217 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 10218 | break; |
| 10219 | } |
| 10220 | |
| 10221 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 10222 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 10223 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 10224 | |
| 10225 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 10226 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 10227 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 10228 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 10229 | break; |
| 10230 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 10231 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 10232 | si.payload.si4.cbch_mobile_alloc.v); |
| 10233 | } |
| 10234 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10235 | [] IPA_RSL[0][0].receive { repeat; } |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10236 | [] T.timeout { |
| 10237 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 10238 | } |
| 10239 | } |
| 10240 | |
| 10241 | /* Disable frequency hopping */ |
| 10242 | f_TC_fh_params_unset(fhp); |
| 10243 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 10244 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10245 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 10246 | |
| 10247 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 10248 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10249 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 10250 | |
| 10251 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 10252 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 10253 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 10254 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 10255 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10256 | } |
| 10257 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10258 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 10259 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 10260 | |
| 10261 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 10262 | template (present) BSSLAP_PDU expect_bsslap) |
| 10263 | { |
| 10264 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 10265 | if (not match(bsslap, expect_bsslap)) { |
| 10266 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 10267 | log("GOT BSSLAP: ", bsslap); |
| 10268 | setverdict(fail, "BSSLAP is not as expected"); |
| 10269 | mtc.stop; |
| 10270 | } |
| 10271 | setverdict(pass); |
| 10272 | } |
| 10273 | |
| 10274 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 10275 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 10276 | |
| 10277 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 10278 | var PDU_BSSAP_LE rx_bsslap; |
| 10279 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 10280 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 10281 | } |
| 10282 | |
| 10283 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 10284 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 10285 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 10286 | f_sleep(1.0); |
| 10287 | |
| 10288 | f_establish_fully(omit, omit); |
| 10289 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10290 | |
| 10291 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10292 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10293 | |
| 10294 | var PDU_BSSAP_LE plr; |
| 10295 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10296 | |
| 10297 | if (not do_ta_request) { |
| 10298 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 10299 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 10300 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 10301 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 10302 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 10303 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 10304 | mtc.stop; |
| 10305 | } |
| 10306 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 10307 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 10308 | if (not match(bsslap, expect_ta_layer3)) { |
| 10309 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 10310 | log("GOT BSSLAP: ", bsslap); |
| 10311 | setverdict(fail, "BSSLAP is not as expected"); |
| 10312 | mtc.stop; |
| 10313 | } |
| 10314 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 10315 | * has no need to request the TA from the BSC and directly responds. */ |
| 10316 | } else { |
| 10317 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 10318 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 10319 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 10320 | } |
| 10321 | |
| 10322 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 10323 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10324 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10325 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10326 | |
| 10327 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 10328 | f_mo_l3_transceive(); |
| 10329 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10330 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10331 | |
| 10332 | f_sleep(2.0); |
| 10333 | setverdict(pass); |
| 10334 | } |
| 10335 | |
| 10336 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 10337 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 10338 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 10339 | f_lcs_loc_req_for_active_ms(false); |
| 10340 | } |
| 10341 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 10342 | var MSC_ConnHdlr vc_conn; |
| 10343 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10344 | |
| 10345 | f_init(1, true); |
| 10346 | f_sleep(1.0); |
| 10347 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 10348 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10349 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10350 | } |
| 10351 | |
| 10352 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 10353 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 10354 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 10355 | f_lcs_loc_req_for_active_ms(true); |
| 10356 | } |
| 10357 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 10358 | var MSC_ConnHdlr vc_conn; |
| 10359 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10360 | |
| 10361 | f_init(1, true); |
| 10362 | f_sleep(1.0); |
| 10363 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 10364 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10365 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10366 | } |
| 10367 | |
| 10368 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 10369 | * conn without an active lchan. */ |
| 10370 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 10371 | { |
| 10372 | var BssmapCause cause := 0; |
| 10373 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 10374 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 10375 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 10376 | |
| 10377 | timer no_more_bssap := 5.0; |
| 10378 | no_more_bssap.start; |
| 10379 | alt { |
| 10380 | [] no_more_bssap.timeout { break; } |
| 10381 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 10382 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 10383 | mtc.stop; |
| 10384 | } |
| 10385 | } |
| 10386 | setverdict(pass); |
| 10387 | } |
| 10388 | |
| 10389 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 10390 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 10391 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 10392 | { |
| 10393 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 10394 | |
| 10395 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 10396 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 10397 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 10398 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10399 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10400 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 10401 | |
| 10402 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 10403 | f_clear_A_conn(); |
| 10404 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 10405 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10406 | } |
| 10407 | |
| 10408 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 10409 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 10410 | */ |
| 10411 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 10412 | f_sleep(1.0); |
| 10413 | |
| 10414 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10415 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10416 | |
| 10417 | /* Register to receive the Paging Command */ |
| 10418 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 10419 | g_chan_nr := new_chan_nr; |
| 10420 | f_rslem_register(0, g_chan_nr); |
| 10421 | |
| 10422 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 10423 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10424 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 10425 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 10426 | |
| 10427 | var PDU_BSSAP_LE plr; |
| 10428 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10429 | |
| 10430 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 10431 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 10432 | |
| 10433 | /* OsmoBSC needs to Page */ |
| 10434 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 10435 | f_logp(BSCVTY, "got Paging Command"); |
| 10436 | |
| 10437 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 10438 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 2bc7589 | 2023-04-07 00:00:34 +0200 | [diff] [blame] | 10439 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(ts_MI_IMSI_LV(g_pars.imsi)), do_clear := false, expect_bssmap_l3 := false); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10440 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10441 | |
| 10442 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 10443 | |
| 10444 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 10445 | |
| 10446 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 10447 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10448 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10449 | |
| 10450 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10451 | |
| 10452 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 10453 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 10454 | f_verify_active_A_conn_and_clear(); |
| 10455 | |
| 10456 | f_sleep(2.0); |
| 10457 | setverdict(pass); |
| 10458 | } |
| 10459 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 10460 | var MSC_ConnHdlr vc_conn; |
| 10461 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10462 | |
| 10463 | f_init(1, true); |
| 10464 | f_sleep(1.0); |
| 10465 | |
| 10466 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 10467 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 10468 | |
| 10469 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 10470 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10471 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10472 | } |
| 10473 | |
| 10474 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 10475 | */ |
| 10476 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 10477 | f_sleep(1.0); |
| 10478 | |
| 10479 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10480 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10481 | |
| 10482 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 10483 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 10484 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 10485 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 10486 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 10487 | |
| 10488 | /* BSC tells MSC about failure */ |
| 10489 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 10490 | locationEstimate := omit, positioningData := omit, |
| 10491 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 10492 | |
| 10493 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 10494 | f_verify_active_A_conn_and_clear(); |
| 10495 | |
| 10496 | f_sleep(2.0); |
| 10497 | setverdict(pass); |
| 10498 | } |
| 10499 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 10500 | var MSC_ConnHdlr vc_conn; |
| 10501 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10502 | |
| 10503 | f_init(1, true); |
| 10504 | f_sleep(1.0); |
| 10505 | |
| 10506 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 10507 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 10508 | |
| 10509 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 10510 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10511 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10512 | } |
| 10513 | |
| 10514 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 10515 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 10516 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 10517 | f_sleep(1.0); |
| 10518 | |
| 10519 | f_establish_fully(omit, omit); |
| 10520 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10521 | |
| 10522 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10523 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10524 | |
| 10525 | var PDU_BSSAP_LE plr; |
| 10526 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10527 | |
| 10528 | if (do_ta) { |
| 10529 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 10530 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 10531 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 10532 | } |
| 10533 | |
| 10534 | /* SMLC fails to respond, BSC runs into timeout */ |
| 10535 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 10536 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10537 | |
| 10538 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 10539 | locationEstimate := omit, positioningData := omit, |
| 10540 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 10541 | |
| 10542 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 10543 | f_verify_active_A_conn_and_clear(); |
| 10544 | |
| 10545 | f_sleep(2.0); |
| 10546 | setverdict(pass); |
| 10547 | } |
| 10548 | |
| 10549 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 10550 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 10551 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 10552 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 10553 | } |
| 10554 | |
| 10555 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 10556 | var MSC_ConnHdlr vc_conn; |
| 10557 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10558 | |
| 10559 | f_init(1, true); |
| 10560 | f_sleep(1.0); |
| 10561 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 10562 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10563 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10564 | } |
| 10565 | |
| 10566 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 10567 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 10568 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 10569 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 10570 | } |
| 10571 | |
| 10572 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 10573 | var MSC_ConnHdlr vc_conn; |
| 10574 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10575 | |
| 10576 | f_init(1, true); |
| 10577 | f_sleep(1.0); |
| 10578 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 10579 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10580 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10581 | } |
| 10582 | |
| 10583 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 10584 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 10585 | f_sleep(1.0); |
| 10586 | |
| 10587 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10588 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10589 | |
| 10590 | /* Register to receive the Paging Command */ |
| 10591 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 10592 | g_chan_nr := new_chan_nr; |
| 10593 | f_rslem_register(0, g_chan_nr); |
| 10594 | |
| 10595 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 10596 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10597 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 10598 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 10599 | |
| 10600 | var PDU_BSSAP_LE plr; |
| 10601 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10602 | |
| 10603 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 10604 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 10605 | |
| 10606 | /* OsmoBSC needs to Page */ |
| 10607 | var PDU_BSSAP_LE rx_bsslap; |
| 10608 | alt { |
| 10609 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 10610 | f_logp(BSCVTY, "got Paging Command"); |
| 10611 | repeat; |
| 10612 | } |
| 10613 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 10614 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 10615 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 10616 | } |
| 10617 | } |
| 10618 | |
| 10619 | /* SMLC responds with failure */ |
| 10620 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 10621 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10622 | |
| 10623 | /* BSC tells MSC about failure */ |
| 10624 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 10625 | locationEstimate := omit, positioningData := omit, |
| 10626 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 10627 | |
| 10628 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 10629 | f_verify_active_A_conn_and_clear(); |
| 10630 | |
| 10631 | f_sleep(2.0); |
| 10632 | setverdict(pass); |
| 10633 | } |
| 10634 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 10635 | var MSC_ConnHdlr vc_conn; |
| 10636 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10637 | |
| 10638 | f_init(1, true); |
| 10639 | f_sleep(1.0); |
| 10640 | |
| 10641 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 10642 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 10643 | |
| 10644 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 10645 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10646 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10647 | } |
| 10648 | |
| 10649 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 10650 | * over. */ |
| 10651 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 10652 | f_sleep(1.0); |
| 10653 | |
| 10654 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10655 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10656 | |
| 10657 | /* Register to receive the Paging Command */ |
| 10658 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 10659 | g_chan_nr := new_chan_nr; |
| 10660 | f_rslem_register(0, g_chan_nr); |
| 10661 | |
| 10662 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 10663 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10664 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 10665 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 10666 | |
| 10667 | var PDU_BSSAP_LE plr; |
| 10668 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10669 | |
| 10670 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 10671 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10672 | f_perform_compl_l3(RSL, RSL_PROC, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10673 | do_clear := false, expect_bssmap_l3 := true); |
| 10674 | |
| 10675 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 10676 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 10677 | |
| 10678 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 10679 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 10680 | |
| 10681 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 10682 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10683 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10684 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10685 | |
| 10686 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 10687 | f_mo_l3_transceive(); |
| 10688 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10689 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10690 | |
| 10691 | f_sleep(2.0); |
| 10692 | setverdict(pass); |
| 10693 | } |
| 10694 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 10695 | var MSC_ConnHdlr vc_conn; |
| 10696 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10697 | |
| 10698 | f_init(1, true); |
| 10699 | f_sleep(1.0); |
| 10700 | |
| 10701 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 10702 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 10703 | |
| 10704 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 10705 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10706 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10707 | } |
| 10708 | |
| 10709 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 10710 | * the new lchan after handover. */ |
| 10711 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 10712 | f_sleep(1.0); |
| 10713 | |
| 10714 | f_establish_fully(omit, omit); |
| 10715 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10716 | |
| 10717 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10718 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10719 | |
| 10720 | var PDU_BSSAP_LE plr; |
| 10721 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10722 | |
| 10723 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 10724 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 10725 | |
| 10726 | var HandoverState hs := { |
| 10727 | rr_ho_cmpl_seen := false, |
| 10728 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 10729 | old_chan_nr := -, |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 10730 | expect_target_tsc := c_BtsParams[1].tsc |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10731 | }; |
| 10732 | /* issue hand-over command on VTY */ |
| 10733 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 10734 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 10735 | f_rslem_suspend(RSL1_PROC); |
| 10736 | |
| 10737 | /* From the MGW perspective, a handover is is characterized by |
| 10738 | * performing one MDCX operation with the MGW. So we expect to see |
| 10739 | * one more MDCX during handover. */ |
| 10740 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 10741 | |
| 10742 | alt { |
| 10743 | [] as_handover(hs); |
| 10744 | } |
| 10745 | |
| 10746 | var PDU_BSSAP_LE rx_bsslap; |
| 10747 | |
| 10748 | interleave { |
| 10749 | /* Expect the BSC to inform the MSC about the handover */ |
| 10750 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 10751 | |
| 10752 | /* Expect the BSC to inform the SMLC about the handover */ |
| 10753 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 10754 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 10755 | } |
| 10756 | } |
| 10757 | |
| 10758 | /* SMLC now responds with geo information data. */ |
| 10759 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10760 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10761 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10762 | |
| 10763 | /* lchan still active */ |
| 10764 | f_mo_l3_transceive(RSL1); |
| 10765 | |
| 10766 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10767 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10768 | |
| 10769 | f_sleep(2.0); |
| 10770 | setverdict(pass); |
| 10771 | } |
| 10772 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 10773 | var MSC_ConnHdlr vc_conn; |
| 10774 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10775 | |
| 10776 | f_init(2, true); |
| 10777 | f_sleep(1.0); |
| 10778 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 10779 | vc_conn.done; |
Oliver Smith | 39f5307 | 2022-10-27 14:44:04 +0200 | [diff] [blame] | 10780 | f_shutdown_helper(ho := true); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10781 | } |
| 10782 | |
Neels Hofmeyr | a47a8c6 | 2022-04-07 00:31:19 +0200 | [diff] [blame] | 10783 | private function f_tc_emerg_call_and_lcs_loc_req(charstring id) runs on MSC_ConnHdlr |
| 10784 | { |
| 10785 | /* Make sure the CHAN RQD indicates an emergency call (0b101xxxxx). The difference is that osmo-bsc directly |
| 10786 | * assigns a TCH lchan and establishing voice for the emergency call will use Mode Modify, not reassignment to |
| 10787 | * another lchan. */ |
Pau Espin Pedrol | 1809bce | 2023-01-03 16:54:41 +0100 | [diff] [blame] | 10788 | g_pars.ra := f_rnd_ra_emerg(); |
Neels Hofmeyr | a47a8c6 | 2022-04-07 00:31:19 +0200 | [diff] [blame] | 10789 | f_assignment_emerg_setup(); |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 10790 | f_assignment_emerg_setup_exp_bssap(); |
Neels Hofmeyr | a47a8c6 | 2022-04-07 00:31:19 +0200 | [diff] [blame] | 10791 | |
| 10792 | /* Here would usually be a CC Call Proceeding from the MSC, but what does the BSC care about DTAP. */ |
| 10793 | |
| 10794 | /* Do a Location Request in-between the CC call setup */ |
| 10795 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10796 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10797 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10798 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 10799 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 10800 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10801 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10802 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10803 | |
Pau Espin Pedrol | 14076d3 | 2023-01-03 17:07:59 +0100 | [diff] [blame] | 10804 | f_assignment_emerg_setup_voice(); |
Neels Hofmeyr | a47a8c6 | 2022-04-07 00:31:19 +0200 | [diff] [blame] | 10805 | |
| 10806 | setverdict(pass); |
| 10807 | f_perform_clear(); |
| 10808 | } |
| 10809 | |
| 10810 | testcase TC_emerg_call_and_lcs_loc_req() runs on test_CT { |
| 10811 | var MSC_ConnHdlr vc_conn; |
| 10812 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10813 | |
| 10814 | f_init(1, true); |
| 10815 | f_sleep(1.0); |
| 10816 | f_vty_allow_emerg_msc(true); |
| 10817 | f_vty_allow_emerg_bts(true, 0); |
| 10818 | vc_conn := f_start_handler(refers(f_tc_emerg_call_and_lcs_loc_req), pars); |
| 10819 | vc_conn.done; |
| 10820 | f_shutdown_helper(); |
| 10821 | } |
| 10822 | |
Neels Hofmeyr | 61f9dc5 | 2022-05-12 23:04:40 +0200 | [diff] [blame] | 10823 | private altstep no_bssmap_clear_req() runs on MSC_ConnHdlr { |
| 10824 | [] BSSAP.receive(tr_BSSMAP_ClearRequest) { |
| 10825 | setverdict(fail, "unexpected BSSMAP Clear Request"); |
| 10826 | mtc.stop; |
| 10827 | } |
| 10828 | } |
| 10829 | |
| 10830 | private type enumerated RslRel { |
| 10831 | RSLREL_REL_IND, |
| 10832 | RSLREL_CONN_FAIL |
| 10833 | }; |
| 10834 | |
| 10835 | private function f_emerg_call_and_lcs_loc_req_early_lchan_release(RslRel rsl_rel) runs on MSC_ConnHdlr |
| 10836 | { |
| 10837 | g_pars.ra := f_rnd_ra_emerg(); |
| 10838 | f_assignment_emerg_setup(); |
Pau Espin Pedrol | 39bd33c | 2023-01-03 17:05:27 +0100 | [diff] [blame] | 10839 | f_assignment_emerg_setup_exp_bssap(); |
Neels Hofmeyr | 61f9dc5 | 2022-05-12 23:04:40 +0200 | [diff] [blame] | 10840 | |
| 10841 | /* Start a Location Request to locate the emergency */ |
| 10842 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10843 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10844 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10845 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 10846 | |
| 10847 | /* As long as this LCS is going on, the BSC should not send any Clear Request. Later on, it is up to the MSC to |
| 10848 | * do a Clear Command when the Location Response arrives. */ |
| 10849 | activate(no_bssmap_clear_req()); |
| 10850 | |
| 10851 | /* the lchan gets interrupted while the Location Request has no response */ |
| 10852 | select (rsl_rel) { |
| 10853 | case (RSLREL_REL_IND) { |
| 10854 | RSL.send(ts_RSL_REL_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 10855 | f_expect_lchan_rel(RSL, RSL_PROC); |
| 10856 | } |
| 10857 | case (RSLREL_CONN_FAIL) { |
| 10858 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 10859 | } |
| 10860 | case else { |
| 10861 | setverdict(fail, "Unknown RslRel type"); |
| 10862 | mtc.stop; |
| 10863 | } |
| 10864 | } |
| 10865 | |
| 10866 | /* Still expect the Location Response to find its way to the MSC. */ |
| 10867 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10868 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10869 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10870 | |
| 10871 | setverdict(pass); |
| 10872 | |
| 10873 | select (rsl_rel) { |
| 10874 | case (RSLREL_REL_IND) { |
| 10875 | f_perform_clear_no_lchan(); |
| 10876 | } |
| 10877 | case (RSLREL_CONN_FAIL) { |
| 10878 | f_perform_clear(); |
| 10879 | } |
| 10880 | } |
| 10881 | } |
| 10882 | |
| 10883 | private function f_tc_emerg_call_and_lcs_loc_req_early_lchan_rel_ind(charstring id) runs on MSC_ConnHdlr |
| 10884 | { |
| 10885 | f_emerg_call_and_lcs_loc_req_early_lchan_release(RSLREL_REL_IND); |
| 10886 | } |
| 10887 | |
| 10888 | testcase TC_emerg_call_and_lcs_loc_req_early_lchan_rel_ind() runs on test_CT { |
| 10889 | var MSC_ConnHdlr vc_conn; |
| 10890 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10891 | |
| 10892 | f_init(1, true); |
| 10893 | f_sleep(1.0); |
| 10894 | f_vty_allow_emerg_msc(true); |
| 10895 | f_vty_allow_emerg_bts(true, 0); |
| 10896 | vc_conn := f_start_handler(refers(f_tc_emerg_call_and_lcs_loc_req_early_lchan_rel_ind), pars); |
| 10897 | vc_conn.done; |
| 10898 | f_shutdown_helper(); |
| 10899 | } |
| 10900 | |
| 10901 | private function f_tc_emerg_call_and_lcs_loc_req_early_lchan_conn_fail(charstring id) runs on MSC_ConnHdlr |
| 10902 | { |
| 10903 | f_emerg_call_and_lcs_loc_req_early_lchan_release(RSLREL_CONN_FAIL); |
| 10904 | } |
| 10905 | |
| 10906 | testcase TC_emerg_call_and_lcs_loc_req_early_lchan_conn_fail() runs on test_CT { |
| 10907 | var MSC_ConnHdlr vc_conn; |
| 10908 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10909 | |
| 10910 | f_init(1, true); |
| 10911 | f_sleep(1.0); |
| 10912 | f_vty_allow_emerg_msc(true); |
| 10913 | f_vty_allow_emerg_bts(true, 0); |
| 10914 | vc_conn := f_start_handler(refers(f_tc_emerg_call_and_lcs_loc_req_early_lchan_conn_fail), pars); |
| 10915 | vc_conn.done; |
| 10916 | f_shutdown_helper(); |
| 10917 | } |
| 10918 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10919 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 10920 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 10921 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10922 | |
| 10923 | /* Also disable attach for the single connected MSC */ |
| 10924 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 10925 | |
| 10926 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000100001'H)), '00F110'O) )); |
| 10927 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 10928 | |
| 10929 | /* No MSC is found, expecting a proper release on RSL */ |
| 10930 | interleave { |
| 10931 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 10932 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 10933 | } |
| 10934 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 10935 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 10936 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 10937 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10938 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 10939 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 10940 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10941 | } |
| 10942 | } |
| 10943 | setverdict(pass); |
| 10944 | } |
| 10945 | testcase TC_no_msc() runs on test_CT { |
| 10946 | |
| 10947 | f_init(1, true); |
| 10948 | f_sleep(1.0); |
| 10949 | var MSC_ConnHdlr vc_conn; |
| 10950 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10951 | |
| 10952 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 10953 | |
| 10954 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 10955 | vc_conn.done; |
| 10956 | |
| 10957 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 10958 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10959 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10960 | } |
| 10961 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 10962 | /* Dyn PDCH todo: |
| 10963 | * activate OSMO as TCH/F |
| 10964 | * activate OSMO as TCH/H |
| 10965 | * does the BSC-located PCU socket get the updated INFO? |
| 10966 | * what if no PCU is connected at the time? |
| 10967 | * is the info correct on delayed PCU (re)connect? |
| 10968 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 10969 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10970 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | f967afc | 2022-08-08 18:17:20 +0200 | [diff] [blame] | 10971 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux_cn); |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 10972 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10973 | |
| 10974 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 10975 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10976 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 10977 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 10978 | g_pars.ass_codec_list.codecElements[0]; |
| 10979 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 10980 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 10981 | g_pars.expect_mr_s0_s7; |
| 10982 | } |
| 10983 | } |
| 10984 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 10985 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 10986 | log("expecting ASS COMPL like this: ", exp_compl); |
| 10987 | |
| 10988 | f_establish_fully(ass_cmd, exp_compl); |
| 10989 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 10990 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 modify vamos tsc 2 3"); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10991 | |
| 10992 | var RSL_Message rsl; |
| 10993 | |
| 10994 | timer T := 5.0; |
| 10995 | T.start; |
| 10996 | alt { |
| 10997 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 10998 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 10999 | log("Rx L3 from net: ", l3); |
| 11000 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 11001 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 11002 | mtc.stop; |
| 11003 | } |
| 11004 | } |
| 11005 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 11006 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 11007 | mtc.stop; |
| 11008 | } |
| 11009 | [] T.timeout { |
| 11010 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 11011 | setverdict(pass); |
| 11012 | } |
| 11013 | } |
| 11014 | T.stop; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11015 | |
| 11016 | f_perform_clear(); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 11017 | } |
| 11018 | |
| 11019 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 11020 | * osmo-bsc. */ |
| 11021 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 11022 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 11023 | var MSC_ConnHdlr vc_conn; |
| 11024 | |
| 11025 | f_init(1, true); |
| 11026 | f_sleep(1.0); |
| 11027 | |
| 11028 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 11029 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 11030 | vc_conn.done; |
| 11031 | f_shutdown_helper(); |
| 11032 | } |
| 11033 | |
| 11034 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 11035 | */ |
| 11036 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 11037 | f_init_vty(); |
| 11038 | |
| 11039 | f_init(1, false); |
| 11040 | f_sleep(1.0); |
| 11041 | |
| 11042 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 11043 | |
| 11044 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 11045 | timer T := 5.0; |
| 11046 | |
| 11047 | T.start; |
| 11048 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11049 | [] IPA_RSL[0][0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 11050 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 11051 | T.stop; |
| 11052 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 11053 | mtc.stop; |
| 11054 | } |
| 11055 | repeat; |
| 11056 | } |
| 11057 | [] T.timeout { |
| 11058 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 11059 | setverdict(pass); |
| 11060 | } |
| 11061 | } |
| 11062 | } |
| 11063 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11064 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 11065 | /* First fully set up a speech lchan */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11066 | f_assignment_codec(id, do_perform_clear := false); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11067 | |
| 11068 | /* Trigger re-assignment to another lchan */ |
| 11069 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 11070 | |
| 11071 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 11072 | * one MDCX on MGCP. */ |
| 11073 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 11074 | |
| 11075 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 11076 | * as the old lchan used. */ |
| 11077 | g_media.bts.ipa_crcx_seen := false; |
| 11078 | g_media.bts.ipa_mdcx_seen := false; |
| 11079 | |
| 11080 | /* Send different BTS side RTP port number for the new lchan */ |
| 11081 | g_media.bts.bts.port_nr := 4223; |
| 11082 | |
| 11083 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 11084 | |
| 11085 | /* Trigger re-assignment. */ |
| 11086 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 11087 | |
| 11088 | timer T := 5.0; |
| 11089 | T.start; |
| 11090 | alt { |
| 11091 | [] as_assignment(assignment_st); |
| 11092 | [] as_Media(); |
| 11093 | [] T.timeout { |
| 11094 | break; |
| 11095 | } |
| 11096 | } |
| 11097 | |
| 11098 | if (not assignment_st.assignment_done) { |
| 11099 | setverdict(fail, "Assignment did not complete"); |
| 11100 | mtc.stop; |
| 11101 | } |
| 11102 | |
| 11103 | f_check_mgcp_expectations() |
| 11104 | setverdict(pass); |
| 11105 | |
| 11106 | f_sleep(2.0); |
| 11107 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 11108 | |
| 11109 | /* Instruct BSC to clear channel */ |
| 11110 | var BssmapCause cause := 0; |
| 11111 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 11112 | interleave { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11113 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 11114 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 11115 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11116 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 11117 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11118 | } |
| 11119 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 11120 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 11121 | } |
| 11122 | } |
Neels Hofmeyr | 40a45d1 | 2021-09-23 22:57:12 +0200 | [diff] [blame] | 11123 | f_expect_dlcx_conns(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11124 | |
| 11125 | f_sleep(0.5); |
| 11126 | } |
| 11127 | |
| 11128 | testcase TC_reassignment_fr() runs on test_CT { |
| 11129 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 11130 | var MSC_ConnHdlr vc_conn; |
| 11131 | |
| 11132 | f_init(1, true); |
| 11133 | f_sleep(1.0); |
| 11134 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 11135 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11136 | |
| 11137 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 11138 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 11139 | vc_conn.done; |
| 11140 | |
| 11141 | /* from f_establish_fully() */ |
| 11142 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 11143 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 11144 | /* from re-assignment */ |
| 11145 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 11146 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 11147 | f_ctrs_bsc_and_bts_verify(); |
| 11148 | f_shutdown_helper(); |
| 11149 | } |
| 11150 | |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11151 | const charstring REEST_LOST_CONNECTION := "REEST_LOST_CONNECTION"; |
| 11152 | const charstring REEST_CLEAR := "REEST_CLEAR"; |
| 11153 | const charstring REEST_CLEAR_DONE := "REEST_CLEAR_DONE"; |
| 11154 | |
| 11155 | /* CM Re-Establishment, 3GPP TS 24.008 4.5.1.6. |
| 11156 | * The MS <-> BTS loses radio connection, MS shows up on second BTS and asks for CM Re-Establishment. |
| 11157 | * BSC should establish a separate A conn for the same MS, the original A conn is then cleared by |
| 11158 | * the MSC as the CM Re-Establishment is handled. |
| 11159 | * |
| 11160 | * MS bts0 bts1 bsc msc test-component |
| 11161 | * |<----->|<----------------->|<-0-->| _1 Establish channel on bts 0 |
| 11162 | * | | _1 wait a bit, to settle down |
| 11163 | * |<-x x--| | _1 "lose connection" |
| 11164 | * | | REEST_LOST_CONNECTION |
| 11165 | * |----------------->|------->|--1-->| _2 new A-conn: Chan Rqd, Imm Ass, Compl L3 with CM Re-Establishment Req |
| 11166 | * | | REEST_CLEAR |
| 11167 | * | |<-0---| _1 Clear Command on first A-conn |
| 11168 | * | |--0-->| _1 Clear Complete |
| 11169 | * | |<----------------->| | _1 Release first channel |
| 11170 | * | | REEST_CLEAR_DONE |
| 11171 | * |<-----------------|<-------|<-1---| _2 Chan Activ, Assignment Command |
| 11172 | * |<-----------------|<-------|<-1---| _2 Clear Command, Release |
| 11173 | * |
| 11174 | */ |
| 11175 | private function f_tc_cm_reestablishment_1(charstring id) runs on MSC_ConnHdlr { |
| 11176 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 11177 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 11178 | |
| 11179 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 11180 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 11181 | |
| 11182 | f_establish_fully(ass_cmd, exp_compl); |
| 11183 | |
| 11184 | /* The original channel loses connection, MS attemts CM Re-Establishment on another cell, see |
| 11185 | * f_tc_cm_reestablishment_2(). This established channel stays active until MSC sends a Clear Command. The time |
| 11186 | * when exactly that happens is determined by f_tc_cm_reestablishment_2(). */ |
| 11187 | f_sleep(2.0); |
| 11188 | COORD.send(REEST_LOST_CONNECTION); |
| 11189 | |
| 11190 | alt { |
| 11191 | [] COORD.receive(REEST_CLEAR); |
| 11192 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 11193 | setverdict(fail, "Unexpected channel release"); |
| 11194 | mtc.stop; |
| 11195 | } |
| 11196 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 11197 | setverdict(fail, "Unexpected channel release"); |
| 11198 | mtc.stop; |
| 11199 | } |
| 11200 | } |
| 11201 | f_perform_clear() |
Neels Hofmeyr | 969abd0 | 2021-09-23 22:24:08 +0200 | [diff] [blame] | 11202 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11203 | COORD.send(REEST_CLEAR_DONE); |
| 11204 | } |
| 11205 | |
| 11206 | private function f_tc_cm_reestablishment_2(charstring id) runs on MSC_ConnHdlr { |
| 11207 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 11208 | |
| 11209 | /* The MS lost the connection on the first channel, now establishes another one */ |
| 11210 | COORD.receive(REEST_LOST_CONNECTION); |
| 11211 | |
| 11212 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 11213 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REESTABL_REQ(mi)); |
| 11214 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 11215 | |
| 11216 | f_create_bssmap_exp(l3_enc); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 11217 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11218 | BSSAP.receive(tr_BSSMAP_ComplL3(l3_enc)); |
| 11219 | |
| 11220 | /* MSC got the CM Re-Establishment request and first off clears the previous conn. */ |
| 11221 | COORD.send(REEST_CLEAR); |
| 11222 | COORD.receive(REEST_CLEAR_DONE); |
| 11223 | |
| 11224 | f_sleep(2.0); |
| 11225 | |
| 11226 | /* Answer the CM Re-Establishment with an Assignment Command. */ |
| 11227 | var template PDU_BSSAP expect_assignment_compl := f_gen_exp_compl(); |
| 11228 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 11229 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 11230 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 11231 | |
| 11232 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
Oliver Smith | ce2dd69 | 2023-04-17 10:25:50 +0200 | [diff] [blame] | 11233 | st.rtp_stream := true; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11234 | st.is_assignment := true; |
| 11235 | |
| 11236 | var ExpectCriteria mgcpcrit := { |
| 11237 | connid := omit, |
| 11238 | endpoint := omit, |
| 11239 | transid := omit |
| 11240 | }; |
| 11241 | f_create_mgcp_expect(mgcpcrit); |
| 11242 | |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 11243 | f_rslem_dchan_queue_enable(RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11244 | |
| 11245 | BSSAP.send(ass_cmd); |
| 11246 | |
| 11247 | var PDU_BSSAP bssap; |
| 11248 | |
| 11249 | alt { |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 11250 | [] as_assignment(st, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
| 11251 | [] as_Media_ipacc(RSL1, RSL2); |
| 11252 | [] as_Media_mgw(); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11253 | [st.assignment_done] BSSAP.receive(expect_assignment_compl) { |
| 11254 | break; |
| 11255 | } |
| 11256 | } |
| 11257 | |
| 11258 | f_sleep(3.0); |
| 11259 | |
| 11260 | f_logp(BSCVTY, "f_tc_cm_reestablishment_2 clearing"); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 11261 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11262 | } |
| 11263 | |
| 11264 | testcase TC_cm_reestablishment() runs on test_CT { |
| 11265 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 11266 | var MSC_ConnHdlr vc_conn1; |
| 11267 | |
| 11268 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 11269 | var MSC_ConnHdlr vc_conn2; |
| 11270 | pars2.imsi := pars1.imsi; |
| 11271 | pars2.media_nr := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11272 | pars2.expect_tsc := c_BtsParams[1].tsc; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11273 | |
| 11274 | f_init(2, true, guard_timeout := 40.0); |
| 11275 | f_sleep(1.0); |
| 11276 | |
| 11277 | vc_conn1 := f_start_handler_create(pars1); |
| 11278 | vc_conn2 := f_start_handler_create(pars2); |
| 11279 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 11280 | f_start_handler_run(vc_conn1, refers(f_tc_cm_reestablishment_1), pars1); |
| 11281 | f_start_handler_run(vc_conn2, refers(f_tc_cm_reestablishment_2), pars2); |
| 11282 | vc_conn1.done; |
| 11283 | vc_conn2.done; |
| 11284 | |
| 11285 | f_shutdown_helper(); |
| 11286 | } |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 11287 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11288 | function f_exp_ipa_rx_nonfatal(template (present) RSL_Message t_rx, |
| 11289 | boolean ignore_other_rx := true, |
| 11290 | BtsTrxIdx idx := {0, 0}, |
| 11291 | float Tval := 2.0) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11292 | runs on test_CT return template (omit) RSL_Message { |
| 11293 | var ASP_RSL_Unitdata rx_rsl_ud; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11294 | timer T := Tval; |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11295 | |
| 11296 | T.start; |
| 11297 | alt { |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11298 | [] IPA_RSL[idx.bts][idx.trx].receive(tr_ASP_RSL_UD(t_rx, ?)) -> value rx_rsl_ud { |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11299 | T.stop; |
| 11300 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11301 | [ignore_other_rx] IPA_RSL[idx.bts][idx.trx].receive { repeat; } |
| 11302 | [not ignore_other_rx] IPA_RSL[idx.bts][idx.trx].receive { |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11303 | log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx); |
| 11304 | T.stop; |
| 11305 | return omit; |
| 11306 | } |
| 11307 | [] T.timeout { |
| 11308 | return omit; |
| 11309 | } |
| 11310 | } |
| 11311 | return rx_rsl_ud.rsl; |
| 11312 | } |
| 11313 | |
| 11314 | private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") { |
| 11315 | f_vty_enter_cfg_bts(pt, bts_nr); |
| 11316 | f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting); |
| 11317 | f_vty_transceive(pt, "exit"); |
| 11318 | f_vty_transceive(pt, "exit"); |
| 11319 | f_vty_transceive(pt, "exit"); |
| 11320 | } |
| 11321 | |
| 11322 | private function f_verify_imm_ass(RSL_Message imm_ass, template uint8_t ra := ?, template GsmFrameNumber fn := ?, |
Vadim Yanitskiy | 35c9a33 | 2022-03-16 20:26:35 +0300 | [diff] [blame] | 11323 | template (present) RslChannelNr chan_nr := ?, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11324 | template (present) uint12_t arfcn := ?, |
| 11325 | template (present) uint3_t tsc := ?) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11326 | { |
| 11327 | var RSL_IE_Body full_imm_ass_info; |
| 11328 | if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) { |
| 11329 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 11330 | mtc.stop; |
| 11331 | } |
| 11332 | |
| 11333 | var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload); |
| 11334 | var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra, |
| 11335 | fn := fn, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11336 | ch_desc := tr_ChanDescH0(chan_nr, arfcn, tsc), |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11337 | page_mode := ?); |
| 11338 | if (not match(rr_imm_ass, expect_imm_ass)) { |
| 11339 | log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass); |
| 11340 | setverdict(fail, "Failed to match Immediate Assignment"); |
| 11341 | mtc.stop; |
| 11342 | } |
| 11343 | } |
| 11344 | |
| 11345 | testcase TC_imm_ass_post_chan_ack() runs on test_CT { |
| 11346 | var RSL_Message chan_act; |
| 11347 | var RSL_Message imm_ass; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11348 | var octetstring l3_payload := gen_l3_valid_payload(); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11349 | |
| 11350 | f_init(1, false); |
| 11351 | f_sleep(1.0); |
| 11352 | |
| 11353 | /* (should be the default anyway, just to make things clear) */ |
| 11354 | f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack"); |
| 11355 | |
| 11356 | /* RA containing reason=LU */ |
| 11357 | var GsmFrameNumber fn := 2342; |
| 11358 | var uint8_t ra := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11359 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11360 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11361 | chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11362 | |
| 11363 | /* First send the Chan Act ACK */ |
| 11364 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11365 | var DchanTuple dt := {-, chan_nr, {0, 0}}; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11366 | var RSL_IE_Body chan_ident_ie; |
| 11367 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 11368 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 11369 | mtc.stop; |
| 11370 | } |
| 11371 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11372 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11373 | |
| 11374 | /* Then expect the Immediate Assignment, after we ACKed the chan act */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11375 | imm_ass := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11376 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11377 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 11378 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11379 | |
| 11380 | /* Check that the lchan is working */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11381 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11382 | |
| 11383 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11384 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11385 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11386 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 11387 | |
| 11388 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11389 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11390 | f_shutdown_helper(); |
| 11391 | } |
| 11392 | |
| 11393 | testcase TC_imm_ass_pre_chan_ack() runs on test_CT { |
| 11394 | var RSL_Message chan_act; |
| 11395 | var RSL_Message imm_ass; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11396 | var octetstring l3_payload := gen_l3_valid_payload(); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11397 | |
| 11398 | f_init(1, false); |
| 11399 | f_sleep(1.0); |
| 11400 | |
| 11401 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 11402 | |
| 11403 | /* RA containing reason=LU */ |
| 11404 | var GsmFrameNumber fn := 2342; |
| 11405 | var uint8_t ra := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11406 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11407 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11408 | chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11409 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11410 | var DchanTuple dt := {-, chan_nr, {0, 0}}; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11411 | var RSL_IE_Body chan_ident_ie; |
| 11412 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 11413 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 11414 | mtc.stop; |
| 11415 | } |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11416 | |
Vadim Yanitskiy | 6917051 | 2022-06-03 01:49:42 +0600 | [diff] [blame] | 11417 | /* (set bts 0 cfg back to default) */ |
| 11418 | f_vty_set_imm_ass(BSCVTY); |
| 11419 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11420 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11421 | imm_ass := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11422 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 11423 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11424 | |
| 11425 | /* Only now send the Chan Act ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11426 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11427 | |
| 11428 | /* Check that the lchan is working */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11429 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11430 | |
| 11431 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11432 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11433 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11434 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 11435 | |
| 11436 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11437 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11438 | f_shutdown_helper(); |
| 11439 | } |
| 11440 | |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11441 | testcase TC_imm_ass_pre_ts_ack() runs on test_CT { |
| 11442 | var RSL_Message chan_act; |
| 11443 | var RSL_Message imm_ass; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11444 | var octetstring l3_payload := gen_l3_valid_payload(); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11445 | |
| 11446 | f_init(1, false); |
| 11447 | f_sleep(1.0); |
| 11448 | |
| 11449 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 11450 | |
| 11451 | /* RA containing reason=LU */ |
| 11452 | var GsmFrameNumber fn := 2342; |
| 11453 | var uint8_t ra := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11454 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11455 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11456 | chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11457 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11458 | var DchanTuple dt := {-, chan_nr, {0, 0}}; |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11459 | var RSL_IE_Body chan_ident_ie; |
| 11460 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 11461 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 11462 | mtc.stop; |
| 11463 | } |
| 11464 | |
Vadim Yanitskiy | 6917051 | 2022-06-03 01:49:42 +0600 | [diff] [blame] | 11465 | /* (set bts 0 cfg back to default) */ |
| 11466 | f_vty_set_imm_ass(BSCVTY); |
| 11467 | |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11468 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11469 | imm_ass := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11470 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 11471 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
| 11472 | |
| 11473 | /* Only now send the Chan Act ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11474 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11475 | |
| 11476 | /* Check that the lchan is working */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11477 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11478 | |
| 11479 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11480 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11481 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11482 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 11483 | |
| 11484 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11485 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11486 | f_shutdown_helper(); |
| 11487 | } |
| 11488 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11489 | testcase TC_imm_ass_pre_chan_ack_dyn_ts() runs on test_CT { |
| 11490 | /* change Timeslot 6 before f_init() starts RSL */ |
| 11491 | f_init_vty(); |
| 11492 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 11493 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 11494 | |
| 11495 | f_init(1, false); |
| 11496 | f_sleep(1.0); |
| 11497 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11498 | var octetstring l3_payload := gen_l3_valid_payload(); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11499 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 11500 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11501 | f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
| 11502 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11503 | |
| 11504 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 11505 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 11506 | |
| 11507 | /* block all static timeslots so that the dyn TS will be used */ |
| 11508 | f_disable_all_tch_f(); |
| 11509 | f_disable_all_tch_h(); |
| 11510 | f_disable_all_sdcch(); |
| 11511 | |
| 11512 | var RSL_Message chan_act; |
| 11513 | var RSL_Message imm_ass; |
| 11514 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11515 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 11516 | |
| 11517 | /* RA containing reason=LU */ |
| 11518 | var GsmFrameNumber fn := 2342; |
| 11519 | var uint8_t ra := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11520 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11521 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11522 | /* Expect the dyn TS to deactivate PDCH first */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11523 | f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(chan_nr)); |
| 11524 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11525 | |
| 11526 | /* Now activation as SDCCH8 */ |
| 11527 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11528 | var DchanTuple dt := {-, chan_nr, {0, 0}}; |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11529 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11530 | chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11531 | var RSL_IE_Body chan_ident_ie; |
| 11532 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 11533 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 11534 | mtc.stop; |
| 11535 | } |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11536 | |
| 11537 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11538 | imm_ass := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11539 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 11540 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11541 | |
| 11542 | /* Only now send the Chan Act ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11543 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11544 | |
| 11545 | /* Check that the lchan is working */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11546 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11547 | |
| 11548 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11549 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11550 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11551 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 11552 | |
Vadim Yanitskiy | 31778dd | 2022-06-14 20:55:16 +0700 | [diff] [blame] | 11553 | /* (set bts 0 cfg back to default) */ |
| 11554 | f_vty_set_imm_ass(BSCVTY); |
| 11555 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11556 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11557 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11558 | f_shutdown_helper(); |
| 11559 | } |
| 11560 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11561 | testcase TC_imm_ass_pre_ts_ack_dyn_ts() runs on test_CT { |
| 11562 | /* change Timeslot 6 before f_init() starts RSL */ |
| 11563 | f_init_vty(); |
| 11564 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 11565 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 11566 | |
| 11567 | f_init(1, false); |
| 11568 | f_sleep(1.0); |
| 11569 | |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11570 | var octetstring l3_payload := gen_l3_valid_payload(); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11571 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 11572 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11573 | f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
| 11574 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11575 | |
| 11576 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 11577 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 11578 | |
| 11579 | /* block all static timeslots so that the dyn TS will be used */ |
| 11580 | f_disable_all_tch_f(); |
| 11581 | f_disable_all_tch_h(); |
| 11582 | f_disable_all_sdcch(); |
| 11583 | |
| 11584 | var RSL_Message chan_act; |
| 11585 | var RSL_Message imm_ass; |
| 11586 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11587 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 11588 | |
| 11589 | /* RA containing reason=LU */ |
| 11590 | var GsmFrameNumber fn := 2342; |
| 11591 | var uint8_t ra := 2; |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11592 | f_ipa_tx(ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11593 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11594 | /* Expect the dyn TS to deactivate PDCH first */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11595 | f_exp_ipa_rx(tr_RSL_RF_CHAN_REL(chan_nr)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11596 | |
| 11597 | /* And already the Immediate Assignment even before the PDCH Deact ACK */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11598 | imm_ass := f_exp_ipa_rx(tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11599 | |
| 11600 | /* continue the Osmo style PDCH Deact (usual chan rel) */ |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11601 | f_ipa_tx(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11602 | |
| 11603 | /* Now activation as SDCCH8 */ |
| 11604 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11605 | var DchanTuple dt := {-, chan_nr, {0, 0}}; |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11606 | |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11607 | chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11608 | var RSL_IE_Body chan_ident_ie; |
| 11609 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 11610 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 11611 | mtc.stop; |
| 11612 | } |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11613 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11614 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 11615 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 11616 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11617 | |
| 11618 | /* Check that the lchan is working */ |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11619 | f_ipa_tx(ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3_payload)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11620 | |
| 11621 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11622 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3_payload))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11623 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11624 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 11625 | |
Vadim Yanitskiy | 31778dd | 2022-06-14 20:55:16 +0700 | [diff] [blame] | 11626 | /* (set bts 0 cfg back to default) */ |
| 11627 | f_vty_set_imm_ass(BSCVTY); |
| 11628 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11629 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11630 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11631 | f_shutdown_helper(); |
| 11632 | } |
| 11633 | |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11634 | /* GET and SET the bts.N.trx.M.rf_locked CTRL variable */ |
| 11635 | testcase TC_ctrl_trx_rf_locked() runs on test_CT { |
| 11636 | var MSC_ConnHdlr vc_conn; |
| 11637 | |
| 11638 | f_init(nr_bts := 2, handler_mode := true, nr_msc := 1); |
| 11639 | f_sleep(1.0); |
| 11640 | |
| 11641 | /* BTS 0, 1, 2 are OML unlocked, only BTS 0, 1 are actually connected to RSL. */ |
| 11642 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11643 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11644 | "1,0,operational,unlocked,on,rsl-up;" & |
| 11645 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11646 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11647 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11648 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11649 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11650 | |
| 11651 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock BTS 1 TRX 0"); |
| 11652 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 11653 | /* give it a moment to settle the FSM status */ |
| 11654 | f_sleep(1.0); |
| 11655 | |
| 11656 | /* Now BTS 1 TRX 0 should reflect "locked". Note the RF policy stays "on", because this is still handled |
| 11657 | * globally in osmo-bsc. Probably after sending "rf_locked 1" for a TRX, that TRX should reflect an RF policy |
| 11658 | * of "off"? But that's for a future patch if at all. */ |
| 11659 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11660 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11661 | "1,0,operational,locked,on,rsl-up;" & |
| 11662 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11663 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11664 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11665 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11666 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11667 | |
| 11668 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock the already locked TRX, nothing should change"); |
| 11669 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 11670 | f_sleep(1.0); |
| 11671 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11672 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11673 | "1,0,operational,locked,on,rsl-up;" & |
| 11674 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11675 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11676 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11677 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11678 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11679 | |
| 11680 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock BTS 1 TRX 0"); |
| 11681 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "0"); |
| 11682 | f_sleep(1.0); |
| 11683 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11684 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11685 | "1,0,operational,unlocked,on,rsl-up;" & |
| 11686 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11687 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11688 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11689 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11690 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11691 | |
| 11692 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an already unlocked TRX, nothing should change"); |
| 11693 | f_ctrl_set(IPA_CTRL, "bts.0.trx.0.rf_locked", "0"); |
| 11694 | f_sleep(1.0); |
| 11695 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11696 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11697 | "1,0,operational,unlocked,on,rsl-up;" & |
| 11698 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11699 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11700 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11701 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11702 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11703 | |
| 11704 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an inoperational TRX"); |
| 11705 | f_ctrl_set(IPA_CTRL, "bts.3.trx.0.rf_locked", "0"); |
| 11706 | f_sleep(1.0); |
| 11707 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 11708 | "0,0,operational,unlocked,on,rsl-up;" & |
| 11709 | "1,0,operational,unlocked,on,rsl-up;" & |
| 11710 | "2,0,operational,unlocked,on,rsl-down;" & |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11711 | "2,1,operational,unlocked,on,rsl-down;" & |
| 11712 | "2,2,operational,unlocked,on,rsl-down;" & |
| 11713 | "2,3,operational,unlocked,on,rsl-down;" & |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11714 | "3,0,inoperational,locked,on,rsl-down;"); |
| 11715 | |
| 11716 | f_shutdown_helper(); |
| 11717 | } |
| 11718 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11719 | const CounterNameVals counternames_cm_serv_rej := { |
| 11720 | { "cm_serv_rej", 0 }, |
| 11721 | { "cm_serv_rej:imsi_unknown_in_hlr", 0 }, |
| 11722 | { "cm_serv_rej:illegal_ms", 0 }, |
| 11723 | { "cm_serv_rej:imsi_unknown_in_vlr", 0 }, |
| 11724 | { "cm_serv_rej:imei_not_accepted", 0 }, |
| 11725 | { "cm_serv_rej:illegal_me", 0 }, |
| 11726 | { "cm_serv_rej:plmn_not_allowed", 0 }, |
| 11727 | { "cm_serv_rej:loc_not_allowed", 0 }, |
| 11728 | { "cm_serv_rej:roaming_not_allowed", 0 }, |
| 11729 | { "cm_serv_rej:network_failure", 0 }, |
| 11730 | { "cm_serv_rej:synch_failure", 0 }, |
| 11731 | { "cm_serv_rej:congestion", 0 }, |
| 11732 | { "cm_serv_rej:srv_opt_not_supported", 0 }, |
| 11733 | { "cm_serv_rej:rqd_srv_opt_not_supported", 0 }, |
| 11734 | { "cm_serv_rej:srv_opt_tmp_out_of_order", 0 }, |
| 11735 | { "cm_serv_rej:call_can_not_be_identified", 0 }, |
| 11736 | { "cm_serv_rej:incorrect_message", 0 }, |
| 11737 | { "cm_serv_rej:invalid_mandantory_inf", 0 }, |
| 11738 | { "cm_serv_rej:msg_type_not_implemented", 0 }, |
| 11739 | { "cm_serv_rej:msg_type_not_compatible", 0 }, |
| 11740 | { "cm_serv_rej:inf_eleme_not_implemented", 0 }, |
| 11741 | { "cm_serv_rej:condtional_ie_error", 0 }, |
| 11742 | { "cm_serv_rej:msg_not_compatible", 0 }, |
| 11743 | { "cm_serv_rej:protocol_error", 0 }, |
| 11744 | { "cm_serv_rej:retry_in_new_cell", 0 } |
| 11745 | }; |
| 11746 | |
| 11747 | private function f_TC_cm_serv_rej(charstring id) runs on MSC_ConnHdlr |
| 11748 | { |
| 11749 | f_create_chan_and_exp(); |
Vadim Yanitskiy | a7fc5a6 | 2021-12-04 20:10:08 +0300 | [diff] [blame] | 11750 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11751 | BSSAP.send(ts_PDU_DTAP_MT(ts_CM_SERV_REJ('02'O), '00'O)); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11752 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_CM_SERV_REJ)); |
| 11753 | f_perform_clear(); |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 11754 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11755 | } |
| 11756 | testcase TC_cm_serv_rej() runs on test_CT { |
| 11757 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 11758 | var MSC_ConnHdlr vc_conn; |
| 11759 | |
| 11760 | f_init(1, true); |
| 11761 | f_sleep(1.0); |
| 11762 | |
| 11763 | f_ctrs_bts_init(1, counternames_cm_serv_rej); |
| 11764 | |
| 11765 | vc_conn := f_start_handler(refers(f_TC_cm_serv_rej), pars); |
| 11766 | vc_conn.done; |
| 11767 | |
| 11768 | f_ctrs_bts_add(0, "cm_serv_rej", 1); |
| 11769 | f_ctrs_bts_add(0, "cm_serv_rej:imsi_unknown_in_hlr", 1); |
| 11770 | f_ctrs_bts_verify(); |
| 11771 | |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 11772 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11773 | f_shutdown_helper(); |
| 11774 | } |
| 11775 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11776 | /* Reproduce a segfault happening when the SDCCH (primary) lchan is lost in-between a TCH Channel Activ and its Channel |
| 11777 | * Activ Ack (SYS#5627). */ |
| 11778 | private function f_TC_lost_sdcch_during_assignment(charstring id) runs on MSC_ConnHdlr { |
| 11779 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Vadim Yanitskiy | f0310e3 | 2021-10-26 00:30:59 +0300 | [diff] [blame] | 11780 | |
| 11781 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 11782 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11783 | |
| 11784 | var BSSMAP_FIELD_CodecType codecType; |
| 11785 | codecType := valueof(ass_cmd.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType); |
| 11786 | |
| 11787 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 11788 | |
| 11789 | /* First establish a signalling lchan */ |
| 11790 | f_create_chan_and_exp(); |
| 11791 | f_rslem_dchan_queue_enable(); |
| 11792 | |
| 11793 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11794 | |
| 11795 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
Oliver Smith | 735b47c | 2023-02-15 16:03:54 +0100 | [diff] [blame] | 11796 | activate(as_Media_mgw()); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11797 | |
| 11798 | var RslChannelNr chan_nr := { u := { ch0 := RSL_CHAN_NR_Bm_ACCH }, tn := 1 }; |
| 11799 | f_rslem_register(0, chan_nr); |
| 11800 | |
| 11801 | f_rslem_set_auto_chan_act_ack(RSL_PROC, false); |
| 11802 | BSSAP.send(ass_cmd); |
| 11803 | |
| 11804 | |
| 11805 | /* Wait for the Channel Activ for the TCH channel */ |
| 11806 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 11807 | RSL.receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), sid := ?)) -> value rx_rsl_ud; |
| 11808 | |
| 11809 | /* make the original SDCCH disappear */ |
| 11810 | RSL.send(ts_RSL_REL_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 11811 | |
| 11812 | /* and ACK the TCH channel activation. This caused a segfault up to OsmoBSC 1.7.0 (SYS#5627) */ |
| 11813 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_ACK(chan_nr, 23), rx_rsl_ud.streamId)); |
| 11814 | |
| 11815 | interleave { |
| 11816 | [] BSSAP.receive(tr_BSSMAP_AssignmentFail); |
| 11817 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 11818 | } |
| 11819 | |
| 11820 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 11821 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 11822 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 11823 | |
| 11824 | var MgcpCommand mgcp; |
Vadim Yanitskiy | 6be4cf4 | 2022-06-04 21:25:47 +0600 | [diff] [blame] | 11825 | var MGCP_RecvFrom mrf; |
| 11826 | var template MgcpMessage msg_dlcx := { command := tr_DLCX }; |
| 11827 | alt { |
| 11828 | [g_pars.aoip] MGCP.receive(tr_DLCX) -> value mgcp { |
| 11829 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 11830 | } |
| 11831 | [not g_pars.aoip] MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 11832 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, MgcpMessage:{ |
| 11833 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 11834 | })); |
| 11835 | } |
| 11836 | } |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11837 | |
| 11838 | f_sleep(0.5); |
| 11839 | } |
| 11840 | testcase TC_lost_sdcch_during_assignment() runs on test_CT { |
| 11841 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 11842 | var MSC_ConnHdlr vc_conn; |
| 11843 | |
Oliver Smith | 735b47c | 2023-02-15 16:03:54 +0100 | [diff] [blame] | 11844 | pars.fail_on_dlcx := false; |
| 11845 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11846 | f_init(1, true); |
| 11847 | f_sleep(1.0); |
| 11848 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11849 | vc_conn := f_start_handler(refers(f_TC_lost_sdcch_during_assignment), pars); |
| 11850 | vc_conn.done; |
| 11851 | |
| 11852 | f_shutdown_helper(); |
| 11853 | } |
| 11854 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11855 | const CounterNameVals counternames_bsc_bts_all_available_allocated := { |
| 11856 | { "all_allocated:sdcch", 0 }, |
| 11857 | { "all_allocated:static_sdcch", 0 }, |
| 11858 | { "all_allocated:tch", 0 }, |
| 11859 | { "all_allocated:static_tch", 0 } |
| 11860 | } |
| 11861 | |
| 11862 | private function f_all_allocated_expect_counter_change(charstring_list expect_changed) runs on test_CT |
| 11863 | { |
| 11864 | /* Make sure counters settle first */ |
| 11865 | f_sleep(1.0); |
| 11866 | |
| 11867 | /* Take a baseline of counters */ |
| 11868 | f_ctrs_bsc_and_bts_init(1, counternames_bsc_bts_all_available_allocated); |
| 11869 | |
| 11870 | /* Elapse some time so that we see changes in counters, hopefully where expected */ |
| 11871 | f_sleep(2.0); |
| 11872 | |
| 11873 | /* Get new counters */ |
| 11874 | var charstring_list all_changed := {}; |
| 11875 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 11876 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bts", g_ctr_bts); |
| 11877 | |
| 11878 | /* Compare with expectations */ |
| 11879 | var charstring_list all_expect_changed := {}; |
| 11880 | for (var integer i := 0; i < lengthof(expect_changed); i := i + 1) { |
| 11881 | all_expect_changed := all_expect_changed & { "bsc.0." & expect_changed[i], "bts.0." & expect_changed[i] }; |
| 11882 | } |
| 11883 | f_counter_name_vals_expect_changed_list(all_changed, all_expect_changed); |
| 11884 | } |
| 11885 | |
| 11886 | testcase TC_ratectr_all_available_allocated() runs on test_CT { |
| 11887 | var ASP_RSL_Unitdata rsl_ud; |
| 11888 | var integer i; |
| 11889 | var integer chreq_total, chreq_nochan; |
| 11890 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11891 | f_init(1, guard_timeout := 60.0); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11892 | f_sleep(1.0); |
| 11893 | |
| 11894 | /* Exhaust all dedicated SDCCH lchans. |
| 11895 | /* GSM 44.018 Table 9.1.8.2: |
| 11896 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 11897 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11898 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11899 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11900 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11901 | } |
| 11902 | |
| 11903 | /* Since only bts 0 is connected, expecting all_allocated to become true for both bts 0 and the "global" bsc |
| 11904 | * level. |
| 11905 | * All SDCCH are now occupied. */ |
| 11906 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 11907 | |
| 11908 | /* Also fill up all remaining (TCH) channels */ |
| 11909 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11910 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11911 | } |
| 11912 | |
| 11913 | /* All TCH are now also occupied */ |
| 11914 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 11915 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11916 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11917 | /* Clean up SDCCH lchans */ |
| 11918 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 11919 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 11920 | } |
| 11921 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11922 | f_shutdown_helper(); |
| 11923 | } |
| 11924 | |
| 11925 | testcase TC_ratectr_all_available_allocated_dyn() runs on test_CT { |
| 11926 | var ASP_RSL_Unitdata rsl_ud; |
| 11927 | var integer i; |
| 11928 | var integer chreq_total, chreq_nochan; |
| 11929 | |
| 11930 | f_init_vty(); |
| 11931 | f_ts_set_chcomb(0, 0, 2, "TCH/F_TCH/H_PDCH"); |
| 11932 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 11933 | /* Now we have 3 TCH/F, 1 OSMO_DYN, 1 TCH/H */ |
| 11934 | |
| 11935 | f_init(1, guard_timeout := 60.0); |
| 11936 | f_sleep(1.0); |
| 11937 | |
| 11938 | /* The dyn TS wants to activate PDCH mode, ACK that. */ |
| 11939 | var RslChannelNr chan_nr; |
| 11940 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11941 | f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
| 11942 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11943 | |
| 11944 | /* Exhaust all dedicated SDCCH lchans. |
| 11945 | /* GSM 44.018 Table 9.1.8.2: |
| 11946 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 11947 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11948 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11949 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11950 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11951 | } |
| 11952 | |
| 11953 | /* The static SDCCH should now be occupied, while still 3x8 dynamic SDCCH potentially remain. So only |
| 11954 | * all_allocated:static_sdcch is counted, all_allocated:sdcch remains zero. */ |
| 11955 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch"}); |
| 11956 | |
| 11957 | /* Request more SDCCH, hence convert the first dyn TS to SDCCH8. |
| 11958 | * Will release them later, so remember all the DchanTuples. */ |
| 11959 | var DchanTuples dyn_sddch := {}; |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11960 | dyn_sddch := dyn_sddch & { f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11961 | |
| 11962 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 11963 | for (i := 0; i < 7; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11964 | dyn_sddch := dyn_sddch & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11965 | } |
| 11966 | |
| 11967 | /* Now all dynamic SDCCH are also occupied, so for the first time all_allocated:sdcch will trigger... */ |
| 11968 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 11969 | |
| 11970 | /* occupy the remaining TCH, three TCH/F and two TCH/H lchans */ |
| 11971 | for (i := 0; i < 5; i := i+1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 11972 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, gen_l3_valid_payload()) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11973 | } |
| 11974 | |
| 11975 | /* All TCH lchans are now also occupied, both static and dynamic */ |
| 11976 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 11977 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11978 | |
| 11979 | /* Starting to release the dyn TS: as soon as the first SDCCH gets released, all_allocated:sdcch stops |
| 11980 | * incrementing. */ |
| 11981 | var BssmapCause cause := 0; |
| 11982 | var DchanTuple dt := dyn_sddch[0]; |
| 11983 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11984 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11985 | |
| 11986 | /* one dyn TS SDCCH is free again, so only the static_sdcch should increment. For tch, both static and dynamic |
| 11987 | * count as occupied, so those still both increment. */ |
| 11988 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", |
| 11989 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11990 | |
| 11991 | /* Release the remaining SDCCH of the dyn TS, so it becomes available as TCH again */ |
| 11992 | for (i := 1; i < lengthof(dyn_sddch); i := i+1) { |
| 11993 | dt := dyn_sddch[i]; |
| 11994 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 11995 | f_exp_chan_rel_and_clear(dt); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11996 | } |
| 11997 | |
| 11998 | /* All SDCCH on the dyn TS are released, the dyn TS wants to activate PDCH again */ |
| 11999 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | e5d393c | 2022-05-29 16:55:42 +0600 | [diff] [blame] | 12000 | f_exp_ipa_rx(tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
| 12001 | f_ipa_tx(ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 12002 | |
| 12003 | /* Now all channels are occupied except the dyn TS, so expecting only the static counters to increment */ |
| 12004 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", "all_allocated:static_tch"}); |
| 12005 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 12006 | /* Clean up SDCCH lchans */ |
| 12007 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 12008 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 12009 | } |
| 12010 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 12011 | /* clean up config */ |
| 12012 | f_ts_reset_chcomb(0); |
| 12013 | |
| 12014 | f_shutdown_helper(); |
| 12015 | } |
| 12016 | |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12017 | private function f_TC_chan_alloc_algo(DchanTuple dt, BtsTrxIdx idx) |
| 12018 | runs on test_CT { |
| 12019 | /* MSC sends an Assignment Request */ |
| 12020 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 12021 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12022 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12023 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 12024 | |
| 12025 | /* Expect the BSC to allocate a TCH channel on the given BTS/TRX */ |
| 12026 | var RSL_Message rsl_chan_act := f_exp_ipa_rx(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), idx); |
| 12027 | /* Send CHAN ACT NACK, so that the requested TCH channel becomes BORKEN */ |
| 12028 | f_ipa_tx(ts_RSL_CHAN_ACT_NACK(rsl_chan_act.ies[0].body.chan_nr, RSL_ERR_EQUIPMENT_FAIL), idx); |
| 12029 | /* Expect to receive an Assignment Failure */ |
| 12030 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)); |
| 12031 | } |
| 12032 | |
| 12033 | testcase TC_chan_alloc_algo_ascending() runs on test_CT { |
| 12034 | /* We need to access BTS2, which has 4 TRXs */ |
| 12035 | f_init(nr_bts := 3); |
| 12036 | |
| 12037 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 12038 | vc_MGCP[0].stop; |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12039 | |
| 12040 | f_vty_enter_cfg_bts(BSCVTY, 2); |
| 12041 | f_vty_transceive(BSCVTY, "channel allocator ascending"); |
| 12042 | f_vty_transceive(BSCVTY, "end"); |
| 12043 | |
| 12044 | /* Expect the BSC to allocate 4 x TCH/F channels on BTS2/TRX0 */ |
| 12045 | for (var integer i := 0; i < 4; i := i + 1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12046 | var DchanTuple dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), {2, 0}); |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12047 | f_TC_chan_alloc_algo(dt, {2, 0}); |
| 12048 | f_perform_clear_test_ct(dt); |
| 12049 | } |
| 12050 | |
| 12051 | /* At this point all 4 x TCH/F channels are BORKEN, but they will be |
| 12052 | * resurrected upon the A-bis/OML link re-establishment. */ |
| 12053 | f_shutdown_helper(); |
| 12054 | } |
| 12055 | |
| 12056 | testcase TC_chan_alloc_algo_descending() runs on test_CT { |
| 12057 | /* We need to access BTS2, which has 4 TRXs */ |
| 12058 | f_init(nr_bts := 3); |
| 12059 | |
| 12060 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 12061 | vc_MGCP[0].stop; |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12062 | |
| 12063 | f_vty_enter_cfg_bts(BSCVTY, 2); |
| 12064 | f_vty_transceive(BSCVTY, "channel allocator descending"); |
| 12065 | f_vty_transceive(BSCVTY, "end"); |
| 12066 | |
| 12067 | /* Expect the BSC to allocate 5 x TCH/F channels on BTS2/TRX3 */ |
| 12068 | for (var integer i := 0; i < 5; i := i + 1) { |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12069 | var DchanTuple dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), {2, 0}); |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12070 | f_TC_chan_alloc_algo(dt, {2, 3}); |
| 12071 | f_perform_clear_test_ct(dt); |
| 12072 | } |
| 12073 | |
| 12074 | /* At this point all 5 x TCH/F channels are BORKEN, but they will be |
| 12075 | * resurrected upon the A-bis/OML link re-establishment. */ |
| 12076 | f_shutdown_helper(); |
| 12077 | } |
| 12078 | |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12079 | testcase TC_chan_alloc_algo_ass_dynamic() runs on test_CT { |
| 12080 | const BtsTrxIdx TRX0 := {2, 0}; |
| 12081 | const BtsTrxIdx TRX3 := {2, 3}; |
| 12082 | |
| 12083 | /* We need to access BTS2, which has 4 TRXs */ |
| 12084 | f_init(nr_bts := 3); |
| 12085 | |
| 12086 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
Pau Espin Pedrol | 3c63053 | 2022-10-20 19:00:11 +0200 | [diff] [blame] | 12087 | vc_MGCP[0].stop; |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12088 | |
| 12089 | f_vty_enter_cfg_bts(BSCVTY, 2); |
| 12090 | f_vty_transceive(BSCVTY, "channel allocator mode assignment dynamic"); |
| 12091 | f_vty_transceive(BSCVTY, "channel allocator dynamic-param ul-rxlev thresh 50 avg-num 2"); |
| 12092 | f_vty_transceive(BSCVTY, "channel allocator dynamic-param c0-chan-load thresh 0"); |
| 12093 | f_vty_transceive(BSCVTY, "end"); |
| 12094 | |
| 12095 | var DchanTuple dt; |
| 12096 | |
| 12097 | f_logp(BSCVTY, "Case a) Unknown Uplink RxLev, fall-back to ascending"); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12098 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), TRX0); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12099 | f_TC_chan_alloc_algo(dt, TRX0); |
| 12100 | f_perform_clear_test_ct(dt); |
| 12101 | |
| 12102 | f_logp(BSCVTY, "Case b) Not enough RxLev samples, use ascending"); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12103 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), TRX0); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12104 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 0, |
| 12105 | ts_RSL_IE_UplinkMeas(30, 0), |
| 12106 | ts_RSL_IE_BS_Power(0)), TRX0); |
Vadim Yanitskiy | 5f6dd35 | 2022-08-24 03:08:32 +0700 | [diff] [blame] | 12107 | f_sleep(0.3); /* give the IUT some time to process sent MRs */ |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12108 | f_TC_chan_alloc_algo(dt, TRX0); |
| 12109 | f_perform_clear_test_ct(dt); |
| 12110 | |
| 12111 | f_logp(BSCVTY, "Case c) Uplink RxLev below the threshold, use ascending"); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12112 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), TRX0); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12113 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 0, |
| 12114 | ts_RSL_IE_UplinkMeas(45, 0), |
| 12115 | ts_RSL_IE_BS_Power(0)), TRX0); |
| 12116 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 1, |
| 12117 | ts_RSL_IE_UplinkMeas(48, 0), |
| 12118 | ts_RSL_IE_BS_Power(0)), TRX0); |
Vadim Yanitskiy | 5f6dd35 | 2022-08-24 03:08:32 +0700 | [diff] [blame] | 12119 | f_sleep(0.3); /* give the IUT some time to process sent MRs */ |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12120 | f_TC_chan_alloc_algo(dt, TRX0); |
| 12121 | f_perform_clear_test_ct(dt); |
| 12122 | |
| 12123 | f_logp(BSCVTY, "Case d) Uplink RxLev above the threshold, use descending"); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12124 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), TRX0); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12125 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 0, |
| 12126 | ts_RSL_IE_UplinkMeas(50, 0), |
| 12127 | ts_RSL_IE_BS_Power(0)), TRX0); |
| 12128 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 1, |
| 12129 | ts_RSL_IE_UplinkMeas(58, 0), |
| 12130 | ts_RSL_IE_BS_Power(0)), TRX0); |
Vadim Yanitskiy | 5f6dd35 | 2022-08-24 03:08:32 +0700 | [diff] [blame] | 12131 | f_sleep(0.3); /* give the IUT some time to process sent MRs */ |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12132 | f_TC_chan_alloc_algo(dt, TRX3); |
| 12133 | f_perform_clear_test_ct(dt); |
| 12134 | |
| 12135 | f_vty_enter_cfg_bts(BSCVTY, 2); |
| 12136 | f_vty_transceive(BSCVTY, "channel allocator dynamic-param c0-chan-load thresh 90"); |
| 12137 | f_vty_transceive(BSCVTY, "end"); |
| 12138 | |
| 12139 | f_logp(BSCVTY, "Case e) Uplink RxLev above the threshold, but C0 load is not"); |
Pau Espin Pedrol | cc77b49 | 2023-01-02 18:56:37 +0100 | [diff] [blame] | 12140 | dt := f_est_dchan('23'O, 23, gen_l3_valid_payload(), TRX0); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12141 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 0, |
| 12142 | ts_RSL_IE_UplinkMeas(50, 0), |
| 12143 | ts_RSL_IE_BS_Power(0)), TRX0); |
| 12144 | f_ipa_tx(ts_RSL_MEAS_RES_EMPTY(dt.rsl_chan_nr, 1, |
| 12145 | ts_RSL_IE_UplinkMeas(58, 0), |
| 12146 | ts_RSL_IE_BS_Power(0)), TRX0); |
Vadim Yanitskiy | 5f6dd35 | 2022-08-24 03:08:32 +0700 | [diff] [blame] | 12147 | f_sleep(0.3); /* give the IUT some time to process sent MRs */ |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12148 | f_TC_chan_alloc_algo(dt, TRX0); |
| 12149 | f_perform_clear_test_ct(dt); |
| 12150 | |
| 12151 | f_vty_enter_cfg_bts(BSCVTY, 2); |
| 12152 | f_vty_transceive(BSCVTY, "channel allocator ascending"); |
| 12153 | f_vty_transceive(BSCVTY, "end"); |
| 12154 | |
| 12155 | /* At this point some TCH/F channels are BORKEN, but they will be |
| 12156 | * resurrected upon the A-bis/OML link re-establishment. */ |
| 12157 | f_shutdown_helper(); |
| 12158 | } |
| 12159 | |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12160 | private function f_vty_mgw_enable(integer mgw_nr := 1) runs on test_CT { |
| 12161 | var rof_charstring cmds := { |
| 12162 | "remote-ip " & mp_test_ip, |
| 12163 | "remote-port " & int2str(2427 + mgw_nr) |
| 12164 | }; |
| 12165 | f_vty_config3(BSCVTY, {"network", "mgw " & int2str(mgw_nr)}, cmds); |
| 12166 | f_vty_transceive(BSCVTY, "mgw " & int2str(mgw_nr) & " reconnect") |
| 12167 | } |
| 12168 | private function f_vty_mgw_disable(integer mgw_nr := 1) runs on test_CT { |
| 12169 | f_vty_config3(BSCVTY, {"network"}, { "no mgw " &int2str(mgw_nr) }); |
| 12170 | } |
| 12171 | private function f_vty_mgw_block(integer mgw_nr := 1, boolean blocked := true) runs on test_CT { |
| 12172 | var charstring arg; |
| 12173 | if (blocked) { |
| 12174 | arg := "block"; |
| 12175 | } else { |
| 12176 | arg := "unblock"; |
| 12177 | } |
| 12178 | f_vty_transceive(BSCVTY, "mgw " & int2str(mgw_nr) & " " & arg); |
| 12179 | } |
Pau Espin Pedrol | bd59842 | 2023-06-15 17:29:09 +0200 | [diff] [blame] | 12180 | private function f_vty_mgw_cfg_keepalive(integer mgw_nr := 1, integer req_intval := 0, charstring req_endp := "null", integer rx_timeout := 0) runs on test_CT { |
| 12181 | var charstring arg; |
| 12182 | var rof_charstring cmds := { |
| 12183 | "keepalive request-interval " & int2str(req_intval), |
| 12184 | "keepalive request-endpoint " & req_endp, |
| 12185 | "keepalive timeout " & int2str(rx_timeout) |
| 12186 | }; |
| 12187 | f_vty_config3(BSCVTY, {"network", "mgw " & int2str(mgw_nr)}, cmds); |
| 12188 | } |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12189 | private const charstring COORD_CMD_ESTABLISHED := "COORD_CMD_ESTABLISHED"; |
| 12190 | private function f_TC_mgwpool_call_seq_1(charstring id) runs on MSC_ConnHdlr { |
| 12191 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Pau Espin Pedrol | b522e1c | 2023-09-28 13:38:50 +0200 | [diff] [blame] | 12192 | var PDU_BSSAP ass_cmd := f_gen_ass_req(ass_cid := 0); |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12193 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12194 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12195 | |
| 12196 | f_establish_fully(ass_cmd, exp_compl); |
| 12197 | COORD.send(COORD_CMD_ESTABLISHED); |
| 12198 | |
| 12199 | COORD.receive(COORD_CMD_ESTABLISHED); |
| 12200 | f_perform_clear() |
| 12201 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
| 12202 | } |
| 12203 | private function f_TC_mgwpool_call_seq_2(charstring id) runs on MSC_ConnHdlr { |
| 12204 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Pau Espin Pedrol | b522e1c | 2023-09-28 13:38:50 +0200 | [diff] [blame] | 12205 | var PDU_BSSAP ass_cmd := f_gen_ass_req(ass_cid := 1); |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12206 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12207 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12208 | |
| 12209 | |
| 12210 | COORD.receive(COORD_CMD_ESTABLISHED); |
| 12211 | f_establish_fully(ass_cmd, exp_compl); |
| 12212 | COORD.send(COORD_CMD_ESTABLISHED); |
| 12213 | |
| 12214 | f_perform_clear() |
| 12215 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
| 12216 | } |
| 12217 | /* Test load is spread around 2 available MGWs */ |
| 12218 | testcase TC_mgwpool_all_used() runs on test_CT { |
| 12219 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 12220 | var MSC_ConnHdlr vc_conn1; |
| 12221 | pars1.mgwpool_idx := 0; |
| 12222 | |
| 12223 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 12224 | var MSC_ConnHdlr vc_conn2; |
| 12225 | pars2.mgwpool_idx := 1; |
Pau Espin Pedrol | 577688b | 2023-09-28 14:51:42 +0200 | [diff] [blame] | 12226 | pars2.media_nr := 2; |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12227 | |
| 12228 | f_init(1, true, nr_mgw := 2); |
| 12229 | f_sleep(1.0); |
| 12230 | |
| 12231 | f_vty_mgw_enable(1); |
| 12232 | |
| 12233 | vc_conn1 := f_start_handler_create(pars1); |
| 12234 | vc_conn2 := f_start_handler_create(pars2); |
| 12235 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 12236 | f_start_handler_run(vc_conn1, refers(f_TC_mgwpool_call_seq_1), pars1); |
| 12237 | f_start_handler_run(vc_conn2, refers(f_TC_mgwpool_call_seq_2), pars2); |
| 12238 | vc_conn1.done; |
| 12239 | vc_conn2.done; |
| 12240 | |
| 12241 | f_vty_mgw_disable(1); |
| 12242 | |
| 12243 | f_shutdown_helper(); |
| 12244 | } |
| 12245 | |
| 12246 | /* Test blocked MGW in the pool are not selected */ |
| 12247 | testcase TC_mgwpool_blocked_not_used() runs on test_CT { |
| 12248 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 12249 | var MSC_ConnHdlr vc_conn1; |
| 12250 | pars1.mgwpool_idx := 0; |
| 12251 | |
| 12252 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 12253 | var MSC_ConnHdlr vc_conn2; |
| 12254 | pars2.mgwpool_idx := 0; /* expect it in the first one, since the second will be blocked */ |
| 12255 | pars2.media_nr := 2; |
| 12256 | |
| 12257 | f_init(1, true, nr_mgw := 2); |
| 12258 | f_sleep(1.0); |
| 12259 | |
| 12260 | f_vty_mgw_enable(1); |
| 12261 | f_vty_mgw_block(1, true); |
| 12262 | |
| 12263 | vc_conn1 := f_start_handler_create(pars1); |
| 12264 | vc_conn2 := f_start_handler_create(pars2); |
| 12265 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 12266 | f_start_handler_run(vc_conn1, refers(f_TC_mgwpool_call_seq_1), pars1); |
| 12267 | f_start_handler_run(vc_conn2, refers(f_TC_mgwpool_call_seq_2), pars2); |
| 12268 | vc_conn1.done; |
| 12269 | vc_conn2.done; |
| 12270 | |
| 12271 | f_vty_mgw_disable(1); |
| 12272 | |
| 12273 | f_shutdown_helper(); |
| 12274 | } |
| 12275 | |
Pau Espin Pedrol | 3f41e32 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12276 | /* Test BTS pinning to an MGW is applied */ |
| 12277 | testcase TC_mgwpool_pin_bts() runs on test_CT { |
| 12278 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 12279 | var MSC_ConnHdlr vc_conn1; |
| 12280 | pars1.mgwpool_idx := 0; |
| 12281 | |
| 12282 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 12283 | var MSC_ConnHdlr vc_conn2; |
| 12284 | pars2.mgwpool_idx := 0; /* expect it in the first one, since the BTS is pinned to the first MGW */ |
| 12285 | pars2.media_nr := 2; |
| 12286 | |
| 12287 | f_init(1, true, nr_mgw := 2); |
| 12288 | f_sleep(1.0); |
| 12289 | |
| 12290 | f_vty_mgw_enable(1); |
| 12291 | f_vty_cfg_bts(BSCVTY, 0, { "mgw pool-target 0" }); |
| 12292 | |
| 12293 | vc_conn1 := f_start_handler_create(pars1); |
| 12294 | vc_conn2 := f_start_handler_create(pars2); |
| 12295 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 12296 | f_start_handler_run(vc_conn1, refers(f_TC_mgwpool_call_seq_1), pars1); |
| 12297 | f_start_handler_run(vc_conn2, refers(f_TC_mgwpool_call_seq_2), pars2); |
| 12298 | vc_conn1.done; |
| 12299 | vc_conn2.done; |
| 12300 | |
| 12301 | f_vty_cfg_bts(BSCVTY, 0, { "no mgw pool-target" } ); |
Vadim Yanitskiy | 389d7e0 | 2022-10-25 17:44:05 +0700 | [diff] [blame] | 12302 | f_vty_mgw_disable(1); |
Pau Espin Pedrol | 3f41e32 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12303 | |
| 12304 | f_shutdown_helper(); |
| 12305 | } |
| 12306 | |
Pau Espin Pedrol | bd59842 | 2023-06-15 17:29:09 +0200 | [diff] [blame] | 12307 | /* Test keepalive procedure on the MGW */ |
| 12308 | private function f_TC_mgwpool_keepalive_mgw0(charstring id) runs on MSC_ConnHdlr { |
| 12309 | /* Make sure the MGW is considered DOWN by the keepalive. See "timeout" |
| 12310 | * param in TC_mgwpool_keepalive. */ |
| 12311 | f_sleep(3.0); |
| 12312 | |
| 12313 | COORD.send(COORD_CMD_ESTABLISHED); |
| 12314 | |
| 12315 | /* Wait for signal that call was established successfully over the other MSC/MGW: */ |
| 12316 | COORD.receive(COORD_CMD_ESTABLISHED); |
| 12317 | } |
| 12318 | private function f_TC_mgwpool_keepalive_mgw1(charstring id) runs on MSC_ConnHdlr { |
| 12319 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 12320 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 12321 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12322 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12323 | |
| 12324 | /* Wait for other MSC/MGW component to tell us the timeout is done and |
| 12325 | * we can start the call, which will be assigned to use because the other |
| 12326 | * MGW will be seen as DOWN. */ |
| 12327 | COORD.receive(COORD_CMD_ESTABLISHED); |
| 12328 | f_establish_fully(ass_cmd, exp_compl); |
| 12329 | /* signal that call was established successfully over the other MSC/MGW: */ |
| 12330 | COORD.send(COORD_CMD_ESTABLISHED); |
| 12331 | |
| 12332 | f_perform_clear() |
| 12333 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
| 12334 | } |
| 12335 | testcase TC_mgwpool_keepalive_down_not_used() runs on test_CT { |
| 12336 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 12337 | var MSC_ConnHdlr vc_conn1; |
| 12338 | pars1.mgwpool_idx := 0; |
| 12339 | |
| 12340 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 12341 | var MSC_ConnHdlr vc_conn2; |
| 12342 | pars2.mgwpool_idx := 1; /* expect it in the second one, since the first will be considered DOWN */ |
| 12343 | pars2.media_nr := 2; |
| 12344 | |
| 12345 | f_init(1, true, nr_mgw := 2); |
| 12346 | f_sleep(1.0); |
| 12347 | |
Vadim Yanitskiy | cf25a3a | 2023-06-20 17:27:18 +0700 | [diff] [blame] | 12348 | f_vty_mgw_cfg_keepalive(0, req_intval := 1, req_endp := "null", rx_timeout := 3); |
Pau Espin Pedrol | bd59842 | 2023-06-15 17:29:09 +0200 | [diff] [blame] | 12349 | f_vty_mgw_enable(1); |
| 12350 | f_vty_mgw_block(1, false); |
Pau Espin Pedrol | bd59842 | 2023-06-15 17:29:09 +0200 | [diff] [blame] | 12351 | |
| 12352 | vc_conn1 := f_start_handler_create(pars1); |
| 12353 | vc_conn2 := f_start_handler_create(pars2); |
| 12354 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 12355 | f_start_handler_run(vc_conn1, refers(f_TC_mgwpool_keepalive_mgw0), pars1); |
| 12356 | f_start_handler_run(vc_conn2, refers(f_TC_mgwpool_keepalive_mgw1), pars2); |
| 12357 | vc_conn1.done; |
| 12358 | vc_conn2.done; |
| 12359 | |
| 12360 | f_vty_mgw_disable(1); |
| 12361 | /* disable keepalive (default status): */ |
| 12362 | f_vty_mgw_cfg_keepalive(0, req_intval := 0, req_endp := "null", rx_timeout := 0); |
| 12363 | |
| 12364 | f_shutdown_helper(); |
| 12365 | } |
| 12366 | |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12367 | private function f_tc_ho_meas_rep_multi_band(charstring id) runs on MSC_ConnHdlr { |
| 12368 | g_pars := f_gen_test_hdlr_pars(); |
| 12369 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 12370 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12371 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12372 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 12373 | f_establish_fully(ass_req, exp_compl); |
| 12374 | |
| 12375 | /* Send a measurement report with bad rxlev except on 3rd entry. The |
| 12376 | * measurement report is divided into two sub lists, as described in |
| 12377 | * 3GPP TS 04.08 § 10.5.2.20. */ |
| 12378 | var NcellReports neighbor_rep := { |
| 12379 | /* Sub list 1: same band */ |
Oliver Smith | a677304 | 2022-10-24 12:56:30 +0200 | [diff] [blame] | 12380 | { rxlev := 0, bcch_freq := 0, bsic := 12 }, /* ARFCN 800, band 1800, LAC 98 */ |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12381 | /* Sub list 2: different band */ |
Oliver Smith | a677304 | 2022-10-24 12:56:30 +0200 | [diff] [blame] | 12382 | { rxlev := 0, bcch_freq := 1, bsic := 13 }, /* ARFCN 200, band 850, LAC 97 */ |
| 12383 | { rxlev := 40, bcch_freq := 2, bsic := 14 }, /* ARFCN 1000, band 900, LAC 99 */ |
| 12384 | { rxlev := 0, bcch_freq := 3, bsic := 11 } /* ARFCN 0, band 900, LAC 96 */ |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12385 | }; |
| 12386 | var octetstring l3_mr := enc_GsmRrL3Message(valueof(ts_MEAS_REP(true, 8, 8, reps := neighbor_rep))); |
| 12387 | RSL.send(ts_RSL_MEAS_RES(g_chan_nr, 0, ts_RSL_IE_UplinkMeas, ts_RSL_IE_BS_Power(0), ts_RSL_IE_L1Info, |
| 12388 | l3_mr, 0)); |
| 12389 | |
| 12390 | /* Expect a handover to the third entry. If the BSC parsed the report |
Oliver Smith | a677304 | 2022-10-24 12:56:30 +0200 | [diff] [blame] | 12391 | * correctly, the third entry has LAC 99. */ |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12392 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { |
Oliver Smith | a677304 | 2022-10-24 12:56:30 +0200 | [diff] [blame] | 12393 | cIl_LAC := { ts_BSSMAP_CI_LAC(99) } |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12394 | }; |
| 12395 | alt { |
| 12396 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired(cid_list := cid_list)) { |
| 12397 | setverdict(pass); |
| 12398 | } |
| 12399 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired()) { |
| 12400 | setverdict(fail, "Handover has unexpected LAC in Cell Identification List. The BSC probably" |
| 12401 | & " didn't parse the multi-band measurement report correctly."); |
| 12402 | } |
| 12403 | } |
| 12404 | |
| 12405 | f_ho_out_of_this_bsc(skip_meas_rep := true); |
| 12406 | } |
| 12407 | testcase TC_ho_meas_rep_multi_band() runs on test_CT { |
| 12408 | /* Verify that the BSC parses the measurement report correctly when |
| 12409 | * neighbors in multiple bands are configured (OS#5717). See |
| 12410 | * gsm_arfcn2band_rc() in libosmocore src/gsm/gsm_utils.c for the |
| 12411 | * ARFCN -> band mapping. The MS is connected to band 1800. */ |
| 12412 | var MSC_ConnHdlr vc_conn; |
| 12413 | |
| 12414 | f_init_vty(); |
| 12415 | f_bts_0_cfg(BSCVTY, |
| 12416 | {"neighbor-list mode automatic", |
| 12417 | "handover 1", |
| 12418 | "handover algorithm 2", |
| 12419 | "handover2 window rxlev averaging 1", |
| 12420 | "no neighbors", |
| 12421 | "neighbor lac 99 arfcn 1000 bsic any", /* band 900 */ |
| 12422 | "neighbor lac 98 arfcn 800 bsic any", /* band 1800 */ |
| 12423 | "neighbor lac 97 arfcn 200 bsic any", /* band 850 */ |
Oliver Smith | a677304 | 2022-10-24 12:56:30 +0200 | [diff] [blame] | 12424 | "neighbor lac 96 arfcn 0 bsic any"}); /* band 900 */ |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12425 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 12426 | |
| 12427 | f_init(1, true); |
| 12428 | f_sleep(1.0); |
| 12429 | |
| 12430 | f_ctrs_bsc_and_bts_handover_init(); |
| 12431 | |
| 12432 | vc_conn := f_start_handler(refers(f_tc_ho_meas_rep_multi_band)); |
| 12433 | vc_conn.done; |
| 12434 | |
| 12435 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 12436 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 12437 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 12438 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 12439 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 12440 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 12441 | f_ctrs_bsc_and_bts_verify(); |
| 12442 | f_shutdown_helper(ho := true); |
| 12443 | } |
| 12444 | |
Neels Hofmeyr | 8f4db54 | 2023-11-22 04:15:10 +0100 | [diff] [blame] | 12445 | private function f_vty_expect_borken(TELNETasp_PT pt, boolean expect_borken) |
| 12446 | { |
| 12447 | var charstring lchan_summary; |
| 12448 | lchan_summary := f_vty_transceive_ret(pt, "show lchan summary"); |
| 12449 | var boolean found_borken := (f_strstr(lchan_summary, "State BORKEN") >= 0); |
| 12450 | if (found_borken != expect_borken) { |
| 12451 | if (expect_borken) { |
| 12452 | setverdict(fail, "Expected 'BORKEN' state in ", lchan_summary); |
| 12453 | } else { |
| 12454 | setverdict(fail, "Expected no 'BORKEN' state in ", lchan_summary); |
| 12455 | } |
| 12456 | mtc.stop; |
| 12457 | } |
| 12458 | } |
| 12459 | |
| 12460 | private function f_tc_unbreak_lchan_after_missing_rel_ack(integer test_variant) runs on MSC_ConnHdlr { |
| 12461 | |
| 12462 | /* Establish a channel, so we can mess with the release of it. */ |
| 12463 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 12464 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 12465 | |
| 12466 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 12467 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 12468 | |
| 12469 | f_establish_fully(ass_cmd, exp_compl); |
| 12470 | |
| 12471 | /* shorten X28, the time after which a BORKEN lchan recovers, from 30s to something short */ |
| 12472 | f_vty_enter_cfg_network(BSCVTY); |
| 12473 | f_vty_transceive(BSCVTY, "timer X28 3"); |
| 12474 | f_vty_transceive(BSCVTY, "end"); |
| 12475 | |
| 12476 | /* Allow us to include handling of Channel Activation in this component, to test recovery from BORKEN */ |
| 12477 | f_rslem_set_auto_chan_act_ack(RSL_PROC, false); |
| 12478 | |
| 12479 | /* give a moment before releasing */ |
| 12480 | f_sleep(2.0); |
| 12481 | |
| 12482 | /* Perform a channel release, but omit the RF CHAN REL ACK. The aim is to get the lchan to go BORKEN. */ |
| 12483 | f_perform_clear(send_rel_ack := false); |
| 12484 | |
| 12485 | f_vty_expect_borken(BSCVTY, false); |
| 12486 | |
| 12487 | /* After a timeout of X6, the lchan ends up in LCHAN_ST_BORKEN */ |
| 12488 | f_sleep(6.0); |
| 12489 | |
| 12490 | f_vty_expect_borken(BSCVTY, true); |
| 12491 | |
| 12492 | /* Now within two seconds, we expect OsmoBSC to attempt recovering from the broken state. |
| 12493 | * |
| 12494 | * test_variant == 1: |
| 12495 | * It will first attempt a Channel Activation. If the BTS accepts that, it means the state is back in sync. |
| 12496 | * Then OsmoBSC releases the lchan again and makes it available for use. |
| 12497 | * |
| 12498 | * test_variant == 2: |
| 12499 | * It will first attempt a Channel Activation and the BTS NACKs that. |
| 12500 | * It will then attempt a release, which we ACK, and the channel will be available again. |
| 12501 | */ |
| 12502 | |
| 12503 | /* Receive the Channel Activation */ |
| 12504 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 12505 | RSL.receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), sid := ?)) -> value rx_rsl_ud; |
| 12506 | |
| 12507 | var RslChannelNr chan_nr; |
| 12508 | var RSL_IE_Body ie; |
| 12509 | if (f_rsl_find_ie(rx_rsl_ud.rsl, RSL_IE_CHAN_NR, ie) == true) { |
| 12510 | chan_nr := ie.chan_nr; |
| 12511 | } else { |
| 12512 | setverdict(fail, "Unable to find RSL_IE_CHAN_NR in ", rx_rsl_ud); |
| 12513 | return; |
| 12514 | } |
| 12515 | |
| 12516 | if (test_variant == 1) { |
| 12517 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_ACK(chan_nr, 23), rx_rsl_ud.streamId)); |
| 12518 | |
| 12519 | /* Back in sync, receive the Channel Release */ |
| 12520 | RSL.receive(tr_RSL_RF_CHAN_REL(chan_nr)); |
| 12521 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 12522 | } else if (test_variant == 2) { |
| 12523 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL), rx_rsl_ud.streamId)); |
| 12524 | |
| 12525 | /* Instead tries a release */ |
| 12526 | RSL.receive(tr_RSL_RF_CHAN_REL(chan_nr)); |
| 12527 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 12528 | /* That worked, channel usable again */ |
| 12529 | } else { |
| 12530 | setverdict(fail, "undefined test_variant ", test_variant); |
| 12531 | } |
| 12532 | |
| 12533 | f_vty_expect_borken(BSCVTY, false); |
| 12534 | setverdict(pass); |
| 12535 | } |
| 12536 | |
| 12537 | /* Test recovery path from a BORKEN lchan */ |
| 12538 | private function f_TC_unbreak_lchan_after_missing_rel_ack_1(charstring id) runs on MSC_ConnHdlr { |
| 12539 | f_tc_unbreak_lchan_after_missing_rel_ack(test_variant := 1); |
| 12540 | } |
| 12541 | testcase TC_unbreak_lchan_after_missing_rel_ack_1() runs on test_CT { |
| 12542 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 12543 | var MSC_ConnHdlr vc_conn; |
| 12544 | f_init(1, true); |
| 12545 | f_sleep(1.0); |
| 12546 | vc_conn := f_start_handler(refers(f_TC_unbreak_lchan_after_missing_rel_ack_1), pars); |
| 12547 | vc_conn.done; |
| 12548 | f_shutdown_helper(); |
| 12549 | } |
| 12550 | |
| 12551 | private function f_TC_unbreak_lchan_after_missing_rel_ack_2(charstring id) runs on MSC_ConnHdlr { |
| 12552 | f_tc_unbreak_lchan_after_missing_rel_ack(test_variant := 2); |
| 12553 | } |
| 12554 | testcase TC_unbreak_lchan_after_missing_rel_ack_2() runs on test_CT { |
| 12555 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 12556 | var MSC_ConnHdlr vc_conn; |
| 12557 | f_init(1, true); |
| 12558 | f_sleep(1.0); |
| 12559 | vc_conn := f_start_handler(refers(f_TC_unbreak_lchan_after_missing_rel_ack_2), pars); |
| 12560 | vc_conn.done; |
| 12561 | f_shutdown_helper(); |
| 12562 | } |
| 12563 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 12564 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12565 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 12566 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 12567 | execute( TC_ctrl_msc0_connection_status() ); |
Neels Hofmeyr | f65ce87 | 2021-09-23 18:40:10 +0200 | [diff] [blame] | 12568 | /* In SCCPlite tests, only one MSC is configured. These tests assume that three MSCs are configured, so only run |
| 12569 | * these in the AoIP test suite. */ |
| 12570 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 12571 | execute( TC_stat_num_msc_connected_1() ); |
| 12572 | execute( TC_stat_num_msc_connected_2() ); |
| 12573 | execute( TC_stat_num_msc_connected_3() ); |
| 12574 | } |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 12575 | execute( TC_stat_num_bts_connected_1() ); |
| 12576 | execute( TC_stat_num_bts_connected_2() ); |
| 12577 | execute( TC_stat_num_bts_connected_3() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 12578 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 12579 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 12580 | execute( TC_ctrl_location() ); |
| 12581 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12582 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 12583 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 12584 | execute( TC_si2quater_2_earfcns() ); |
| 12585 | execute( TC_si2quater_3_earfcns() ); |
| 12586 | execute( TC_si2quater_4_earfcns() ); |
| 12587 | execute( TC_si2quater_5_earfcns() ); |
| 12588 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 12589 | execute( TC_si2quater_12_earfcns() ); |
| 12590 | execute( TC_si2quater_23_earfcns() ); |
| 12591 | execute( TC_si2quater_32_earfcns() ); |
| 12592 | execute( TC_si2quater_33_earfcns() ); |
| 12593 | execute( TC_si2quater_42_earfcns() ); |
| 12594 | execute( TC_si2quater_48_earfcns() ); |
| 12595 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 12596 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 12597 | execute( TC_si_acc_ramp_rotate() ); |
Oliver Smith | 45a6dd3 | 2023-09-27 10:52:50 +0200 | [diff] [blame] | 12598 | execute( TC_si2_ncc_permitted() ); /* TODO: test in SI6 too */ |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 12599 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12600 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 12601 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 12602 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 12603 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 12604 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 12605 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 12606 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 12607 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 12608 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 12609 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 12610 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 12611 | execute( TC_chan_rel_rll_rel_ind() ); |
| 12612 | execute( TC_chan_rel_conn_fail() ); |
| 12613 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 12614 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 12615 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 12616 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 12617 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 12618 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 12619 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 12620 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 12621 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 12622 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 12623 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12624 | |
| 12625 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 12626 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 12627 | execute( TC_assignment_csd() ); |
| 12628 | execute( TC_assignment_ctm() ); |
| 12629 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 12630 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 12631 | execute( TC_assignment_aoip_tla_v6() ); |
| 12632 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 12633 | execute( TC_assignment_fr_a5_0() ); |
| 12634 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 12635 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 12636 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 12637 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 12638 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 12639 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 12640 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 12641 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 12642 | execute( TC_ciph_mode_a5_0() ); |
| 12643 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 12644 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 12645 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 12646 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 12647 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 12648 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 12649 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 12650 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 12651 | execute( TC_assignment_codec_hr() ); |
| 12652 | execute( TC_assignment_codec_efr() ); |
| 12653 | execute( TC_assignment_codec_amr_f() ); |
| 12654 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 12655 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 12656 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 12657 | execute( TC_assignment_codec_amr_f_S1() ); |
| 12658 | execute( TC_assignment_codec_amr_h_S1() ); |
| 12659 | execute( TC_assignment_codec_amr_f_S124() ); |
| 12660 | execute( TC_assignment_codec_amr_h_S124() ); |
| 12661 | execute( TC_assignment_codec_amr_f_S0() ); |
| 12662 | execute( TC_assignment_codec_amr_f_S02() ); |
| 12663 | execute( TC_assignment_codec_amr_f_S024() ); |
| 12664 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 12665 | execute( TC_assignment_codec_amr_h_S0() ); |
| 12666 | execute( TC_assignment_codec_amr_h_S02() ); |
| 12667 | execute( TC_assignment_codec_amr_h_S024() ); |
| 12668 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 12669 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 12670 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 12671 | execute( TC_assignment_codec_amr_f_zero() ); |
| 12672 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 12673 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 12674 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 12675 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 12676 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 12677 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 12678 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 12679 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 12680 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 12681 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 12682 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 12683 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 12684 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 12685 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 12686 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 12687 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 12688 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 12689 | execute( TC_assignment_codec_req_hr_fr() ); |
| 12690 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 12691 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 12692 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 12693 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 12694 | |
Pau Espin Pedrol | cd6077f | 2022-09-19 20:23:37 +0200 | [diff] [blame] | 12695 | execute( TC_assignment_codec_hr_osmux_on() ); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 12696 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | 29c6dfb | 2022-08-08 18:37:56 +0200 | [diff] [blame] | 12697 | execute( TC_assignment_osmux_cn() ); |
| 12698 | execute( TC_assignment_osmux_bts() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 12699 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12700 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 12701 | execute( TC_rll_est_ind_inact_lchan() ); |
| 12702 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 12703 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 12704 | execute( TC_rll_est_ind_inval_sacch() ); |
| 12705 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 12706 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 12707 | execute( TC_tch_dlci_link_id_sapi() ); |
| 12708 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 12709 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 12710 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 12711 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 12712 | execute( TC_rll_timeout_sapi_n_reject() ); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 12713 | execute( TC_rll_sapi_n_reject_dlci_cc() ); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 12714 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12715 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 12716 | execute( TC_paging_imsi_nochan() ); |
| 12717 | execute( TC_paging_tmsi_nochan() ); |
| 12718 | execute( TC_paging_tmsi_any() ); |
| 12719 | execute( TC_paging_tmsi_sdcch() ); |
| 12720 | execute( TC_paging_tmsi_tch_f() ); |
| 12721 | execute( TC_paging_tmsi_tch_hf() ); |
| 12722 | execute( TC_paging_imsi_nochan_cgi() ); |
| 12723 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 12724 | execute( TC_paging_imsi_nochan_ci() ); |
| 12725 | execute( TC_paging_imsi_nochan_lai() ); |
| 12726 | execute( TC_paging_imsi_nochan_lac() ); |
| 12727 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 12728 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 12729 | execute( TC_paging_imsi_nochan_rnc() ); |
| 12730 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 12731 | execute( TC_paging_imsi_nochan_lacs() ); |
| 12732 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 12733 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 12734 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 12735 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 12736 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 12737 | execute( TC_paging_resp_unsol() ); |
Pau Espin Pedrol | 09b9bad | 2022-04-21 18:48:08 +0200 | [diff] [blame] | 12738 | execute( TC_paging_500req() ); |
Pau Espin Pedrol | 189bf1b | 2022-04-27 12:42:13 +0200 | [diff] [blame] | 12739 | execute( TC_paging_450req_no_paging_load_ind() ); |
Pau Espin Pedrol | 07657ae | 2023-01-03 12:08:05 +0100 | [diff] [blame] | 12740 | execute( TC_paging_imsi_nochan_ci_resp_invalid_mi() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 12741 | |
| 12742 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 12743 | execute( TC_rsl_unknown_unit_id() ); |
| 12744 | |
| 12745 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12746 | |
| 12747 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 12748 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 12749 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 12750 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 12751 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 12752 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 12753 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 12754 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 12755 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 12756 | execute( TC_ho_int_a5_0() ); |
| 12757 | execute( TC_ho_int_a5_1() ); |
| 12758 | execute( TC_ho_int_a5_3() ); |
| 12759 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 12760 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 12761 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 12762 | /* TC_ho_out_of_this_bsc is run last, see comment below */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 12763 | execute( TC_ho_out_fail_no_msc_response() ); |
| 12764 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 12765 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 12766 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 12767 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 12768 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 12769 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 12770 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 12771 | execute( TC_ho_into_this_bsc_a5_4() ); |
Neels Hofmeyr | 93182e0 | 2022-02-17 21:59:07 +0100 | [diff] [blame] | 12772 | execute( TC_ho_into_this_bsc_a5_1_3_no_chosen_enc_alg() ); |
| 12773 | execute( TC_ho_into_this_bsc_a5_1_3() ); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 12774 | execute( TC_ho_into_this_bsc_a5_mismatch() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 12775 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 12776 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 12777 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 12778 | execute( TC_srvcc_eutran_to_geran() ); |
Vadim Yanitskiy | 634f75d | 2022-03-14 17:04:45 +0300 | [diff] [blame] | 12779 | execute( TC_srvcc_eutran_to_geran_a5_3() ); |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 12780 | execute( TC_srvcc_eutran_to_geran_src_sai() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 12781 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 12782 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 12783 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 12784 | execute( TC_ho_in_fail_msc_clears() ); |
| 12785 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 12786 | execute( TC_ho_in_fail_no_detect() ); |
| 12787 | execute( TC_ho_in_fail_no_detect2() ); |
Oliver Smith | 7a8594a | 2023-02-13 14:30:49 +0100 | [diff] [blame] | 12788 | execute( TC_ho_in_fail_mgw_mdcx_timeout() ); |
Oliver Smith | 4eed06f | 2023-02-15 15:43:19 +0100 | [diff] [blame] | 12789 | execute( TC_ho_in_fail_ipa_crcx_timeout() ); |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 12790 | execute( TC_ho_into_this_bsc_sccp_cr_without_bssap() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 12791 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 12792 | execute( TC_ho_neighbor_config_1() ); |
| 12793 | execute( TC_ho_neighbor_config_2() ); |
| 12794 | execute( TC_ho_neighbor_config_3() ); |
| 12795 | execute( TC_ho_neighbor_config_4() ); |
| 12796 | execute( TC_ho_neighbor_config_5() ); |
| 12797 | execute( TC_ho_neighbor_config_6() ); |
| 12798 | execute( TC_ho_neighbor_config_7() ); |
| 12799 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 12800 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 12801 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 12802 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 12803 | |
| 12804 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 12805 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 12806 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 12807 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | 37a4c15 | 2021-11-16 19:02:23 +0100 | [diff] [blame] | 12808 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 12809 | execute( TC_dyn_ts_sdcch8_all_subslots_used() ); |
| 12810 | execute( TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 12811 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 12812 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 12813 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 12814 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 12815 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 12816 | /* Power control related */ |
| 12817 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 12818 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 12819 | |
| 12820 | /* MSC pooling */ |
| 12821 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 12822 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 12823 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 12824 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 12825 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 12826 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 12827 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 12828 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 12829 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 12830 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 12831 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 12832 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 12833 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 12834 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 12835 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 12836 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 12837 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 12838 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
Neels Hofmeyr | 2bdc6b6 | 2023-04-05 02:45:19 +0200 | [diff] [blame] | 12839 | |
| 12840 | execute( TC_mscpool_sccp_n_pcstate_detaches_msc() ); |
Neels Hofmeyr | 38632aa | 2023-04-05 03:50:51 +0200 | [diff] [blame] | 12841 | execute( TC_mscpool_sccp_n_pcstate_attaches_msc() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 12842 | } |
| 12843 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 12844 | execute( TC_early_conn_fail() ); |
| 12845 | execute( TC_late_conn_fail() ); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 12846 | execute( TC_stats_conn_fail() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 12847 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 12848 | /* Emergency call handling (deny / allow) */ |
| 12849 | execute( TC_assignment_emerg_setup_allow() ); |
Pau Espin Pedrol | b27653c | 2023-01-03 14:07:21 +0100 | [diff] [blame] | 12850 | execute( TC_assignment_emerg_setup_allow_imei() ); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 12851 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 12852 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 12853 | execute( TC_emerg_premption() ); |
| 12854 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 12855 | /* Frequency hopping parameters handling */ |
| 12856 | execute( TC_fh_params_chan_activ() ); |
| 12857 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 12858 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 12859 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 12860 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 12861 | |
| 12862 | if (mp_enable_lcs_tests) { |
| 12863 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 12864 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 12865 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 12866 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 12867 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 12868 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 12869 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 12870 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 12871 | execute( TC_ho_during_lcs_loc_req() ); |
Neels Hofmeyr | a47a8c6 | 2022-04-07 00:31:19 +0200 | [diff] [blame] | 12872 | execute( TC_emerg_call_and_lcs_loc_req() ); |
Neels Hofmeyr | 61f9dc5 | 2022-05-12 23:04:40 +0200 | [diff] [blame] | 12873 | execute( TC_emerg_call_and_lcs_loc_req_early_lchan_rel_ind() ); |
| 12874 | execute( TC_emerg_call_and_lcs_loc_req_early_lchan_conn_fail() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 12875 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 12876 | |
| 12877 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 12878 | |
| 12879 | execute( TC_refuse_chan_act_to_vamos() ); |
| 12880 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 12881 | |
| 12882 | execute( TC_reassignment_fr() ); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 12883 | |
| 12884 | execute( TC_cm_reestablishment() ); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 12885 | |
| 12886 | execute( TC_imm_ass_post_chan_ack() ); |
| 12887 | execute( TC_imm_ass_pre_chan_ack() ); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 12888 | execute( TC_imm_ass_pre_ts_ack() ); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 12889 | execute( TC_imm_ass_pre_chan_ack_dyn_ts() ); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 12890 | execute( TC_imm_ass_pre_ts_ack_dyn_ts() ); |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 12891 | |
| 12892 | execute( TC_ctrl_trx_rf_locked() ); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 12893 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 12894 | execute( TC_ratectr_all_available_allocated() ); |
| 12895 | execute( TC_ratectr_all_available_allocated_dyn() ); |
| 12896 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 12897 | execute( TC_cm_serv_rej() ); |
| 12898 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 12899 | execute( TC_lost_sdcch_during_assignment() ); |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 12900 | |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12901 | /* Channel allocator */ |
| 12902 | execute( TC_chan_alloc_algo_ascending() ); |
| 12903 | execute( TC_chan_alloc_algo_descending() ); |
Vadim Yanitskiy | 7c29c4e | 2022-06-18 03:07:50 +0700 | [diff] [blame] | 12904 | execute( TC_chan_alloc_algo_ass_dynamic() ); |
Vadim Yanitskiy | 1a16d31 | 2022-05-31 16:14:01 +0600 | [diff] [blame] | 12905 | |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12906 | /* MGW pool */ |
Pau Espin Pedrol | 4e43183 | 2023-02-08 12:43:47 +0100 | [diff] [blame] | 12907 | execute( TC_mgwpool_all_used() ); |
| 12908 | execute( TC_mgwpool_blocked_not_used() ); |
| 12909 | execute( TC_mgwpool_pin_bts() ); |
Pau Espin Pedrol | bd59842 | 2023-06-15 17:29:09 +0200 | [diff] [blame] | 12910 | execute( TC_mgwpool_keepalive_down_not_used() ); |
Pau Espin Pedrol | d2355e8 | 2022-10-20 19:34:43 +0200 | [diff] [blame] | 12911 | |
Oliver Smith | c9a5f53 | 2022-10-21 11:32:23 +0200 | [diff] [blame] | 12912 | execute( TC_ho_meas_rep_multi_band() ); |
| 12913 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 12914 | /* Run TC_ho_out_of_this_bsc last, because it may trigger a segfault before osmo-bsc's patch |
| 12915 | * with change-id I5a3345ab0005a73597f5c27207480912a2f5aae6 */ |
| 12916 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 8f4db54 | 2023-11-22 04:15:10 +0100 | [diff] [blame] | 12917 | |
| 12918 | execute( TC_unbreak_lchan_after_missing_rel_ack_1() ); |
| 12919 | execute( TC_unbreak_lchan_after_missing_rel_ack_2() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 12920 | } |
| 12921 | |
| 12922 | } |