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; |
| 24 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 25 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 26 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 28 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 29 | import from IPL4asp_Types all; |
| 30 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 31 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 32 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Adapter all; |
| 34 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 35 | import from BSSAP_LE_Types all; |
| 36 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from BSSAP_CodecPort all; |
| 38 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 39 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 40 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 42 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 43 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 44 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 45 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 46 | import from MGCP_Templates all; |
| 47 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 48 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 49 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 51 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 52 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 59 | import from Osmocom_VTY_Functions all; |
| 60 | import from TELNETasp_PortType all; |
| 61 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 62 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 63 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 64 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 65 | import from L3_Templates all; |
| 66 | import from GSM_RR_Types all; |
| 67 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 68 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 70 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 71 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 72 | import from SCCPasp_Types all; |
| 73 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 74 | import from GSM_SystemInformation all; |
| 75 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 76 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 77 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 78 | type record of integer integer_list; |
| 79 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 80 | const integer NUM_BTS := 3; |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 81 | const integer NUM_BTS_CFG := 4; /* we have 4 BTS in the osmo-bsc.cfg (for inter-BSC HO tests) but use only 3 */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 82 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 84 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 85 | /* 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] | 86 | const integer NUM_TCHH_PER_BTS := 2; |
| 87 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 88 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 89 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 90 | /* Default Training Sequence Code expected for bts[i]: |
| 91 | * BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2. |
| 92 | * BTS 1 has BSIC 11, TSC = (BSIC & 7) = 3. |
| 93 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 94 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 95 | */ |
| 96 | const integer_list BTS_TSC := { |
| 97 | 2, |
| 98 | 3, |
| 99 | 4, |
| 100 | 4 |
| 101 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 102 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 103 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 104 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 105 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 106 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 109 | /* Default list of counters for an 'msc' entity. */ |
| 110 | const CounterNameVals counternames_msc_mscpool := { |
| 111 | { "mscpool:subscr:new", 0 }, |
| 112 | { "mscpool:subscr:known", 0 }, |
| 113 | { "mscpool:subscr:reattach", 0 }, |
| 114 | { "mscpool:subscr:attach_lost", 0 }, |
| 115 | { "mscpool:subscr:paged", 0 } |
| 116 | }; |
| 117 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 118 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 119 | const CounterNameVals counternames_bsc_mscpool := { |
| 120 | { "mscpool:subscr:no_msc", 0 } |
| 121 | }; |
| 122 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 123 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 124 | const CounterNameVals counternames_bsc_bts_handover := { |
| 125 | { "assignment:attempted", 0 }, |
| 126 | { "assignment:completed", 0 }, |
| 127 | { "assignment:stopped", 0 }, |
| 128 | { "assignment:no_channel", 0 }, |
| 129 | { "assignment:timeout", 0 }, |
| 130 | { "assignment:failed", 0 }, |
| 131 | { "assignment:error", 0 }, |
| 132 | |
| 133 | { "handover:attempted", 0 }, |
| 134 | { "handover:completed", 0 }, |
| 135 | { "handover:stopped", 0 }, |
| 136 | { "handover:no_channel", 0 }, |
| 137 | { "handover:timeout", 0 }, |
| 138 | { "handover:failed", 0 }, |
| 139 | { "handover:error", 0 }, |
| 140 | |
| 141 | { "intra_cell_ho:attempted", 0 }, |
| 142 | { "intra_cell_ho:completed", 0 }, |
| 143 | { "intra_cell_ho:stopped", 0 }, |
| 144 | { "intra_cell_ho:no_channel", 0 }, |
| 145 | { "intra_cell_ho:timeout", 0 }, |
| 146 | { "intra_cell_ho:failed", 0 }, |
| 147 | { "intra_cell_ho:error", 0 }, |
| 148 | |
| 149 | { "intra_bsc_ho:attempted", 0 }, |
| 150 | { "intra_bsc_ho:completed", 0 }, |
| 151 | { "intra_bsc_ho:stopped", 0 }, |
| 152 | { "intra_bsc_ho:no_channel", 0 }, |
| 153 | { "intra_bsc_ho:timeout", 0 }, |
| 154 | { "intra_bsc_ho:failed", 0 }, |
| 155 | { "intra_bsc_ho:error", 0 }, |
| 156 | |
| 157 | { "interbsc_ho_out:attempted", 0 }, |
| 158 | { "interbsc_ho_out:completed", 0 }, |
| 159 | { "interbsc_ho_out:stopped", 0 }, |
| 160 | { "interbsc_ho_out:timeout", 0 }, |
| 161 | { "interbsc_ho_out:failed", 0 }, |
| 162 | { "interbsc_ho_out:error", 0 }, |
| 163 | |
| 164 | { "interbsc_ho_in:attempted", 0 }, |
| 165 | { "interbsc_ho_in:completed", 0 }, |
| 166 | { "interbsc_ho_in:stopped", 0 }, |
| 167 | { "interbsc_ho_in:no_channel", 0 }, |
| 168 | { "interbsc_ho_in:timeout", 0 }, |
| 169 | { "interbsc_ho_in:failed", 0 }, |
| 170 | { "interbsc_ho_in:error", 0 } |
| 171 | }; |
| 172 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 173 | const CounterNameVals counternames_bts_handover := { |
| 174 | { "incoming_intra_bsc_ho:attempted", 0 }, |
| 175 | { "incoming_intra_bsc_ho:completed", 0 }, |
| 176 | { "incoming_intra_bsc_ho:stopped", 0 }, |
| 177 | { "incoming_intra_bsc_ho:no_channel", 0 }, |
| 178 | { "incoming_intra_bsc_ho:timeout", 0 }, |
| 179 | { "incoming_intra_bsc_ho:failed", 0 }, |
| 180 | { "incoming_intra_bsc_ho:error", 0 } |
| 181 | }; |
| 182 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 183 | /* Set of all System Information received during one RSL port's startup. |
| 184 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 185 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 186 | */ |
| 187 | type record SystemInformationConfig { |
| 188 | SystemInformationType1 si1 optional, |
| 189 | SystemInformationType2 si2 optional, |
| 190 | SystemInformationType2bis si2bis optional, |
| 191 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 192 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 193 | SystemInformationType3 si3 optional, |
| 194 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 195 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 196 | SystemInformationType5 si5 optional, |
| 197 | SystemInformationType5bis si5bis optional, |
| 198 | SystemInformationType5ter si5ter optional, |
| 199 | SystemInformationType6 si6 optional |
| 200 | }; |
| 201 | |
| 202 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 203 | si1 := omit, |
| 204 | si2 := omit, |
| 205 | si2bis := omit, |
| 206 | si2ter := omit, |
| 207 | si2quater := omit, |
| 208 | si3 := omit, |
| 209 | si4 := omit, |
| 210 | si13 := omit, |
| 211 | si5 := omit, |
| 212 | si5bis := omit, |
| 213 | si5ter := omit, |
| 214 | si6 := omit |
| 215 | }; |
| 216 | |
| 217 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 218 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 219 | template uint3_t meas_bw := 3) |
| 220 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 221 | meas_bw_presence := '1'B, |
| 222 | meas_bw := meas_bw); |
| 223 | |
| 224 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 225 | 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] | 226 | template uint3_t prio := 3, |
| 227 | template (present) uint5_t thresh_high := 20, |
| 228 | template uint5_t thresh_low := 10, |
| 229 | template uint5_t qrxlevmin := 22) |
| 230 | := tr_EUTRAN_NeighbourCells( |
| 231 | cell_desc_list := cell_desc_list, |
| 232 | prio_presence := '1'B, |
| 233 | prio := prio, |
| 234 | thresh_high := thresh_high, |
| 235 | thresh_low_presence := '1'B, |
| 236 | thresh_low := thresh_low, |
| 237 | qrxlevmin_presence := '1'B, |
| 238 | qrxlevmin := qrxlevmin); |
| 239 | |
| 240 | template SystemInformationConfig SystemInformationConfig_default := { |
| 241 | si1 := { |
| 242 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 243 | rach_control := { |
| 244 | max_retrans := RACH_MAX_RETRANS_7, |
| 245 | tx_integer := '1001'B, |
| 246 | cell_barr_access := false, |
| 247 | re_not_allowed := true, |
| 248 | acc := '0000010000000000'B |
| 249 | }, |
| 250 | rest_octets := ? |
| 251 | }, |
| 252 | si2 := { |
| 253 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 254 | ncc_permitted := '11111111'B, |
| 255 | rach_control := { |
| 256 | max_retrans := RACH_MAX_RETRANS_7, |
| 257 | tx_integer := '1001'B, |
| 258 | cell_barr_access := false, |
| 259 | re_not_allowed := true, |
| 260 | acc := '0000010000000000'B |
| 261 | } |
| 262 | }, |
| 263 | si2bis := omit, |
| 264 | si2ter := { |
| 265 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 266 | rest_octets := ? |
| 267 | }, |
| 268 | si2quater := { |
| 269 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 270 | }, |
| 271 | si3 := { |
| 272 | cell_id := 0, |
| 273 | lai := { |
| 274 | mcc_mnc := '001F01'H, |
| 275 | lac := 1 |
| 276 | }, |
| 277 | ctrl_chan_desc := { |
| 278 | msc_r99 := true, |
| 279 | att := true, |
| 280 | bs_ag_blks_res := 1, |
| 281 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 282 | si22ind := false, |
| 283 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 284 | spare := '00'B, |
| 285 | bs_pa_mfrms := 3, |
| 286 | t3212 := 30 |
| 287 | }, |
| 288 | cell_options := { |
| 289 | dn_ind := false, |
| 290 | pwrc := false, |
| 291 | dtx := MS_SHALL_USE_UL_DTX, |
| 292 | radio_link_tout_div4 := 7 |
| 293 | }, |
| 294 | cell_sel_par := { |
| 295 | cell_resel_hyst_2dB := 2, |
| 296 | ms_txpwr_max_cch := 7, |
| 297 | acs := '0'B, |
| 298 | neci := true, |
| 299 | rxlev_access_min := 0 |
| 300 | }, |
| 301 | rach_control := { |
| 302 | max_retrans := RACH_MAX_RETRANS_7, |
| 303 | tx_integer := '1001'B, |
| 304 | cell_barr_access := false, |
| 305 | re_not_allowed := true, |
| 306 | acc := '0000010000000000'B |
| 307 | }, |
| 308 | rest_octets := { |
| 309 | sel_params := { |
| 310 | presence := '0'B, |
| 311 | params := omit |
| 312 | }, |
| 313 | pwr_offset := { |
| 314 | presence := '0'B, |
| 315 | offset := omit |
| 316 | }, |
| 317 | si_2ter_ind := '1'B, |
| 318 | early_cm_ind := '0'B, |
| 319 | sched_where := { |
| 320 | presence := '0'B, |
| 321 | where := omit |
| 322 | }, |
| 323 | gprs_ind := { |
| 324 | presence := '1'B, |
| 325 | ind := { |
| 326 | ra_colour := 0, |
| 327 | si13_pos := '0'B |
| 328 | } |
| 329 | }, |
| 330 | umts_early_cm_ind := '1'B, |
| 331 | si2_quater_ind := { |
| 332 | presence := '1'B, |
| 333 | ind := '0'B |
| 334 | }, |
| 335 | iu_mode_ind := omit, |
| 336 | si21_ind := { |
| 337 | presence := '0'B, |
| 338 | pos := omit |
| 339 | } |
| 340 | } |
| 341 | }, |
| 342 | si4 := { |
| 343 | lai := { |
| 344 | mcc_mnc := '001F01'H, |
| 345 | lac := 1 |
| 346 | }, |
| 347 | cell_sel_par := { |
| 348 | cell_resel_hyst_2dB := 2, |
| 349 | ms_txpwr_max_cch := 7, |
| 350 | acs := '0'B, |
| 351 | neci := true, |
| 352 | rxlev_access_min := 0 |
| 353 | }, |
| 354 | rach_control := { |
| 355 | max_retrans := RACH_MAX_RETRANS_7, |
| 356 | tx_integer := '1001'B, |
| 357 | cell_barr_access := false, |
| 358 | re_not_allowed := true, |
| 359 | acc := '0000010000000000'B |
| 360 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 361 | cbch_chan_desc := { |
| 362 | iei := '64'O, |
| 363 | v := { |
| 364 | chan_nr := { |
| 365 | u := { |
| 366 | sdcch4 := { |
| 367 | tag := '001'B, |
| 368 | sub_chan := 2 |
| 369 | } |
| 370 | }, |
| 371 | tn := 0 |
| 372 | }, |
| 373 | tsc := 2, |
| 374 | h := false, |
| 375 | arfcn := 871, |
| 376 | maio_hsn := omit |
| 377 | } |
| 378 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 379 | cbch_mobile_alloc := omit, |
| 380 | rest_octets := { |
| 381 | sel_params := { |
| 382 | presence := '0'B, |
| 383 | params := omit |
| 384 | }, |
| 385 | pwr_offset := { |
| 386 | presence := '0'B, |
| 387 | offset := omit |
| 388 | }, |
| 389 | gprs_ind := { |
| 390 | presence := '1'B, |
| 391 | ind := { |
| 392 | ra_colour := 0, |
| 393 | si13_pos := '0'B |
| 394 | } |
| 395 | }, |
| 396 | s_presence := '0'B, |
| 397 | s := omit |
| 398 | } |
| 399 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 400 | si13 := { |
| 401 | rest_octets := { |
| 402 | presence := '1'B, |
| 403 | bcch_change_mark := ?, |
| 404 | si_change_field := '0000'B, |
| 405 | presence2 := '0'B, |
| 406 | si13_change_mark := omit, |
| 407 | gprs_ma := omit, |
| 408 | zero := '0'B, /* PBCCH not present in cell */ |
| 409 | rac := 0, |
| 410 | spgc_ccch_sup := '0'B, |
| 411 | priority_access_thr := '110'B, |
| 412 | network_control_order := '00'B, |
| 413 | gprs_cell_opts := { |
| 414 | nmo := '01'B, |
| 415 | t3168 := '011'B, |
| 416 | t3192 := '010'B, |
| 417 | drx_timer_max := '011'B, |
| 418 | access_burst_type := '0'B, |
| 419 | control_ack_type := '1'B, |
| 420 | bs_cv_max := 15, |
| 421 | pan_presence := '1'B, |
| 422 | pan_dec := 1, |
| 423 | pan_inc := 1, |
| 424 | pan_max := '111'B, |
| 425 | ext_info_presence := ?, |
| 426 | ext_info_length := *, |
| 427 | ext_info := * |
| 428 | }, |
| 429 | gprs_pwr_ctrl_params := { |
| 430 | alpha := 0, |
| 431 | t_avg_w := '10000'B, |
| 432 | t_avg_t := '10000'B, |
| 433 | pc_meas_chan := '0'B, |
| 434 | n_avg_i := '1000'B |
| 435 | } |
| 436 | } |
| 437 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 438 | si5 := { |
| 439 | bcch_freq_list := '10000000000000000000000000000000'O |
| 440 | }, |
| 441 | si5bis := omit, |
| 442 | si5ter := { |
| 443 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 444 | }, |
| 445 | si6 := { |
| 446 | cell_id := 0, |
| 447 | lai := { |
| 448 | mcc_mnc := '001F01'H, |
| 449 | lac := 1 |
| 450 | }, |
| 451 | cell_options := { |
| 452 | dtx_ext := '1'B, |
| 453 | pwrc := false, |
| 454 | dtx := '01'B, |
| 455 | radio_link_timeout := '0111'B |
| 456 | }, |
| 457 | ncc_permitted := '11111111'B, |
Vadim Yanitskiy | 348b07c | 2022-03-10 17:11:22 +0300 | [diff] [blame] | 458 | rest_octets := { |
| 459 | pch_nch_info := ?, |
| 460 | vbs_vgcs_options := ?, |
| 461 | dtm_support := '0'B, |
| 462 | rac := omit, |
| 463 | max_lapdm := omit, |
| 464 | band_ind := '0'B /* C0 ARFCN indicates 1800 band */ |
| 465 | } |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 466 | } |
| 467 | }; |
| 468 | |
| 469 | |
| 470 | /* List of all the System Information received on all RSL ports */ |
| 471 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 472 | |
| 473 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 474 | { |
| 475 | var RSL_IE_Body sysinfo_type_ie; |
| 476 | var RSL_IE_SysinfoType si_type; |
| 477 | var octetstring data; |
| 478 | |
| 479 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 480 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 481 | mtc.stop; |
| 482 | } |
| 483 | si_type := sysinfo_type_ie.sysinfo_type; |
| 484 | |
| 485 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 486 | var RSL_IE_Body bcch_ie; |
| 487 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 488 | data := bcch_ie.other.payload; |
| 489 | } |
| 490 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 491 | var RSL_IE_Body l3_ie; |
| 492 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 493 | data := l3_ie.l3_info.payload; |
| 494 | } |
| 495 | } else { |
| 496 | setverdict(fail, "Don't understand this System Information message"); |
| 497 | mtc.stop; |
| 498 | } |
| 499 | |
| 500 | var boolean handled := false; |
| 501 | |
| 502 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 503 | handled := true; |
| 504 | |
| 505 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 506 | if (not isbound(data)) { |
| 507 | si.si1 := omit; |
| 508 | } else { |
| 509 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 510 | } |
| 511 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 512 | if (not isbound(data)) { |
| 513 | si.si2 := omit; |
| 514 | } else { |
| 515 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 516 | } |
| 517 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 518 | if (not isbound(data)) { |
| 519 | si.si2bis := omit; |
| 520 | } else { |
| 521 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 522 | } |
| 523 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 524 | if (not isbound(data)) { |
| 525 | si.si2ter := omit; |
| 526 | } else { |
| 527 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 528 | } |
| 529 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 530 | if (not isbound(data)) { |
| 531 | si.si2quater := {}; |
| 532 | } else { |
| 533 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 534 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 535 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 536 | } |
| 537 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 538 | if (not isbound(data)) { |
| 539 | si.si3 := omit; |
| 540 | } else { |
| 541 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 542 | } |
| 543 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 544 | if (not isbound(data)) { |
| 545 | si.si4 := omit; |
| 546 | } else { |
| 547 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 548 | } |
| 549 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 550 | if (not isbound(data)) { |
| 551 | si.si13 := omit; |
| 552 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 553 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 554 | } |
| 555 | } else { |
| 556 | handled := false; |
| 557 | } |
| 558 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 559 | handled := true; |
| 560 | |
| 561 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 562 | if (not isbound(data)) { |
| 563 | si.si5 := omit; |
| 564 | } else { |
| 565 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 566 | } |
| 567 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 568 | if (not isbound(data)) { |
| 569 | si.si5bis := omit; |
| 570 | } else { |
| 571 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 572 | } |
| 573 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 574 | if (not isbound(data)) { |
| 575 | si.si5ter := omit; |
| 576 | } else { |
| 577 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 578 | } |
| 579 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 580 | if (not isbound(data)) { |
| 581 | si.si6 := omit; |
| 582 | } else { |
| 583 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 584 | } |
| 585 | } else { |
| 586 | handled := false; |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | if (not handled) { |
| 591 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 592 | } |
| 593 | } |
| 594 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 595 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 596 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 597 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 598 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 599 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 600 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 601 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 602 | 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] | 603 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 604 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 605 | /* Configure/manage IPA_Emulation: */ |
| 606 | port IPA_CFG_PT IPA_CFG_PORT; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 607 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 608 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 609 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 610 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 611 | /* StatsD */ |
| 612 | var StatsD_Checker_CT vc_STATSD; |
| 613 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 614 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 615 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 616 | /* for old legacy-tests only */ |
| 617 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 618 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 619 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 620 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 621 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 622 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 623 | /* Osmux is enabled through VTY */ |
| 624 | var boolean g_osmux_enabled := false; |
| 625 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 626 | /*Configure T(tias) over VTY, seconds */ |
| 627 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 628 | /*Configure T(tiar) over VTY, seconds */ |
| 629 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 630 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 631 | /* 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] | 632 | timer T_guard := 30.0; |
| 633 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 634 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 635 | var CounterNameValsList g_ctr_bsc; |
| 636 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 637 | |
| 638 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 639 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 640 | } |
| 641 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 642 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 643 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 644 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 645 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 646 | /* port number to which to establish the IPA OML connections */ |
| 647 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 648 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 649 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 650 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 651 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 652 | /* port number to which to listen for STATSD metrics */ |
| 653 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 654 | /* IP address at which the test binds */ |
| 655 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 656 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 657 | RAN_Configurations mp_bssap_cfg := { |
| 658 | { |
| 659 | transport := BSSAP_TRANSPORT_AoIP, |
| 660 | sccp_service_type := "mtp3_itu", |
| 661 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 662 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 663 | own_ssn := 254, |
| 664 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 665 | peer_ssn := 254, |
| 666 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 667 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 668 | }, |
| 669 | { |
| 670 | transport := BSSAP_TRANSPORT_AoIP, |
| 671 | sccp_service_type := "mtp3_itu", |
| 672 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 673 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 674 | own_ssn := 254, |
| 675 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 676 | peer_ssn := 254, |
| 677 | sio := '83'O, |
| 678 | rctx := 2 |
| 679 | }, |
| 680 | { |
| 681 | transport := BSSAP_TRANSPORT_AoIP, |
| 682 | sccp_service_type := "mtp3_itu", |
| 683 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 684 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 685 | own_ssn := 254, |
| 686 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 687 | peer_ssn := 254, |
| 688 | sio := '83'O, |
| 689 | rctx := 3 |
| 690 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 691 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 692 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 693 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 694 | phys_chan_configs phys_chan_config := { |
| 695 | "CCCH+SDCCH4+CBCH", |
| 696 | "TCH/F", |
| 697 | "TCH/F", |
| 698 | "TCH/F", |
| 699 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 700 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 701 | "PDCH", |
| 702 | "PDCH" |
| 703 | }; |
| 704 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 705 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 706 | sccp_service_type := "mtp3_itu", |
| 707 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 708 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 709 | own_ssn := 252, /* SMLC side SSN */ |
| 710 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 711 | peer_ssn := 250, /* BSC side SSN */ |
| 712 | sio := '83'O, |
| 713 | rctx := 6 |
| 714 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 715 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 716 | |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 717 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 718 | uint8_t mp_exp_ms_power_level := 7; |
Vadim Yanitskiy | 6e06801 | 2022-02-05 21:35:43 +0600 | [diff] [blame] | 719 | |
| 720 | /* Whether to check for memory leaks */ |
| 721 | boolean mp_verify_talloc_count := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 722 | } |
| 723 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 724 | 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] | 725 | |
| 726 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 727 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 728 | pars.aoip := true; |
| 729 | } else { |
| 730 | pars.aoip := false; |
| 731 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 732 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 733 | pars.mscpool.bssap_idx := bssap_idx; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 734 | pars.expect_tsc := BTS_TSC[0]; |
Vadim Yanitskiy | 96bb9cb | 2021-12-10 21:14:15 +0300 | [diff] [blame] | 735 | pars.imsi := f_rnd_imsi('00101'H); |
| 736 | |
| 737 | log(testcasename(), ": using IMSI ", pars.imsi); |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 738 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 739 | return pars; |
| 740 | } |
| 741 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 742 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 743 | |
| 744 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 745 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 746 | log("initial msc rate counters: ", g_ctr_msc); |
| 747 | } |
| 748 | |
| 749 | 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] | 750 | 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] | 751 | } |
| 752 | |
| 753 | /* f_ctrs_msc_init(); |
| 754 | * f_do_thing(on_msc := 0); |
| 755 | * f_do_thing(on_msc := 0); |
| 756 | * f_do_other(on_msc := 1); |
| 757 | * f_ctrs_msc_add(0, "thing", 2); |
| 758 | * f_ctrs_msc_add(1, "other"); |
| 759 | * f_ctrs_msc_verify(); |
| 760 | */ |
| 761 | private function f_ctrs_msc_verify() runs on test_CT { |
| 762 | log("verifying msc rate counters: ", g_ctr_msc); |
| 763 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 764 | } |
| 765 | |
| 766 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 767 | * f_ctrs_msc_init(); |
| 768 | * f_do_thing(on_msc := 0); |
| 769 | * f_do_thing(on_msc := 0); |
| 770 | * f_do_thing(on_msc := 0); |
| 771 | * f_ctrs_msc_expect(0, "thing", 3); |
| 772 | */ |
| 773 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 774 | f_ctrs_msc_add(msc_nr, countername, val); |
| 775 | f_ctrs_msc_verify(); |
| 776 | } |
| 777 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 778 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 779 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 780 | 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] | 781 | 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] | 782 | log("initial bts rate counters: ", g_ctr_bts); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 783 | } |
| 784 | |
| 785 | function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 786 | f_ctrs_bts_init(bts_count, counternames); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 787 | f_ctrs_bsc_init(counternames); |
| 788 | } |
| 789 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 790 | private function f_ctrs_bsc_and_bts_handover_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 791 | var CounterNameVals bts_names := counternames_bsc_bts_handover & counternames_bts_handover; |
Neels Hofmeyr | 4dec8cc | 2021-11-29 15:59:44 +0100 | [diff] [blame] | 792 | f_ctrs_bts_init(bts_count, bts_names); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 793 | f_ctrs_bsc_init(counternames_bsc_bts_handover); |
| 794 | } |
| 795 | |
| 796 | 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] | 797 | 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] | 798 | } |
| 799 | |
| 800 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 801 | f_ctrs_bts_add(bts_nr, countername, val); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 802 | f_ctrs_bsc_add(countername, val); |
| 803 | } |
| 804 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 805 | function f_ctrs_bts_verify() runs on test_CT { |
| 806 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 807 | } |
| 808 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 809 | /* f_ctrs_bsc_and_bts_init(); |
| 810 | * f_do_thing(on_bts := 0); |
| 811 | * f_do_thing(on_bts := 0); |
| 812 | * f_do_other(on_bts := 1); |
| 813 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 814 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 815 | * f_ctrs_bsc_and_bts_verify(); |
| 816 | */ |
| 817 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 818 | f_ctrs_bts_verify(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 819 | f_ctrs_bsc_verify(); |
| 820 | } |
| 821 | |
| 822 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 823 | * f_ctrs_bsc_and_bts_init(); |
| 824 | * f_do_thing(on_bts := 0); |
| 825 | * f_do_thing(on_bts := 0); |
| 826 | * f_do_thing(on_bts := 0); |
| 827 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 828 | */ |
| 829 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 830 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 831 | f_ctrs_bsc_and_bts_verify(); |
| 832 | } |
| 833 | |
| 834 | |
| 835 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 836 | |
| 837 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 838 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 839 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 840 | } |
| 841 | |
| 842 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 843 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 844 | } |
| 845 | |
| 846 | /* f_ctrs_bsc_init(); |
| 847 | * f_do_thing(); |
| 848 | * f_do_thing(); |
| 849 | * f_do_other(); |
| 850 | * f_ctrs_bsc_add("thing", 2); |
| 851 | * f_ctrs_bsc_add("other"); |
| 852 | * f_ctrs_bsc_verify(); |
| 853 | */ |
| 854 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 855 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 856 | } |
| 857 | |
| 858 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 859 | * f_ctrs_bsc_init(); |
| 860 | * f_do_thing(); |
| 861 | * f_ctrs_bsc_expect("thing", 1); |
| 862 | */ |
| 863 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 864 | f_ctrs_bsc_add(countername, val); |
| 865 | f_ctrs_bsc_verify(); |
| 866 | } |
| 867 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 868 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 869 | friend function f_shutdown_helper() runs on test_CT { |
Neels Hofmeyr | 1899749 | 2021-12-13 17:30:35 +0100 | [diff] [blame] | 870 | /* 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] | 871 | if (BSCVTY.checkstate("Mapped") and mp_verify_talloc_count) { |
Neels Hofmeyr | 1899749 | 2021-12-13 17:30:35 +0100 | [diff] [blame] | 872 | f_verify_talloc_count(BSCVTY, {"struct bsc_subscr", "struct gsm_subscriber_connection"}); |
| 873 | } |
| 874 | |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 875 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 876 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 877 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 878 | } |
| 879 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 880 | 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] | 881 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 882 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 883 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 884 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 885 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 886 | T.start; |
| 887 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 888 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 889 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 890 | 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] | 891 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 892 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 893 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 894 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 895 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 896 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 897 | repeat; |
| 898 | } |
| 899 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 900 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 901 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 902 | /* If we received a RESET after ours was sent, it |
| 903 | may be a race condition where the other peer beacame |
| 904 | available after we sent it, but we are in a desired |
| 905 | state anyway, so go forward. */ |
| 906 | if (not reset_received) { |
| 907 | setverdict(fail); |
| 908 | } |
| 909 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 910 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 911 | } |
| 912 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 913 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 914 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 915 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 916 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 917 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 918 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 919 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 920 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 921 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 922 | } |
| 923 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 924 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 925 | * \param clnt IPA_Client for which to establish |
| 926 | * \param bsc_host IP address / hostname of the BSC |
| 927 | * \param bsc_port TCP port number of the BSC |
| 928 | * \param i number identifying this BTS |
| 929 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 930 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 931 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 932 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 933 | timer T := 10.0; |
| 934 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 935 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 936 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA") alive; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 937 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 938 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 939 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 940 | if (handler_mode) { |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 941 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL") alive; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 942 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 943 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 944 | |
| 945 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 946 | connect(clnt.vc_IPA:CFG_PORT, self:IPA_CFG_PORT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 947 | if (handler_mode) { |
| 948 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 949 | } else { |
| 950 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 951 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 952 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 953 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars)); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 954 | if (handler_mode) { |
| 955 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 956 | return; |
| 957 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 958 | |
| 959 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 960 | T.start; |
| 961 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 962 | [] IPA_RSL[i].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 963 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 964 | IPA_RSL[i].send(ts_ASP_RSL_UD(ts_RSL_PAGING_LOAD_IND(23))); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 965 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 966 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 967 | [] IPA_RSL[i].receive { repeat } |
| 968 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 969 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 970 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 971 | } |
| 972 | } |
| 973 | } |
| 974 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 975 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 976 | var IPL4asp_Types.Result res := { |
| 977 | errorCode := omit, |
| 978 | connId := omit, |
| 979 | os_error_code := omit, |
| 980 | os_error_text := omit |
| 981 | }; |
| 982 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 983 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 984 | return; |
| 985 | } |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 986 | |
| 987 | /* Alive components don't finish sockets (TCP FIN) when they are |
| 988 | * stopped. Hence, we need to manually call close() on them to make sure |
| 989 | * the IUT knows about it. */ |
| 990 | f_ipa_cfg_disconnect(IPA_CFG_PORT, res); |
| 991 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 992 | clnt.vc_IPA.stop; |
| 993 | if (isbound(clnt.vc_RSL)) { |
| 994 | clnt.vc_RSL.stop; |
| 995 | } |
| 996 | } |
| 997 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 998 | /* 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] | 999 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 1000 | timer T := secs_max; |
| 1001 | T.start; |
| 1002 | while (true) { |
| 1003 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 1004 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 1005 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 1006 | * until all MO's are initialized */ |
| 1007 | T.start(1.0); |
| 1008 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1009 | return; |
| 1010 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 1011 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1012 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 1013 | 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] | 1014 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1015 | } |
| 1016 | } |
| 1017 | } |
| 1018 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1019 | /* 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] | 1020 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1021 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 1022 | [] T_guard.timeout { |
| 1023 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1024 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 1025 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1026 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1027 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1028 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1029 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 1030 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 1031 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1032 | } |
| 1033 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1034 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1035 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1036 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1037 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 1038 | } |
| 1039 | } |
| 1040 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1041 | function f_init_mgcp(charstring id) runs on test_CT { |
| 1042 | id := id & "-MGCP"; |
| 1043 | |
| 1044 | var MGCPOps ops := { |
| 1045 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 1046 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 1047 | }; |
| 1048 | var MGCP_conn_parameters mgcp_pars := { |
| 1049 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 1050 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1051 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 1052 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 1053 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 1054 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1055 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1056 | }; |
| 1057 | |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 1058 | vc_MGCP := MGCP_Emulation_CT.create(id) alive; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1059 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 1060 | } |
| 1061 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1062 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 1063 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 1064 | * OsmuxCID IE. |
| 1065 | */ |
| 1066 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 1067 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 1068 | if (allow) { |
| 1069 | f_vty_transceive(BSCVTY, "osmux on"); |
| 1070 | } else { |
| 1071 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1072 | } |
| 1073 | f_vty_transceive(BSCVTY, "exit"); |
| 1074 | f_vty_transceive(BSCVTY, "exit"); |
| 1075 | g_osmux_enabled := allow; |
| 1076 | } |
| 1077 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1078 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1079 | if (BSCVTY.checkstate("Mapped")) { |
| 1080 | /* skip initialization if already executed once */ |
| 1081 | return; |
| 1082 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1083 | map(self:BSCVTY, system:BSCVTY); |
| 1084 | f_vty_set_prompts(BSCVTY); |
| 1085 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1086 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1087 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1088 | } |
| 1089 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1090 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1091 | { |
| 1092 | // log on TTCN3 log output |
| 1093 | log(log_msg); |
| 1094 | // log in stderr log |
Neels Hofmeyr | 8bdafe5 | 2021-12-14 17:25:48 +0100 | [diff] [blame] | 1095 | if (pt.checkstate("Mapped")) { |
| 1096 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
| 1097 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1098 | } |
| 1099 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1100 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1101 | { |
| 1102 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1103 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1104 | } |
| 1105 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1106 | } |
| 1107 | |
| 1108 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1109 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1110 | |
| 1111 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1112 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1113 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1114 | repeat; |
| 1115 | } |
| 1116 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1117 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1118 | repeat; |
| 1119 | } |
| 1120 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1121 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1122 | repeat; |
| 1123 | } |
| 1124 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1125 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1126 | repeat; |
| 1127 | } |
| 1128 | |
| 1129 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1130 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1131 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1132 | repeat; |
| 1133 | } |
| 1134 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1135 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1136 | repeat; |
| 1137 | } |
| 1138 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1139 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1140 | repeat; |
| 1141 | } |
| 1142 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1143 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1144 | repeat; |
| 1145 | } |
| 1146 | } |
| 1147 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1148 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1149 | private type record of boolean my_BooleanList; |
| 1150 | |
| 1151 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1152 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1153 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1154 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1155 | 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] | 1156 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1157 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1158 | * stepping into that config node. */ |
| 1159 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1160 | continue; |
| 1161 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1162 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1163 | if (allow_attach_list[msc_nr]) { |
| 1164 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1165 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1166 | } else { |
| 1167 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1168 | } |
| 1169 | f_vty_transceive(pt, "exit"); |
| 1170 | f_vty_transceive(pt, "exit"); |
| 1171 | } |
| 1172 | } |
| 1173 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1174 | /* global initialization function |
| 1175 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1176 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1177 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1178 | */ |
| 1179 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false, |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1180 | integer nr_msc := 1, float guard_timeout := 30.0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1181 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1182 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1183 | if (g_initialized) { |
| 1184 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1185 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1186 | g_initialized := true; |
| 1187 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1188 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1189 | activate(as_Tguard()); |
| 1190 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1191 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 1192 | f_vty_allow_osmux(allow_osmux); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1193 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1194 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1195 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1196 | |
Neels Hofmeyr | 9db8e0e | 2021-08-23 20:45:58 +0200 | [diff] [blame] | 1197 | /* Make sure each MSC's internal state is "DISCONNECTED" at first */ |
| 1198 | for (bssap_idx := 0; bssap_idx < NUM_MSC; bssap_idx := bssap_idx+1) { |
| 1199 | f_vty_transceive(BSCVTY, "msc " & int2str(bssap_idx) & " bssmap reset", strict := false); |
| 1200 | } |
| 1201 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1202 | 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] | 1203 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1204 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1205 | * MSC-side BSSAP emulation */ |
| 1206 | if (handler_mode) { |
| 1207 | var RanOps ranops := MSC_RanOps; |
| 1208 | ranops.use_osmux := g_osmux_enabled; |
| 1209 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1210 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1211 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1212 | } else { |
| 1213 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1214 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1215 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1216 | f_legacy_bssap_reset(); |
| 1217 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1218 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1219 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1220 | if (mp_enable_lcs_tests) { |
| 1221 | if (handler_mode) { |
| 1222 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1223 | } else { |
| 1224 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1225 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1226 | } |
| 1227 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1228 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1229 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1230 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1231 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1232 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1233 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1234 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1235 | f_init_mgcp("VirtMSC"); |
| 1236 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1237 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1238 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1239 | } |
Neels Hofmeyr | 9c0f9c8 | 2022-01-23 01:20:28 +0100 | [diff] [blame] | 1240 | |
| 1241 | /* Emit a marker to appear in the SUT's own logging output */ |
| 1242 | f_logp(BSCVTY, testcasename() & "() start"); |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1243 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1244 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1245 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1246 | runs on test_CT { |
| 1247 | /* wait until osmo-bts-omldummy has respawned */ |
| 1248 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1249 | |
| 1250 | /* start RSL connection */ |
| 1251 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1252 | /* wait until BSC tells us "connected" */ |
| 1253 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1254 | } |
| 1255 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1256 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1257 | template SystemInformationConfig expect_si) |
| 1258 | runs on test_CT { |
| 1259 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1260 | |
| 1261 | f_init_bts(bts_idx, handler_mode); |
| 1262 | |
| 1263 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1264 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1265 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1266 | */ |
| 1267 | f_sleep(5.0); |
| 1268 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1269 | |
| 1270 | deactivate(sysinfo); |
| 1271 | |
| 1272 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1273 | setverdict(pass); |
| 1274 | } else { |
| 1275 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1276 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1277 | setverdict(fail, "received SI does not match expectations"); |
| 1278 | return; |
| 1279 | } |
| 1280 | } |
| 1281 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1282 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1283 | function f_exp_ipa_rx(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1284 | runs on test_CT return RSL_Message { |
| 1285 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1286 | timer T := t_secs; |
| 1287 | |
| 1288 | T.start; |
| 1289 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1290 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1291 | T.stop; |
| 1292 | } |
| 1293 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1294 | [] T.timeout { |
| 1295 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1296 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1297 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1298 | } |
| 1299 | return rx_rsl_ud.rsl; |
| 1300 | } |
| 1301 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1302 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1303 | function f_ipa_tx(integer bts_nr, template (value) RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1304 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1305 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1306 | } |
| 1307 | |
| 1308 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1309 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1310 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1311 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1312 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1313 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1314 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1315 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1316 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1317 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1318 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1319 | } |
| 1320 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1321 | const CounterNameVals counternames_bts_chreq := { |
| 1322 | { "chreq:total", 0 }, |
| 1323 | { "chreq:attempted_emerg", 0 }, |
| 1324 | { "chreq:attempted_call", 0 }, |
| 1325 | { "chreq:attempted_location_upd", 0 }, |
| 1326 | { "chreq:attempted_pag", 0 }, |
| 1327 | { "chreq:attempted_pdch", 0 }, |
| 1328 | { "chreq:attempted_other", 0 }, |
| 1329 | { "chreq:attempted_unknown", 0 }, |
| 1330 | { "chreq:successful", 0 }, |
| 1331 | { "chreq:successful_emerg", 0 }, |
| 1332 | { "chreq:successful_call", 0 }, |
| 1333 | { "chreq:successful_location_upd", 0 }, |
| 1334 | { "chreq:successful_pag", 0 }, |
| 1335 | { "chreq:successful_pdch", 0 }, |
| 1336 | { "chreq:successful_other", 0 }, |
| 1337 | { "chreq:successful_unknown", 0 }, |
| 1338 | { "chreq:no_channel", 0 }, |
| 1339 | { "chreq:max_delay_exceeded", 0 } |
| 1340 | }; |
| 1341 | |
| 1342 | /* verify the "chreq:*" counters */ |
| 1343 | private function f_chan_act_counter(OCT1 ra, charstring chreq_ctr_suffix) runs on test_CT |
| 1344 | { |
| 1345 | var GsmFrameNumber fn := 23; |
| 1346 | |
| 1347 | f_logp(BSCVTY, "f_chan_act_counter(" & chreq_ctr_suffix & ")"); |
| 1348 | |
| 1349 | var RSL_Message rx_rsl; |
| 1350 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1351 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1352 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1353 | |
| 1354 | f_ctrs_bts_add(0, "chreq:total"); |
| 1355 | f_ctrs_bts_add(0, "chreq:attempted_" & chreq_ctr_suffix); |
| 1356 | f_ctrs_bts_verify(); |
| 1357 | |
| 1358 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 1359 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 1360 | |
| 1361 | f_ctrs_bts_add(0, "chreq:successful"); |
| 1362 | f_ctrs_bts_add(0, "chreq:successful_" & chreq_ctr_suffix); |
| 1363 | f_ctrs_bts_verify(); |
| 1364 | |
| 1365 | /* test is done, release RSL Conn Fail Ind to clean up */ |
| 1366 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1367 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1368 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 1369 | f_sleep(1.0); |
| 1370 | } |
| 1371 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1372 | testcase TC_chan_act_counter() runs on test_CT { |
| 1373 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1374 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1375 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1376 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1377 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1378 | |
Neels Hofmeyr | 734b1a3 | 2021-11-29 16:00:17 +0100 | [diff] [blame] | 1379 | f_vty_allow_emerg_bts(true, 0); |
| 1380 | |
| 1381 | f_ctrs_bts_init(1, counternames_bts_chreq); |
| 1382 | |
| 1383 | /* emergency call: RA & 0xe0 == 0xa0 --> CHREQ_T_EMERG_CALL */ |
| 1384 | f_chan_act_counter('a3'O, "emerg"); |
| 1385 | |
| 1386 | /* voice TCH/H: RA & 0xf0 == 0x40 --> CHREQ_T_VOICE_CALL_TCH_H */ |
| 1387 | f_chan_act_counter('43'O, "call"); |
| 1388 | |
| 1389 | /* LU: RA & 0xf0 == 0x00 --> CHREQ_T_LOCATION_UPD */ |
| 1390 | f_chan_act_counter('03'O, "location_upd"); |
| 1391 | |
| 1392 | /* Paging: RA & 0xf0 == 0x20 --> CHREQ_T_PAG_R_TCH_F */ |
| 1393 | f_chan_act_counter('23'O, "pag"); |
| 1394 | /* Paging: RA & 0xf0 == 0x30 --> CHREQ_T_PAG_R_TCH_FH */ |
| 1395 | f_chan_act_counter('33'O, "pag"); |
| 1396 | |
| 1397 | /* LU: RA & 0xfc == 0x78 --> CHREQ_T_PDCH_TWO_PHASE */ |
| 1398 | /* no PCU, so PDCH not allowed. Skip this test for now. */ |
| 1399 | /* f_chan_act_counter('7b'O, "pdch"); */ |
| 1400 | |
| 1401 | /* LU: RA & 0xf0 == 0x10 --> CHREQ_T_SDCCH */ |
| 1402 | f_chan_act_counter('13'O, "other"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1403 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1404 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1405 | } |
| 1406 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1407 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1408 | 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] | 1409 | var RSL_Message rx_rsl; |
| 1410 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1411 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1412 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1413 | |
| 1414 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1415 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1416 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1417 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1418 | } |
| 1419 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1420 | /* Normal variant */ |
| 1421 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1422 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1423 | f_TC_chan_act_ack_noest(); |
| 1424 | } |
| 1425 | |
| 1426 | /* Emergency call variant */ |
| 1427 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1428 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1429 | f_init(1); |
| 1430 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1431 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1432 | } |
| 1433 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1434 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1435 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1436 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1437 | |
| 1438 | var RSL_Message rx_rsl; |
| 1439 | var GsmRrMessage rr; |
| 1440 | |
| 1441 | f_init(1); |
| 1442 | f_vty_allow_emerg_bts(false, 0); |
| 1443 | |
| 1444 | IPA_RSL[0].clear; |
| 1445 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1446 | |
| 1447 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1448 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1449 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1450 | setverdict(pass); |
| 1451 | } else { |
| 1452 | setverdict(fail, "immediate assignment not rejected"); |
| 1453 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1454 | |
| 1455 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1456 | } |
| 1457 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1458 | /* Test behavior if MSC never answers to CR */ |
| 1459 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1460 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1461 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1462 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1463 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1464 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1465 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1466 | |
| 1467 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1468 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1469 | |
| 1470 | var octetstring l3 := '00010203040506'O |
| 1471 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1472 | |
| 1473 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1474 | |
| 1475 | /* 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] | 1476 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1477 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1478 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1479 | } |
| 1480 | |
| 1481 | /* Test behavior if MSC answers with CREF to CR */ |
| 1482 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1483 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1484 | var RSL_Message rx_rsl; |
| 1485 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1486 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1487 | |
| 1488 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1489 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1490 | |
| 1491 | var octetstring l3 := '00010203040506'O |
| 1492 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1493 | |
| 1494 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1495 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1496 | |
| 1497 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1498 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1499 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1500 | } |
| 1501 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1502 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1503 | testcase TC_chan_act_nack() runs on test_CT { |
| 1504 | var RSL_Message rx_rsl; |
| 1505 | var integer chact_nack; |
| 1506 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1507 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1508 | |
| 1509 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1510 | |
| 1511 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1512 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1513 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1514 | |
| 1515 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1516 | |
| 1517 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1518 | f_sleep(0.5); |
| 1519 | |
| 1520 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1521 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1522 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1523 | } |
| 1524 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1525 | /* Test for channel exhaustion due to RACH overload */ |
| 1526 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1527 | var ASP_RSL_Unitdata rsl_ud; |
| 1528 | var integer i; |
| 1529 | var integer chreq_total, chreq_nochan; |
| 1530 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1531 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1532 | |
| 1533 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1534 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1535 | |
Neels Hofmeyr | 85fa37f | 2021-10-06 13:50:38 +0200 | [diff] [blame] | 1536 | /* GSM 44.018 Table 9.1.8.2: |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1537 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1538 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1539 | 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] | 1540 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1541 | } |
| 1542 | |
| 1543 | IPA_RSL[0].clear; |
| 1544 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1545 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1546 | 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] | 1547 | |
| 1548 | /* now expect additional channel activations to fail */ |
| 1549 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1550 | |
| 1551 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1552 | [] IPA_RSL[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] | 1553 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1554 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1555 | [] IPA_RSL[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] | 1556 | var GsmRrMessage rr; |
| 1557 | /* match on IMM ASS REJ */ |
| 1558 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1559 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1560 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1561 | 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] | 1562 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1563 | chreq_nochan+1); |
| 1564 | setverdict(pass); |
| 1565 | } else { |
| 1566 | repeat; |
| 1567 | } |
| 1568 | } |
| 1569 | [] IPA_RSL[0].receive { repeat; } |
| 1570 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1571 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1572 | } |
| 1573 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1574 | /* Test channel deactivation due to silence from MS */ |
| 1575 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1576 | var RslChannelNr chan_nr; |
| 1577 | |
| 1578 | f_init(1); |
| 1579 | |
| 1580 | /* Request for a dedicated channel */ |
| 1581 | chan_nr := f_chreq_act_ack('23'O); |
| 1582 | |
| 1583 | /* Wait some time until the channel is released */ |
| 1584 | f_sleep(2.0); |
| 1585 | |
| 1586 | /* Expect CHANnel RELease */ |
| 1587 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1588 | [] IPA_RSL[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] | 1589 | log("Received CHANnel RELease"); |
| 1590 | setverdict(pass); |
| 1591 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1592 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1593 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1594 | * Assignment Reject since a dedicated channel was |
| 1595 | * already allocated, and Immediate Assignment was |
| 1596 | * already sent. */ |
| 1597 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1598 | } |
| 1599 | [] IPA_RSL[0].receive { |
| 1600 | setverdict(fail, "Unexpected RSL message!"); |
| 1601 | } |
| 1602 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1603 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1604 | } |
| 1605 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1606 | /*********************************************************************** |
| 1607 | * Assignment Testing |
| 1608 | ***********************************************************************/ |
| 1609 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1610 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1611 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1612 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1613 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1614 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1615 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1616 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1617 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1618 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1619 | } |
| 1620 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1621 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1622 | 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] | 1623 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1624 | var RSL_Message rx_rsl; |
| 1625 | var DchanTuple dt; |
| 1626 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1627 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1628 | |
| 1629 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1630 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1631 | /* send assignment without AoIP IEs */ |
| 1632 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1633 | } else { |
| 1634 | /* Send assignmetn without CIC in IPA case */ |
| 1635 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1636 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1637 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1638 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1639 | alt { |
| 1640 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1641 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1642 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1643 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1644 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1645 | setverdict(pass); |
| 1646 | } |
| 1647 | [] BSSAP.receive { repeat; } |
| 1648 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1649 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1650 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1651 | } |
| 1652 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1653 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1654 | function f_gen_ass_req(boolean osmux_enabled := false, 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] | 1655 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1656 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1657 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1658 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1659 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1660 | if (osmux_enabled) { |
| 1661 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1662 | } else { |
| 1663 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1664 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1665 | } else { |
| 1666 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1667 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1668 | } |
| 1669 | return ass_cmd; |
| 1670 | } |
| 1671 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1672 | 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] | 1673 | 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] | 1674 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1675 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1676 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1677 | |
| 1678 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1679 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
| 1680 | var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1681 | var template BSSMAP_IE_KC128 kc128 := omit; |
| 1682 | if (ispresent(enc)) { |
| 1683 | var TestHdlrEncrParams v_enc := valueof(enc); |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 1684 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg_permitted)); |
| 1685 | if (ispresent(v_enc.enc_alg_chosen)) { |
| 1686 | chosenEncryptionAlgorithm := valueof( |
| 1687 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
| 1688 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg_chosen)), 1))); |
| 1689 | } |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1690 | if (ispresent(v_enc.enc_kc128)) { |
| 1691 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1692 | } |
| 1693 | } |
| 1694 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1695 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1696 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1697 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 1698 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, |
| 1699 | cell_id_source := cell_id_source, |
| 1700 | oldToNewBSSIEs := oldToNewBSSIEs, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1701 | encryptionInformation := encryptionInformation, |
| 1702 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
Neels Hofmeyr | 9fe1320 | 2022-03-04 00:05:43 +0100 | [diff] [blame] | 1703 | kC128 := kc128, |
| 1704 | /* on AoIP, allow "all" codecs (until we add more concise |
| 1705 | * tests) */ |
| 1706 | codecList := ts_BSSMAP_IE_CodecList( |
| 1707 | {ts_CodecAMR_F, ts_CodecAMR_H, |
| 1708 | ts_CodecEFR, ts_CodecFR, ts_CodecHR}))); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1709 | } else { |
| 1710 | 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] | 1711 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, |
| 1712 | cell_id_source := cell_id_source, |
| 1713 | oldToNewBSSIEs := oldToNewBSSIEs, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1714 | encryptionInformation := encryptionInformation, |
| 1715 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1716 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1717 | } |
| 1718 | return ho_req; |
| 1719 | } |
| 1720 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1721 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1722 | function f_gen_exp_compl(boolean expect_osmux := false, integer bssap_idx := 0) return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1723 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1724 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1725 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1726 | if (expect_osmux) { |
| 1727 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1728 | } else { |
| 1729 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1730 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1731 | } else { |
| 1732 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1733 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1734 | } |
| 1735 | return exp_compl; |
| 1736 | } |
| 1737 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1738 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1739 | 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] | 1740 | runs on test_CT return DchanTuple { |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1741 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1742 | var RSL_Message rx_rsl; |
| 1743 | var DchanTuple dt; |
| 1744 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1745 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1746 | |
| 1747 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1748 | /* send assignment without AoIP IEs */ |
| 1749 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1750 | alt { |
| 1751 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1752 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1753 | setverdict(pass); |
| 1754 | } else { |
| 1755 | setverdict(fail, fail_text); |
| 1756 | } |
| 1757 | } |
| 1758 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1759 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1760 | setverdict(pass); |
| 1761 | } else { |
| 1762 | setverdict(fail, fail_text); |
| 1763 | } |
| 1764 | } |
| 1765 | [] BSSAP.receive { repeat; } |
| 1766 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 1767 | return dt; |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1768 | } |
| 1769 | testcase TC_assignment_csd() runs on test_CT { |
| 1770 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1771 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1772 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1773 | //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] | 1774 | var DchanTuple dt := f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 1775 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1776 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1777 | } |
| 1778 | |
| 1779 | testcase TC_assignment_ctm() runs on test_CT { |
| 1780 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1781 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1782 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1783 | //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] | 1784 | var DchanTuple dt := f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 1785 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1786 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1787 | } |
| 1788 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1789 | type record DchanTuple { |
| 1790 | integer sccp_conn_id, |
| 1791 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1792 | } |
| 1793 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 1794 | type record of DchanTuple DchanTuples; |
| 1795 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1796 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1797 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1798 | runs on test_CT return RslChannelNr { |
| 1799 | var RSL_Message rx_rsl; |
| 1800 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1801 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1802 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1803 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Daniel Willmann | f4ac4ce | 2018-08-02 14:06:30 +0200 | [diff] [blame] | 1804 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1805 | return chan_nr; |
| 1806 | } |
| 1807 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1808 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1809 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1810 | runs on test_CT return DchanTuple { |
| 1811 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1812 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1813 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1814 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1815 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1816 | |
| 1817 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1818 | |
| 1819 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1820 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1821 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1822 | |
| 1823 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1824 | } |
| 1825 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 1826 | /* Like f_est_dchan(), but for the first lchan of a dynamic timeslot: first ACK the deactivation of PDCH. */ |
| 1827 | function f_est_dchan_dyn(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1828 | runs on test_CT return DchanTuple { |
| 1829 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1830 | var DchanTuple dt; |
| 1831 | |
| 1832 | /* Send CHAN RQD */ |
| 1833 | var RSL_Message rx_rsl; |
| 1834 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1835 | |
| 1836 | /* The dyn TS first deactivates PDCH */ |
| 1837 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1838 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1839 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1840 | |
| 1841 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1842 | dt.rsl_chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1843 | |
| 1844 | /* Now activates the signalling channel */ |
| 1845 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, fn+10)); |
| 1846 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 1847 | |
| 1848 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1849 | |
| 1850 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1851 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1852 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1853 | |
| 1854 | return dt; |
| 1855 | } |
| 1856 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1857 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1858 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1859 | var RSL_Message rx_rsl; |
| 1860 | /* expect BSC to disable the channel */ |
| 1861 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1862 | /* respond with CHAN REL ACK */ |
| 1863 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1864 | |
| 1865 | /* expect Clear Complete from BSC */ |
| 1866 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1867 | |
| 1868 | /* MSC disconnects as instructed. */ |
| 1869 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1870 | } |
| 1871 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1872 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1873 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1874 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1875 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1876 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1877 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1878 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1879 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1880 | |
| 1881 | /* simulate RLL REL IND */ |
| 1882 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1883 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1884 | /* expect Clear Request on MSC side */ |
| 1885 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1886 | |
| 1887 | /* Instruct BSC to clear channel */ |
| 1888 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1889 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1890 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1891 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1892 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1893 | |
| 1894 | /* wait for SCCP emulation to do its job */ |
| 1895 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1896 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1897 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1898 | } |
| 1899 | |
| 1900 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1901 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1902 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1903 | var DchanTuple dt; |
| 1904 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1905 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1906 | |
| 1907 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1908 | |
| 1909 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1910 | f_ipa_tx(0, 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] | 1911 | /* TODO: different cause values? */ |
| 1912 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1913 | /* expect Clear Request from BSC */ |
| 1914 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1915 | |
| 1916 | /* Instruct BSC to clear channel */ |
| 1917 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1918 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1919 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1920 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1921 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1922 | |
| 1923 | /* wait for SCCP emulation to do its job */ |
| 1924 | f_sleep(1.0); |
| 1925 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1926 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1927 | } |
| 1928 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1929 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1930 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1931 | testcase TC_early_conn_fail() runs on test_CT { |
| 1932 | var RSL_Message rx_rsl; |
| 1933 | var DchanTuple dt; |
| 1934 | |
| 1935 | f_init(1); |
| 1936 | |
| 1937 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1938 | 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] | 1939 | |
| 1940 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1941 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1942 | |
| 1943 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1944 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1945 | |
| 1946 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1947 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1948 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1949 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1950 | } |
| 1951 | |
| 1952 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1953 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1954 | testcase TC_late_conn_fail() runs on test_CT { |
| 1955 | var RSL_Message rx_rsl; |
| 1956 | var DchanTuple dt; |
| 1957 | |
| 1958 | f_init(1); |
| 1959 | |
| 1960 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1961 | |
| 1962 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1963 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1964 | |
| 1965 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1966 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1967 | |
| 1968 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1969 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1970 | |
| 1971 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1972 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1973 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1974 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1975 | |
| 1976 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1977 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1978 | |
| 1979 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1980 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1981 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1982 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1983 | } |
| 1984 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1985 | private function f_TC_stats_conn_fail(charstring id) runs on MSC_ConnHdlr { |
| 1986 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 1987 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1988 | |
| 1989 | f_statsd_reset(); |
| 1990 | |
| 1991 | /* Establish SDCCH */ |
| 1992 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1993 | f_establish_fully(ass_cmd, exp_fail); |
| 1994 | |
| 1995 | /* Expect stats to be 0 */ |
| 1996 | var StatsDExpects expect := { |
| 1997 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 0, max := 0}, |
| 1998 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 0, max := 0} |
| 1999 | }; |
| 2000 | f_statsd_expect(expect); |
| 2001 | |
| 2002 | /* Simulate CONN FAIL IND on SDCCH */ |
| 2003 | RSL.send(ts_ASP_RSL_UD( |
| 2004 | ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL), |
| 2005 | IPAC_PROTO_RSL_TRX0)); |
| 2006 | |
Neels Hofmeyr | 58be48a | 2021-09-07 18:39:21 +0200 | [diff] [blame] | 2007 | f_sleep(1.0); |
| 2008 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2009 | /* Expect stats to be 1 */ |
| 2010 | expect := { |
| 2011 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 1, max := 1}, |
| 2012 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 1, max := 1} |
| 2013 | }; |
| 2014 | f_statsd_expect(expect); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 2015 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 2016 | f_perform_clear(); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 2017 | } |
| 2018 | testcase TC_stats_conn_fail() runs on test_CT { |
| 2019 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2020 | var MSC_ConnHdlr vc_conn; |
| 2021 | |
| 2022 | f_init(1, true); |
| 2023 | f_sleep(1.0); |
| 2024 | |
| 2025 | vc_conn := f_start_handler(refers(f_TC_stats_conn_fail), pars); |
| 2026 | vc_conn.done; |
| 2027 | |
| 2028 | f_shutdown_helper(); |
| 2029 | } |
| 2030 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 2031 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2032 | boolean expect_deact_sacch := true, |
| 2033 | boolean expect_rr_chan_rel := true, |
| 2034 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2035 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2036 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2037 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2038 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2039 | |
| 2040 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2041 | var boolean got_deact_sacch := false; |
| 2042 | var boolean got_rr_chan_rel := false; |
| 2043 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2044 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2045 | var RSL_IE_Body l3_ie; |
| 2046 | var PDU_ML3_NW_MS l3; |
| 2047 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2048 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 2049 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2050 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2051 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2052 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2053 | repeat; |
| 2054 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2055 | [not istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CellSelectInd))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2056 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2057 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2058 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 2059 | setverdict(fail, "cannot find L3"); |
| 2060 | mtc.stop; |
| 2061 | } |
| 2062 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 2063 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2064 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2065 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 2066 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 2067 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2068 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 2069 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2070 | setverdict(pass); |
| 2071 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 2072 | log("EXPECTED CELLS: ", expect_cells); |
| 2073 | 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] | 2074 | } |
| 2075 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2076 | |
| 2077 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 2078 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 2079 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 2080 | if (match(got_cause, expect_rr_cause)) { |
| 2081 | setverdict(pass); |
| 2082 | } else { |
| 2083 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 2084 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 2085 | } |
| 2086 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2087 | repeat; |
| 2088 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2089 | [istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2090 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2091 | |
| 2092 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 2093 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 2094 | setverdict(fail, "cannot find L3"); |
| 2095 | mtc.stop; |
| 2096 | } |
| 2097 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 2098 | |
| 2099 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 2100 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 2101 | if (match(got_cause, expect_rr_cause)) { |
| 2102 | setverdict(pass); |
| 2103 | } else { |
| 2104 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 2105 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 2106 | } |
| 2107 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 2108 | repeat; |
| 2109 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2110 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2111 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2112 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2113 | if (handle_rll_rel) { |
| 2114 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 2115 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2116 | repeat; |
| 2117 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2118 | [] IPA_RSL[bts_nr].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] | 2119 | /* respond with CHAN REL ACK */ |
| 2120 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 2121 | } |
| 2122 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2123 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2124 | repeat; |
| 2125 | } |
| 2126 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2127 | |
| 2128 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 2129 | " got_rll_rel_req=", got_rll_rel_req); |
| 2130 | |
| 2131 | if (expect_deact_sacch != got_deact_sacch) { |
| 2132 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 2133 | } |
| 2134 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 2135 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 2136 | } |
| 2137 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 2138 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 2139 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 2140 | } |
| 2141 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2142 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 2143 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 2144 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2145 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2146 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2147 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2148 | |
| 2149 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2150 | |
| 2151 | /* Instruct BSC to clear channel */ |
| 2152 | var BssmapCause cause := 0; |
| 2153 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2154 | |
| 2155 | /* expect Clear Complete from BSC on A */ |
| 2156 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2157 | /* release the SCCP connection */ |
| 2158 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2159 | } |
| 2160 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2161 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2162 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2163 | } |
| 2164 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2165 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 2166 | var BSSAP_N_DATA_ind rx_di; |
| 2167 | var DchanTuple dt; |
| 2168 | |
| 2169 | f_init(1); |
| 2170 | |
| 2171 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2172 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2173 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2174 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 2175 | |
| 2176 | /* Instruct BSC to clear channel */ |
| 2177 | var BssmapCause cause := 0; |
| 2178 | if (tx_csfb_ind) { |
| 2179 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2180 | } else { |
| 2181 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2182 | } |
| 2183 | |
| 2184 | /* expect Clear Complete from BSC on A */ |
| 2185 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2186 | /* release the SCCP connection */ |
| 2187 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2188 | } |
| 2189 | |
| 2190 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 2191 | SystemInformationConfig_default, use that: */ |
| 2192 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 2193 | |
| 2194 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 2195 | f_shutdown_helper(); |
| 2196 | } |
| 2197 | |
| 2198 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 2199 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 2200 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2201 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 2202 | Indicator or not shouldn't matter at all. */ |
| 2203 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 2204 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 2205 | } |
| 2206 | |
| 2207 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 2208 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2209 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2210 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 2211 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 2212 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 2213 | } |
| 2214 | |
| 2215 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 2216 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2217 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 2218 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 2219 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 2220 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2221 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 2222 | var BSSAP_N_DATA_ind rx_di; |
| 2223 | var DchanTuple dt; |
| 2224 | |
| 2225 | f_init(1); |
| 2226 | |
| 2227 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2228 | |
| 2229 | /* Instruct BSC to clear channel */ |
| 2230 | var BssmapCause cause := 0; |
| 2231 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2232 | |
| 2233 | /* expect Clear Complete from BSC on A */ |
| 2234 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2235 | /* release the SCCP connection */ |
| 2236 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2237 | } |
| 2238 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2239 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2240 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2241 | } |
| 2242 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2243 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 2244 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2245 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2246 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2247 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2248 | |
| 2249 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2250 | |
| 2251 | /* release the SCCP connection */ |
| 2252 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2253 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2254 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2255 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2256 | } |
| 2257 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2258 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2259 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2260 | var DchanTuple dt; |
| 2261 | |
| 2262 | f_init(1); |
| 2263 | |
| 2264 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2265 | |
| 2266 | /* release the SCCP connection */ |
| 2267 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2268 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2269 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2270 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2271 | } |
| 2272 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2273 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2274 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2275 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2276 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2277 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2278 | |
| 2279 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2280 | |
| 2281 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2282 | IPA_RSL[0].clear; |
| 2283 | |
| 2284 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2285 | 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))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2286 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2287 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2288 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2289 | } |
| 2290 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2291 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2292 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2293 | } |
| 2294 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2295 | /* Verify T(iar) triggers and releases the channel */ |
| 2296 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2297 | var DchanTuple dt; |
| 2298 | |
| 2299 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2300 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2301 | T(iar) >= T(ias)*2 */ |
| 2302 | g_bsc_sccp_timer_ias := 2; |
| 2303 | g_bsc_sccp_timer_iar := 5; |
| 2304 | |
| 2305 | f_init(1); |
| 2306 | |
| 2307 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2308 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2309 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2310 | } |
| 2311 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2312 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2313 | runs on test_CT |
| 2314 | { |
| 2315 | var DchanTuple dt; |
| 2316 | |
| 2317 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2318 | var BssmapCause cause := 0; |
| 2319 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2320 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2321 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2322 | } |
| 2323 | |
| 2324 | f_expect_chan_rel(0, 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] | 2325 | } |
| 2326 | |
| 2327 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2328 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2329 | f_init(1); |
| 2330 | |
| 2331 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2332 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2333 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2334 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2335 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2336 | 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] | 2337 | |
| 2338 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2339 | } |
| 2340 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2341 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2342 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2343 | timer T := 2.0; |
| 2344 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2345 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2346 | |
| 2347 | var octetstring l3 := '00010203040506'O; |
| 2348 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2349 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2350 | |
| 2351 | T.start; |
| 2352 | alt { |
| 2353 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2354 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2355 | } |
| 2356 | [] BSSAP.receive {} |
| 2357 | [] IPA_RSL[0].receive {} |
| 2358 | [] T.timeout {} |
| 2359 | } |
| 2360 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2361 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2362 | } |
| 2363 | |
| 2364 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2365 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2366 | var RslChannelNr chan_nr; |
| 2367 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2368 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2369 | |
| 2370 | chan_nr := f_chreq_act_ack() |
| 2371 | |
| 2372 | var octetstring l3 := '00010203040506'O; |
| 2373 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2374 | |
| 2375 | timer T := 2.0; |
| 2376 | T.start; |
| 2377 | alt { |
| 2378 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2379 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2380 | } |
| 2381 | [] BSSAP.receive { repeat; } |
| 2382 | [] IPA_RSL[0].receive { repeat; } |
| 2383 | [] T.timeout {} |
| 2384 | } |
| 2385 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2386 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2387 | } |
| 2388 | |
| 2389 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2390 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2391 | timer T := 2.0; |
| 2392 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2393 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2394 | |
| 2395 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2396 | |
| 2397 | var octetstring l3 := '00010203040506'O; |
| 2398 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2399 | |
| 2400 | T.start; |
| 2401 | alt { |
| 2402 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2403 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2404 | } |
| 2405 | [] BSSAP.receive { repeat; } |
| 2406 | [] IPA_RSL[0].receive { repeat; } |
| 2407 | [] T.timeout {} |
| 2408 | } |
| 2409 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2410 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2414 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2415 | timer T := 2.0; |
| 2416 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2417 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2418 | |
| 2419 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2420 | |
| 2421 | var octetstring l3 := '00010203040506'O; |
| 2422 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2423 | |
| 2424 | T.start; |
| 2425 | alt { |
| 2426 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2427 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2428 | } |
| 2429 | [] BSSAP.receive { repeat; } |
| 2430 | [] IPA_RSL[0].receive { repeat; } |
| 2431 | [] T.timeout {} |
| 2432 | } |
| 2433 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2434 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2435 | } |
| 2436 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2437 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2438 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2439 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2440 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2441 | |
| 2442 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2443 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2444 | |
| 2445 | f_establish_fully(ass_cmd, exp_compl); |
| 2446 | |
| 2447 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2448 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2449 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2450 | BSSAP.receive(PDU_BSSAP:{ |
| 2451 | discriminator := '1'B, |
| 2452 | spare := '0000000'B, |
| 2453 | dlci := 'C3'O, |
| 2454 | lengthIndicator := ?, |
| 2455 | pdu := { dtap := '0904'O } |
| 2456 | }); |
| 2457 | |
| 2458 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2459 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2460 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2461 | var template (value) RslLinkId link_id; |
| 2462 | var template (value) OCT1 dlci; |
| 2463 | |
| 2464 | if (i mod 2 == 0) { |
| 2465 | /* SAPI0 on FACCH or SDCCH */ |
| 2466 | link_id := ts_RslLinkID_DCCH(0); |
| 2467 | dlci := '80'O; |
| 2468 | } else { |
| 2469 | /* SAPI3 on SACCH */ |
| 2470 | link_id := ts_RslLinkID_SACCH(3); |
| 2471 | dlci := 'C3'O; |
| 2472 | } |
| 2473 | |
| 2474 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2475 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2476 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2477 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2478 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 2479 | f_perform_clear(); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2480 | } |
| 2481 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2482 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2483 | var MSC_ConnHdlr vc_conn; |
| 2484 | |
| 2485 | f_init(1, true); |
| 2486 | f_sleep(1.0); |
| 2487 | |
| 2488 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2489 | vc_conn.done; |
| 2490 | |
| 2491 | f_shutdown_helper(); |
| 2492 | } |
| 2493 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2494 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2495 | template myBSSMAP_Cause cause := ?, |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2496 | template (present) BIT2 cc := ?, |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2497 | float T_val := 2.0) |
| 2498 | runs on test_CT { |
| 2499 | var BSSAP_N_DATA_ind rx_di; |
| 2500 | timer T; |
| 2501 | |
| 2502 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2503 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2504 | |
| 2505 | T.start(T_val); |
| 2506 | alt { |
| 2507 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2508 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2509 | if (not match(rx_cause, tr_cause)) { |
| 2510 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2511 | rx_cause, " vs expected ", tr_cause); |
| 2512 | } |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2513 | |
| 2514 | /* Who ever on the earth decided to define this field as two separate bits?!? */ |
| 2515 | var BIT2 rx_cc := rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c2 |
| 2516 | & rx_di.userData.pdu.bssmap.sAPInReject.dLCI.c1; |
| 2517 | if (not match(rx_cc, cc)) { |
| 2518 | setverdict(fail, "Rx unexpected Control Channel type: ", |
| 2519 | rx_cc, " vs expected ", cc); |
| 2520 | } |
| 2521 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2522 | setverdict(pass); |
| 2523 | } |
| 2524 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2525 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2526 | } |
| 2527 | [] T.timeout { |
| 2528 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2529 | } |
| 2530 | } |
| 2531 | } |
| 2532 | |
| 2533 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2534 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2535 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2536 | var RSL_Message rx_rsl; |
| 2537 | var DchanTuple dt; |
| 2538 | |
| 2539 | f_init(1); |
| 2540 | |
| 2541 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2542 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2543 | |
| 2544 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2545 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2546 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2547 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2548 | |
| 2549 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2550 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2551 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2552 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2553 | |
| 2554 | /* Clean up the connection */ |
| 2555 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2556 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2557 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2558 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2559 | } |
| 2560 | |
| 2561 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2562 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2563 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2564 | var RSL_Message rx_rsl; |
| 2565 | var DchanTuple dt; |
| 2566 | |
| 2567 | f_init(1); |
| 2568 | |
| 2569 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2570 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2571 | |
| 2572 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2573 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2574 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2575 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2576 | |
| 2577 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2578 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2579 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2580 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2581 | |
| 2582 | /* Clean up the connection */ |
| 2583 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2584 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2585 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2586 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2587 | } |
| 2588 | |
| 2589 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2590 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2591 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2592 | var RSL_Message rx_rsl; |
| 2593 | var DchanTuple dt; |
| 2594 | |
| 2595 | f_init(1); |
| 2596 | |
| 2597 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2598 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2599 | |
| 2600 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2601 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2602 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2603 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2604 | |
| 2605 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2606 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2607 | |
| 2608 | /* Clean up the connection */ |
| 2609 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2610 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2611 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2612 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2613 | } |
| 2614 | |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 2615 | /* Check DLCI CC (Control Channel type) bits in SAPI N Reject */ |
| 2616 | testcase TC_rll_sapi_n_reject_dlci_cc() runs on test_CT { |
| 2617 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2618 | var RSL_Message rx_rsl; |
| 2619 | var DchanTuple dt; |
| 2620 | |
| 2621 | f_init(1); |
| 2622 | |
| 2623 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2624 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2625 | |
| 2626 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2627 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2628 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2629 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2630 | |
| 2631 | /* MS sends unexpected ERROR INDication on DCCH/ACCH SAPI=3 */ |
| 2632 | f_ipa_tx(0, 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] | 2633 | 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] | 2634 | |
| 2635 | /* Clean up the connection */ |
| 2636 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2637 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2638 | |
| 2639 | f_shutdown_helper(); |
| 2640 | } |
| 2641 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2642 | testcase TC_si_default() runs on test_CT { |
| 2643 | f_init(0); |
| 2644 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2645 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2646 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2647 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2648 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2649 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2650 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2651 | { |
| 2652 | select (earfcn_index) { |
| 2653 | case (0) { |
| 2654 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2655 | return 111; |
| 2656 | } |
| 2657 | case (1) { |
| 2658 | return 1; |
| 2659 | } |
| 2660 | case (2) { |
| 2661 | return 0; |
| 2662 | } |
| 2663 | case (3) { |
| 2664 | return 65535; |
| 2665 | } |
| 2666 | case else { |
| 2667 | return 23 * (earfcn_index - 3); |
| 2668 | } |
| 2669 | } |
| 2670 | } |
| 2671 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2672 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2673 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2674 | |
| 2675 | f_init(0); |
| 2676 | |
| 2677 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2678 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2679 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2680 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2681 | } |
| 2682 | |
| 2683 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2684 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2685 | if (not istemplatekind(expect_cells, "omit")) { |
| 2686 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2687 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2688 | var BSSAP_N_DATA_ind rx_di; |
| 2689 | var DchanTuple dt; |
| 2690 | |
| 2691 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2692 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2693 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2694 | 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] | 2695 | |
| 2696 | /* Instruct BSC to clear channel */ |
| 2697 | var BssmapCause cause := 0; |
| 2698 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2699 | |
| 2700 | /* expect Clear Complete from BSC on A */ |
| 2701 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2702 | /* release the SCCP connection */ |
| 2703 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2704 | } |
| 2705 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2706 | f_expect_chan_rel(0, 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] | 2707 | } |
| 2708 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2709 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2710 | 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] | 2711 | } |
| 2712 | } |
| 2713 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2714 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2715 | { |
| 2716 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2717 | var integer si2quater_count := (count + 2) / 3; |
| 2718 | |
| 2719 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2720 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2721 | var integer index := i / 3; |
| 2722 | var integer earfcn_index := i mod 3; |
| 2723 | if (index >= lengthof(si2quater)) { |
| 2724 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2725 | } |
| 2726 | 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); |
| 2727 | } |
| 2728 | |
| 2729 | return si2quater; |
| 2730 | } |
| 2731 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2732 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2733 | { |
| 2734 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2735 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2736 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2737 | for (var integer i := 0; i < count; i := i + 1) { |
| 2738 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2739 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2740 | } |
| 2741 | |
| 2742 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2743 | } |
| 2744 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2745 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2746 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2747 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2748 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2749 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2750 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2751 | } |
| 2752 | |
| 2753 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2754 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2755 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2756 | } |
| 2757 | |
| 2758 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2759 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2760 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2761 | } |
| 2762 | |
| 2763 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2764 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2765 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2766 | } |
| 2767 | |
| 2768 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2769 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2770 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2771 | } |
| 2772 | |
| 2773 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2774 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2775 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2776 | } |
| 2777 | |
| 2778 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2779 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2780 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2781 | } |
| 2782 | |
| 2783 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2784 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2785 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2786 | } |
| 2787 | |
| 2788 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2789 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2790 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2791 | } |
| 2792 | |
| 2793 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2794 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2795 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2796 | } |
| 2797 | |
| 2798 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2799 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2800 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2804 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2805 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2806 | } |
| 2807 | |
| 2808 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2809 | * 48 EARFCNs. */ |
| 2810 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2811 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2812 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2813 | f_init(0); |
| 2814 | |
| 2815 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2816 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2817 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2818 | } |
| 2819 | |
| 2820 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2821 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2822 | var charstring vty_error; |
| 2823 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2824 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2825 | f_vty_transceive(BSCVTY, "end"); |
| 2826 | |
| 2827 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2828 | log("Got expected VTY error: ", vty_error); |
| 2829 | setverdict(pass); |
| 2830 | } else { |
| 2831 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2832 | } |
| 2833 | |
| 2834 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2835 | |
| 2836 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2837 | 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] | 2838 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2839 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2840 | } |
| 2841 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2842 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2843 | { |
| 2844 | var uint8_t count := 0; |
| 2845 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2846 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2847 | count := count + 1; |
| 2848 | } |
| 2849 | } |
| 2850 | return count; |
| 2851 | } |
| 2852 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2853 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2854 | { |
| 2855 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2856 | var SystemInformationType1 last_si1; |
| 2857 | |
| 2858 | timer T := 30.0; |
| 2859 | T.start; |
| 2860 | alt { |
| 2861 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2862 | tr_RSL_BCCH_INFO, |
| 2863 | tr_RSL_NO_SACCH_FILL, |
| 2864 | tr_RSL_SACCH_FILL)) |
| 2865 | ) -> value rx_rsl_ud { |
| 2866 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2867 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2868 | repeat; |
| 2869 | } |
| 2870 | last_si1 := g_system_information[rsl_idx].si1; |
| 2871 | g_system_information[rsl_idx].si1 := omit; |
| 2872 | T.stop; |
| 2873 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2874 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2875 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2876 | } |
| 2877 | return last_si1; |
| 2878 | } |
| 2879 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2880 | /* verify ACC rotate feature */ |
| 2881 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2882 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2883 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2884 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2885 | var uint8_t count; |
| 2886 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2887 | |
| 2888 | f_init(0, guard_timeout := 60.0); |
| 2889 | |
| 2890 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2891 | "access-control-class-rotate 3", |
| 2892 | "access-control-class-rotate-quantum 1"}); |
| 2893 | |
| 2894 | /* Init and get first sysinfo */ |
| 2895 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2896 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2897 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2898 | last_si1 := f_recv_next_si1(0); |
| 2899 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2900 | count := f_acc09_count_allowed(acc); |
| 2901 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2902 | |
| 2903 | if (count != 3) { |
| 2904 | log("RSL: EXPECTED SI ACC len=3"); |
| 2905 | setverdict(fail, "received SI does not match expectations"); |
| 2906 | break; |
| 2907 | } |
| 2908 | |
| 2909 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2910 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2911 | times_allowed[j] := times_allowed[j] + 1; |
| 2912 | } |
| 2913 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2914 | } |
| 2915 | |
| 2916 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2917 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2918 | if (j != 5 and times_allowed[j] < 3) { |
| 2919 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2920 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2921 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2922 | } |
| 2923 | } |
| 2924 | |
| 2925 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2926 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2927 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2928 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2929 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2930 | /* verify ACC startup ramp+rotate feature */ |
| 2931 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2932 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2933 | var SystemInformationType1 last_si1; |
| 2934 | var AccessControlClass acc; |
| 2935 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2936 | var uint8_t count; |
| 2937 | var uint8_t prev_count; |
| 2938 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2939 | |
| 2940 | f_init(0, guard_timeout := 80.0); |
| 2941 | |
| 2942 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2943 | "access-control-class-rotate 0", |
| 2944 | "access-control-class-rotate-quantum 1", |
| 2945 | "access-control-class-ramping", |
| 2946 | "access-control-class-ramping-step-interval 5", |
| 2947 | "access-control-class-ramping-step-size 5"}); |
| 2948 | |
| 2949 | /* Init and get first sysinfo */ |
| 2950 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2951 | last_si1 := g_system_information[0].si1; |
| 2952 | acc := last_si1.rach_control.acc; |
| 2953 | count := f_acc09_count_allowed(acc); |
| 2954 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2955 | while (count > 0) { |
| 2956 | last_si1 := f_recv_next_si1(0); |
| 2957 | acc := last_si1.rach_control.acc; |
| 2958 | count := f_acc09_count_allowed(acc); |
| 2959 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2960 | } |
| 2961 | |
| 2962 | /* Increase adm subset size, we should see ramping start up */ |
| 2963 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2964 | prev_count := 0; |
| 2965 | while (true) { |
| 2966 | last_si1 := f_recv_next_si1(0); |
| 2967 | acc := last_si1.rach_control.acc; |
| 2968 | count := f_acc09_count_allowed(acc); |
| 2969 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2970 | |
| 2971 | if (prev_count > count) { |
| 2972 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2973 | break; |
| 2974 | } |
| 2975 | |
| 2976 | if (count == 9) { |
| 2977 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2978 | } |
| 2979 | |
| 2980 | prev_count := count; |
| 2981 | } |
| 2982 | |
| 2983 | setverdict(pass); |
| 2984 | |
| 2985 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2986 | "rach access-control-class 4 allowed", |
| 2987 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2988 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2989 | } |
| 2990 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2991 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2992 | var charstring ctrl_resp; |
| 2993 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2994 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2995 | |
| 2996 | /* See https://osmocom.org/issues/2729 */ |
| 2997 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2998 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2999 | } |
| 3000 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3001 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 3002 | var charstring ctrl_resp; |
| 3003 | |
| 3004 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3005 | |
| 3006 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3007 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 3008 | } |
| 3009 | |
Neels Hofmeyr | 0bc470d | 2021-08-21 13:37:13 +0200 | [diff] [blame] | 3010 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 3011 | private function f_tc_stat_num_msc_connected_msc_connhdlr(integer expect_num_msc_connected) runs on MSC_ConnHdlr { |
| 3012 | g_pars := f_gen_test_hdlr_pars(); |
| 3013 | var StatsDExpects expect := { |
| 3014 | { name := "TTCN3.bsc.0.num_msc.connected", mtype := "g", min := expect_num_msc_connected, max := expect_num_msc_connected }, |
| 3015 | { name := "TTCN3.bsc.0.num_msc.total", mtype := "g", min := NUM_MSC, max := NUM_MSC } |
| 3016 | }; |
| 3017 | f_statsd_expect(expect); |
| 3018 | } |
| 3019 | |
| 3020 | private function f_tc_stat_num_msc_connected_test_ct(void_fn tc_fn, integer nr_msc) runs on test_CT |
| 3021 | { |
| 3022 | var MSC_ConnHdlr vc_conn; |
| 3023 | |
| 3024 | f_init(nr_bts := 1, handler_mode := true, nr_msc := nr_msc); |
| 3025 | f_sleep(1.0); |
| 3026 | vc_conn := f_start_handler(tc_fn); |
| 3027 | vc_conn.done; |
| 3028 | |
| 3029 | /* Also verify stat exposed on CTRL interface */ |
| 3030 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:connected", int2str(nr_msc)); |
| 3031 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:total", int2str(NUM_MSC)); |
| 3032 | |
| 3033 | f_shutdown_helper(); |
| 3034 | } |
| 3035 | |
| 3036 | /* Verify that when 1 MSC is active, that num_msc:connected reports 1. */ |
| 3037 | private function f_tc_stat_num_msc_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 3038 | f_tc_stat_num_msc_connected_msc_connhdlr(1); |
| 3039 | } |
| 3040 | testcase TC_stat_num_msc_connected_1() runs on test_CT { |
| 3041 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_1), 1); |
| 3042 | } |
| 3043 | |
| 3044 | /* Verify that when 2 MSCs are active, that num_msc:connected reports 2. */ |
| 3045 | private function f_tc_stat_num_msc_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 3046 | f_tc_stat_num_msc_connected_msc_connhdlr(2); |
| 3047 | } |
| 3048 | testcase TC_stat_num_msc_connected_2() runs on test_CT { |
| 3049 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_2), 2); |
| 3050 | } |
| 3051 | |
| 3052 | /* Verify that when 3 MSCs are active, that num_msc:connected reports 3. */ |
| 3053 | private function f_tc_stat_num_msc_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 3054 | f_tc_stat_num_msc_connected_msc_connhdlr(3); |
| 3055 | } |
| 3056 | testcase TC_stat_num_msc_connected_3() runs on test_CT { |
| 3057 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_3), 3); |
| 3058 | } |
| 3059 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3060 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 3061 | private function f_tc_stat_num_bts_connected_msc_connhdlr(integer expect_num_bts_connected) runs on MSC_ConnHdlr { |
| 3062 | g_pars := f_gen_test_hdlr_pars(); |
| 3063 | var StatsDExpects expect := { |
| 3064 | { name := "TTCN3.bsc.0.num_bts.oml_connected", mtype := "g", min := expect_num_bts_connected, max := NUM_BTS_CFG }, |
| 3065 | { name := "TTCN3.bsc.0.num_bts.all_trx_rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 3066 | { name := "TTCN3.bsc.0.num_bts.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG }, |
| 3067 | { name := "TTCN3.bsc.0.num_trx.rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 3068 | { name := "TTCN3.bsc.0.num_trx.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG } |
| 3069 | }; |
| 3070 | f_statsd_expect(expect); |
| 3071 | } |
| 3072 | |
| 3073 | private function f_tc_stat_num_bts_connected_test_ct(void_fn tc_fn, integer nr_bts) runs on test_CT { |
| 3074 | var MSC_ConnHdlr vc_conn; |
| 3075 | |
| 3076 | f_init(nr_bts := nr_bts, handler_mode := true, nr_msc := 1); |
| 3077 | f_sleep(1.0); |
| 3078 | vc_conn := f_start_handler(tc_fn); |
| 3079 | vc_conn.done; |
| 3080 | |
| 3081 | /* Also verify stat exposed on CTRL interface */ |
| 3082 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:all_trx_rsl_connected", int2str(nr_bts)); |
| 3083 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:total", int2str(NUM_BTS_CFG)); |
| 3084 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:rsl_connected", int2str(nr_bts)); |
| 3085 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:total", int2str(NUM_BTS_CFG)); |
| 3086 | |
Neels Hofmeyr | a41ae30 | 2021-09-06 22:06:02 +0200 | [diff] [blame] | 3087 | /* Verify rf_states exposed on CTRL interface */ |
| 3088 | var charstring expect_net_rf_states := ""; |
| 3089 | for (var integer i := 0; i < NUM_BTS_CFG; i := i + 1) { |
| 3090 | var charstring expect_bts_rf_states := int2str(i) & ",0,"; |
| 3091 | if (i < NUM_BTS) { |
| 3092 | /* In these tests, OML for the first NUM_BTS are always connected via osmo-bts-omldummy */ |
| 3093 | expect_bts_rf_states := expect_bts_rf_states & "operational,unlocked,"; |
| 3094 | } else { |
| 3095 | /* For remaining i < NUM_BTS_CFG, OML is not connected, i.e. inoperational */ |
| 3096 | expect_bts_rf_states := expect_bts_rf_states & "inoperational,locked,"; |
| 3097 | } |
| 3098 | /* The RF policy is still global in osmo-bsc, i.e. always "on" */ |
| 3099 | expect_bts_rf_states := expect_bts_rf_states & "on,"; |
| 3100 | if (i < nr_bts) { |
| 3101 | /* For BTS where RSL is connected, the RSL state will be "up" */ |
| 3102 | expect_bts_rf_states := expect_bts_rf_states & "rsl-up;"; |
| 3103 | } else { |
| 3104 | expect_bts_rf_states := expect_bts_rf_states & "rsl-down;"; |
| 3105 | } |
| 3106 | |
| 3107 | f_ctrl_get_exp(IPA_CTRL, "bts." & int2str(i) & ".rf_states", expect_bts_rf_states); |
| 3108 | expect_net_rf_states := expect_net_rf_states & expect_bts_rf_states; |
| 3109 | } |
| 3110 | f_ctrl_get_exp(IPA_CTRL, "rf_states", expect_net_rf_states); |
| 3111 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 3112 | f_shutdown_helper(); |
| 3113 | } |
| 3114 | |
| 3115 | /* Verify that when 1 BTS is connected, that num_{bts,trx}:*_connected reports 1. */ |
| 3116 | private function f_tc_stat_num_bts_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 3117 | f_tc_stat_num_bts_connected_msc_connhdlr(1); |
| 3118 | } |
| 3119 | testcase TC_stat_num_bts_connected_1() runs on test_CT { |
| 3120 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_1), 1); |
| 3121 | } |
| 3122 | |
| 3123 | /* Verify that when 2 BTS is connected, that num_{bts,trx}:*_connected reports 2. */ |
| 3124 | private function f_tc_stat_num_bts_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 3125 | f_tc_stat_num_bts_connected_msc_connhdlr(2); |
| 3126 | } |
| 3127 | testcase TC_stat_num_bts_connected_2() runs on test_CT { |
| 3128 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_2), 2); |
| 3129 | } |
| 3130 | |
| 3131 | /* Verify that when 3 BTS is connected, that num_{bts,trx}:*_connected reports 3. */ |
| 3132 | private function f_tc_stat_num_bts_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 3133 | f_tc_stat_num_bts_connected_msc_connhdlr(3); |
| 3134 | } |
| 3135 | testcase TC_stat_num_bts_connected_3() runs on test_CT { |
| 3136 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_3), 3); |
| 3137 | } |
| 3138 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3139 | testcase TC_ctrl() runs on test_CT { |
| 3140 | var charstring ctrl_resp; |
| 3141 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3142 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3143 | |
| 3144 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 3145 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 3146 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 3147 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 3148 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 3149 | |
| 3150 | var integer bts_nr := 0; |
| 3151 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 3152 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 3153 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 3154 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 3155 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 3156 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 3157 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 3158 | |
| 3159 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 3160 | f_sleep(2.0); |
| 3161 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 3162 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 3163 | } |
| 3164 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 3165 | |
| 3166 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 3167 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3168 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 3169 | } |
| 3170 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3171 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 3172 | "location-state" over the SCCPlite IPA conn */ |
| 3173 | testcase TC_ctrl_location() runs on test_CT { |
| 3174 | var MSC_ConnHdlr vc_conn; |
| 3175 | var integer bts_nr := 0; |
| 3176 | |
| 3177 | f_init(1, true); |
| 3178 | f_sleep(1.0); |
| 3179 | |
| 3180 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 3181 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3182 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 3183 | |
| 3184 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 3185 | f_sleep(2.0); |
| 3186 | |
| 3187 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 3188 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 3189 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 3190 | |
| 3191 | /* should match the one from config */ |
| 3192 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 3193 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3194 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 3195 | } |
| 3196 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3197 | |
| 3198 | /*********************************************************************** |
| 3199 | * Paging Testing |
| 3200 | ***********************************************************************/ |
| 3201 | |
| 3202 | type record Cell_Identity { |
| 3203 | GsmMcc mcc, |
| 3204 | GsmMnc mnc, |
| 3205 | GsmLac lac, |
| 3206 | GsmCellId ci |
| 3207 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 3208 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3209 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3210 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3211 | type set of integer BtsIdList; |
| 3212 | |
| 3213 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 3214 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 3215 | if (bts_id == bts_ids[j]) { |
| 3216 | return true; |
| 3217 | } |
| 3218 | } |
| 3219 | return false; |
| 3220 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3221 | |
| 3222 | /* core paging test helper function; used by most paging test cases */ |
| 3223 | private function f_pageing_helper(hexstring imsi, |
| 3224 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3225 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3226 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3227 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3228 | { |
| 3229 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3230 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3231 | var RSL_Message rx_rsl; |
| 3232 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3233 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3234 | |
| 3235 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3236 | |
| 3237 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 3238 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3239 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3240 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3241 | |
| 3242 | if (isvalue(rsl_chneed)) { |
| 3243 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 3244 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 3245 | } else { |
| 3246 | bssmap_chneed := omit; |
| 3247 | } |
| 3248 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3249 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 3250 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3251 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3252 | if (not istemplatekind(tmsi, "omit")) { |
| 3253 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3254 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3255 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3256 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3257 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3258 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3259 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(mi)); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3260 | /* check channel type, paging group */ |
| 3261 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 3262 | setverdict(fail, "Paging for wrong paging group"); |
| 3263 | } |
| 3264 | if (ispresent(rsl_chneed) and |
| 3265 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 3266 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 3267 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3268 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 3269 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3270 | /* do a quick check on all not-included BTSs if they received paging */ |
| 3271 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3272 | timer T := 0.1; |
| 3273 | if (f_bts_in_list(i, bts_ids)) { |
| 3274 | continue; |
| 3275 | } |
| 3276 | T.start; |
| 3277 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3278 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(mi))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3279 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 3280 | } |
| 3281 | [] IPA_RSL[i].receive { repeat; } |
| 3282 | [] T.timeout { } |
| 3283 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3284 | } |
| 3285 | |
| 3286 | setverdict(pass); |
| 3287 | } |
| 3288 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3289 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3290 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3291 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 3292 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 3293 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3294 | /* PAGING by IMSI + TMSI */ |
| 3295 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 3296 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3297 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 3298 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3299 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3300 | } |
| 3301 | |
| 3302 | /* PAGING by IMSI + TMSI */ |
| 3303 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 3304 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3305 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3306 | 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] | 3307 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3308 | } |
| 3309 | |
| 3310 | /* Paging with different "channel needed' values */ |
| 3311 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 3312 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3313 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3314 | 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] | 3315 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3316 | } |
| 3317 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 3318 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3319 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3320 | 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] | 3321 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3322 | } |
| 3323 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 3324 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3325 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3326 | 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] | 3327 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3328 | } |
| 3329 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 3330 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3331 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3332 | 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] | 3333 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3334 | } |
| 3335 | |
| 3336 | /* Paging by CGI */ |
| 3337 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 3338 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3339 | 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] | 3340 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3341 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3342 | } |
| 3343 | |
| 3344 | /* Paging by LAC+CI */ |
| 3345 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 3346 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3347 | 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] | 3348 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3349 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3350 | } |
| 3351 | |
| 3352 | /* Paging by CI */ |
| 3353 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 3354 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3355 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3356 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3357 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3358 | } |
| 3359 | |
| 3360 | /* Paging by LAI */ |
| 3361 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 3362 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3363 | 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] | 3364 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3365 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3366 | } |
| 3367 | |
| 3368 | /* Paging by LAC */ |
| 3369 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 3370 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3371 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3372 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3373 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3374 | } |
| 3375 | |
| 3376 | /* Paging by "all in BSS" */ |
| 3377 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 3378 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3379 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3380 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3381 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3382 | } |
| 3383 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3384 | /* 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] | 3385 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 3386 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3387 | 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] | 3388 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3389 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3390 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3391 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3392 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3393 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 3394 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3395 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3396 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3397 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3398 | } |
| 3399 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3400 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3401 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 3402 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3403 | 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] | 3404 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3405 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3406 | } |
| 3407 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3408 | /* 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] | 3409 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 3410 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3411 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 3412 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3413 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3414 | } |
| 3415 | |
| 3416 | /* Paging on empty list: Verify none of them page */ |
| 3417 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3418 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3419 | cid_list := { cIl_LAC := { } }; |
| 3420 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3421 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3422 | } |
| 3423 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3424 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3425 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3426 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3427 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3428 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3429 | f_shutdown_helper(); |
| 3430 | } |
| 3431 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3432 | /* Verify paging retransmission interval + count */ |
| 3433 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3434 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3435 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3436 | /* Verify PCH load */ |
| 3437 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3438 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3439 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3440 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3441 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3442 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3443 | |
| 3444 | /* tell BSC there is no paging space anymore */ |
| 3445 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3446 | f_sleep(0.2); |
| 3447 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3448 | |
| 3449 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3450 | * there would be 8 retransmissions during 4 seconds */ |
| 3451 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3452 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3453 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3454 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3455 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3456 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3457 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3458 | [] T_retrans.timeout { |
| 3459 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3460 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3461 | T_retrans.start; |
| 3462 | repeat; |
| 3463 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3464 | [] T.timeout { |
| 3465 | setverdict(pass); |
| 3466 | } |
| 3467 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3468 | |
| 3469 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3470 | } |
| 3471 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3472 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3473 | testcase TC_paging_counter() runs on test_CT { |
| 3474 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3475 | timer T := 4.0; |
| 3476 | var integer i; |
| 3477 | var integer paging_attempted_bsc; |
| 3478 | var integer paging_attempted_bts[NUM_BTS]; |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3479 | var integer paging_expired_bsc; |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3480 | var integer paging_expired_bts[NUM_BTS]; |
| 3481 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3482 | |
| 3483 | f_init(); |
| 3484 | |
| 3485 | /* read counters before paging */ |
| 3486 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3487 | if (Misc_Helpers.f_osmo_repo_is("nightly")) { /* osmo-bsc > 1.8.0 */ |
| 3488 | paging_expired_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired"); |
| 3489 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3490 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3491 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3492 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3493 | } |
| 3494 | |
| 3495 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3496 | |
| 3497 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3498 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3499 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3500 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3501 | paging_attempted_bts[i]+1); |
| 3502 | } |
| 3503 | |
| 3504 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3505 | f_sleep(12.0); |
Oliver Smith | 8b343d3 | 2021-11-26 13:01:42 +0100 | [diff] [blame] | 3506 | if (Misc_Helpers.f_osmo_repo_is("nightly")) { /* osmo-bsc > 1.8.0 */ |
| 3507 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:expired", paging_expired_bsc+1); |
| 3508 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3509 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3510 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3511 | paging_expired_bts[i]+1); |
| 3512 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3513 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3514 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3515 | } |
| 3516 | |
| 3517 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3518 | /* Verify paging stops after A-RESET */ |
| 3519 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3520 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3521 | timer T := 3.0; |
| 3522 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3523 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3524 | |
| 3525 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3526 | 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))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3527 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3528 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[0].sccp_addr_own, g_bssap[0].sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3529 | [] BSSAP.receive { repeat; } |
| 3530 | } |
| 3531 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3532 | /* Wait to avoid a possible race condition if a paging message is |
| 3533 | * received right before the reset ACK. */ |
| 3534 | f_sleep(0.2); |
| 3535 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3536 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3537 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3538 | IPA_RSL[i].clear; |
| 3539 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3540 | |
| 3541 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3542 | T.start; |
| 3543 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3544 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3545 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3546 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3547 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3548 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3549 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3550 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3551 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3552 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3553 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3554 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3555 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3556 | [] T.timeout { |
| 3557 | setverdict(pass); |
| 3558 | } |
| 3559 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3560 | |
| 3561 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3562 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3563 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3564 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3565 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3566 | * pick the first configured MSC. This behavior is required in order to make |
| 3567 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3568 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3569 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3570 | */ |
| 3571 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3572 | |
| 3573 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3574 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3575 | |
| 3576 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3577 | var DchanTuple dt; |
| 3578 | var PDU_ML3_MS_NW l3 := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010008880018'H)))); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3579 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3580 | |
| 3581 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3582 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3583 | |
| 3584 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3585 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3586 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3587 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3588 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3589 | T.start; |
| 3590 | alt { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3591 | [] 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] | 3592 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3593 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 3594 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3595 | } |
| 3596 | [] BSSAP.receive { |
| 3597 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3598 | } |
| 3599 | [] T.timeout { |
| 3600 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3601 | } |
| 3602 | } |
| 3603 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3604 | f_perform_clear_test_ct(dt); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3605 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3606 | } |
| 3607 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3608 | /* Test RSL link drop causes counter increment */ |
| 3609 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3610 | var integer rsl_fail; |
| 3611 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3612 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3613 | |
| 3614 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3615 | |
Pau Espin Pedrol | af0c61e | 2022-01-11 12:48:34 +0100 | [diff] [blame] | 3616 | f_ipa_rsl_stop(bts[0].rsl); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3617 | |
| 3618 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3619 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3620 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3621 | } |
| 3622 | |
| 3623 | /* TODO: Test OML link drop causes counter increment */ |
| 3624 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3625 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3626 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3627 | timer T := 10.0; |
| 3628 | |
| 3629 | bts[0].rsl.id := "IPA-0-RSL"; |
Harald Welte | 7138913 | 2021-12-09 21:58:18 +0100 | [diff] [blame] | 3630 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA") alive; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3631 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3632 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3633 | bts[0].rsl.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] | 3634 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3635 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3636 | |
| 3637 | f_init_mgcp("VirtMSC"); |
| 3638 | |
| 3639 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3640 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3641 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3642 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3643 | |
| 3644 | /* wait for IPA OML link to connect and then disconnect */ |
| 3645 | T.start; |
| 3646 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3647 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3648 | T.stop; |
| 3649 | return true; |
| 3650 | } |
| 3651 | [] IPA_RSL[0].receive { repeat } |
| 3652 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3653 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3654 | } |
| 3655 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3656 | return false; |
| 3657 | } |
| 3658 | |
| 3659 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3660 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3661 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3662 | setverdict(pass); |
| 3663 | } else { |
| 3664 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3665 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3666 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3667 | } |
| 3668 | |
| 3669 | |
| 3670 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3671 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3672 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3673 | setverdict(pass); |
| 3674 | } else { |
| 3675 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3676 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3677 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3678 | } |
| 3679 | |
| 3680 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3681 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3682 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3683 | ***********************************************************************/ |
| 3684 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3685 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3686 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3687 | import from RSL_Emulation all; |
| 3688 | import from MSC_ConnectionHandler all; |
| 3689 | |
| 3690 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3691 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3692 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3693 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3694 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3695 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3696 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3697 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3698 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3699 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3700 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3701 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3702 | if (isvalue(bts[2])) { |
| 3703 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3704 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3705 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3706 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3707 | if (mp_enable_lcs_tests) { |
| 3708 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3709 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3710 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3711 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3712 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3713 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3714 | } |
| 3715 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3716 | function f_start_handler_create(template (omit) TestHdlrParams pars := omit) |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3717 | runs on test_CT return MSC_ConnHdlr { |
| 3718 | var charstring id := testcasename(); |
| 3719 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3720 | var integer bssap_idx := 0; |
| 3721 | if (isvalue(pars)) { |
| 3722 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3723 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3724 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3725 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3726 | return vc_conn; |
| 3727 | } |
| 3728 | |
| 3729 | function f_start_handler_run(MSC_ConnHdlr vc_conn, void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3730 | runs on test_CT return MSC_ConnHdlr { |
| 3731 | var charstring id := testcasename(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3732 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3733 | return vc_conn; |
| 3734 | } |
| 3735 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3736 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3737 | runs on test_CT return MSC_ConnHdlr { |
| 3738 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 3739 | } |
| 3740 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3741 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3742 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3743 | runs on MSC_ConnHdlr { |
| 3744 | if (isvalue(pars)) { |
| 3745 | g_pars := valueof(pars); |
| 3746 | } |
| 3747 | fn.apply(id); |
| 3748 | } |
| 3749 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3750 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 3751 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 3752 | f_vty_transceive(BSCVTY, "network"); |
| 3753 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 3754 | f_vty_transceive(BSCVTY, "exit"); |
| 3755 | f_vty_transceive(BSCVTY, "exit"); |
| 3756 | } |
| 3757 | |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 3758 | const charstring VTY_A5_DEFAULT := "0 1 3"; |
| 3759 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3760 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 3761 | /* 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] | 3762 | f_vty_encryption_a5(VTY_A5_DEFAULT); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3763 | } |
| 3764 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3765 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3766 | 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] | 3767 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3768 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3769 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3770 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3771 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3772 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3773 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3774 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3775 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3776 | f_perform_clear(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3777 | } |
| 3778 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3779 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3780 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3781 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3782 | |
| 3783 | f_init(1, true); |
| 3784 | f_sleep(1.0); |
| 3785 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3786 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3787 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3788 | } |
| 3789 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3790 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3791 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3792 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3793 | |
| 3794 | f_init(1, true); |
| 3795 | f_sleep(1.0); |
| 3796 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3797 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3798 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3799 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 3800 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 3801 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 3802 | var MSC_ConnHdlr vc_conn; |
| 3803 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3804 | |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 3805 | 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] | 3806 | |
| 3807 | f_init(1, true); |
| 3808 | f_vty_encryption_a5("0 1 2 3"); |
| 3809 | f_sleep(1.0); |
| 3810 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3811 | vc_conn.done; |
| 3812 | f_vty_encryption_a5_reset(); |
| 3813 | f_shutdown_helper(); |
| 3814 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 3815 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 3816 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 3817 | var MSC_ConnHdlr vc_conn; |
| 3818 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3819 | |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 3820 | 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] | 3821 | |
| 3822 | f_init(1, true); |
| 3823 | f_vty_encryption_a5("1 2"); |
| 3824 | f_sleep(1.0); |
| 3825 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3826 | vc_conn.done; |
| 3827 | f_vty_encryption_a5_reset(); |
| 3828 | f_shutdown_helper(); |
| 3829 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3830 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3831 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3832 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3833 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3834 | |
| 3835 | f_init(1, true); |
| 3836 | f_sleep(1.0); |
| 3837 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3838 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3839 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3840 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3841 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 3842 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 3843 | var MSC_ConnHdlr vc_conn; |
| 3844 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3845 | 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] | 3846 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3847 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3848 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3849 | f_sleep(1.0); |
| 3850 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3851 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3852 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3853 | f_shutdown_helper(); |
| 3854 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3855 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3856 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3857 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3858 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3859 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3860 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3861 | |
| 3862 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3863 | f_perform_clear(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3864 | } |
| 3865 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3866 | var MSC_ConnHdlr vc_conn; |
| 3867 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3868 | |
| 3869 | f_init(1, true); |
| 3870 | f_sleep(1.0); |
| 3871 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3872 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3873 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3874 | } |
| 3875 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3876 | |
| 3877 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3878 | 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] | 3879 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3880 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3881 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3882 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3883 | 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] | 3884 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3885 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3886 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3887 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3888 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3889 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3890 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3891 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3892 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3893 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3894 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3895 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3896 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3897 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3898 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3899 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3900 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3901 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3902 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3903 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3904 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3905 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3906 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3907 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3908 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3909 | } |
| 3910 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3911 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3912 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3913 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3914 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3915 | f_init(1, true); |
| 3916 | f_sleep(1.0); |
| 3917 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3918 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3919 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3920 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3921 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 3922 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3923 | var MSC_ConnHdlr vc_conn; |
| 3924 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3925 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 3926 | |
| 3927 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3928 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3929 | f_sleep(1.0); |
| 3930 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3931 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3932 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3933 | f_shutdown_helper(); |
| 3934 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3935 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 3936 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 3937 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 3938 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3939 | var MSC_ConnHdlr vc_conn; |
| 3940 | |
| 3941 | f_init(1, true); |
| 3942 | f_sleep(1.0); |
| 3943 | |
| 3944 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 3945 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 3946 | vc_conn.done; |
| 3947 | f_shutdown_helper(); |
| 3948 | } |
| 3949 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3950 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3951 | 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] | 3952 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3953 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3954 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3955 | |
| 3956 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3957 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3958 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3959 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3960 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3961 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3962 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3963 | var MSC_ConnHdlr vc_conn; |
| 3964 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3965 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3966 | f_sleep(1.0); |
| 3967 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3968 | 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] | 3969 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3970 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3971 | } |
| 3972 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3973 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 3974 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 3975 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3976 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3977 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3978 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3979 | |
| 3980 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 3981 | |
| 3982 | var BSSMAP_FIELD_CodecType codecType; |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3983 | |
| 3984 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 3985 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 3986 | |
| 3987 | f_create_chan_and_exp(); |
| 3988 | /* we should now have a COMPL_L3 at the MSC */ |
| 3989 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3990 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 3991 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 3992 | f_perform_clear(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3993 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3994 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 3995 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3996 | var MSC_ConnHdlr vc_conn; |
| 3997 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3998 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3999 | f_sleep(1.0); |
| 4000 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 4001 | 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] | 4002 | 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] | 4003 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4004 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4005 | } |
| 4006 | |
| 4007 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4008 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4009 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4010 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4011 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4012 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4013 | |
| 4014 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4015 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4016 | |
| 4017 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 4018 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 4019 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 4020 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 4021 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 4022 | }; |
| 4023 | f_statsd_expect(expect); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4024 | f_perform_clear(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4025 | } |
| 4026 | |
| 4027 | testcase TC_assignment_sign() runs on test_CT { |
| 4028 | var MSC_ConnHdlr vc_conn; |
| 4029 | |
| 4030 | f_init(1, true); |
| 4031 | f_sleep(1.0); |
| 4032 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4033 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4034 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4035 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 4036 | } |
| 4037 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4038 | /*********************************************************************** |
| 4039 | * Codec (list) testing |
| 4040 | ***********************************************************************/ |
| 4041 | |
| 4042 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 4043 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 4044 | return boolean { |
| 4045 | select (a_elem.codecType) { |
| 4046 | case (GSM_FR) { |
| 4047 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 4048 | return true; |
| 4049 | } |
| 4050 | } |
| 4051 | case (GSM_HR) { |
| 4052 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 4053 | return true; |
| 4054 | } |
| 4055 | } |
| 4056 | case (GSM_EFR) { |
| 4057 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 4058 | return true; |
| 4059 | } |
| 4060 | } |
| 4061 | case (FR_AMR) { |
| 4062 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 4063 | return true; |
| 4064 | } |
| 4065 | } |
| 4066 | case (HR_AMR) { |
| 4067 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 4068 | return true; |
| 4069 | } |
| 4070 | } |
| 4071 | case else { } |
| 4072 | } |
| 4073 | return false; |
| 4074 | } |
| 4075 | |
| 4076 | /* check if the given rsl_mode is compatible with the a_list */ |
| 4077 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 4078 | return boolean { |
| 4079 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 4080 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 4081 | return true; |
| 4082 | } |
| 4083 | } |
| 4084 | return false; |
| 4085 | } |
| 4086 | |
| 4087 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 4088 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4089 | return BSSMAP_IE_ChannelType { |
| 4090 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 4091 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 4092 | select (a_elem.codecType) { |
| 4093 | case (GSM_FR) { |
| 4094 | ret.channelRateAndType := ChRate_TCHF; |
| 4095 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 4096 | } |
| 4097 | case (GSM_HR) { |
| 4098 | ret.channelRateAndType := ChRate_TCHH; |
| 4099 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 4100 | } |
| 4101 | case (GSM_EFR) { |
| 4102 | ret.channelRateAndType := ChRate_TCHF; |
| 4103 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 4104 | } |
| 4105 | case (FR_AMR) { |
| 4106 | ret.channelRateAndType := ChRate_TCHF; |
| 4107 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 4108 | } |
| 4109 | case (HR_AMR) { |
| 4110 | ret.channelRateAndType := ChRate_TCHH; |
| 4111 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 4112 | } |
| 4113 | case else { |
| 4114 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4115 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4116 | } |
| 4117 | } |
| 4118 | return ret; |
| 4119 | } |
| 4120 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4121 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 4122 | return template RSL_IE_Body { |
| 4123 | var template RSL_IE_Body mode_ie := { |
| 4124 | chan_mode := { |
| 4125 | len := ?, |
| 4126 | reserved := ?, |
| 4127 | dtx_d := ?, |
| 4128 | dtx_u := ?, |
| 4129 | spd_ind := RSL_SPDI_SPEECH, |
| 4130 | ch_rate_type := -, |
| 4131 | coding_alg_rate := - |
| 4132 | } |
| 4133 | } |
| 4134 | |
| 4135 | select (a_elem.codecType) { |
| 4136 | case (GSM_FR) { |
| 4137 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4138 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 4139 | } |
| 4140 | case (GSM_HR) { |
| 4141 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 4142 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 4143 | } |
| 4144 | case (GSM_EFR) { |
| 4145 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4146 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 4147 | } |
| 4148 | case (FR_AMR) { |
| 4149 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 4150 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 4151 | } |
| 4152 | case (HR_AMR) { |
| 4153 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 4154 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 4155 | } |
| 4156 | } |
| 4157 | return mode_ie; |
| 4158 | } |
| 4159 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4160 | type record CodecListTest { |
| 4161 | BSSMAP_IE_SpeechCodecList codec_list, |
| 4162 | charstring id |
| 4163 | } |
| 4164 | type record of CodecListTest CodecListTests |
| 4165 | |
| 4166 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4167 | f_assignment_codec(id); |
| 4168 | } |
| 4169 | |
| 4170 | private function f_assignment_codec(charstring id, boolean do_perform_clear := true) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4171 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 4172 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4173 | |
| 4174 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4175 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4176 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4177 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 4178 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4179 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 4180 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 4181 | g_pars.expect_mr_s0_s7; |
| 4182 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 4183 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4184 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4185 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4186 | log("expecting ASS COMPL like this: ", exp_compl); |
| 4187 | |
| 4188 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 4189 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4190 | if (not g_pars.expect_channel_mode_modify) { |
| 4191 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 4192 | 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] | 4193 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4194 | var RSL_IE_Body mode_ie; |
| 4195 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 4196 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4197 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4198 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4199 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4200 | if (not match(mode_ie, t_mode_ie)) { |
| 4201 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 4202 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4203 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4204 | |
| 4205 | var RSL_IE_Body mr_conf; |
| 4206 | if (g_pars.expect_mr_conf_ie != omit) { |
| 4207 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 4208 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 4209 | mtc.stop; |
| 4210 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4211 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4212 | |
| 4213 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 4214 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 4215 | g_pars.expect_mr_conf_ie); |
| 4216 | } |
| 4217 | } else { |
| 4218 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 4219 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 4220 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 4221 | mtc.stop; |
| 4222 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4223 | } |
| 4224 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4225 | |
| 4226 | if (do_perform_clear) { |
| 4227 | f_perform_clear(); |
| 4228 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4229 | } |
| 4230 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4231 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 4232 | |
| 4233 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4234 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4235 | |
| 4236 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4237 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4238 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4239 | } |
| 4240 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4241 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4242 | log("expecting ASS FAIL like this: ", exp_fail); |
| 4243 | |
| 4244 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4245 | f_perform_clear(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4246 | } |
| 4247 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4248 | const CounterNameVals counternames_bsc_bts_assignment := { |
| 4249 | { "assignment:attempted", 0 }, |
| 4250 | { "assignment:completed", 0 }, |
| 4251 | { "assignment:stopped", 0 }, |
| 4252 | { "assignment:no_channel", 0 }, |
| 4253 | { "assignment:timeout", 0 }, |
| 4254 | { "assignment:failed", 0 }, |
| 4255 | { "assignment:error", 0 } |
| 4256 | }; |
| 4257 | |
| 4258 | const CounterNameVals counternames_bts_assignment := { |
| 4259 | { "assignment:attempted_sign", 0 }, |
| 4260 | { "assignment:attempted_speech", 0 }, |
| 4261 | { "assignment:completed_sign", 0 }, |
| 4262 | { "assignment:completed_speech", 0 }, |
| 4263 | { "assignment:stopped_sign", 0 }, |
| 4264 | { "assignment:stopped_speech", 0 }, |
| 4265 | { "assignment:no_channel_sign", 0 }, |
| 4266 | { "assignment:no_channel_speech", 0 }, |
| 4267 | { "assignment:timeout_sign", 0 }, |
| 4268 | { "assignment:timeout_speech", 0 }, |
| 4269 | { "assignment:failed_sign", 0 }, |
| 4270 | { "assignment:failed_speech", 0 }, |
| 4271 | { "assignment:error_sign", 0 }, |
| 4272 | { "assignment:error_speech", 0 } |
| 4273 | }; |
| 4274 | |
| 4275 | function f_ctrs_bsc_and_bts_assignment_init(integer bts_count := NUM_BTS) runs on test_CT { |
| 4276 | var CounterNameVals bts_names := counternames_bsc_bts_assignment & counternames_bts_assignment; |
| 4277 | f_ctrs_bts_init(bts_count, bts_names); |
| 4278 | f_ctrs_bsc_init(counternames_bsc_bts_assignment); |
| 4279 | } |
| 4280 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4281 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4282 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4283 | var MSC_ConnHdlr vc_conn; |
| 4284 | |
| 4285 | f_init(1, true); |
| 4286 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4287 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4288 | |
| 4289 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4290 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4291 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4292 | |
| 4293 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4294 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4295 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4296 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4297 | f_ctrs_bts_verify(); |
| 4298 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4299 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4300 | } |
| 4301 | |
| 4302 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4303 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4304 | var MSC_ConnHdlr vc_conn; |
| 4305 | |
| 4306 | f_init(1, true); |
| 4307 | f_sleep(1.0); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4308 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4309 | |
| 4310 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4311 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4312 | vc_conn.done; |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4313 | |
| 4314 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4315 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4316 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4317 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4318 | f_ctrs_bts_verify(); |
| 4319 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4320 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4321 | } |
| 4322 | |
| 4323 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4324 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4325 | var MSC_ConnHdlr vc_conn; |
| 4326 | |
| 4327 | f_init(1, true); |
| 4328 | f_sleep(1.0); |
| 4329 | |
| 4330 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4331 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4332 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4333 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4334 | } |
| 4335 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4336 | /* Allow 5,90k only (current default config) */ |
| 4337 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4338 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4339 | "amr-config 12_2k forbidden", |
| 4340 | "amr-config 10_2k forbidden", |
| 4341 | "amr-config 7_95k forbidden", |
| 4342 | "amr-config 7_40k forbidden", |
| 4343 | "amr-config 6_70k forbidden", |
| 4344 | "amr-config 5_90k allowed", |
| 4345 | "amr-config 5_15k forbidden", |
| 4346 | "amr-config 4_75k forbidden" |
| 4347 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4348 | } |
| 4349 | |
| 4350 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 4351 | * ("Config-NB-Code = 1") */ |
| 4352 | 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] | 4353 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4354 | "amr-config 12_2k allowed", |
| 4355 | "amr-config 10_2k forbidden", |
| 4356 | "amr-config 7_95k forbidden", |
| 4357 | "amr-config 7_40k allowed", |
| 4358 | "amr-config 6_70k forbidden", |
| 4359 | "amr-config 5_90k allowed", |
| 4360 | "amr-config 5_15k forbidden", |
| 4361 | "amr-config 4_75k allowed" |
| 4362 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4363 | } |
| 4364 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4365 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 4366 | var charstring tch; |
| 4367 | if (fr) { |
| 4368 | tch := "tch-f"; |
| 4369 | } else { |
| 4370 | tch := "tch-h"; |
| 4371 | } |
| 4372 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 4373 | } |
| 4374 | |
| 4375 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 4376 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 4377 | f_vty_amr_start_mode_set(fr, "auto"); |
| 4378 | } |
| 4379 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4380 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4381 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4382 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4383 | |
| 4384 | /* Note: This setups the codec configuration. The parameter payload in |
| 4385 | * mr_conf must be consistant with the parameter codecElements in pars |
| 4386 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4387 | var RSL_IE_Body mr_conf := { |
| 4388 | other := { |
| 4389 | len := 2, |
| 4390 | payload := '2804'O |
| 4391 | } |
| 4392 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4393 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4394 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4395 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4396 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4397 | pars.expect_mr_conf_ie := mr_conf; |
| 4398 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4399 | f_init(1, true); |
| 4400 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4401 | f_vty_amr_start_mode_set(true, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4402 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4403 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4404 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4405 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4406 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4407 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4408 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4409 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4410 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4411 | f_ctrs_bts_verify(); |
| 4412 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4413 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4414 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4415 | } |
| 4416 | |
| 4417 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4418 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4419 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4420 | |
| 4421 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4422 | var RSL_IE_Body mr_conf := { |
| 4423 | other := { |
| 4424 | len := 2, |
| 4425 | payload := '2804'O |
| 4426 | } |
| 4427 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4428 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4429 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4430 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4431 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4432 | pars.expect_mr_conf_ie := mr_conf; |
| 4433 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4434 | f_init(1, true); |
| 4435 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4436 | f_vty_amr_start_mode_set(false, "1"); |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4437 | f_ctrs_bsc_and_bts_assignment_init(1); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4438 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4439 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4440 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4441 | |
Neels Hofmeyr | bcfc944 | 2021-11-29 16:44:08 +0100 | [diff] [blame] | 4442 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted", 1); |
| 4443 | f_ctrs_bts_add(0, "assignment:attempted_speech", 1); |
| 4444 | f_ctrs_bsc_and_bts_add(0, "assignment:completed", 1); |
| 4445 | f_ctrs_bts_add(0, "assignment:completed_speech", 1); |
| 4446 | f_ctrs_bts_verify(); |
| 4447 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4448 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4449 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4450 | } |
| 4451 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4452 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 4453 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 4454 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4455 | var MSC_ConnHdlr vc_conn; |
| 4456 | |
| 4457 | f_init(1, true); |
| 4458 | f_sleep(1.0); |
| 4459 | |
| 4460 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 4461 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 4462 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 4463 | f_disable_all_sdcch(); |
| 4464 | f_disable_all_tch_h(); |
| 4465 | |
| 4466 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4467 | pars.expect_channel_mode_modify := true; |
| 4468 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4469 | vc_conn.done; |
| 4470 | |
| 4471 | f_enable_all_sdcch(); |
| 4472 | f_enable_all_tch(); |
| 4473 | f_shutdown_helper(); |
| 4474 | } |
| 4475 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4476 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 4477 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 4478 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4479 | var MSC_ConnHdlr vc_conn; |
| 4480 | |
| 4481 | var RSL_IE_Body mr_conf := { |
| 4482 | other := { |
| 4483 | len := 2, |
| 4484 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 4485 | } |
| 4486 | }; |
| 4487 | |
| 4488 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4489 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4490 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4491 | pars.expect_mr_conf_ie := mr_conf; |
| 4492 | |
| 4493 | f_init(1, true); |
| 4494 | f_sleep(1.0); |
| 4495 | |
| 4496 | /* First set nonzero start mode bits */ |
| 4497 | f_vty_amr_start_mode_set(true, "4"); |
| 4498 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4499 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4500 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4501 | f_vty_amr_start_mode_set(true, "auto"); |
| 4502 | |
| 4503 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4504 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4505 | |
| 4506 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4507 | f_vty_amr_start_mode_set(true, "1"); |
| 4508 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4509 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4510 | } |
| 4511 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4512 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 4513 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4514 | runs on test_CT { |
| 4515 | |
| 4516 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4517 | var MSC_ConnHdlr vc_conn; |
| 4518 | |
| 4519 | /* See note above */ |
| 4520 | var RSL_IE_Body mr_conf := { |
| 4521 | other := { |
| 4522 | len := lengthof(mrconf), |
| 4523 | payload := mrconf |
| 4524 | } |
| 4525 | }; |
| 4526 | |
| 4527 | if (fr) { |
| 4528 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4529 | } else { |
| 4530 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4531 | } |
| 4532 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4533 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4534 | pars.expect_mr_conf_ie := mr_conf; |
| 4535 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4536 | |
| 4537 | f_init(1, true); |
| 4538 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4539 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4540 | f_sleep(1.0); |
| 4541 | |
| 4542 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4543 | vc_conn.done; |
| 4544 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4545 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4546 | } |
| 4547 | |
| 4548 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4549 | runs on test_CT { |
| 4550 | |
| 4551 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4552 | var MSC_ConnHdlr vc_conn; |
| 4553 | |
| 4554 | if (fr) { |
| 4555 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4556 | } else { |
| 4557 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4558 | } |
| 4559 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4560 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4561 | |
| 4562 | f_init(1, true); |
| 4563 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4564 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4565 | f_sleep(1.0); |
| 4566 | |
| 4567 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4568 | vc_conn.done; |
| 4569 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4570 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4571 | } |
| 4572 | |
| 4573 | |
| 4574 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4575 | * set. */ |
| 4576 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4577 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4578 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4579 | } |
| 4580 | |
| 4581 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4582 | * rates set. */ |
| 4583 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4584 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4585 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4586 | } |
| 4587 | |
| 4588 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4589 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4590 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4591 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4592 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4593 | } |
| 4594 | |
| 4595 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4596 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4597 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4598 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4599 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4600 | } |
| 4601 | |
| 4602 | /* The following block of tests selects more and more rates until all four |
| 4603 | * possible rates are in the active set (full rate) */ |
| 4604 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4605 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4606 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4607 | } |
| 4608 | |
| 4609 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4610 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4611 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4612 | } |
| 4613 | |
| 4614 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4615 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4616 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4617 | } |
| 4618 | |
| 4619 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4620 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4621 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4622 | } |
| 4623 | |
| 4624 | /* The following block of tests selects more and more rates until all three |
| 4625 | * possible rates are in the active set (half rate) */ |
| 4626 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4627 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4628 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4629 | } |
| 4630 | |
| 4631 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4632 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4633 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4634 | } |
| 4635 | |
| 4636 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4637 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4638 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4639 | } |
| 4640 | |
| 4641 | /* The following block tests what happens when the MSC does offer rate |
| 4642 | * configurations that are not supported by the BSC. Normally such situations |
| 4643 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4644 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4645 | * to offer rates that are not applicable anyway. */ |
| 4646 | |
| 4647 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4648 | /* Try to include 12,2k in into the active set even though the channel |
| 4649 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4650 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4651 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4652 | } |
| 4653 | |
| 4654 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4655 | /* See what happens when all rates are selected at once. Since then |
| 4656 | * Also S1 is selected, this setting will be prefered and we should |
| 4657 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4658 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4659 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4660 | } |
| 4661 | |
| 4662 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4663 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4664 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4665 | * 5,90k, and 4,75k, into the active set. */ |
| 4666 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4667 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4668 | } |
| 4669 | |
| 4670 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4671 | /* Try to select no rates at all */ |
| 4672 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4673 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4674 | } |
| 4675 | |
| 4676 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4677 | /* Try to select only unsupported rates */ |
| 4678 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4679 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4680 | } |
| 4681 | |
| 4682 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4683 | /* Try to select 12,2k for half rate */ |
| 4684 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4685 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4686 | } |
| 4687 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4688 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4689 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4690 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4691 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4692 | } |
| 4693 | |
| 4694 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4695 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4696 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4697 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4698 | } |
| 4699 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4700 | 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] | 4701 | /* "amr tch-f modes 0 2 4 7" => total 4 modes and start mode 4 => '11'B on the wire */ |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4702 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4703 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4704 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4705 | } |
| 4706 | |
| 4707 | 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] | 4708 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4709 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4710 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4711 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4712 | } |
| 4713 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4714 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4715 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4716 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4717 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4718 | 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] | 4719 | } |
| 4720 | |
| 4721 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4722 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4723 | 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] | 4724 | } |
| 4725 | |
| 4726 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4727 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4728 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4729 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4730 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4731 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4732 | 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] | 4733 | } |
| 4734 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4735 | private function f_disable_all_sdcch() runs on test_CT { |
| 4736 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4737 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4738 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4739 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4740 | } |
| 4741 | |
| 4742 | private function f_enable_all_sdcch() runs on test_CT { |
| 4743 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4744 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4745 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4746 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4747 | } |
| 4748 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4749 | /* Allow HR only */ |
| 4750 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4751 | g_pars := f_gen_test_hdlr_pars(); |
| 4752 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4753 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4754 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4755 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4756 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4757 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4758 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4759 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4760 | } |
| 4761 | |
| 4762 | /* Allow FR only */ |
| 4763 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4764 | g_pars := f_gen_test_hdlr_pars(); |
| 4765 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4766 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4767 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4768 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4769 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4770 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4771 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4772 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4773 | } |
| 4774 | |
| 4775 | /* Allow HR only (expect assignment failure) */ |
| 4776 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4777 | g_pars := f_gen_test_hdlr_pars(); |
| 4778 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4779 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4780 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4781 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4782 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4783 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4784 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4785 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4786 | } |
| 4787 | |
| 4788 | /* Allow FR only (expect assignment failure) */ |
| 4789 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4790 | g_pars := f_gen_test_hdlr_pars(); |
| 4791 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4792 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4793 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4794 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4795 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4796 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4797 | f_establish_fully(ass_cmd, exp_fail); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4798 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4799 | } |
| 4800 | |
| 4801 | /* Allow FR and HR, but prefer FR */ |
| 4802 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4803 | g_pars := f_gen_test_hdlr_pars(); |
| 4804 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4805 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4806 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4807 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4808 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4809 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4810 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4811 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4812 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4813 | } |
| 4814 | |
| 4815 | /* Allow FR and HR, but prefer HR */ |
| 4816 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4817 | g_pars := f_gen_test_hdlr_pars(); |
| 4818 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4819 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4820 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4821 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4822 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4823 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4824 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4825 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4826 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4827 | } |
| 4828 | |
| 4829 | /* Allow FR and HR, but prefer FR */ |
| 4830 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4831 | g_pars := f_gen_test_hdlr_pars(); |
| 4832 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4833 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4834 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4835 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4836 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4837 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4838 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4839 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4840 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4841 | } |
| 4842 | |
| 4843 | /* Allow FR and HR, but prefer HR */ |
| 4844 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4845 | g_pars := f_gen_test_hdlr_pars(); |
| 4846 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4847 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4848 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4849 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4850 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4851 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4852 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4853 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4854 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4855 | } |
| 4856 | |
| 4857 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4858 | * to work without conflicts */ |
| 4859 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4860 | var MSC_ConnHdlr vc_conn; |
| 4861 | f_init(1, true); |
| 4862 | f_sleep(1.0); |
| 4863 | f_enable_all_tch(); |
| 4864 | f_disable_all_tch_f(); |
| 4865 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4866 | vc_conn.done; |
| 4867 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4868 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4869 | } |
| 4870 | |
| 4871 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4872 | * to fail. */ |
| 4873 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4874 | var MSC_ConnHdlr vc_conn; |
| 4875 | f_init(1, true); |
| 4876 | f_sleep(1.0); |
| 4877 | f_enable_all_tch(); |
| 4878 | f_disable_all_tch_f(); |
| 4879 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4880 | vc_conn.done; |
| 4881 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4882 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4883 | } |
| 4884 | |
| 4885 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4886 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4887 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4888 | var MSC_ConnHdlr vc_conn; |
| 4889 | f_init(1, true); |
| 4890 | f_sleep(1.0); |
| 4891 | f_enable_all_tch(); |
| 4892 | f_disable_all_tch_f(); |
| 4893 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4894 | vc_conn.done; |
| 4895 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4896 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4897 | } |
| 4898 | |
| 4899 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4900 | * are exhausted, this is expected to work without conflicts. */ |
| 4901 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4902 | var MSC_ConnHdlr vc_conn; |
| 4903 | f_init(1, true); |
| 4904 | f_sleep(1.0); |
| 4905 | f_enable_all_tch(); |
| 4906 | f_disable_all_tch_f(); |
| 4907 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4908 | vc_conn.done; |
| 4909 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4910 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4911 | } |
| 4912 | |
| 4913 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4914 | * to work without conflicts */ |
| 4915 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4916 | var MSC_ConnHdlr vc_conn; |
| 4917 | f_init(1, true); |
| 4918 | f_sleep(1.0); |
| 4919 | f_enable_all_tch(); |
| 4920 | f_disable_all_tch_h(); |
| 4921 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4922 | vc_conn.done; |
| 4923 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4924 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4925 | } |
| 4926 | |
| 4927 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4928 | * to fail. */ |
| 4929 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4930 | var MSC_ConnHdlr vc_conn; |
| 4931 | f_init(1, true); |
| 4932 | f_sleep(1.0); |
| 4933 | f_enable_all_tch(); |
| 4934 | f_disable_all_tch_h(); |
| 4935 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4936 | vc_conn.done; |
| 4937 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4938 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4939 | } |
| 4940 | |
| 4941 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4942 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4943 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4944 | var MSC_ConnHdlr vc_conn; |
| 4945 | f_init(1, true); |
| 4946 | f_sleep(1.0); |
| 4947 | f_enable_all_tch(); |
| 4948 | f_disable_all_tch_h(); |
| 4949 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4950 | vc_conn.done; |
| 4951 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4952 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4953 | } |
| 4954 | |
| 4955 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4956 | * are exhausted, this is expected to work without conflicts. */ |
| 4957 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4958 | var MSC_ConnHdlr vc_conn; |
| 4959 | f_init(1, true); |
| 4960 | f_sleep(1.0); |
| 4961 | f_enable_all_tch(); |
| 4962 | f_disable_all_tch_h(); |
| 4963 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4964 | vc_conn.done; |
| 4965 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4966 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4967 | } |
| 4968 | |
| 4969 | /* Allow FR and HR, but prefer HR */ |
| 4970 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4971 | g_pars := f_gen_test_hdlr_pars(); |
| 4972 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4973 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4974 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4975 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4976 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4977 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4978 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4979 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4980 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4981 | } |
| 4982 | |
| 4983 | /* Allow FR and HR, but prefer FR */ |
| 4984 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4985 | g_pars := f_gen_test_hdlr_pars(); |
| 4986 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4987 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4988 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4989 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4990 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4991 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4992 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4993 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 4994 | f_perform_clear(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4995 | } |
| 4996 | |
| 4997 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4998 | * HR, which is the prefered type, is selected. */ |
| 4999 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 5000 | var MSC_ConnHdlr vc_conn; |
| 5001 | f_init(1, true); |
| 5002 | f_sleep(1.0); |
| 5003 | f_enable_all_tch(); |
| 5004 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 5005 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5006 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5007 | } |
| 5008 | |
| 5009 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 5010 | * FR, which is the prefered type, is selected. */ |
| 5011 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 5012 | var MSC_ConnHdlr vc_conn; |
| 5013 | f_init(1, true); |
| 5014 | f_sleep(1.0); |
| 5015 | f_enable_all_tch(); |
| 5016 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 5017 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5018 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 5019 | } |
| 5020 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5021 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 5022 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 5023 | g_pars := f_gen_test_hdlr_pars(); |
| 5024 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 5025 | |
| 5026 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 5027 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 5028 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 5029 | var template uint3_t tsc := ?; |
| 5030 | |
| 5031 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 5032 | f_create_bssmap_exp(l3_enc); |
| 5033 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 5034 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 5035 | |
| 5036 | /* we should now have a COMPL_L3 at the MSC */ |
| 5037 | timer T := 10.0; |
| 5038 | T.start; |
| 5039 | alt { |
| 5040 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 5041 | [] T.timeout { |
| 5042 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 5043 | } |
| 5044 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5045 | |
| 5046 | f_perform_clear(); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5047 | } |
| 5048 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 5049 | var MSC_ConnHdlr vc_conn; |
| 5050 | f_init(1, true); |
| 5051 | f_sleep(1.0); |
| 5052 | f_disable_all_sdcch(); |
| 5053 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 5054 | vc_conn.done; |
| 5055 | f_enable_all_sdcch(); |
| 5056 | f_shutdown_helper(); |
| 5057 | } |
| 5058 | |
| 5059 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 5060 | expected that no TCH will be selected for signalling and assigment will fail |
| 5061 | because it's dictated by VTY config */ |
| 5062 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 5063 | var RSL_Message rsl_unused, rsl_msg; |
| 5064 | var GsmRrMessage rr; |
| 5065 | f_init(1, false); |
| 5066 | f_sleep(1.0); |
| 5067 | f_vty_allow_tch_for_signalling(false, 0); |
| 5068 | f_disable_all_sdcch(); |
| 5069 | |
| 5070 | /* RA containing reason=LU */ |
| 5071 | f_ipa_tx(0, ts_RSL_CHAN_RQD('02'O, 2342)); |
| 5072 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 5073 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 5074 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 5075 | setverdict(fail, "Expected reject"); |
| 5076 | } |
| 5077 | |
| 5078 | f_vty_allow_tch_for_signalling(true, 0); |
| 5079 | f_enable_all_sdcch(); |
| 5080 | f_shutdown_helper(); |
| 5081 | } |
| 5082 | |
| 5083 | /* Request a voice channel with all SDCCH exhausted, it is |
| 5084 | * expected that TCH channel will be allocated since the VTY option is only |
| 5085 | * aimed at signalling requests */ |
| 5086 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 5087 | g_pars := f_gen_test_hdlr_pars(); |
| 5088 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 5089 | |
| 5090 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 5091 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 5092 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 5093 | var template uint3_t tsc := ?; |
| 5094 | |
| 5095 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 5096 | f_create_bssmap_exp(l3_enc); |
| 5097 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 5098 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 5099 | |
| 5100 | /* we should now have a COMPL_L3 at the MSC */ |
| 5101 | timer T := 10.0; |
| 5102 | T.start; |
| 5103 | alt { |
| 5104 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 5105 | [] T.timeout { |
| 5106 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 5107 | } |
| 5108 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5109 | f_perform_clear(); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 5110 | } |
| 5111 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 5112 | var MSC_ConnHdlr vc_conn; |
| 5113 | f_init(1, true); |
| 5114 | f_sleep(1.0); |
| 5115 | f_vty_allow_tch_for_signalling(false, 0); |
| 5116 | f_disable_all_sdcch(); |
| 5117 | |
| 5118 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 5119 | vc_conn.done; |
| 5120 | |
| 5121 | f_vty_allow_tch_for_signalling(true, 0); |
| 5122 | f_enable_all_sdcch(); |
| 5123 | f_shutdown_helper(); |
| 5124 | } |
| 5125 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5126 | testcase TC_assignment_osmux() runs on test_CT { |
| 5127 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5128 | var MSC_ConnHdlr vc_conn; |
| 5129 | |
| 5130 | /* See note above */ |
| 5131 | var RSL_IE_Body mr_conf := { |
| 5132 | other := { |
| 5133 | len := 2, |
| 5134 | payload := '2804'O |
| 5135 | } |
| 5136 | }; |
| 5137 | |
| 5138 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 5139 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 5140 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 5141 | pars.expect_mr_conf_ie := mr_conf; |
| 5142 | pars.use_osmux := true; |
| 5143 | |
| 5144 | f_init(1, true, true); |
| 5145 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5146 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5147 | |
| 5148 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 5149 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 5150 | |
| 5151 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 5152 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 5153 | } |
| 5154 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5155 | /* test the procedure of the MSC requesting a Classmark Update: |
| 5156 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 5157 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5158 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 5159 | g_pars := f_gen_test_hdlr_pars(); |
| 5160 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5161 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5162 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5163 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 5164 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 5165 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 5166 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5167 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 5168 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 5169 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5170 | |
| 5171 | f_perform_clear(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5172 | } |
| 5173 | testcase TC_classmark() runs on test_CT { |
| 5174 | var MSC_ConnHdlr vc_conn; |
| 5175 | f_init(1, true); |
| 5176 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5177 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5178 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5179 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5180 | } |
| 5181 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5182 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 5183 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 5184 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 5185 | g_pars := f_gen_test_hdlr_pars(); |
| 5186 | f_MscConnHdlr_init_vty(); |
| 5187 | |
| 5188 | f_create_chan_and_exp(); |
| 5189 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5190 | |
| 5191 | /* Send CommonID */ |
| 5192 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 5193 | |
| 5194 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 5195 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 5196 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 5197 | |
| 5198 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5199 | |
| 5200 | f_perform_clear(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5201 | } |
| 5202 | testcase TC_common_id() runs on test_CT { |
| 5203 | var MSC_ConnHdlr vc_conn; |
| 5204 | f_init(1, true); |
| 5205 | f_sleep(1.0); |
| 5206 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 5207 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5208 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 5209 | } |
| 5210 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5211 | 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] | 5212 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5213 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5214 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5215 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5216 | /* send the single message we want to send */ |
| 5217 | f_rsl_send_l3(l3); |
| 5218 | } |
| 5219 | |
| 5220 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 5221 | timer T := sec; |
| 5222 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5223 | T.start; |
| 5224 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5225 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 5226 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5227 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5228 | } |
| 5229 | [] T.timeout { |
| 5230 | setverdict(pass); |
| 5231 | } |
| 5232 | } |
| 5233 | } |
| 5234 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5235 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5236 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 5237 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 5238 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5239 | f_perform_clear(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5240 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5241 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 5242 | var MSC_ConnHdlr vc_conn; |
| 5243 | f_init(1, true); |
| 5244 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5245 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5246 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5247 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 5248 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5249 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5250 | |
| 5251 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5252 | 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] | 5253 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 5254 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5255 | f_perform_clear(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5256 | } |
| 5257 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 5258 | var MSC_ConnHdlr vc_conn; |
| 5259 | f_init(1, true); |
| 5260 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5261 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5262 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5263 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 5264 | } |
| 5265 | |
| 5266 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5267 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 5268 | 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] | 5269 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 5270 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5271 | f_perform_clear(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5272 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5273 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 5274 | var MSC_ConnHdlr vc_conn; |
| 5275 | f_init(1, true); |
| 5276 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5277 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5278 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5279 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 5280 | } |
| 5281 | |
| 5282 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5283 | /* short message from MS should be ignored */ |
| 5284 | 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] | 5285 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5286 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5287 | /* we should now have a COMPL_L3 at the MSC */ |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5288 | |
| 5289 | /* send short message */ |
| 5290 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 5291 | f_bssap_expect_nothing(); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5292 | f_perform_clear(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5293 | } |
| 5294 | testcase TC_err_82_short_msg() runs on test_CT { |
| 5295 | var MSC_ConnHdlr vc_conn; |
| 5296 | f_init(1, true); |
| 5297 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5298 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5299 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5300 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 5301 | } |
| 5302 | |
| 5303 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5304 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 5305 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 5306 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 5307 | timer T := 3.0 |
| 5308 | alt { |
| 5309 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 5310 | setverdict(pass); |
| 5311 | } |
| 5312 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 5313 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5314 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5315 | f_perform_clear(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5316 | } |
| 5317 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 5318 | var MSC_ConnHdlr vc_conn; |
| 5319 | f_init(1, true); |
| 5320 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5321 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5322 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5323 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5324 | } |
| 5325 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5326 | /*********************************************************************** |
| 5327 | * Handover |
| 5328 | ***********************************************************************/ |
| 5329 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5330 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 5331 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 5332 | runs on test_CT { |
| 5333 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5334 | " timeslot "&int2str(ts_nr)&" "; |
| 5335 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 5336 | } |
| 5337 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5338 | /* 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] | 5339 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 5340 | uint8_t bts_nr, uint8_t trx_nr, |
| 5341 | in RslChannelNr chan_nr) |
| 5342 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5343 | /* FIXME: resolve those from component-global state */ |
| 5344 | var integer ts_nr := chan_nr.tn; |
| 5345 | var integer ss_nr; |
| 5346 | if (ischosen(chan_nr.u.ch0)) { |
| 5347 | ss_nr := 0; |
| 5348 | } else if (ischosen(chan_nr.u.lm)) { |
| 5349 | ss_nr := chan_nr.u.lm.sub_chan; |
| 5350 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 5351 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 5352 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 5353 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 5354 | } else { |
| 5355 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5356 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5357 | } |
| 5358 | |
| 5359 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5360 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5361 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5362 | } |
| 5363 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5364 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 5365 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 5366 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 5367 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 5368 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5369 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 5370 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 5371 | { |
| 5372 | 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] | 5373 | } |
| 5374 | |
| 5375 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 5376 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 5377 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5378 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5379 | |
| 5380 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5381 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5382 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5383 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5384 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5385 | |
| 5386 | var HandoverState hs := { |
| 5387 | rr_ho_cmpl_seen := false, |
| 5388 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5389 | old_chan_nr := -, |
| 5390 | expect_target_tsc := BTS_TSC[1] |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5391 | }; |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5392 | /* issue hand-over command on VTY, from BTS 0 to BTS 1 */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5393 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5394 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5395 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5396 | |
| 5397 | /* From the MGW perspective, a handover is is characterized by |
| 5398 | * performing one MDCX operation with the MGW. So we expect to see |
| 5399 | * one more MDCX during handover. */ |
| 5400 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5401 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5402 | alt { |
| 5403 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5404 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5405 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 5406 | /* Since this is an internal handover we expect the BSC to inform the |
| 5407 | * MSC about the event */ |
| 5408 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 5409 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5410 | /* Check the amount of MGCP transactions is still consistant with the |
| 5411 | * test expectation */ |
| 5412 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5413 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5414 | var RSL_Message chan_act := f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr); |
| 5415 | |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5416 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 5417 | * 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] | 5418 | f_verify_encr_info(chan_act); |
| 5419 | |
| 5420 | f_chan_act_verify_tsc(chan_act, BTS_TSC[1]); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5421 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5422 | f_perform_clear(RSL1, RSL1_PROC); |
| 5423 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5424 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5425 | } |
| 5426 | |
| 5427 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5428 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5429 | var MSC_ConnHdlr vc_conn; |
| 5430 | f_init(2, true); |
| 5431 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5432 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5433 | pars.expect_tsc := BTS_TSC[0]; |
| 5434 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5435 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5436 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5437 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5438 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5439 | |
| 5440 | /* from f_establish_fully() */ |
| 5441 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5442 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5443 | /* from handover */ |
| 5444 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5445 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5446 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5447 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5448 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5449 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5450 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5451 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5452 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5453 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5454 | 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] | 5455 | var MSC_ConnHdlr vc_conn; |
| 5456 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5457 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5458 | |
| 5459 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5460 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5461 | f_sleep(1.0); |
| 5462 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5463 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5464 | |
| 5465 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 5466 | vc_conn.done; |
| 5467 | |
| 5468 | /* from f_establish_fully() */ |
| 5469 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5470 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5471 | /* from handover */ |
| 5472 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5473 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5474 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5475 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5476 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5477 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:completed"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5478 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5479 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5480 | f_shutdown_helper(); |
| 5481 | } |
| 5482 | |
| 5483 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 5484 | f_tc_ho_int_a5('01'O); |
| 5485 | } |
| 5486 | |
| 5487 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 5488 | f_tc_ho_int_a5('02'O); |
| 5489 | } |
| 5490 | |
| 5491 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 5492 | f_tc_ho_int_a5('08'O); |
| 5493 | } |
| 5494 | |
| 5495 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5496 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5497 | } |
| 5498 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5499 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 5500 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 5501 | g_pars := f_gen_test_hdlr_pars(); |
| 5502 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5503 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5504 | |
| 5505 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5506 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5507 | |
| 5508 | f_establish_fully(ass_cmd, exp_compl); |
| 5509 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 5510 | |
| 5511 | var HandoverState hs := { |
| 5512 | rr_ho_cmpl_seen := false, |
| 5513 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5514 | old_chan_nr := -, |
| 5515 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5516 | }; |
| 5517 | /* issue hand-over command on VTY */ |
| 5518 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 5519 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5520 | f_rslem_suspend(RSL1_PROC); |
| 5521 | |
| 5522 | /* From the MGW perspective, a handover is is characterized by |
| 5523 | * performing one MDCX operation with the MGW. So we expect to see |
| 5524 | * one more MDCX during handover. */ |
| 5525 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5526 | |
| 5527 | var RSL_Message rsl; |
| 5528 | var PDU_ML3_NW_MS l3; |
| 5529 | var RslChannelNr new_chan_nr; |
| 5530 | var GsmArfcn arfcn; |
| 5531 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5532 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5533 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5534 | setverdict(fail, "Expected handoverCommand"); |
| 5535 | mtc.stop; |
| 5536 | } |
| 5537 | } |
| 5538 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5539 | new_chan_nr, arfcn); |
| 5540 | |
| 5541 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5542 | |
| 5543 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5544 | * before performing a hand-over */ |
| 5545 | f_rslem_resume(RSL1_PROC); |
| 5546 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5547 | |
| 5548 | f_sleep(1.0); |
| 5549 | |
| 5550 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5551 | * and the old lchan reports a Radio Link Failure. */ |
| 5552 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5553 | |
| 5554 | var PDU_BSSAP rx_clear_request; |
| 5555 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5556 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5557 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5558 | |
| 5559 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5560 | |
| 5561 | var MgcpCommand mgcp; |
| 5562 | interleave { |
| 5563 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5564 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5565 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5566 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5567 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5568 | } |
| 5569 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5570 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5571 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5572 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5573 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5574 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 5575 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 5576 | } |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5577 | } |
| 5578 | |
| 5579 | f_sleep(0.5); |
| 5580 | setverdict(pass); |
| 5581 | } |
| 5582 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5583 | var MSC_ConnHdlr vc_conn; |
| 5584 | f_init(2, true); |
| 5585 | f_sleep(1.0); |
| 5586 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5587 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5588 | |
| 5589 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5590 | vc_conn.done; |
| 5591 | |
| 5592 | /* from f_establish_fully() */ |
| 5593 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5594 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5595 | /* from handover */ |
| 5596 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5597 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5598 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5599 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5600 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 5601 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:stopped"); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5602 | f_ctrs_bsc_and_bts_verify(); |
| 5603 | f_shutdown_helper(); |
| 5604 | } |
| 5605 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5606 | /* 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] | 5607 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5608 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5609 | var template MgcpResponse mgcp_resp; |
| 5610 | var MGCP_RecvFrom mrf; |
| 5611 | var template MgcpMessage msg_resp; |
| 5612 | var template MgcpMessage msg_dlcx := { |
| 5613 | command := tr_DLCX() |
| 5614 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5615 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5616 | if (g_pars.aoip) { |
| 5617 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5618 | log("Got first DLCX: ", mgcp); |
| 5619 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5620 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5621 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5622 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 5623 | log("Got second DLCX: ", mgcp); |
| 5624 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 5625 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5626 | } else { |
| 5627 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 5628 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 5629 | log("Got first DLCX: ", mrf.msg.command); |
| 5630 | msg_resp := { |
| 5631 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 5632 | } |
| 5633 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 5634 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5635 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5636 | } |
| 5637 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5638 | private function f_ho_out_of_this_bsc(template (omit) BSSMAP_oldToNewBSSIEs exp_oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5639 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 5640 | var NcellReports neighbor_rep := { |
| 5641 | { rxlev := 20, bcch_freq := 0, bsic := 11 } |
| 5642 | }; |
| 5643 | var octetstring l3_mr := enc_GsmRrL3Message(valueof(ts_MEAS_REP(true, 8, 8, reps := neighbor_rep))); |
| 5644 | RSL.send(ts_RSL_MEAS_RES(g_chan_nr, 0, ts_RSL_IE_UplinkMeas, ts_RSL_IE_BS_Power(0), ts_RSL_IE_L1Info, |
| 5645 | l3_mr, 0)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5646 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5647 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5648 | |
| 5649 | f_sleep(0.5); |
| 5650 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5651 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5652 | * containing an RR Handover Command coming from the target BSS... */ |
| 5653 | |
| 5654 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5655 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5656 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5657 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5658 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5659 | |
| 5660 | /* expect the Handover Command to go out on RR */ |
| 5661 | var RSL_Message rsl_ho_cmd |
| 5662 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5663 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5664 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5665 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5666 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5667 | setverdict(fail); |
| 5668 | } else { |
| 5669 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5670 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5671 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5672 | setverdict(fail); |
| 5673 | } else { |
| 5674 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5675 | setverdict(pass); |
| 5676 | } |
| 5677 | } |
| 5678 | |
| 5679 | /* When the other BSS has reported a completed handover, this side is |
| 5680 | * torn down. */ |
| 5681 | |
| 5682 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 5683 | var BssmapCause cause := enum2int(cause_val); |
| 5684 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5685 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5686 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5687 | |
| 5688 | interleave { |
| 5689 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 5690 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 5691 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5692 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 5693 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 5694 | } |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5695 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5696 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5697 | } |
| 5698 | |
| 5699 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5700 | g_pars := f_gen_test_hdlr_pars(); |
| 5701 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5702 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5703 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5704 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5705 | f_establish_fully(ass_req, exp_compl); |
| 5706 | |
| 5707 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5708 | } |
| 5709 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 5710 | var MSC_ConnHdlr vc_conn; |
| 5711 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 5712 | f_init_vty(); |
| 5713 | f_bts_0_cfg(BSCVTY, |
| 5714 | {"neighbor-list mode automatic", |
| 5715 | "handover 1", |
| 5716 | "handover algorithm 2", |
| 5717 | "handover2 window rxlev averaging 1", |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 5718 | "no neighbors", |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 5719 | "neighbor lac 99 arfcn 123 bsic any"}); |
| 5720 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5721 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5722 | f_init(1, true); |
| 5723 | f_sleep(1.0); |
| 5724 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5725 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5726 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5727 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 5728 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5729 | |
| 5730 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5731 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5732 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5733 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5734 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5735 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 5736 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5737 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5738 | } |
| 5739 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5740 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5741 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 5742 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5743 | octetstring l3 := '0123456789'O) |
| 5744 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5745 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 5746 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5747 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5748 | var template PDU_BSSAP exp_data := { |
| 5749 | discriminator := '1'B, |
| 5750 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5751 | dlci := dlci, |
| 5752 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5753 | pdu := { |
| 5754 | dtap := l3 |
| 5755 | } |
| 5756 | }; |
| 5757 | BSSAP.receive(exp_data); |
| 5758 | setverdict(pass); |
| 5759 | } |
| 5760 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5761 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5762 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5763 | template (value) OCT1 dlci := '00'O, |
| 5764 | octetstring l3 := '0123456789'O) |
| 5765 | runs on MSC_ConnHdlr { |
| 5766 | BSSAP.send(PDU_BSSAP:{ |
| 5767 | discriminator := '1'B, |
| 5768 | spare := '0000000'B, |
| 5769 | dlci := dlci, |
| 5770 | lengthIndicator := lengthof(l3), |
| 5771 | pdu := { |
| 5772 | dtap := l3 |
| 5773 | } |
| 5774 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5775 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5776 | setverdict(pass); |
| 5777 | } |
| 5778 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5779 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 5780 | * simply never sends a BSSMAP Handover Command. */ |
| 5781 | 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] | 5782 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5783 | |
| 5784 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5785 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5786 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5787 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5788 | f_establish_fully(ass_req, exp_compl); |
| 5789 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 5790 | 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] | 5791 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5792 | |
| 5793 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5794 | |
| 5795 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 5796 | * Let's give it a bit extra. */ |
| 5797 | f_sleep(15.0); |
| 5798 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5799 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5800 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5801 | f_perform_clear(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5802 | } |
| 5803 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 5804 | var MSC_ConnHdlr vc_conn; |
| 5805 | |
| 5806 | f_init(1, true); |
| 5807 | f_sleep(1.0); |
| 5808 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5809 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5810 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5811 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 5812 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5813 | |
| 5814 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5815 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5816 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5817 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5818 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5819 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5820 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5821 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5822 | } |
| 5823 | |
| 5824 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 5825 | * RR Handover Failure. */ |
| 5826 | 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] | 5827 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5828 | |
| 5829 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5830 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5831 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5832 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5833 | f_establish_fully(ass_req, exp_compl); |
| 5834 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 5835 | 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] | 5836 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5837 | |
| 5838 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5839 | |
| 5840 | f_sleep(0.5); |
| 5841 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5842 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5843 | * containing an RR Handover Command coming from the target BSS... */ |
| 5844 | |
| 5845 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5846 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5847 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5848 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5849 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5850 | |
| 5851 | /* expect the Handover Command to go out on RR */ |
| 5852 | var RSL_Message rsl_ho_cmd |
| 5853 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5854 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5855 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5856 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5857 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5858 | setverdict(fail); |
| 5859 | } else { |
| 5860 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5861 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5862 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5863 | setverdict(fail); |
| 5864 | } else { |
| 5865 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5866 | setverdict(pass); |
| 5867 | } |
| 5868 | } |
| 5869 | |
| 5870 | f_sleep(0.2); |
| 5871 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5872 | |
| 5873 | /* Should tell the MSC about the failure */ |
| 5874 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5875 | |
| 5876 | f_sleep(1.0); |
| 5877 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5878 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5879 | f_sleep(1.0); |
| 5880 | |
| 5881 | setverdict(pass); |
| 5882 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5883 | f_perform_clear(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5884 | } |
| 5885 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5886 | var MSC_ConnHdlr vc_conn; |
| 5887 | |
| 5888 | f_init(1, true); |
| 5889 | f_sleep(1.0); |
| 5890 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5891 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5892 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5893 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5894 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5895 | |
| 5896 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5897 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5898 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5899 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5900 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5901 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5902 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5903 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5904 | } |
| 5905 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5906 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5907 | * (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] | 5908 | * and the lchan is released. */ |
| 5909 | 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] | 5910 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5911 | |
| 5912 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5913 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5914 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5915 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5916 | f_establish_fully(ass_req, exp_compl); |
| 5917 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 5918 | 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] | 5919 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5920 | |
| 5921 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5922 | |
| 5923 | f_sleep(0.5); |
| 5924 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5925 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5926 | * containing an RR Handover Command coming from the target BSS... */ |
| 5927 | |
| 5928 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5929 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5930 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5931 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5932 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5933 | |
| 5934 | /* expect the Handover Command to go out on RR */ |
| 5935 | var RSL_Message rsl_ho_cmd |
| 5936 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5937 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5938 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5939 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5940 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5941 | setverdict(fail); |
| 5942 | } else { |
| 5943 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5944 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5945 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5946 | setverdict(fail); |
| 5947 | } else { |
| 5948 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5949 | setverdict(pass); |
| 5950 | } |
| 5951 | } |
| 5952 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5953 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5954 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5955 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5956 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5957 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5958 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5959 | log("Got BSSMAP Clear Request"); |
| 5960 | /* Instruct BSC to clear channel */ |
| 5961 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5962 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5963 | |
| 5964 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5965 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5966 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5967 | log("Got Deact SACCH"); |
| 5968 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5969 | [] 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] | 5970 | log("Got RR Release"); |
| 5971 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5972 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5973 | log("Got RF Chan Rel"); |
| 5974 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5975 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5976 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5977 | } |
| 5978 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5979 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5980 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 5981 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5982 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5983 | setverdict(pass); |
| 5984 | f_sleep(1.0); |
| 5985 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5986 | 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] | 5987 | var MSC_ConnHdlr vc_conn; |
| 5988 | |
| 5989 | f_init(1, true); |
| 5990 | f_sleep(1.0); |
| 5991 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 5992 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5993 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5994 | 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] | 5995 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5996 | |
| 5997 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5998 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5999 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6000 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6001 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6002 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6003 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6004 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 6005 | } |
| 6006 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6007 | 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] | 6008 | var PDU_BSSAP rx_bssap; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6009 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6010 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6011 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6012 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6013 | * before we get started. */ |
| 6014 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6015 | f_rslem_register(0, new_chan_nr); |
| 6016 | g_chan_nr := new_chan_nr; |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 6017 | var uint3_t expect_target_tsc := BTS_TSC[0]; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6018 | f_sleep(1.0); |
| 6019 | |
| 6020 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6021 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6022 | activate(as_Media()); |
| 6023 | |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 6024 | var PDU_BSSAP ho_req := f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
| 6025 | cell_id_source := g_pars.cell_id_source, |
| 6026 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 6027 | enc := g_pars.encr); |
| 6028 | if (g_pars.inter_bsc_ho_in__ho_req_in_initial_sccp_cr) { |
| 6029 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, ho_req)); |
| 6030 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 6031 | } else { |
| 6032 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, omit)); |
| 6033 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 6034 | BSSAP.send(ho_req); |
| 6035 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6036 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6037 | alt { |
| 6038 | [] BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap { |
| 6039 | if (g_pars.expect_ho_fail) { |
| 6040 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6041 | "Expected Handover Request to fail, but got Handover Request Ack") |
| 6042 | } |
| 6043 | } |
| 6044 | [] BSSAP.receive(tr_BSSMAP_HandoverFailure) -> value rx_bssap { |
| 6045 | if (not g_pars.expect_ho_fail) { |
| 6046 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6047 | "Expected Handover Request to succeed, but got Handover Failure") |
| 6048 | } |
| 6049 | // TODO: evaluate correct cause value. But osmo-bsc doesn't seem to send meaningful causes yet! |
| 6050 | // For now just accept any cause. |
| 6051 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6052 | setverdict(pass); |
| 6053 | return; |
| 6054 | } |
| 6055 | } |
| 6056 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6057 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6058 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 6059 | /* we're sure that the channel activation is done now, verify the parameters in it */ |
| 6060 | var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 6061 | f_verify_encr_info(chan_act); |
| 6062 | f_chan_act_verify_tsc(chan_act, expect_target_tsc); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6063 | |
Neels Hofmeyr | 46e16e5 | 2022-02-23 17:04:00 +0100 | [diff] [blame] | 6064 | if (ispresent(rx_bssap.pdu.bssmap.handoverRequestAck.codecList)) { |
| 6065 | if (not g_pars.aoip) { |
| 6066 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6067 | "handoverRequestAck: Expected no Speech Codec List (BSS Supported), because this is not AoIP"); |
| 6068 | } |
| 6069 | /* TODO: check actual codecs? */ |
| 6070 | } else { |
| 6071 | if (g_pars.aoip) { |
| 6072 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6073 | "handoverRequestAck: Expected Speech Codec List (BSS Supported), but none found"); |
| 6074 | } |
| 6075 | } |
| 6076 | |
| 6077 | if (ispresent(rx_bssap.pdu.bssmap.handoverRequestAck.speechCodec)) { |
| 6078 | if (not g_pars.aoip) { |
| 6079 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6080 | "handoverRequestAck: Expected no Speech Codec (Chosen), because this is not AoIP"); |
| 6081 | } |
| 6082 | /* TODO: check actual codec? */ |
| 6083 | } else { |
| 6084 | if (g_pars.aoip) { |
| 6085 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, |
| 6086 | "handoverRequestAck: Expected Speech Codec (Chosen), but none found"); |
| 6087 | } |
| 6088 | } |
| 6089 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6090 | var octetstring ho_command_str; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6091 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6092 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6093 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6094 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6095 | |
| 6096 | var GsmArfcn arfcn; |
| 6097 | var RslChannelNr actual_new_chan_nr; |
| 6098 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6099 | actual_new_chan_nr, arfcn); |
| 6100 | |
| 6101 | if (actual_new_chan_nr != new_chan_nr) { |
| 6102 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6103 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6104 | setverdict(fail); |
| 6105 | return; |
| 6106 | } |
| 6107 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6108 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 6109 | var uint3_t got_tsc := rr_chan_desc_tsc(ho_command.msgs.rrm.handoverCommand.channelDescription2); |
| 6110 | if (not match(got_tsc, expect_target_tsc)) { |
| 6111 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 6112 | expect_target_tsc, " got ", got_tsc); |
| 6113 | mtc.stop; |
| 6114 | } else { |
| 6115 | log("handoverCommand: verified TSC = ", got_tsc); |
| 6116 | } |
| 6117 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6118 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6119 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6120 | * the new lchan with a Handover RACH: */ |
| 6121 | |
| 6122 | /* send handover detect */ |
| 6123 | |
| 6124 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6125 | |
| 6126 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6127 | |
| 6128 | /* send handover complete over the new channel */ |
| 6129 | |
| 6130 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 6131 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 6132 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 6133 | |
| 6134 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6135 | setverdict(pass); |
| 6136 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6137 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6138 | 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] | 6139 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6140 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 6141 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 6142 | 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] | 6143 | } |
| 6144 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6145 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6146 | } else { |
| 6147 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6148 | } |
| 6149 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6150 | if (g_pars.expect_ho_fail) { |
| 6151 | f_perform_clear_no_lchan(); |
| 6152 | } else { |
| 6153 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
| 6154 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6155 | setverdict(pass); |
| 6156 | } |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6157 | 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] | 6158 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6159 | |
| 6160 | f_init(1, true); |
| 6161 | f_sleep(1.0); |
| 6162 | |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6163 | f_vty_encryption_a5(vty_a5_cfg); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6164 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6165 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6166 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6167 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6168 | |
| 6169 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 6170 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6171 | |
| 6172 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6173 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6174 | if (pars.expect_ho_fail) { |
| 6175 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6176 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:failed"); |
| 6177 | } else { |
| 6178 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 6179 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 6180 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6181 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6182 | |
| 6183 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6184 | } |
| 6185 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6186 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 6187 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6188 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6189 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6190 | } |
| 6191 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6192 | function f_tc_ho_into_this_bsc_a5(TestHdlrEncrParams encr, charstring vty_a5_cfg := VTY_A5_DEFAULT, |
| 6193 | boolean expect_fail := false) runs on test_CT { |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6194 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6195 | pars.encr := encr; |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6196 | pars.expect_ho_fail := expect_fail; |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6197 | f_tc_ho_into_this_bsc_main(pars, vty_a5_cfg); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6198 | f_shutdown_helper(); |
| 6199 | } |
| 6200 | |
| 6201 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6202 | f_tc_ho_into_this_bsc_a5(f_encr_params('01'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6203 | } |
| 6204 | |
| 6205 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6206 | f_tc_ho_into_this_bsc_a5(f_encr_params('02'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6207 | } |
| 6208 | |
| 6209 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
Neels Hofmeyr | d23e8a0 | 2022-02-17 01:55:59 +0100 | [diff] [blame] | 6210 | f_tc_ho_into_this_bsc_a5(f_encr_params('08'O)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 6211 | } |
| 6212 | |
| 6213 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
Neels Hofmeyr | 731ddc5 | 2022-02-17 21:56:15 +0100 | [diff] [blame] | 6214 | 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] | 6215 | } |
| 6216 | |
Neels Hofmeyr | 1951be2 | 2022-02-16 16:21:07 +0100 | [diff] [blame] | 6217 | /* Report: in inter-BSC incoming handover, when the MSC omits the Chosen Encryption Algorithm IE in the Handover Request |
| 6218 | * message, then osmo-bsc starts an unencrypted lchan even if A5/0 is not permitted. |
| 6219 | * |
| 6220 | * This test verifies that the Encryption Information is present in the Channel Activation when the Chosen Enc Alg is |
| 6221 | * omitted. |
| 6222 | * |
| 6223 | * Related: SYS#5839 |
| 6224 | */ |
| 6225 | testcase TC_ho_into_this_bsc_a5_1_3_no_chosen_enc_alg() runs on test_CT { |
| 6226 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '0a'O, alg_expect := '08'O, alg_chosen := omit)); |
| 6227 | } |
| 6228 | |
| 6229 | testcase TC_ho_into_this_bsc_a5_1_3() runs on test_CT { |
| 6230 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '0a'O, alg_expect := '08'O)); |
| 6231 | } |
| 6232 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 6233 | /* Send a permitted algo mask that does not intersect with osmo-bsc.cfg */ |
| 6234 | testcase TC_ho_into_this_bsc_a5_mismatch() runs on test_CT { |
| 6235 | f_tc_ho_into_this_bsc_a5(f_encr_params(alg_permitted := '18'O, alg_expect := '10'O), "0 1", |
| 6236 | expect_fail := true); // 0x18 = A5/3 and A5/4 |
| 6237 | } |
| 6238 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6239 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 6240 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6241 | pars.host_aoip_tla := "::6"; |
| 6242 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6243 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 6244 | } |
| 6245 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6246 | /* 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] | 6247 | 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] | 6248 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 6249 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 6250 | neighbors. */ |
| 6251 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 6252 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6253 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6254 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6255 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 6256 | |
| 6257 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6258 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6259 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6260 | f_shutdown_helper(); |
| 6261 | } |
| 6262 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6263 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 6264 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 6265 | list when the channel is released. */ |
| 6266 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 6267 | f_init_vty(); |
| 6268 | f_vty_allow_srvcc_fast_return(true, 0) |
| 6269 | |
| 6270 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6271 | pars.last_used_eutran_plmn := '323454'O; |
| 6272 | pars.exp_fast_return := false; |
| 6273 | f_tc_ho_into_this_bsc_main(pars); |
| 6274 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6275 | f_shutdown_helper(); |
| 6276 | } |
| 6277 | |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 6278 | /* Same as TC_srvcc_eutran_to_geran, but using SAI as serving Cell Identifier. SYS#5838 */ |
| 6279 | testcase TC_srvcc_eutran_to_geran_src_sai() runs on test_CT { |
| 6280 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6281 | pars.last_used_eutran_plmn := '323454'O; |
| 6282 | pars.cell_id_source := valueof(ts_CellID_SAI('123456'O, 300, 444)); |
| 6283 | f_tc_ho_into_this_bsc_main(pars); |
| 6284 | |
| 6285 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 6286 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 6287 | f_ctrs_bsc_and_bts_verify(); |
| 6288 | f_shutdown_helper(); |
| 6289 | } |
| 6290 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6291 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 6292 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 6293 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 6294 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 6295 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 6296 | setverdict(pass); |
| 6297 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6298 | |
| 6299 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 6300 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6301 | var MSC_ConnHdlr vc_conn; |
| 6302 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6303 | |
Neels Hofmeyr | 6cc90eb | 2021-12-15 12:49:39 +0100 | [diff] [blame] | 6304 | f_init_vty(); |
| 6305 | f_bts_0_cfg(BSCVTY, |
| 6306 | {"neighbor-list mode automatic", |
| 6307 | "handover 1", |
| 6308 | "handover algorithm 2", |
| 6309 | "handover2 window rxlev averaging 1", |
| 6310 | "no neighbors", |
| 6311 | "neighbor lac 99 arfcn 123 bsic any"}); |
| 6312 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6313 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6314 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6315 | if (disable_fast_return) { |
| 6316 | f_vty_allow_srvcc_fast_return(true, 0); |
| 6317 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6318 | f_sleep(1.0); |
| 6319 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6320 | f_ctrs_bsc_and_bts_handover_init(); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6321 | |
| 6322 | pars.last_used_eutran_plmn := '323454'O; |
| 6323 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6324 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 6325 | |
| 6326 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 6327 | vc_conn.done; |
| 6328 | |
| 6329 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 6330 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 6331 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 6332 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 6333 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 6334 | 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] | 6335 | |
| 6336 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 6337 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6338 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6339 | |
| 6340 | if (disable_fast_return) { |
| 6341 | f_vty_allow_srvcc_fast_return(false, 0); |
| 6342 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 6343 | f_shutdown_helper(); |
| 6344 | } |
| 6345 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 6346 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 6347 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 6348 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 6349 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 6350 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 6351 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 6352 | } |
| 6353 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 6354 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 6355 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 6356 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 6357 | } |
| 6358 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6359 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 6360 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6361 | f_rslem_register(0, new_chan_nr); |
| 6362 | g_chan_nr := new_chan_nr; |
| 6363 | f_sleep(1.0); |
| 6364 | |
| 6365 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6366 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6367 | activate(as_Media()); |
| 6368 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6369 | 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] | 6370 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6371 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6372 | |
| 6373 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6374 | |
| 6375 | var PDU_BSSAP rx_bssap; |
| 6376 | var octetstring ho_command_str; |
| 6377 | |
| 6378 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6379 | |
| 6380 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6381 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6382 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6383 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6384 | |
| 6385 | var GsmArfcn arfcn; |
| 6386 | var RslChannelNr actual_new_chan_nr; |
| 6387 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6388 | actual_new_chan_nr, arfcn); |
| 6389 | |
| 6390 | if (actual_new_chan_nr != new_chan_nr) { |
| 6391 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6392 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6393 | setverdict(fail); |
| 6394 | return; |
| 6395 | } |
| 6396 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6397 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 6398 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 6399 | f_sleep(1.0); |
| 6400 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6401 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6402 | * tells the MS to handover to the new lchan. In this case, the MS |
| 6403 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 6404 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 6405 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 6406 | * BSSMAP Clear Command: */ |
| 6407 | |
| 6408 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6409 | var BssmapCause cause := enum2int(cause_val); |
| 6410 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6411 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6412 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6413 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6414 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6415 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6416 | setverdict(pass); |
| 6417 | f_sleep(1.0); |
| 6418 | |
| 6419 | setverdict(pass); |
| 6420 | } |
| 6421 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 6422 | var MSC_ConnHdlr vc_conn; |
| 6423 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6424 | |
| 6425 | f_init(1, true); |
| 6426 | f_sleep(1.0); |
| 6427 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6428 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6429 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6430 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6431 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6432 | |
| 6433 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 6434 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6435 | |
| 6436 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6437 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6438 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6439 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6440 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6441 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6442 | } |
| 6443 | |
| 6444 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 6445 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6446 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6447 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6448 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6449 | * before we get started. */ |
| 6450 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6451 | f_rslem_register(0, new_chan_nr); |
| 6452 | g_chan_nr := new_chan_nr; |
| 6453 | f_sleep(1.0); |
| 6454 | |
| 6455 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6456 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6457 | activate(as_Media()); |
| 6458 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6459 | 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] | 6460 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6461 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6462 | |
| 6463 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6464 | |
| 6465 | var PDU_BSSAP rx_bssap; |
| 6466 | var octetstring ho_command_str; |
| 6467 | |
| 6468 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6469 | |
| 6470 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6471 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6472 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6473 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6474 | |
| 6475 | var GsmArfcn arfcn; |
| 6476 | var RslChannelNr actual_new_chan_nr; |
| 6477 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6478 | actual_new_chan_nr, arfcn); |
| 6479 | |
| 6480 | if (actual_new_chan_nr != new_chan_nr) { |
| 6481 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6482 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6483 | setverdict(fail); |
| 6484 | return; |
| 6485 | } |
| 6486 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6487 | |
| 6488 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6489 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6490 | * the new lchan with a Handover RACH: */ |
| 6491 | |
| 6492 | /* send handover detect */ |
| 6493 | |
| 6494 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6495 | |
| 6496 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6497 | |
| 6498 | /* The MSC chooses to clear the connection now, maybe we got the |
| 6499 | * Handover RACH on the new cell but the MS still signaled Handover |
| 6500 | * Failure to the old BSS? */ |
| 6501 | |
| 6502 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6503 | var BssmapCause cause := enum2int(cause_val); |
| 6504 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6505 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6506 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6507 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6508 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6509 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6510 | f_sleep(1.0); |
| 6511 | } |
| 6512 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 6513 | var MSC_ConnHdlr vc_conn; |
| 6514 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6515 | |
| 6516 | f_init(1, true); |
| 6517 | f_sleep(1.0); |
| 6518 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6519 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6520 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6521 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6522 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6523 | |
| 6524 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 6525 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6526 | |
| 6527 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6528 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6529 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6530 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6531 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6532 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6533 | } |
| 6534 | |
| 6535 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 6536 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 6537 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6538 | f_rslem_register(0, new_chan_nr); |
| 6539 | g_chan_nr := new_chan_nr; |
| 6540 | f_sleep(1.0); |
| 6541 | |
| 6542 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6543 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6544 | activate(as_Media()); |
| 6545 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6546 | 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] | 6547 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6548 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6549 | |
| 6550 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6551 | |
| 6552 | var PDU_BSSAP rx_bssap; |
| 6553 | var octetstring ho_command_str; |
| 6554 | |
| 6555 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6556 | |
| 6557 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6558 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6559 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6560 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6561 | |
| 6562 | var GsmArfcn arfcn; |
| 6563 | var RslChannelNr actual_new_chan_nr; |
| 6564 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6565 | actual_new_chan_nr, arfcn); |
| 6566 | |
| 6567 | if (actual_new_chan_nr != new_chan_nr) { |
| 6568 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6569 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6570 | setverdict(fail); |
| 6571 | return; |
| 6572 | } |
| 6573 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6574 | |
| 6575 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6576 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6577 | * on the new lchan. */ |
| 6578 | |
| 6579 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6580 | |
| 6581 | /* Did osmo-bsc also send a Clear Request? */ |
| 6582 | timer T := 0.5; |
| 6583 | T.start; |
| 6584 | alt { |
| 6585 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6586 | [] T.timeout { } |
| 6587 | } |
| 6588 | |
| 6589 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 6590 | * asked for it, this is a Handover Failure after all). */ |
| 6591 | |
| 6592 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6593 | var BssmapCause cause := enum2int(cause_val); |
| 6594 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6595 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6596 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6597 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6598 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6599 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6600 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6601 | } |
| 6602 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 6603 | var MSC_ConnHdlr vc_conn; |
| 6604 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6605 | |
| 6606 | f_init(1, true); |
| 6607 | f_sleep(1.0); |
| 6608 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6609 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6610 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6611 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6612 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6613 | |
| 6614 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 6615 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6616 | |
| 6617 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6618 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6619 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6620 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6621 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6622 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6623 | } |
| 6624 | |
| 6625 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 6626 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 6627 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6628 | f_rslem_register(0, new_chan_nr); |
| 6629 | g_chan_nr := new_chan_nr; |
| 6630 | f_sleep(1.0); |
| 6631 | |
| 6632 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6633 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6634 | activate(as_Media()); |
| 6635 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6636 | 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] | 6637 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6638 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6639 | |
| 6640 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6641 | |
| 6642 | var PDU_BSSAP rx_bssap; |
| 6643 | var octetstring ho_command_str; |
| 6644 | |
| 6645 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6646 | |
| 6647 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6648 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6649 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6650 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6651 | |
| 6652 | var GsmArfcn arfcn; |
| 6653 | var RslChannelNr actual_new_chan_nr; |
| 6654 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6655 | actual_new_chan_nr, arfcn); |
| 6656 | |
| 6657 | if (actual_new_chan_nr != new_chan_nr) { |
| 6658 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6659 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6660 | setverdict(fail); |
| 6661 | return; |
| 6662 | } |
| 6663 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6664 | |
| 6665 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6666 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6667 | * on the new lchan. */ |
| 6668 | |
| 6669 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6670 | |
| 6671 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6672 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6673 | |
| 6674 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6675 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6676 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6677 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6678 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6679 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6680 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6681 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6682 | f_sleep(1.0); |
| 6683 | } |
| 6684 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 6685 | var MSC_ConnHdlr vc_conn; |
| 6686 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6687 | |
| 6688 | f_init(1, true); |
| 6689 | f_sleep(1.0); |
| 6690 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6691 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6692 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6693 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6694 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6695 | |
| 6696 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 6697 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6698 | |
| 6699 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6700 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6701 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6702 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6703 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6704 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6705 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6706 | |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 6707 | /* An incoming inter-BSC HO can either issue the Handover Request message attached to the initial SCCP N-Connect (as in |
| 6708 | * the other tests we have so far), or the first CR can be "empty" with the BSSAP request following later. Test the |
| 6709 | * empty N-Connect case. */ |
| 6710 | testcase TC_ho_into_this_bsc_sccp_cr_without_bssap() runs on test_CT { |
| 6711 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6712 | pars.inter_bsc_ho_in__ho_req_in_initial_sccp_cr := false; |
| 6713 | f_tc_ho_into_this_bsc_main(pars); |
| 6714 | f_shutdown_helper(); |
| 6715 | } |
| 6716 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6717 | type record of charstring Commands; |
| 6718 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6719 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6720 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6721 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6722 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6723 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6724 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6725 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6726 | } |
| 6727 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 6728 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 6729 | { |
| 6730 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 6731 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 6732 | f_vty_transceive(pt, cmds[i]); |
| 6733 | } |
| 6734 | f_vty_transceive(pt, "end"); |
| 6735 | } |
| 6736 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6737 | private function f_probe_for_handover(charstring log_label, |
| 6738 | charstring log_descr, |
| 6739 | charstring handover_vty_cmd, |
| 6740 | boolean expect_handover, |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6741 | boolean is_inter_bsc_handover := false, |
| 6742 | template uint3_t expect_target_tsc := ?) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6743 | runs on MSC_ConnHdlr |
| 6744 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 6745 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 6746 | * lchans to be established on bts 1 or bts 2. */ |
| 6747 | f_rslem_suspend(RSL1_PROC); |
| 6748 | f_rslem_suspend(RSL2_PROC); |
| 6749 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6750 | var RSL_Message rsl; |
| 6751 | |
| 6752 | var charstring log_msg := " (expecting handover)" |
| 6753 | if (not expect_handover) { |
| 6754 | log_msg := " (expecting NO handover)"; |
| 6755 | } |
| 6756 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 6757 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 6758 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6759 | timer T := 2.0; |
| 6760 | T.start; |
| 6761 | |
| 6762 | alt { |
| 6763 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 6764 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 6765 | log("Rx L3 from net: ", l3); |
| 6766 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 6767 | var RslChannelNr new_chan_nr; |
| 6768 | var GsmArfcn arfcn; |
| 6769 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 6770 | new_chan_nr, arfcn); |
| 6771 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 6772 | log(l3.msgs.rrm.handoverCommand); |
| 6773 | |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6774 | /* Verify correct TSC in handoverCommand */ |
| 6775 | var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.handoverCommand.channelDescription2); |
| 6776 | if (not match(got_tsc, expect_target_tsc)) { |
| 6777 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 6778 | expect_target_tsc, " got ", got_tsc); |
| 6779 | mtc.stop; |
| 6780 | } else { |
| 6781 | log("handoverCommand: verified TSC = ", got_tsc, " (matches ", |
| 6782 | expect_target_tsc, ")"); |
| 6783 | } |
| 6784 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6785 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 6786 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 6787 | * anyway. */ |
| 6788 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 6789 | f_rslem_resume(RSL1_PROC); |
| 6790 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 6791 | f_rslem_resume(RSL2_PROC); |
| 6792 | |
| 6793 | if (expect_handover and not is_inter_bsc_handover) { |
| 6794 | setverdict(pass); |
| 6795 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 6796 | } else { |
| 6797 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 6798 | & log_label & ": " & log_descr); |
| 6799 | } |
| 6800 | |
| 6801 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 6802 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 6803 | * Handover Failure. */ |
| 6804 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6805 | |
| 6806 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 6807 | f_sleep(0.5); |
| 6808 | RSL1.clear; |
| 6809 | RSL2.clear; |
| 6810 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 6811 | break; |
| 6812 | } else { |
| 6813 | repeat; |
| 6814 | } |
| 6815 | } |
| 6816 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 6817 | if (expect_handover and is_inter_bsc_handover) { |
| 6818 | setverdict(pass); |
| 6819 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 6820 | } else { |
| 6821 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 6822 | & log_label & ": " & log_descr); |
| 6823 | } |
| 6824 | |
| 6825 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 6826 | |
| 6827 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 6828 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 6829 | * setting a short timeout and waiting is the only way. */ |
| 6830 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 6831 | f_sleep(1.5); |
| 6832 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 6833 | |
| 6834 | break; |
| 6835 | } |
| 6836 | [] T.timeout { |
| 6837 | if (expect_handover) { |
| 6838 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 6839 | & log_label & ": " & log_descr); |
| 6840 | } else { |
| 6841 | setverdict(pass); |
| 6842 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 6843 | } |
| 6844 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 6845 | break; |
| 6846 | } |
| 6847 | } |
| 6848 | |
| 6849 | f_rslem_resume(RSL1_PROC); |
| 6850 | f_rslem_resume(RSL2_PROC); |
| 6851 | f_sleep(3.0); |
| 6852 | RSL.clear; |
| 6853 | |
| 6854 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 6855 | } |
| 6856 | |
| 6857 | /* Test the effect of various neighbor configuration scenarios: |
| 6858 | * |
| 6859 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 6860 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 6861 | */ |
| 6862 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 6863 | g_pars := f_gen_test_hdlr_pars(); |
| 6864 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6865 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6866 | |
| 6867 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6868 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6869 | |
| 6870 | /* Establish lchan at bts 0 */ |
| 6871 | f_establish_fully(ass_cmd, exp_compl); |
| 6872 | |
| 6873 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 6874 | f_vty_enter_cfg_network(BSCVTY); |
| 6875 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 6876 | f_vty_transceive(BSCVTY, "end"); |
| 6877 | } |
| 6878 | |
| 6879 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 6880 | f_tc_ho_neighbor_config_start(); |
| 6881 | |
| 6882 | /* |
| 6883 | * bts 0 ARFCN 871 BSIC 10 |
| 6884 | * bts 1 ARFCN 871 BSIC 11 |
| 6885 | * bts 2 ARFCN 871 BSIC 12 |
| 6886 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6887 | */ |
| 6888 | |
| 6889 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6890 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6891 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 6892 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6893 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6894 | |
| 6895 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 6896 | "handover any to arfcn 13 bsic 39", |
| 6897 | false); |
| 6898 | |
| 6899 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 6900 | "handover any to arfcn 871 bsic 12", |
| 6901 | false); |
| 6902 | |
| 6903 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 6904 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6905 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6906 | |
| 6907 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6908 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6909 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 6910 | var MSC_ConnHdlr vc_conn; |
| 6911 | f_init(3, true, guard_timeout := 60.0); |
| 6912 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6913 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6914 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 6915 | vc_conn.done; |
| 6916 | |
| 6917 | /* f_tc_ho_neighbor_config_start() */ |
| 6918 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6919 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6920 | |
| 6921 | /* 1.a */ |
| 6922 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6923 | * handover quickly by sending a Handover Failure message. */ |
| 6924 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6925 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6926 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6927 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6928 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6929 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6930 | |
| 6931 | /* 1.b */ |
| 6932 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6933 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6934 | |
| 6935 | /* 1.c */ |
| 6936 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6937 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6938 | |
| 6939 | /* 1.d */ |
| 6940 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6941 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6942 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6943 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6944 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6945 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6946 | |
| 6947 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6948 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6949 | } |
| 6950 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6951 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 6952 | f_tc_ho_neighbor_config_start(); |
| 6953 | |
| 6954 | /* |
| 6955 | * bts 0 ARFCN 871 BSIC 10 |
| 6956 | * bts 1 ARFCN 871 BSIC 11 |
| 6957 | * bts 2 ARFCN 871 BSIC 12 |
| 6958 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6959 | */ |
| 6960 | |
| 6961 | 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] | 6962 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6963 | f_sleep(0.5); |
| 6964 | |
| 6965 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 6966 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6967 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6968 | |
| 6969 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6970 | "handover any to arfcn 871 bsic 12", |
| 6971 | false); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 6972 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6973 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6974 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 6975 | var MSC_ConnHdlr vc_conn; |
| 6976 | f_init(3, true, guard_timeout := 50.0); |
| 6977 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6978 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6979 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 6980 | vc_conn.done; |
| 6981 | |
| 6982 | /* f_tc_ho_neighbor_config_start() */ |
| 6983 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6984 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6985 | |
| 6986 | /* 2.a */ |
| 6987 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6988 | * handover quickly by sending a Handover Failure message. */ |
| 6989 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6990 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6991 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6992 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 6993 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:attempted"); |
| 6994 | f_ctrs_bts_add(1, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6995 | |
| 6996 | /* 2.b */ |
| 6997 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6998 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6999 | |
| 7000 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7001 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7002 | } |
| 7003 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7004 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 7005 | f_tc_ho_neighbor_config_start(); |
| 7006 | |
| 7007 | /* |
| 7008 | * bts 0 ARFCN 871 BSIC 10 |
| 7009 | * bts 1 ARFCN 871 BSIC 11 |
| 7010 | * bts 2 ARFCN 871 BSIC 12 |
| 7011 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7012 | */ |
| 7013 | |
| 7014 | 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] | 7015 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7016 | f_sleep(0.5); |
| 7017 | |
| 7018 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 7019 | "handover any to arfcn 871 bsic 11", |
| 7020 | false); |
| 7021 | 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", |
| 7022 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 7023 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7024 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7025 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7026 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 7027 | var MSC_ConnHdlr vc_conn; |
| 7028 | f_init(3, true, guard_timeout := 50.0); |
| 7029 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7030 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7031 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 7032 | vc_conn.done; |
| 7033 | |
| 7034 | /* f_tc_ho_neighbor_config_start() */ |
| 7035 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7036 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7037 | |
| 7038 | /* 3.a */ |
| 7039 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7040 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7041 | |
| 7042 | /* 3.b */ |
| 7043 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7044 | * handover quickly by sending a Handover Failure message. */ |
| 7045 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7046 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7047 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7048 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7049 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 7050 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7051 | |
| 7052 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7053 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7054 | } |
| 7055 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7056 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 7057 | f_tc_ho_neighbor_config_start(); |
| 7058 | |
| 7059 | /* |
| 7060 | * bts 0 ARFCN 871 BSIC 10 |
| 7061 | * bts 1 ARFCN 871 BSIC 11 |
| 7062 | * bts 2 ARFCN 871 BSIC 12 |
| 7063 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7064 | */ |
| 7065 | |
| 7066 | 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] | 7067 | 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] | 7068 | f_sleep(0.5); |
| 7069 | |
| 7070 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 7071 | "handover any to arfcn 871 bsic 11", |
| 7072 | false); |
| 7073 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 7074 | "handover any to arfcn 871 bsic 12", |
| 7075 | false); |
| 7076 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 7077 | "handover any to arfcn 123 bsic 45", |
| 7078 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7079 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7080 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7081 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 7082 | var MSC_ConnHdlr vc_conn; |
| 7083 | f_init(3, true, guard_timeout := 50.0); |
| 7084 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7085 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7086 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 7087 | vc_conn.done; |
| 7088 | |
| 7089 | /* f_tc_ho_neighbor_config_start() */ |
| 7090 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7091 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7092 | |
| 7093 | /* 4.a */ |
| 7094 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7095 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7096 | |
| 7097 | /* 4.b */ |
| 7098 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7099 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7100 | |
| 7101 | /* 4.c */ |
| 7102 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7103 | * handover quickly by timing out after the Handover Required message */ |
| 7104 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7105 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7106 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7107 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7108 | |
| 7109 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7110 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7111 | } |
| 7112 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7113 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 7114 | f_tc_ho_neighbor_config_start(); |
| 7115 | |
| 7116 | /* |
| 7117 | * bts 0 ARFCN 871 BSIC 10 |
| 7118 | * bts 1 ARFCN 871 BSIC 11 |
| 7119 | * bts 2 ARFCN 871 BSIC 12 |
| 7120 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7121 | */ |
| 7122 | |
| 7123 | 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] | 7124 | 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] | 7125 | f_sleep(0.5); |
| 7126 | |
| 7127 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 7128 | "handover any to arfcn 871 bsic 12", |
| 7129 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7130 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7131 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7132 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 7133 | var MSC_ConnHdlr vc_conn; |
| 7134 | f_init(3, true); |
| 7135 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7136 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7137 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 7138 | vc_conn.done; |
| 7139 | |
| 7140 | /* f_tc_ho_neighbor_config_start() */ |
| 7141 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7142 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7143 | |
| 7144 | /* 5 */ |
| 7145 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7146 | * handover quickly by timing out after the Handover Required message */ |
| 7147 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7148 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7149 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7150 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7151 | |
| 7152 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7153 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7154 | } |
| 7155 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7156 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 7157 | f_tc_ho_neighbor_config_start(); |
| 7158 | |
| 7159 | /* |
| 7160 | * bts 0 ARFCN 871 BSIC 10 |
| 7161 | * bts 1 ARFCN 871 BSIC 11 |
| 7162 | * bts 2 ARFCN 871 BSIC 12 |
| 7163 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7164 | */ |
| 7165 | |
| 7166 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 7167 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7168 | 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] | 7169 | f_sleep(0.5); |
| 7170 | |
| 7171 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 7172 | "handover any to arfcn 871 bsic 12", |
| 7173 | false); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7174 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7175 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7176 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 7177 | var MSC_ConnHdlr vc_conn; |
| 7178 | f_init(3, true); |
| 7179 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7180 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7181 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 7182 | vc_conn.done; |
| 7183 | |
| 7184 | /* f_tc_ho_neighbor_config_start() */ |
| 7185 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7186 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7187 | |
| 7188 | /* 6.a */ |
| 7189 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7190 | * handover quickly by timing out after the Handover Required message */ |
| 7191 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7192 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 7193 | |
| 7194 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7195 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7196 | } |
| 7197 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7198 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 7199 | f_tc_ho_neighbor_config_start(); |
| 7200 | |
| 7201 | /* |
| 7202 | * bts 0 ARFCN 871 BSIC 10 |
| 7203 | * bts 1 ARFCN 871 BSIC 11 |
| 7204 | * bts 2 ARFCN 871 BSIC 12 |
| 7205 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 7206 | */ |
| 7207 | |
| 7208 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 7209 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 7210 | 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] | 7211 | f_sleep(0.5); |
| 7212 | |
| 7213 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 7214 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 7215 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7216 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 7217 | "handover any to arfcn 123 bsic 45", |
| 7218 | true, true); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7219 | f_perform_clear(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7220 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7221 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 7222 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 7223 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7224 | f_sleep(1.0); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7225 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7226 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 7227 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7228 | |
| 7229 | /* f_tc_ho_neighbor_config_start() */ |
| 7230 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 7231 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 7232 | |
| 7233 | /* 7.a */ |
| 7234 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7235 | * handover quickly by sending a Handover Failure message. */ |
| 7236 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7237 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 7238 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 7239 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 7240 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:attempted"); |
| 7241 | f_ctrs_bts_add(2, "incoming_intra_bsc_ho:failed"); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 7242 | |
| 7243 | /* 7.b */ |
| 7244 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 7245 | * handover quickly by timing out after the Handover Required message */ |
| 7246 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 7247 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 7248 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 7249 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 7250 | |
| 7251 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7252 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7253 | } |
| 7254 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7255 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7256 | * BSSMAP Reset just because of that. */ |
| 7257 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 7258 | var default d; |
| 7259 | var integer i; |
| 7260 | var DchanTuple dt; |
| 7261 | |
| 7262 | f_init(); |
| 7263 | |
| 7264 | /* Wait for initial BSSMAP Reset to pass */ |
| 7265 | f_sleep(4.0); |
| 7266 | |
| 7267 | d := activate(no_bssmap_reset()); |
| 7268 | |
| 7269 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7270 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7271 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 7272 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7273 | /* Since we're doing a lot of runs, give each one a fresh |
| 7274 | * T_guard from the top. */ |
| 7275 | T_guard.start; |
| 7276 | |
| 7277 | /* Setup a BSSAP connection and clear it right away. This is |
| 7278 | * the MSC telling the BSC about a planned release, it's not an |
| 7279 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 7280 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7281 | |
| 7282 | /* MSC disconnects (RLSD). */ |
| 7283 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 7284 | } |
| 7285 | |
| 7286 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7287 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7288 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7289 | f_sleep(4.0); |
| 7290 | |
| 7291 | deactivate(d); |
| 7292 | f_shutdown_helper(); |
| 7293 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 7294 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7295 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7296 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 7297 | * the MSC. */ |
| 7298 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 7299 | var default d; |
| 7300 | var integer i; |
| 7301 | var DchanTuple dt; |
| 7302 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7303 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 7304 | var BssmapCause cause := enum2int(cause_val); |
| 7305 | |
| 7306 | f_init(); |
| 7307 | |
| 7308 | /* Wait for initial BSSMAP Reset to pass */ |
| 7309 | f_sleep(4.0); |
| 7310 | |
| 7311 | d := activate(no_bssmap_reset()); |
| 7312 | |
| 7313 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7314 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7315 | * Let's do it some more times for good measure. */ |
| 7316 | for (i := 0; i < 8; i := i+1) { |
| 7317 | /* Since we're doing a lot of runs, give each one a fresh |
| 7318 | * T_guard from the top. */ |
| 7319 | T_guard.start; |
| 7320 | |
| 7321 | /* Setup a BSSAP connection and clear it right away. This is |
| 7322 | * the MSC telling the BSC about a planned release, it's not an |
| 7323 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 7324 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7325 | |
| 7326 | /* Instruct BSC to clear channel */ |
| 7327 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7328 | |
| 7329 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 7330 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7331 | } |
| 7332 | |
| 7333 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7334 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7335 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7336 | f_sleep(4.0); |
| 7337 | |
| 7338 | deactivate(d); |
| 7339 | f_shutdown_helper(); |
| 7340 | } |
| 7341 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7342 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 7343 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 7344 | * Release Ind on RSL. */ |
| 7345 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 7346 | var default d; |
| 7347 | var integer i; |
| 7348 | var DchanTuple dt; |
| 7349 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7350 | var integer j; |
| 7351 | |
| 7352 | f_init(); |
| 7353 | |
| 7354 | /* Wait for initial BSSMAP Reset to pass */ |
| 7355 | f_sleep(4.0); |
| 7356 | |
| 7357 | d := activate(no_bssmap_reset()); |
| 7358 | |
| 7359 | /* Setup up a number of connections and RLSD them again from the MSC |
| 7360 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 7361 | * Let's do it some more times for good measure. */ |
| 7362 | for (i := 0; i < 8; i := i+1) { |
| 7363 | /* Since we're doing a lot of runs, give each one a fresh |
| 7364 | * T_guard from the top. */ |
| 7365 | T_guard.start; |
| 7366 | |
| 7367 | /* Setup a BSSAP connection and clear it right away. This is |
| 7368 | * the MSC telling the BSC about a planned release, it's not an |
| 7369 | * erratic loss of a connection. */ |
| 7370 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 7371 | |
| 7372 | /* simulate RLL REL IND */ |
| 7373 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 7374 | |
| 7375 | /* expect Clear Request on MSC side */ |
| 7376 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 7377 | |
| 7378 | /* Instruct BSC to clear channel */ |
| 7379 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 7380 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7381 | |
| 7382 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 7383 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7384 | } |
| 7385 | |
| 7386 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 7387 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 7388 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 7389 | f_sleep(4.0); |
| 7390 | |
| 7391 | deactivate(d); |
| 7392 | f_shutdown_helper(); |
| 7393 | } |
| 7394 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7395 | /*********************************************************************** |
| 7396 | * IPA style dynamic PDCH |
| 7397 | ***********************************************************************/ |
| 7398 | |
| 7399 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7400 | template (omit) RSL_Cause nack := omit) |
| 7401 | runs on test_CT { |
| 7402 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7403 | var RSL_Message rsl_unused; |
| 7404 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7405 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 7406 | /* expect the BSC to issue the related RSL command */ |
| 7407 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7408 | if (istemplatekind(nack, "omit")) { |
| 7409 | /* respond with a related acknowledgement */ |
| 7410 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7411 | } else { |
| 7412 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 7413 | } |
| 7414 | } |
| 7415 | |
| 7416 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7417 | template (omit) RSL_Cause nack := omit) |
| 7418 | runs on test_CT { |
| 7419 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 7420 | var RSL_Message rsl_unused; |
| 7421 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 7422 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 7423 | /* expect the BSC to issue the related RSL command */ |
| 7424 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 7425 | if (istemplatekind(nack, "omit")) { |
| 7426 | /* respond with a related acknowledgement */ |
| 7427 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 7428 | } else { |
| 7429 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 7430 | } |
| 7431 | } |
| 7432 | |
| 7433 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 7434 | runs on test_CT return charstring { |
| 7435 | var charstring cmd, resp; |
| 7436 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 7437 | 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] | 7438 | } |
| 7439 | |
| 7440 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7441 | template charstring exp) |
| 7442 | runs on test_CT { |
| 7443 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 7444 | if (not match(mode, exp)) { |
| 7445 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 7446 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7447 | } |
| 7448 | } |
| 7449 | |
| 7450 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 7451 | runs on test_CT { |
| 7452 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 7453 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 7454 | f_vty_transceive(BSCVTY, "end"); |
| 7455 | } |
| 7456 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7457 | |
| 7458 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 7459 | var integer i; |
| 7460 | for (i := 0; i < 8; i := i + 1) { |
| 7461 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 7462 | } |
| 7463 | } |
| 7464 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7465 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 7466 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 7467 | private const charstring PDCH_MODE := "PDCH mode"; |
| 7468 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7469 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7470 | |
| 7471 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 7472 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 7473 | var RSL_Message rsl_unused; |
| 7474 | |
| 7475 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7476 | f_init_vty(); |
| 7477 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7478 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7479 | |
| 7480 | f_init(1, false); |
| 7481 | f_sleep(1.0); |
| 7482 | |
| 7483 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7484 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7485 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7486 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7487 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7488 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7489 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7490 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7491 | 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] | 7492 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7493 | |
| 7494 | /* De-activate it via VTY */ |
| 7495 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7496 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7497 | 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] | 7498 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7499 | |
| 7500 | /* re-activate it via VTY */ |
| 7501 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 7502 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7503 | 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] | 7504 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7505 | |
| 7506 | /* and finally de-activate it again */ |
| 7507 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7508 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7509 | 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] | 7510 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7511 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7512 | /* clean up config */ |
| 7513 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7514 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7515 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7516 | } |
| 7517 | |
| 7518 | /* Test IPA PDCH activation NACK */ |
| 7519 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 7520 | var RSL_Message rsl_unused; |
| 7521 | |
| 7522 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7523 | f_init_vty(); |
| 7524 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7525 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7526 | |
| 7527 | f_init(1, false); |
| 7528 | f_sleep(1.0); |
| 7529 | |
| 7530 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7531 | |
| 7532 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7533 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7534 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7535 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7536 | f_sleep(1.0); |
| 7537 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7538 | |
| 7539 | /* De-activate it via VTY */ |
| 7540 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7541 | f_sleep(1.0); |
| 7542 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7543 | |
| 7544 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 7545 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 7546 | f_sleep(1.0); |
| 7547 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7548 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7549 | /* clean up config */ |
| 7550 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7551 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7552 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7553 | } |
| 7554 | |
| 7555 | |
| 7556 | /*********************************************************************** |
| 7557 | * Osmocom style dynamic PDCH |
| 7558 | ***********************************************************************/ |
| 7559 | |
| 7560 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7561 | template (omit) RSL_Cause nack := omit) |
| 7562 | runs on test_CT { |
| 7563 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7564 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7565 | /* 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] | 7566 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7567 | /* expect the BSC to issue the related RSL command */ |
| 7568 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 7569 | if (istemplatekind(nack, "omit")) { |
| 7570 | /* respond with a related acknowledgement */ |
| 7571 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7572 | } else { |
| 7573 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 7574 | } |
| 7575 | } |
| 7576 | |
| 7577 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7578 | template (omit) RSL_Cause nack := omit) |
| 7579 | runs on test_CT { |
| 7580 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7581 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7582 | /* 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] | 7583 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7584 | /* expect the BSC to issue the related RSL command */ |
| 7585 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 7586 | if (istemplatekind(nack, "omit")) { |
| 7587 | /* respond with a related acknowledgement */ |
| 7588 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 7589 | } else { |
| 7590 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 7591 | } |
| 7592 | } |
| 7593 | |
| 7594 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 7595 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 7596 | var RSL_Message rsl_unused; |
| 7597 | |
| 7598 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7599 | f_init_vty(); |
| 7600 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7601 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7602 | |
| 7603 | f_init(1, false); |
| 7604 | f_sleep(1.0); |
| 7605 | |
| 7606 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7607 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7608 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7609 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7610 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7611 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7612 | |
| 7613 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7614 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7615 | 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] | 7616 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7617 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7618 | /* clean up config */ |
| 7619 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7620 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7621 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7622 | } |
| 7623 | |
| 7624 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 7625 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 7626 | var RSL_Message rsl_unused; |
| 7627 | |
| 7628 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7629 | f_init_vty(); |
| 7630 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7631 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7632 | |
| 7633 | f_init(1, false); |
| 7634 | f_sleep(1.0); |
| 7635 | |
| 7636 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7637 | |
| 7638 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7639 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7640 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7641 | |
| 7642 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 7643 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7644 | f_sleep(1.0); |
| 7645 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7646 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7647 | /* clean up config */ |
| 7648 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7649 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7650 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7651 | } |
| 7652 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7653 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 7654 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 7655 | var RSL_Message rsl_unused, rsl_msg; |
| 7656 | var DchanTuple dt; |
| 7657 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7658 | |
| 7659 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7660 | f_init_vty(); |
| 7661 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7662 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7663 | |
| 7664 | f_init(1, false); |
| 7665 | f_sleep(1.0); |
| 7666 | |
| 7667 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7668 | |
| 7669 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7670 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7671 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7672 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7673 | |
| 7674 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7675 | f_sleep(1.0); |
| 7676 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7677 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7678 | |
| 7679 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7680 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7681 | var DchanTuples sdcch_cleanup := {}; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7682 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7683 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7684 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7685 | sdcch_cleanup := sdcch_cleanup & { dt }; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7686 | } |
| 7687 | |
| 7688 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7689 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7690 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7691 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7692 | |
| 7693 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7694 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7695 | |
| 7696 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7697 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7698 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7699 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7700 | |
| 7701 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7702 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7703 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7704 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7705 | |
| 7706 | /* Instruct BSC to clear channel */ |
| 7707 | var BssmapCause cause := 0; |
| 7708 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7709 | f_exp_chan_rel_and_clear(dt, 0); |
| 7710 | |
| 7711 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7712 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7713 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7714 | f_sleep(1.0); |
| 7715 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7716 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7717 | /* Clean up SDCCH lchans */ |
| 7718 | for (i := 0; i < lengthof(sdcch_cleanup); i := i + 1) { |
| 7719 | f_perform_clear_test_ct(sdcch_cleanup[i]); |
| 7720 | } |
| 7721 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7722 | /* clean up config */ |
| 7723 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7724 | |
| 7725 | f_shutdown_helper(); |
| 7726 | } |
| 7727 | |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7728 | /* Validate all 8 subslots of a dynamics TS configured as SDCCH8 are used */ |
| 7729 | testcase TC_dyn_ts_sdcch8_all_subslots_used() runs on test_CT { |
| 7730 | var ASP_RSL_Unitdata rsl_ud; |
| 7731 | var integer i; |
| 7732 | var integer chreq_total, chreq_nochan; |
| 7733 | |
| 7734 | f_init_vty(); |
| 7735 | for (i := 1; i < 8; i := i + 1) { |
| 7736 | if (i == 2) { |
| 7737 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7738 | } else { |
| 7739 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7740 | } |
| 7741 | } |
| 7742 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7743 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7744 | f_init(1, guard_timeout := 60.0); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7745 | |
| 7746 | /* The dyn TS want to activate PDCH mode, ACK that. */ |
| 7747 | var RslChannelNr chan_nr; |
| 7748 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7749 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7750 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7751 | |
| 7752 | f_sleep(1.0); |
| 7753 | |
| 7754 | /* Exhaust all dedicated SDCCH lchans. |
| 7755 | /* GSM 44.018 Table 9.1.8.2: |
| 7756 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 7757 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7758 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7759 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7760 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7761 | } |
| 7762 | |
| 7763 | /* Only the dyn TS is still available. Its first lchan gets converted to SDCCH8 */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7764 | chan_cleanup := chan_cleanup & { f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7765 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 7766 | for (i := 0; i < 7; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7767 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
| 7768 | } |
| 7769 | |
| 7770 | /* Clean up SDCCH lchans */ |
| 7771 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 7772 | f_perform_clear_test_ct(chan_cleanup[i]); |
Neels Hofmeyr | e1a7c4d | 2021-10-23 23:13:01 +0200 | [diff] [blame] | 7773 | } |
| 7774 | |
| 7775 | /* clean up config */ |
| 7776 | f_ts_reset_chcomb(0); |
| 7777 | |
| 7778 | f_shutdown_helper(); |
| 7779 | } |
| 7780 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7781 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 7782 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 7783 | it as TCH directly instead. SYS#5309. */ |
| 7784 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 7785 | var RSL_Message rsl_unused, rsl_msg; |
| 7786 | var DchanTuple dt; |
| 7787 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7788 | var integer i; |
| 7789 | |
| 7790 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7791 | f_init_vty(); |
| 7792 | for (i := 1; i < 8; i := i + 1) { |
| 7793 | if (i == 6) { |
| 7794 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7795 | } else { |
| 7796 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7797 | } |
| 7798 | } |
| 7799 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7800 | |
| 7801 | f_init(1, false); |
| 7802 | f_sleep(1.0); |
| 7803 | |
| 7804 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7805 | |
| 7806 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7807 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7808 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7809 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7810 | |
| 7811 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7812 | f_sleep(1.0); |
| 7813 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7814 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7815 | |
| 7816 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7817 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7818 | var DchanTuples chan_cleanup := {}; |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7819 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7820 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7821 | dt := f_est_dchan(ra, i, '00010203040506'O); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7822 | chan_cleanup := chan_cleanup & { dt }; |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7823 | } |
| 7824 | |
| 7825 | /* Now the dyn ts is selected. First PDCH is released, then TCH chan is activated */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7826 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int(ra) + i, 1), 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7827 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7828 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7829 | |
| 7830 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7831 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7832 | |
| 7833 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7834 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7835 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7836 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7837 | |
| 7838 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7839 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7840 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7841 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7842 | |
| 7843 | /* Instruct BSC to clear channel */ |
| 7844 | var BssmapCause cause := 0; |
| 7845 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7846 | f_exp_chan_rel_and_clear(dt, 0); |
| 7847 | |
| 7848 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7849 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7850 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7851 | f_sleep(1.0); |
| 7852 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7853 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7854 | /* Clean up SDCCH lchans */ |
| 7855 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 7856 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 7857 | } |
| 7858 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7859 | /* clean up config */ |
| 7860 | f_ts_reset_chcomb(0); |
| 7861 | /* TODO: clean up other channels? */ |
| 7862 | |
| 7863 | f_shutdown_helper(); |
| 7864 | } |
| 7865 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7866 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 7867 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 7868 | var RSL_Message rsl_unused, rsl_msg; |
| 7869 | var DchanTuple dt; |
| 7870 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7871 | var GsmRrMessage rr; |
| 7872 | |
| 7873 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7874 | f_init_vty(); |
| 7875 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7876 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7877 | |
| 7878 | f_init(1, false); |
| 7879 | f_sleep(1.0); |
| 7880 | |
| 7881 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7882 | |
| 7883 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7884 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7885 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7886 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7887 | |
| 7888 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7889 | f_sleep(1.0); |
| 7890 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7891 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7892 | |
| 7893 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7894 | * on CCCH+SDCCH4+CBCH) */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7895 | var DchanTuples chan_cleanup := {}; |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7896 | var integer i; |
Pau Espin Pedrol | ce4d5bb | 2021-10-25 13:31:25 +0200 | [diff] [blame] | 7897 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i + 1) { |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7898 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7899 | chan_cleanup := chan_cleanup & { dt }; |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7900 | } |
| 7901 | |
| 7902 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7903 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7904 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7905 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7906 | |
| 7907 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7908 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7909 | |
| 7910 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7911 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7912 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7913 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 7914 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 7915 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 7916 | } |
| 7917 | |
| 7918 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 7919 | |
| 7920 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 7921 | /* rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr)); |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7922 | * f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7923 | * f_sleep(1.0); |
| 7924 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 7925 | */ |
| 7926 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 7927 | /* Clean up SDCCH lchans */ |
| 7928 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 7929 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 7930 | } |
| 7931 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7932 | /* clean up config */ |
| 7933 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7934 | |
| 7935 | f_shutdown_helper(); |
| 7936 | } |
| 7937 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7938 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 7939 | 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] | 7940 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7941 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7942 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7943 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7944 | } |
| 7945 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7946 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 7947 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 7948 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 7949 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7950 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7951 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7952 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7953 | } |
| 7954 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7955 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 7956 | the BTS does autonomous MS power control loop */ |
| 7957 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 7958 | var MSC_ConnHdlr vc_conn; |
| 7959 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7960 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 7961 | pars.exp_ms_power_params := true; |
| 7962 | |
| 7963 | f_init(1, true); |
| 7964 | f_sleep(1.0); |
| 7965 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 7966 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7967 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7968 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7969 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 7970 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 7971 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 7972 | f_init(1); |
| 7973 | |
| 7974 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 7975 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 7976 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 7977 | |
| 7978 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
| 7979 | var template RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
| 7980 | chan_nr := t_RslChanNr_BCCH(0), |
| 7981 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 7982 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
| 7983 | var RSL_Message unused := f_exp_ipa_rx(0, tr_rsl_pdu); |
| 7984 | |
| 7985 | /* Additionally verify the applied value over the CTRL interface */ |
| 7986 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 7987 | if (cred != int2str(red)) { |
| 7988 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 7989 | cred, " (expected ", red, ")"); |
| 7990 | } |
| 7991 | } |
| 7992 | |
| 7993 | f_shutdown_helper(); |
| 7994 | } |
| 7995 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7996 | /*********************************************************************** |
| 7997 | * MSC Pooling |
| 7998 | ***********************************************************************/ |
| 7999 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8000 | 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] | 8001 | 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] | 8002 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8003 | 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] | 8004 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8005 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8006 | [] 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] | 8007 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8008 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8009 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8010 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8011 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 8012 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8013 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8014 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8015 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8016 | break; |
| 8017 | } |
| 8018 | } |
| 8019 | } |
| 8020 | |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8021 | private altstep as_mgcp_ack_all_dlcx() runs on MSC_ConnHdlr { |
| 8022 | var MgcpCommand mgcp_cmd; |
| 8023 | [] MGCP.receive(tr_DLCX(?)) -> value mgcp_cmd { |
| 8024 | MGCP.send(ts_DLCX_ACK2(mgcp_cmd.line.trans_id)); |
| 8025 | repeat; |
| 8026 | } |
| 8027 | } |
| 8028 | |
| 8029 | private altstep as_rsl_ack_all_rel_req() runs on MSC_ConnHdlr { |
| 8030 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 8031 | [] RSL.receive(tr_RSL_REL_REQ(g_chan_nr, ?)) { |
| 8032 | RSL.send(ts_RSL_REL_CONF(g_chan_nr, main_dcch)); |
| 8033 | repeat; |
| 8034 | } |
| 8035 | } |
| 8036 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8037 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
| 8038 | 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] | 8039 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8040 | var default ack_dlcx := activate(as_mgcp_ack_all_dlcx()); |
| 8041 | var default ack_rel_req := activate(as_rsl_ack_all_rel_req()); |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8042 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8043 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8044 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8045 | [] 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] | 8046 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8047 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8048 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8049 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8050 | } |
| 8051 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8052 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8053 | /* Also drop the SCCP connection */ |
| 8054 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8055 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 8056 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8057 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8058 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8059 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8060 | } |
| 8061 | } |
Neels Hofmeyr | 6289af1 | 2021-12-16 18:17:49 +0100 | [diff] [blame] | 8062 | deactivate(ack_dlcx); |
| 8063 | deactivate(ack_rel_req); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8064 | } |
| 8065 | |
Neels Hofmeyr | c3c6ee6 | 2022-01-26 01:22:12 +0100 | [diff] [blame] | 8066 | friend function f_perform_clear_no_rr_rel(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC) |
| 8067 | runs on MSC_ConnHdlr { |
| 8068 | var default ack_dlcx := activate(as_mgcp_ack_all_dlcx()); |
| 8069 | var default ack_rel_req := activate(as_rsl_ack_all_rel_req()); |
| 8070 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
| 8071 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8072 | interleave { |
| 8073 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8074 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8075 | } |
| 8076 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 8077 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
| 8078 | /* Also drop the SCCP connection */ |
| 8079 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8080 | } |
| 8081 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 8082 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8083 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8084 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
| 8085 | } |
| 8086 | } |
| 8087 | deactivate(ack_dlcx); |
| 8088 | deactivate(ack_rel_req); |
| 8089 | } |
| 8090 | |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 8091 | friend function f_perform_clear_no_lchan() |
| 8092 | runs on MSC_ConnHdlr { |
| 8093 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
| 8094 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 8095 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 8096 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
| 8097 | /* Also drop the SCCP connection */ |
| 8098 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8099 | } |
| 8100 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8101 | private function f_perform_clear_test_ct(DchanTuple dt) |
| 8102 | runs on test_CT |
| 8103 | { |
| 8104 | /* Instruct BSC to clear channel */ |
| 8105 | var BssmapCause cause := 0; |
| 8106 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 8107 | f_exp_chan_rel_and_clear(dt, 0); |
| 8108 | } |
| 8109 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8110 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 8111 | 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] | 8112 | runs on MSC_ConnHdlr { |
| 8113 | timer T := 10.0; |
| 8114 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 8115 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 8116 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8117 | f_create_bssmap_exp(l3_enc); |
| 8118 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8119 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 8120 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8121 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8122 | */ |
| 8123 | var RSL_Message rx_rsl; |
| 8124 | var GsmRrMessage rr; |
| 8125 | |
| 8126 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8127 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8128 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8129 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8130 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 8131 | */ |
| 8132 | timer Tt := 10.0; |
| 8133 | |
| 8134 | /* request a channel to be established */ |
| 8135 | Tt.start; |
| 8136 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8137 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8138 | Tt.stop; |
| 8139 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8140 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8141 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 8142 | mtc.stop; |
| 8143 | } |
| 8144 | [] Tt.timeout { |
| 8145 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 8146 | mtc.stop; |
| 8147 | } |
| 8148 | } |
| 8149 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 8150 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8151 | 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] | 8152 | |
| 8153 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8154 | if (expect_bssmap_l3) { |
| 8155 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 8156 | var template PDU_BSSAP exp_l3_compl; |
| 8157 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 8158 | if (g_pars.aoip == false) { |
| 8159 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 8160 | } else { |
| 8161 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 8162 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8163 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8164 | var PDU_BSSAP bssap; |
| 8165 | T.start; |
| 8166 | alt { |
| 8167 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 8168 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 8169 | log("rx exp_l3_compl = ", bssap); |
| 8170 | } |
| 8171 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 8172 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 8173 | } |
| 8174 | [] T.timeout { |
| 8175 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 8176 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8177 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8178 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 8179 | /* start ciphering, if requested */ |
| 8180 | if (ispresent(g_pars.encr)) { |
| 8181 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8182 | 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] | 8183 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8184 | } |
| 8185 | |
| 8186 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8187 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8188 | } |
| 8189 | setverdict(pass); |
| 8190 | f_sleep(1.0); |
| 8191 | } |
| 8192 | |
| 8193 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 8194 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8195 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8196 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8197 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8198 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8199 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8200 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8201 | } |
| 8202 | } |
| 8203 | |
| 8204 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 8205 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 8206 | 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] | 8207 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 8208 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 8209 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 8210 | 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] | 8211 | } |
| 8212 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 8213 | |
| 8214 | f_init(1, true); |
| 8215 | f_sleep(1.0); |
| 8216 | var MSC_ConnHdlr vc_conn; |
| 8217 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8218 | |
| 8219 | f_ctrs_msc_init(); |
| 8220 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8221 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 8222 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8223 | |
| 8224 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8225 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8226 | } |
| 8227 | |
| 8228 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 8229 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8230 | * just as well using only RSL. */ |
| 8231 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 8232 | |
| 8233 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8234 | f_sleep(1.0); |
| 8235 | |
| 8236 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8237 | * would be randomly affected by which other tests ran before this. */ |
| 8238 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8239 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8240 | f_ctrs_msc_init(); |
| 8241 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8242 | var MSC_ConnHdlr vc_conn1; |
| 8243 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8244 | pars1.mscpool.rsl_idx := 0; |
| 8245 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 8246 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8247 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8248 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8249 | |
| 8250 | var MSC_ConnHdlr vc_conn2; |
| 8251 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8252 | pars2.mscpool.rsl_idx := 1; |
| 8253 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8254 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8255 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8256 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8257 | |
| 8258 | /* Test round-robin wrap to the first MSC */ |
| 8259 | var MSC_ConnHdlr vc_conn3; |
| 8260 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8261 | pars3.mscpool.rsl_idx := 2; |
| 8262 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8263 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8264 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8265 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8266 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8267 | } |
| 8268 | |
| 8269 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 8270 | * (configured in osmo-bsc.cfg). */ |
| 8271 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8272 | * just as well using only RSL. */ |
| 8273 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 8274 | |
| 8275 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8276 | f_sleep(1.0); |
| 8277 | |
| 8278 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8279 | * would be randomly affected by which other tests ran before this. */ |
| 8280 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8281 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8282 | f_ctrs_msc_init(); |
| 8283 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8284 | var MSC_ConnHdlr vc_conn1; |
| 8285 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8286 | pars1.mscpool.rsl_idx := 0; |
| 8287 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8288 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8289 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8290 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8291 | |
| 8292 | var MSC_ConnHdlr vc_conn2; |
| 8293 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8294 | pars2.mscpool.rsl_idx := 1; |
| 8295 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8296 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8297 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8298 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8299 | |
| 8300 | /* Test round-robin wrap to the first MSC */ |
| 8301 | var MSC_ConnHdlr vc_conn3; |
| 8302 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8303 | pars3.mscpool.rsl_idx := 2; |
| 8304 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 8305 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8306 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8307 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8308 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8309 | } |
| 8310 | |
| 8311 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 8312 | * (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 |
| 8313 | * NULL-NRI setting is stronger than that. */ |
| 8314 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8315 | * just as well using only RSL. */ |
| 8316 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 8317 | |
| 8318 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8319 | f_sleep(1.0); |
| 8320 | |
| 8321 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8322 | * would be randomly affected by which other tests ran before this. */ |
| 8323 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8324 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8325 | f_ctrs_msc_init(); |
| 8326 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8327 | var MSC_ConnHdlr vc_conn1; |
| 8328 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8329 | pars1.mscpool.rsl_idx := 0; |
| 8330 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8331 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8332 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8333 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8334 | |
| 8335 | var MSC_ConnHdlr vc_conn2; |
| 8336 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8337 | pars2.mscpool.rsl_idx := 1; |
| 8338 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8339 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8340 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8341 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8342 | |
| 8343 | /* Test round-robin wrap to the first MSC */ |
| 8344 | var MSC_ConnHdlr vc_conn3; |
| 8345 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8346 | pars3.mscpool.rsl_idx := 2; |
| 8347 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 8348 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8349 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8350 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8351 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8352 | } |
| 8353 | |
| 8354 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 8355 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 8356 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8357 | * just as well using only RSL. */ |
| 8358 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 8359 | |
| 8360 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8361 | f_sleep(1.0); |
| 8362 | |
| 8363 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8364 | * would be randomly affected by which other tests ran before this. */ |
| 8365 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8366 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8367 | f_ctrs_msc_init(); |
| 8368 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8369 | var MSC_ConnHdlr vc_conn1; |
| 8370 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8371 | pars1.mscpool.rsl_idx := 0; |
| 8372 | /* An NRI that is not assigned to any MSC */ |
| 8373 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 8374 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8375 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8376 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8377 | |
| 8378 | var MSC_ConnHdlr vc_conn2; |
| 8379 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8380 | pars2.mscpool.rsl_idx := 1; |
| 8381 | /* An NRI that is not assigned to any MSC */ |
| 8382 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 8383 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8384 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8385 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8386 | |
| 8387 | /* Test round-robin wrap to the first MSC */ |
| 8388 | var MSC_ConnHdlr vc_conn3; |
| 8389 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8390 | pars3.mscpool.rsl_idx := 2; |
| 8391 | /* An NRI that is not assigned to any MSC */ |
| 8392 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 8393 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8394 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8395 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8396 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8397 | } |
| 8398 | |
| 8399 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 8400 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 8401 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8402 | * just as well using only RSL. */ |
| 8403 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 8404 | |
| 8405 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8406 | f_sleep(1.0); |
| 8407 | |
| 8408 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8409 | * would be randomly affected by which other tests ran before this. */ |
| 8410 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8411 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8412 | f_ctrs_msc_init(); |
| 8413 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8414 | var MSC_ConnHdlr vc_conn1; |
| 8415 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8416 | pars1.mscpool.rsl_idx := 0; |
| 8417 | /* An NRI that is assigned to an unconnected MSC */ |
| 8418 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 8419 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8420 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8421 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8422 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8423 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8424 | |
| 8425 | var MSC_ConnHdlr vc_conn2; |
| 8426 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8427 | pars2.mscpool.rsl_idx := 1; |
| 8428 | /* An NRI that is assigned to an unconnected MSC */ |
| 8429 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 8430 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8431 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8432 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8433 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 8434 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8435 | |
| 8436 | /* Test round-robin wrap to the first MSC */ |
| 8437 | var MSC_ConnHdlr vc_conn3; |
| 8438 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8439 | pars3.mscpool.rsl_idx := 2; |
| 8440 | /* An NRI that is assigned to an unconnected MSC */ |
| 8441 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 8442 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8443 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8444 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 8445 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 8446 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8447 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8448 | } |
| 8449 | |
| 8450 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 8451 | * osmo-bsc.cfg). */ |
| 8452 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8453 | * just as well using only RSL. */ |
| 8454 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 8455 | |
| 8456 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 8457 | f_sleep(1.0); |
| 8458 | |
| 8459 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 8460 | * this is not using round-robin. */ |
| 8461 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8462 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8463 | f_ctrs_msc_init(); |
| 8464 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8465 | var MSC_ConnHdlr vc_conn1; |
| 8466 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8467 | pars1.mscpool.rsl_idx := 0; |
| 8468 | /* An NRI of the second MSC's range (256-511) */ |
| 8469 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 8470 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8471 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8472 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8473 | |
| 8474 | var MSC_ConnHdlr vc_conn2; |
| 8475 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8476 | pars2.mscpool.rsl_idx := 1; |
| 8477 | /* An NRI of the second MSC's range (256-511) */ |
| 8478 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 8479 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8480 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8481 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8482 | |
| 8483 | var MSC_ConnHdlr vc_conn3; |
| 8484 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8485 | pars3.mscpool.rsl_idx := 2; |
| 8486 | /* An NRI of the second MSC's range (256-511) */ |
| 8487 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 8488 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8489 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8490 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8491 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8492 | } |
| 8493 | |
| 8494 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 8495 | * while a round-robin remains unaffected by that. */ |
| 8496 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8497 | * just as well using only RSL. */ |
| 8498 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 8499 | |
| 8500 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8501 | f_sleep(1.0); |
| 8502 | |
| 8503 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 8504 | * this is not using round-robin. */ |
| 8505 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 8506 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8507 | f_ctrs_msc_init(); |
| 8508 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8509 | var MSC_ConnHdlr vc_conn1; |
| 8510 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8511 | pars1.mscpool.rsl_idx := 0; |
| 8512 | /* An NRI of the third MSC's range (512-767) */ |
| 8513 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 8514 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8515 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8516 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8517 | |
| 8518 | var MSC_ConnHdlr vc_conn2; |
| 8519 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8520 | pars2.mscpool.rsl_idx := 1; |
| 8521 | /* An NRI of the third MSC's range (512-767) */ |
| 8522 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 8523 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8524 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8525 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8526 | |
| 8527 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 8528 | var MSC_ConnHdlr vc_conn3; |
| 8529 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8530 | pars3.mscpool.rsl_idx := 2; |
| 8531 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 8532 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8533 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8534 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8535 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8536 | } |
| 8537 | |
| 8538 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 8539 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8540 | * just as well using only RSL. */ |
| 8541 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 8542 | |
| 8543 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8544 | f_sleep(1.0); |
| 8545 | |
| 8546 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 8547 | * instead, and hits msc 0. */ |
| 8548 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8549 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8550 | f_ctrs_msc_init(); |
| 8551 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8552 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 8553 | var MSC_ConnHdlr vc_conn1; |
| 8554 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8555 | pars1.mscpool.rsl_idx := 0; |
| 8556 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 8557 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8558 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8559 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8560 | |
| 8561 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 8562 | var MSC_ConnHdlr vc_conn2; |
| 8563 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8564 | pars2.mscpool.rsl_idx := 1; |
| 8565 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 8566 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8567 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8568 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8569 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8570 | } |
| 8571 | |
| 8572 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 8573 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 8574 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 8575 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 8576 | //cid_list := { cIl_allInBSS := ''O }; |
| 8577 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 8578 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 8579 | var BSSAP_N_UNITDATA_req paging; |
| 8580 | var hexstring imsi := '001010000000123'H; |
| 8581 | |
| 8582 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8583 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8584 | 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] | 8585 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 8586 | BSSAP.send(paging); |
| 8587 | |
| 8588 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 8589 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 8590 | * channel number is picked here. */ |
| 8591 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 8592 | f_rslem_register(0, new_chan_nr); |
| 8593 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 8594 | f_rslem_unregister(0, new_chan_nr); |
| 8595 | |
| 8596 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 8597 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8598 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8599 | f_sleep(1.0); |
| 8600 | } |
| 8601 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 8602 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 8603 | f_sleep(1.0); |
| 8604 | |
| 8605 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 8606 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 8607 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 8608 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8609 | f_ctrs_msc_init(); |
| 8610 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8611 | var MSC_ConnHdlr vc_conn1; |
| 8612 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8613 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8614 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8615 | 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] | 8616 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 8617 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8618 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8619 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8620 | } |
| 8621 | |
| 8622 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 8623 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 8624 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 8625 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 8626 | //cid_list := { cIl_allInBSS := ''O }; |
| 8627 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 8628 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 8629 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 8630 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8631 | var BSSAP_N_UNITDATA_req paging; |
| 8632 | |
| 8633 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8634 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8635 | 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] | 8636 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 8637 | BSSAP.send(paging); |
| 8638 | |
| 8639 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 8640 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 8641 | * channel number is picked here. */ |
| 8642 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 8643 | f_rslem_register(0, new_chan_nr); |
| 8644 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 8645 | f_rslem_unregister(0, new_chan_nr); |
| 8646 | |
| 8647 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 8648 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 8649 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8650 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8651 | f_sleep(1.0); |
| 8652 | } |
| 8653 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 8654 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 8655 | f_sleep(1.0); |
| 8656 | |
| 8657 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 8658 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 8659 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 8660 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8661 | f_ctrs_msc_init(); |
| 8662 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8663 | var MSC_ConnHdlr vc_conn1; |
| 8664 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8665 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8666 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8667 | 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] | 8668 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 8669 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8670 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8671 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8672 | } |
| 8673 | |
| 8674 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 8675 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8676 | * just as well using only RSL. */ |
| 8677 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 8678 | |
| 8679 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8680 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8681 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8682 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8683 | |
| 8684 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8685 | * would be randomly affected by which other tests ran before this. */ |
| 8686 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8687 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8688 | f_ctrs_msc_init(); |
| 8689 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8690 | var MSC_ConnHdlr vc_conn1; |
| 8691 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8692 | pars1.mscpool.rsl_idx := 0; |
| 8693 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 8694 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8695 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8696 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8697 | |
| 8698 | var MSC_ConnHdlr vc_conn2; |
| 8699 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8700 | pars2.mscpool.rsl_idx := 1; |
| 8701 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8702 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8703 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8704 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8705 | |
| 8706 | var MSC_ConnHdlr vc_conn3; |
| 8707 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8708 | pars3.mscpool.rsl_idx := 2; |
| 8709 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8710 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8711 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8712 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8713 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8714 | } |
| 8715 | |
| 8716 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 8717 | * TMSI NRI. */ |
| 8718 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 8719 | |
| 8720 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8721 | f_sleep(1.0); |
| 8722 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8723 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8724 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 8725 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8726 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8727 | * would be randomly affected by which other tests ran before this. */ |
| 8728 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8729 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8730 | f_ctrs_msc_init(); |
| 8731 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8732 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 8733 | var MSC_ConnHdlr vc_conn1; |
| 8734 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8735 | pars1.mscpool.rsl_idx := 0; |
| 8736 | /* An NRI of the second MSC's range (256-511) */ |
| 8737 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 8738 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8739 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8740 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8741 | |
| 8742 | var MSC_ConnHdlr vc_conn2; |
| 8743 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8744 | pars2.mscpool.rsl_idx := 1; |
| 8745 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8746 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8747 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8748 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8749 | |
| 8750 | var MSC_ConnHdlr vc_conn3; |
| 8751 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8752 | pars3.mscpool.rsl_idx := 2; |
| 8753 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8754 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8755 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8756 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8757 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8758 | } |
| 8759 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8760 | /* Allow/Deny emergency calls globally via VTY */ |
| 8761 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 8762 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 8763 | if (allow) { |
| 8764 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 8765 | } else { |
| 8766 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 8767 | } |
| 8768 | f_vty_transceive(BSCVTY, "exit"); |
| 8769 | f_vty_transceive(BSCVTY, "exit"); |
| 8770 | } |
| 8771 | |
| 8772 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 8773 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 8774 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8775 | if (allow) { |
| 8776 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 8777 | } else { |
| 8778 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 8779 | } |
| 8780 | f_vty_transceive(BSCVTY, "exit"); |
| 8781 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 8782 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8783 | } |
| 8784 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 8785 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 8786 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 8787 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8788 | if (allow) { |
| 8789 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 8790 | } else { |
| 8791 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 8792 | } |
| 8793 | f_vty_transceive(BSCVTY, "exit"); |
| 8794 | f_vty_transceive(BSCVTY, "exit"); |
| 8795 | f_vty_transceive(BSCVTY, "exit"); |
| 8796 | } |
| 8797 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 8798 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 8799 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 8800 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8801 | if (allow) { |
| 8802 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 8803 | } else { |
| 8804 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 8805 | } |
| 8806 | f_vty_transceive(BSCVTY, "exit"); |
| 8807 | f_vty_transceive(BSCVTY, "exit"); |
| 8808 | f_vty_transceive(BSCVTY, "exit"); |
| 8809 | } |
| 8810 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8811 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 8812 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 8813 | var PDU_ML3_MS_NW emerg_setup; |
| 8814 | var octetstring emerg_setup_enc; |
| 8815 | var RSL_Message emerg_setup_data_ind; |
| 8816 | |
| 8817 | f_establish_fully(omit, omit); |
| 8818 | |
| 8819 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 8820 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 8821 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 8822 | |
| 8823 | RSL.send(emerg_setup_data_ind); |
| 8824 | } |
| 8825 | |
| 8826 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 8827 | * CALLS are permitted by the BSC config. */ |
| 8828 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 8829 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8830 | var PDU_ML3_MS_NW emerg_setup; |
| 8831 | timer T := 3.0; |
| 8832 | |
| 8833 | f_assignment_emerg_setup() |
| 8834 | |
| 8835 | T.start; |
| 8836 | alt { |
| 8837 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 8838 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 8839 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 8840 | setverdict(fail, "no emergency setup"); |
| 8841 | } |
| 8842 | } |
| 8843 | [] BSSAP.receive { |
| 8844 | setverdict(fail, "unexpected BSSAP message!"); |
| 8845 | } |
| 8846 | [] T.timeout { |
| 8847 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 8848 | } |
| 8849 | } |
| 8850 | |
| 8851 | setverdict(pass); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8852 | f_perform_clear(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8853 | } |
| 8854 | |
| 8855 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 8856 | * forbidden by the BSC config. */ |
| 8857 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 8858 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8859 | timer T := 3.0; |
| 8860 | |
| 8861 | f_assignment_emerg_setup() |
| 8862 | |
| 8863 | T.start; |
| 8864 | alt { |
| 8865 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8866 | setverdict(pass); |
| 8867 | } |
| 8868 | [] RSL.receive { |
| 8869 | setverdict(fail, "unexpected RSL message!"); |
| 8870 | } |
| 8871 | [] T.timeout { |
| 8872 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 8873 | } |
| 8874 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 8875 | BSSAP.receive(tr_BSSMAP_ClearRequest); |
Neels Hofmeyr | c3c6ee6 | 2022-01-26 01:22:12 +0100 | [diff] [blame] | 8876 | f_perform_clear_no_rr_rel(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8877 | } |
| 8878 | |
| 8879 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 8880 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 8881 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8882 | var MSC_ConnHdlr vc_conn; |
| 8883 | |
| 8884 | f_init(1, true); |
| 8885 | f_sleep(1.0); |
| 8886 | |
| 8887 | f_vty_allow_emerg_msc(true); |
| 8888 | f_vty_allow_emerg_bts(true, 0); |
| 8889 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 8890 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8891 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8892 | } |
| 8893 | |
| 8894 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 8895 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 8896 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8897 | var MSC_ConnHdlr vc_conn; |
| 8898 | |
| 8899 | f_init(1, true); |
| 8900 | f_sleep(1.0); |
| 8901 | |
| 8902 | f_vty_allow_emerg_msc(false); |
| 8903 | f_vty_allow_emerg_bts(true, 0); |
| 8904 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8905 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8906 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8907 | } |
| 8908 | |
| 8909 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 8910 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 8911 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8912 | var MSC_ConnHdlr vc_conn; |
| 8913 | |
| 8914 | /* Note: This simulates a spec violation by the MS, correct MS |
| 8915 | * implementations would not try to establish an emergency call because |
| 8916 | * the system information tells in advance that emergency calls are |
| 8917 | * not forbidden */ |
| 8918 | |
| 8919 | f_init(1, true); |
| 8920 | f_sleep(1.0); |
| 8921 | |
| 8922 | f_vty_allow_emerg_msc(true); |
| 8923 | f_vty_allow_emerg_bts(false, 0); |
| 8924 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8925 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8926 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8927 | } |
| 8928 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8929 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 8930 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 8931 | * emergency call */ |
| 8932 | testcase TC_emerg_premption() runs on test_CT { |
| 8933 | var ASP_RSL_Unitdata rsl_ud; |
| 8934 | var integer i; |
| 8935 | var integer chreq_total, chreq_nochan; |
| 8936 | var RSL_Message rx_rsl; |
| 8937 | var RslChannelNr chan_nr; |
| 8938 | |
| 8939 | f_init(1); |
| 8940 | f_sleep(1.0); |
| 8941 | |
| 8942 | f_vty_allow_emerg_msc(true); |
| 8943 | f_vty_allow_emerg_bts(true, 0); |
| 8944 | |
| 8945 | /* Fill up all channels on the BTS */ |
| 8946 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 8947 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 8948 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 8949 | chan_nr := f_chreq_act_ack('33'O, i); |
| 8950 | } |
| 8951 | IPA_RSL[0].clear; |
| 8952 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 8953 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 8954 | |
| 8955 | /* Send Channel request for emegergency call */ |
| 8956 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 8957 | |
| 8958 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 8959 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 8960 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 8961 | |
| 8962 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 8963 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8964 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 8965 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 8966 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 8967 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8968 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8969 | } |
| 8970 | |
| 8971 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 8972 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8973 | private type record FHParamsTs { |
| 8974 | boolean enabled, |
| 8975 | uint6_t hsn, |
| 8976 | uint6_t maio, |
| 8977 | ArfcnList ma |
| 8978 | }; |
| 8979 | |
| 8980 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8981 | private type record FHParamsTrx { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8982 | GsmBandArfcn arfcn, |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8983 | FHParamsTs ts[8] |
| 8984 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8985 | |
| 8986 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 8987 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 8988 | runs on test_CT return FHParamsTrx { |
| 8989 | var FHParamsTrx fhp; |
| 8990 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 8991 | /* Generate a random ARFCN in the range of 0 - 3. This ARFCN will |
| 8992 | * fall in the GSM900 band. */ |
| 8993 | fhp.arfcn.arfcn := f_rnd_int(3); |
| 8994 | fhp.arfcn.pcs := false; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8995 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8996 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 8997 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8998 | fhp.ts[tn].enabled := false; |
| 8999 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9000 | continue; |
| 9001 | } |
| 9002 | |
| 9003 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9004 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 9005 | fhp.ts[tn].maio := f_rnd_int(64); |
| 9006 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9007 | |
| 9008 | /* Random Mobile Allocation (hopping channels) */ |
| 9009 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 9010 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 9011 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9012 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9013 | } |
| 9014 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9015 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9016 | } |
| 9017 | |
| 9018 | log("f_TC_fh_params_gen(): ", fhp); |
| 9019 | return fhp; |
| 9020 | } |
| 9021 | |
| 9022 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 9023 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 9024 | { |
| 9025 | var template (present) ChannelDescription tr_cd; |
| 9026 | var template (present) MaioHsn tr_maio_hsn; |
| 9027 | var uint3_t tn := cd.chan_nr.tn; |
| 9028 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9029 | if (fhp.ts[tn].enabled) { |
| 9030 | 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] | 9031 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 9032 | } else { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9033 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9034 | } |
| 9035 | |
| 9036 | if (not match(cd, tr_cd)) { |
| 9037 | setverdict(fail, "Channel Description IE does not match: ", |
| 9038 | cd, " vs expected ", tr_cd); |
| 9039 | } |
| 9040 | } |
| 9041 | |
| 9042 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 9043 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 9044 | in MobileAllocationLV ma) |
| 9045 | { |
| 9046 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 9047 | |
| 9048 | if (not match(ma, tr_ma)) { |
| 9049 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 9050 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 9051 | } else { |
| 9052 | setverdict(pass); |
| 9053 | } |
| 9054 | } |
| 9055 | |
| 9056 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 9057 | in MobileAllocationLV ma) |
| 9058 | return template MobileAllocationLV { |
| 9059 | /* 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] | 9060 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9061 | return { len := 0, ma := ''B }; |
| 9062 | } |
| 9063 | |
| 9064 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 9065 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 9066 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9067 | |
| 9068 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9069 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 9070 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 9071 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9072 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9073 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9074 | } |
| 9075 | } |
| 9076 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9077 | /* Take ARFCN of the TRX itself into account */ |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9078 | full_mask[fhp.arfcn.arfcn] := '1'B; |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9079 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9080 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9081 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9082 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9083 | } |
| 9084 | |
| 9085 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 9086 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9087 | if (full_mask[i] != '1'B) |
| 9088 | { continue; } |
| 9089 | |
| 9090 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 9091 | if (slot_mask[i] == '1'B) { |
| 9092 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9093 | } else { |
| 9094 | ma_mask := ma_mask & '0'B; |
| 9095 | } |
| 9096 | } |
| 9097 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 9098 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 9099 | if (full_mask[0] == '1'B) { |
| 9100 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 9101 | if (slot_mask[0] == '1'B) { |
| 9102 | ma_mask := ma_mask & '1'B; |
| 9103 | } else { |
| 9104 | ma_mask := ma_mask & '0'B; |
| 9105 | } |
| 9106 | } |
| 9107 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9108 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 9109 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9110 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 9111 | |
| 9112 | return { len := ma_mask_len, ma := ma_mask }; |
| 9113 | } |
| 9114 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9115 | /* Configure the appropriate band for a given arfcn, exc */ |
| 9116 | private function f_TC_set_band_by_arfcn(integer bts_nr, GsmBandArfcn arfcn) runs on test_CT |
| 9117 | { |
| 9118 | var charstring band; |
| 9119 | var GsmBandArfcn arfcn_ := valueof(ts_GsmBandArfcn(arfcn.arfcn, arfcn.pcs, false)); |
| 9120 | |
| 9121 | select (arfcn_) { |
| 9122 | case (tr_GsmBandArfcn((259..293), false, ?)) { band := "GSM450"; } |
| 9123 | case (tr_GsmBandArfcn((306..340), false, ?)) { band := "GSM480"; } |
| 9124 | case (tr_GsmBandArfcn((438..511), false, ?)) { band := "GSM750"; } |
| 9125 | case (tr_GsmBandArfcn((128..251), false, ?)) { band := "GSM850"; } |
| 9126 | case (tr_GsmBandArfcn((0..124), false, ?)) { band := "GSM900"; } |
| 9127 | case (tr_GsmBandArfcn((955..1023), false, ?)) { band := "GSM900"; } |
| 9128 | case (tr_GsmBandArfcn((512..885), false, ?)) { band := "DCS1800"; } |
| 9129 | case (tr_GsmBandArfcn((512..810), true, ?)) { band := "PCS1900"; } |
| 9130 | case else { return; } |
| 9131 | } |
| 9132 | |
| 9133 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 9134 | f_vty_transceive(BSCVTY, "band " & band); |
| 9135 | f_vty_transceive(BSCVTY, "end"); |
| 9136 | } |
| 9137 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9138 | /* Configure the hopping parameters in accordance with the given record */ |
| 9139 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 9140 | uint8_t bts_nr := 0, |
| 9141 | uint8_t trx_nr := 0) |
| 9142 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9143 | |
| 9144 | f_TC_set_band_by_arfcn(bts_nr, fhp.arfcn); |
| 9145 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9146 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 9147 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 9148 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9149 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9150 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9151 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9152 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 9153 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9154 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9155 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 9156 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9157 | continue; |
| 9158 | } |
| 9159 | |
| 9160 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9161 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 9162 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9163 | |
| 9164 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9165 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9166 | 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] | 9167 | } |
| 9168 | |
| 9169 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 9170 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9171 | } |
| 9172 | |
| 9173 | f_vty_transceive(BSCVTY, "end"); |
| 9174 | } |
| 9175 | |
| 9176 | /* Disable frequency hopping on all timeslots */ |
| 9177 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 9178 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9179 | uint8_t trx_nr := 0, |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9180 | GsmBandArfcn arfcn := {pcs := false, arfcn := 871}) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9181 | runs on test_CT { |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9182 | |
| 9183 | f_TC_set_band_by_arfcn(bts_nr, arfcn); |
| 9184 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9185 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 9186 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 9187 | |
Philipp Maier | 798d895 | 2021-10-19 14:43:19 +0200 | [diff] [blame] | 9188 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn.arfcn)); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 9189 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9190 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9191 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 9192 | |
| 9193 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 9194 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 9195 | 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] | 9196 | } |
| 9197 | |
| 9198 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 9199 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9200 | } |
| 9201 | |
| 9202 | f_vty_transceive(BSCVTY, "end"); |
| 9203 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9204 | } |
| 9205 | |
| 9206 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 9207 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 9208 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 9209 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9210 | var RSL_Message rsl_msg; |
| 9211 | var RSL_IE_Body ie; |
| 9212 | |
| 9213 | f_init_vty(); |
| 9214 | |
| 9215 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9216 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9217 | |
| 9218 | f_init(1); |
| 9219 | |
| 9220 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 9221 | for (var integer i := 0; i < 9; i := i + 1) { |
| 9222 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 9223 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9224 | |
| 9225 | /* Make sure that Channel Identification IE is present */ |
| 9226 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 9227 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9228 | continue; |
| 9229 | } |
| 9230 | |
| 9231 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9232 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 9233 | |
| 9234 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 9235 | if (ie.chan_ident.ma.v.len != 0) { |
| 9236 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 9237 | ie.chan_ident.ma, ", despite it shall be"); |
| 9238 | continue; |
| 9239 | } |
| 9240 | } |
| 9241 | |
| 9242 | /* Disable frequency hopping */ |
| 9243 | f_TC_fh_params_unset(fhp); |
| 9244 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9245 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9246 | } |
| 9247 | |
| 9248 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 9249 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 9250 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9251 | var RSL_Message rsl_msg; |
| 9252 | var RSL_IE_Body ie; |
| 9253 | |
| 9254 | f_init_vty(); |
| 9255 | |
| 9256 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9257 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9258 | |
| 9259 | f_init(1); |
| 9260 | |
| 9261 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 9262 | for (var integer i := 0; i < 9; i := i + 1) { |
| 9263 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 9264 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9265 | |
| 9266 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 9267 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 9268 | |
| 9269 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 9270 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 9271 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 9272 | continue; |
| 9273 | } |
| 9274 | |
| 9275 | /* Decode the actual Immediate Assignment message */ |
| 9276 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 9277 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 9278 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 9279 | continue; |
| 9280 | } |
| 9281 | |
| 9282 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9283 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 9284 | |
| 9285 | /* Make sure that the Mobile Allocation IE matches */ |
| 9286 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 9287 | rr_msg.payload.imm_ass.mobile_allocation); |
| 9288 | } |
| 9289 | |
| 9290 | /* Disable frequency hopping */ |
| 9291 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9292 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9293 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9294 | } |
| 9295 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9296 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 9297 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 9298 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9299 | var RSL_Message rsl_msg; |
| 9300 | var RSL_IE_Body ie; |
| 9301 | |
| 9302 | f_init_vty(); |
| 9303 | |
| 9304 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9305 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9306 | |
| 9307 | f_init(1); |
| 9308 | |
| 9309 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 9310 | vc_MGCP.stop; |
| 9311 | |
| 9312 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9313 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 9314 | |
| 9315 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 9316 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 9317 | for (var integer i := 0; i < 3; i := i + 1) { |
| 9318 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 9319 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 9320 | |
| 9321 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 9322 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 9323 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9324 | |
| 9325 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 9326 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 9327 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 9328 | |
| 9329 | /* Make sure that L3 Information IE is present */ |
| 9330 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 9331 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 9332 | continue; |
| 9333 | } |
| 9334 | |
| 9335 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 9336 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 9337 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 9338 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 9339 | continue; |
| 9340 | } |
| 9341 | |
| 9342 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9343 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 9344 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9345 | |
| 9346 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 9347 | 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] | 9348 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9349 | continue; |
| 9350 | } |
| 9351 | |
| 9352 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 9353 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 9354 | if (chan_desc.h and ma_present) { |
| 9355 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9356 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 9357 | } else if (chan_desc.h and not ma_present) { |
| 9358 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9359 | continue; |
| 9360 | } else if (not chan_desc.h and ma_present) { |
| 9361 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 9362 | continue; |
| 9363 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 9364 | |
| 9365 | f_perform_clear_test_ct(dt); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9366 | } |
| 9367 | |
| 9368 | /* Give the IUT some time to release all channels */ |
| 9369 | f_sleep(3.0); |
| 9370 | |
| 9371 | /* Disable frequency hopping */ |
| 9372 | f_TC_fh_params_unset(fhp); |
| 9373 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9374 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9375 | } |
| 9376 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9377 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 9378 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 9379 | runs on test_CT { |
| 9380 | var RSL_Message rsl_msg; |
| 9381 | var RSL_IE_Body ie; |
| 9382 | var DchanTuple dt; |
| 9383 | |
| 9384 | /* Establish a dedicated channel, so we can trigger handover */ |
| 9385 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
Vadim Yanitskiy | c18ff47 | 2021-11-18 20:15:37 +0300 | [diff] [blame] | 9386 | f_sleep(0.5); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9387 | |
| 9388 | /* Trigger handover from BTS0 to BTS1 */ |
| 9389 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 9390 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 9391 | |
| 9392 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 9393 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9394 | |
| 9395 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 9396 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 9397 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 9398 | |
| 9399 | /* Make sure that L3 Information IE is present */ |
| 9400 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 9401 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 9402 | return; |
| 9403 | } |
| 9404 | |
| 9405 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 9406 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 9407 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 9408 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 9409 | return; |
| 9410 | } |
| 9411 | |
| 9412 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 9413 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 9414 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 9415 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 9416 | return; |
| 9417 | } |
| 9418 | |
| 9419 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 9420 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9421 | |
| 9422 | /* Make sure that Cell Channel Description IE is present */ |
| 9423 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 9424 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 9425 | return; |
| 9426 | } |
| 9427 | |
| 9428 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 9429 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 9430 | if (ma_present) { |
| 9431 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9432 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 9433 | } else { |
| 9434 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9435 | return; |
| 9436 | } |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 9437 | |
| 9438 | f_perform_clear_test_ct(dt); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9439 | } |
| 9440 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 9441 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 9442 | |
| 9443 | f_init_vty(); |
| 9444 | |
| 9445 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 9446 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 9447 | |
| 9448 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9449 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 9450 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9451 | |
| 9452 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9453 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 9454 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9455 | |
| 9456 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 9457 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 9458 | |
| 9459 | f_init(2); |
| 9460 | |
| 9461 | f_TC_fh_params_handover_cmd(fhp); |
| 9462 | |
| 9463 | /* Disable frequency hopping on BTS1 */ |
| 9464 | f_TC_fh_params_unset(fhp, 1); |
| 9465 | |
| 9466 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 9467 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 9468 | |
| 9469 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9470 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 9471 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9472 | |
| 9473 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9474 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 9475 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9476 | |
| 9477 | f_shutdown_helper(); |
| 9478 | } |
| 9479 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9480 | /* Verify the hopping parameters in System Information Type 4 */ |
| 9481 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 9482 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 9483 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9484 | timer T := 5.0; |
| 9485 | |
| 9486 | f_init_vty(); |
| 9487 | |
| 9488 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 9489 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 9490 | |
| 9491 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 9492 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 9493 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9494 | |
| 9495 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9496 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 9497 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9498 | |
| 9499 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 9500 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9501 | |
| 9502 | f_init(1); |
| 9503 | |
| 9504 | T.start; |
| 9505 | alt { |
| 9506 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 9507 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 9508 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 9509 | |
| 9510 | /* Make sure that what we decoded is System Information Type 4 */ |
| 9511 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 9512 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 9513 | repeat; |
| 9514 | } |
| 9515 | |
| 9516 | /* Make sure that CBCH Channel Description IE is present */ |
| 9517 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 9518 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 9519 | break; |
| 9520 | } |
| 9521 | |
| 9522 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 9523 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 9524 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 9525 | |
| 9526 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 9527 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 9528 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 9529 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 9530 | break; |
| 9531 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 9532 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 9533 | si.payload.si4.cbch_mobile_alloc.v); |
| 9534 | } |
| 9535 | } |
| 9536 | [] IPA_RSL[0].receive { repeat; } |
| 9537 | [] T.timeout { |
| 9538 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 9539 | } |
| 9540 | } |
| 9541 | |
| 9542 | /* Disable frequency hopping */ |
| 9543 | f_TC_fh_params_unset(fhp); |
| 9544 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 9545 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9546 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 9547 | |
| 9548 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 9549 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9550 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 9551 | |
| 9552 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 9553 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 9554 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 9555 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 9556 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9557 | } |
| 9558 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9559 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 9560 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 9561 | |
| 9562 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 9563 | template (present) BSSLAP_PDU expect_bsslap) |
| 9564 | { |
| 9565 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 9566 | if (not match(bsslap, expect_bsslap)) { |
| 9567 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 9568 | log("GOT BSSLAP: ", bsslap); |
| 9569 | setverdict(fail, "BSSLAP is not as expected"); |
| 9570 | mtc.stop; |
| 9571 | } |
| 9572 | setverdict(pass); |
| 9573 | } |
| 9574 | |
| 9575 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 9576 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 9577 | |
| 9578 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 9579 | var PDU_BSSAP_LE rx_bsslap; |
| 9580 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 9581 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 9582 | } |
| 9583 | |
| 9584 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9585 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 9586 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 9587 | f_sleep(1.0); |
| 9588 | |
| 9589 | f_establish_fully(omit, omit); |
| 9590 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9591 | |
| 9592 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9593 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9594 | |
| 9595 | var PDU_BSSAP_LE plr; |
| 9596 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9597 | |
| 9598 | if (not do_ta_request) { |
| 9599 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 9600 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 9601 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 9602 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 9603 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 9604 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 9605 | mtc.stop; |
| 9606 | } |
| 9607 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 9608 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 9609 | if (not match(bsslap, expect_ta_layer3)) { |
| 9610 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 9611 | log("GOT BSSLAP: ", bsslap); |
| 9612 | setverdict(fail, "BSSLAP is not as expected"); |
| 9613 | mtc.stop; |
| 9614 | } |
| 9615 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 9616 | * has no need to request the TA from the BSC and directly responds. */ |
| 9617 | } else { |
| 9618 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9619 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9620 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9621 | } |
| 9622 | |
| 9623 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9624 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9625 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9626 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9627 | |
| 9628 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 9629 | f_mo_l3_transceive(); |
| 9630 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9631 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9632 | |
| 9633 | f_sleep(2.0); |
| 9634 | setverdict(pass); |
| 9635 | } |
| 9636 | |
| 9637 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9638 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 9639 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 9640 | f_lcs_loc_req_for_active_ms(false); |
| 9641 | } |
| 9642 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 9643 | var MSC_ConnHdlr vc_conn; |
| 9644 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9645 | |
| 9646 | f_init(1, true); |
| 9647 | f_sleep(1.0); |
| 9648 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 9649 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9650 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9651 | } |
| 9652 | |
| 9653 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9654 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 9655 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 9656 | f_lcs_loc_req_for_active_ms(true); |
| 9657 | } |
| 9658 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 9659 | var MSC_ConnHdlr vc_conn; |
| 9660 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9661 | |
| 9662 | f_init(1, true); |
| 9663 | f_sleep(1.0); |
| 9664 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 9665 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9666 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9667 | } |
| 9668 | |
| 9669 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 9670 | * conn without an active lchan. */ |
| 9671 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 9672 | { |
| 9673 | var BssmapCause cause := 0; |
| 9674 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9675 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 9676 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9677 | |
| 9678 | timer no_more_bssap := 5.0; |
| 9679 | no_more_bssap.start; |
| 9680 | alt { |
| 9681 | [] no_more_bssap.timeout { break; } |
| 9682 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 9683 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 9684 | mtc.stop; |
| 9685 | } |
| 9686 | } |
| 9687 | setverdict(pass); |
| 9688 | } |
| 9689 | |
| 9690 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 9691 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 9692 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 9693 | { |
| 9694 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 9695 | |
| 9696 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 9697 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 9698 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 9699 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9700 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9701 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 9702 | |
| 9703 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 9704 | f_clear_A_conn(); |
| 9705 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9706 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9707 | } |
| 9708 | |
| 9709 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9710 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 9711 | */ |
| 9712 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 9713 | f_sleep(1.0); |
| 9714 | |
| 9715 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9716 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9717 | |
| 9718 | /* Register to receive the Paging Command */ |
| 9719 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9720 | g_chan_nr := new_chan_nr; |
| 9721 | f_rslem_register(0, g_chan_nr); |
| 9722 | |
| 9723 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9724 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9725 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9726 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9727 | |
| 9728 | var PDU_BSSAP_LE plr; |
| 9729 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9730 | |
| 9731 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9732 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9733 | |
| 9734 | /* OsmoBSC needs to Page */ |
| 9735 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 9736 | f_logp(BSCVTY, "got Paging Command"); |
| 9737 | |
| 9738 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 9739 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9740 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 9741 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9742 | |
| 9743 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 9744 | |
| 9745 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9746 | |
| 9747 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9748 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9749 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9750 | |
| 9751 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9752 | |
| 9753 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 9754 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 9755 | f_verify_active_A_conn_and_clear(); |
| 9756 | |
| 9757 | f_sleep(2.0); |
| 9758 | setverdict(pass); |
| 9759 | } |
| 9760 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 9761 | var MSC_ConnHdlr vc_conn; |
| 9762 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9763 | |
| 9764 | f_init(1, true); |
| 9765 | f_sleep(1.0); |
| 9766 | |
| 9767 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9768 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9769 | |
| 9770 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 9771 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9772 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9773 | } |
| 9774 | |
| 9775 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 9776 | */ |
| 9777 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 9778 | f_sleep(1.0); |
| 9779 | |
| 9780 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9781 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9782 | |
| 9783 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 9784 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9785 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 9786 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 9787 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9788 | |
| 9789 | /* BSC tells MSC about failure */ |
| 9790 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9791 | locationEstimate := omit, positioningData := omit, |
| 9792 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 9793 | |
| 9794 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9795 | f_verify_active_A_conn_and_clear(); |
| 9796 | |
| 9797 | f_sleep(2.0); |
| 9798 | setverdict(pass); |
| 9799 | } |
| 9800 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 9801 | var MSC_ConnHdlr vc_conn; |
| 9802 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9803 | |
| 9804 | f_init(1, true); |
| 9805 | f_sleep(1.0); |
| 9806 | |
| 9807 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9808 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9809 | |
| 9810 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 9811 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9812 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9813 | } |
| 9814 | |
| 9815 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9816 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 9817 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 9818 | f_sleep(1.0); |
| 9819 | |
| 9820 | f_establish_fully(omit, omit); |
| 9821 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9822 | |
| 9823 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9824 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9825 | |
| 9826 | var PDU_BSSAP_LE plr; |
| 9827 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9828 | |
| 9829 | if (do_ta) { |
| 9830 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9831 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9832 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9833 | } |
| 9834 | |
| 9835 | /* SMLC fails to respond, BSC runs into timeout */ |
| 9836 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 9837 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9838 | |
| 9839 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9840 | locationEstimate := omit, positioningData := omit, |
| 9841 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 9842 | |
| 9843 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9844 | f_verify_active_A_conn_and_clear(); |
| 9845 | |
| 9846 | f_sleep(2.0); |
| 9847 | setverdict(pass); |
| 9848 | } |
| 9849 | |
| 9850 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9851 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 9852 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 9853 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 9854 | } |
| 9855 | |
| 9856 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 9857 | var MSC_ConnHdlr vc_conn; |
| 9858 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9859 | |
| 9860 | f_init(1, true); |
| 9861 | f_sleep(1.0); |
| 9862 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 9863 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9864 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9865 | } |
| 9866 | |
| 9867 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9868 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 9869 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 9870 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 9871 | } |
| 9872 | |
| 9873 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 9874 | var MSC_ConnHdlr vc_conn; |
| 9875 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9876 | |
| 9877 | f_init(1, true); |
| 9878 | f_sleep(1.0); |
| 9879 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 9880 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9881 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9882 | } |
| 9883 | |
| 9884 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 9885 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 9886 | f_sleep(1.0); |
| 9887 | |
| 9888 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9889 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9890 | |
| 9891 | /* Register to receive the Paging Command */ |
| 9892 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9893 | g_chan_nr := new_chan_nr; |
| 9894 | f_rslem_register(0, g_chan_nr); |
| 9895 | |
| 9896 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9897 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9898 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9899 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9900 | |
| 9901 | var PDU_BSSAP_LE plr; |
| 9902 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9903 | |
| 9904 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9905 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9906 | |
| 9907 | /* OsmoBSC needs to Page */ |
| 9908 | var PDU_BSSAP_LE rx_bsslap; |
| 9909 | alt { |
| 9910 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 9911 | f_logp(BSCVTY, "got Paging Command"); |
| 9912 | repeat; |
| 9913 | } |
| 9914 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9915 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 9916 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 9917 | } |
| 9918 | } |
| 9919 | |
| 9920 | /* SMLC responds with failure */ |
| 9921 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9922 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9923 | |
| 9924 | /* BSC tells MSC about failure */ |
| 9925 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9926 | locationEstimate := omit, positioningData := omit, |
| 9927 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 9928 | |
| 9929 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9930 | f_verify_active_A_conn_and_clear(); |
| 9931 | |
| 9932 | f_sleep(2.0); |
| 9933 | setverdict(pass); |
| 9934 | } |
| 9935 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 9936 | var MSC_ConnHdlr vc_conn; |
| 9937 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9938 | |
| 9939 | f_init(1, true); |
| 9940 | f_sleep(1.0); |
| 9941 | |
| 9942 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9943 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9944 | |
| 9945 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 9946 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9947 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9948 | } |
| 9949 | |
| 9950 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 9951 | * over. */ |
| 9952 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9953 | f_sleep(1.0); |
| 9954 | |
| 9955 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9956 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9957 | |
| 9958 | /* Register to receive the Paging Command */ |
| 9959 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9960 | g_chan_nr := new_chan_nr; |
| 9961 | f_rslem_register(0, g_chan_nr); |
| 9962 | |
| 9963 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9964 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9965 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9966 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9967 | |
| 9968 | var PDU_BSSAP_LE plr; |
| 9969 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9970 | |
| 9971 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 9972 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9973 | 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] | 9974 | do_clear := false, expect_bssmap_l3 := true); |
| 9975 | |
| 9976 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9977 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9978 | |
| 9979 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 9980 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9981 | |
| 9982 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9983 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9984 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9985 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9986 | |
| 9987 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 9988 | f_mo_l3_transceive(); |
| 9989 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9990 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9991 | |
| 9992 | f_sleep(2.0); |
| 9993 | setverdict(pass); |
| 9994 | } |
| 9995 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 9996 | var MSC_ConnHdlr vc_conn; |
| 9997 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9998 | |
| 9999 | f_init(1, true); |
| 10000 | f_sleep(1.0); |
| 10001 | |
| 10002 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 10003 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 10004 | |
| 10005 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 10006 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10007 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10008 | } |
| 10009 | |
| 10010 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 10011 | * the new lchan after handover. */ |
| 10012 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 10013 | f_sleep(1.0); |
| 10014 | |
| 10015 | f_establish_fully(omit, omit); |
| 10016 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 10017 | |
| 10018 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 10019 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 10020 | |
| 10021 | var PDU_BSSAP_LE plr; |
| 10022 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 10023 | |
| 10024 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 10025 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 10026 | |
| 10027 | var HandoverState hs := { |
| 10028 | rr_ho_cmpl_seen := false, |
| 10029 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 10030 | old_chan_nr := -, |
| 10031 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10032 | }; |
| 10033 | /* issue hand-over command on VTY */ |
| 10034 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 10035 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 10036 | f_rslem_suspend(RSL1_PROC); |
| 10037 | |
| 10038 | /* From the MGW perspective, a handover is is characterized by |
| 10039 | * performing one MDCX operation with the MGW. So we expect to see |
| 10040 | * one more MDCX during handover. */ |
| 10041 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 10042 | |
| 10043 | alt { |
| 10044 | [] as_handover(hs); |
| 10045 | } |
| 10046 | |
| 10047 | var PDU_BSSAP_LE rx_bsslap; |
| 10048 | |
| 10049 | interleave { |
| 10050 | /* Expect the BSC to inform the MSC about the handover */ |
| 10051 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 10052 | |
| 10053 | /* Expect the BSC to inform the SMLC about the handover */ |
| 10054 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 10055 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 10056 | } |
| 10057 | } |
| 10058 | |
| 10059 | /* SMLC now responds with geo information data. */ |
| 10060 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 10061 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 10062 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 10063 | |
| 10064 | /* lchan still active */ |
| 10065 | f_mo_l3_transceive(RSL1); |
| 10066 | |
| 10067 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 10068 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10069 | |
| 10070 | f_sleep(2.0); |
| 10071 | setverdict(pass); |
| 10072 | } |
| 10073 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 10074 | var MSC_ConnHdlr vc_conn; |
| 10075 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10076 | |
| 10077 | f_init(2, true); |
| 10078 | f_sleep(1.0); |
| 10079 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 10080 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10081 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10082 | } |
| 10083 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10084 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 10085 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 10086 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 10087 | |
| 10088 | /* Also disable attach for the single connected MSC */ |
| 10089 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 10090 | |
| 10091 | 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) )); |
| 10092 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 10093 | |
| 10094 | /* No MSC is found, expecting a proper release on RSL */ |
| 10095 | interleave { |
| 10096 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 10097 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 10098 | } |
| 10099 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 10100 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 10101 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 10102 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10103 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 10104 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 10105 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10106 | } |
| 10107 | } |
| 10108 | setverdict(pass); |
| 10109 | } |
| 10110 | testcase TC_no_msc() runs on test_CT { |
| 10111 | |
| 10112 | f_init(1, true); |
| 10113 | f_sleep(1.0); |
| 10114 | var MSC_ConnHdlr vc_conn; |
| 10115 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10116 | |
| 10117 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 10118 | |
| 10119 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 10120 | vc_conn.done; |
| 10121 | |
| 10122 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 10123 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 10124 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10125 | } |
| 10126 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 10127 | /* Dyn PDCH todo: |
| 10128 | * activate OSMO as TCH/F |
| 10129 | * activate OSMO as TCH/H |
| 10130 | * does the BSC-located PCU socket get the updated INFO? |
| 10131 | * what if no PCU is connected at the time? |
| 10132 | * is the info correct on delayed PCU (re)connect? |
| 10133 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 10134 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10135 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 10136 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 10137 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 10138 | |
| 10139 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 10140 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10141 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 10142 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 10143 | g_pars.ass_codec_list.codecElements[0]; |
| 10144 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 10145 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 10146 | g_pars.expect_mr_s0_s7; |
| 10147 | } |
| 10148 | } |
| 10149 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 10150 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 10151 | log("expecting ASS COMPL like this: ", exp_compl); |
| 10152 | |
| 10153 | f_establish_fully(ass_cmd, exp_compl); |
| 10154 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 10155 | 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] | 10156 | |
| 10157 | var RSL_Message rsl; |
| 10158 | |
| 10159 | timer T := 5.0; |
| 10160 | T.start; |
| 10161 | alt { |
| 10162 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 10163 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 10164 | log("Rx L3 from net: ", l3); |
| 10165 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 10166 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 10167 | mtc.stop; |
| 10168 | } |
| 10169 | } |
| 10170 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 10171 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 10172 | mtc.stop; |
| 10173 | } |
| 10174 | [] T.timeout { |
| 10175 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 10176 | setverdict(pass); |
| 10177 | } |
| 10178 | } |
| 10179 | T.stop; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10180 | |
| 10181 | f_perform_clear(); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10182 | } |
| 10183 | |
| 10184 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 10185 | * osmo-bsc. */ |
| 10186 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 10187 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10188 | var MSC_ConnHdlr vc_conn; |
| 10189 | |
| 10190 | f_init(1, true); |
| 10191 | f_sleep(1.0); |
| 10192 | |
| 10193 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10194 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 10195 | vc_conn.done; |
| 10196 | f_shutdown_helper(); |
| 10197 | } |
| 10198 | |
| 10199 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 10200 | */ |
| 10201 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 10202 | f_init_vty(); |
| 10203 | |
| 10204 | f_init(1, false); |
| 10205 | f_sleep(1.0); |
| 10206 | |
| 10207 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 10208 | |
| 10209 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10210 | timer T := 5.0; |
| 10211 | |
| 10212 | T.start; |
| 10213 | alt { |
| 10214 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 10215 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 10216 | T.stop; |
| 10217 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 10218 | mtc.stop; |
| 10219 | } |
| 10220 | repeat; |
| 10221 | } |
| 10222 | [] T.timeout { |
| 10223 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 10224 | setverdict(pass); |
| 10225 | } |
| 10226 | } |
| 10227 | } |
| 10228 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10229 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 10230 | /* First fully set up a speech lchan */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10231 | f_assignment_codec(id, do_perform_clear := false); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10232 | |
| 10233 | /* Trigger re-assignment to another lchan */ |
| 10234 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 10235 | |
| 10236 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 10237 | * one MDCX on MGCP. */ |
| 10238 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 10239 | |
| 10240 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 10241 | * as the old lchan used. */ |
| 10242 | g_media.bts.ipa_crcx_seen := false; |
| 10243 | g_media.bts.ipa_mdcx_seen := false; |
| 10244 | |
| 10245 | /* Send different BTS side RTP port number for the new lchan */ |
| 10246 | g_media.bts.bts.port_nr := 4223; |
| 10247 | |
| 10248 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 10249 | |
| 10250 | /* Trigger re-assignment. */ |
| 10251 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 10252 | |
| 10253 | timer T := 5.0; |
| 10254 | T.start; |
| 10255 | alt { |
| 10256 | [] as_assignment(assignment_st); |
| 10257 | [] as_Media(); |
| 10258 | [] T.timeout { |
| 10259 | break; |
| 10260 | } |
| 10261 | } |
| 10262 | |
| 10263 | if (not assignment_st.assignment_done) { |
| 10264 | setverdict(fail, "Assignment did not complete"); |
| 10265 | mtc.stop; |
| 10266 | } |
| 10267 | |
| 10268 | f_check_mgcp_expectations() |
| 10269 | setverdict(pass); |
| 10270 | |
| 10271 | f_sleep(2.0); |
| 10272 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 10273 | |
| 10274 | /* Instruct BSC to clear channel */ |
| 10275 | var BssmapCause cause := 0; |
| 10276 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 10277 | interleave { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10278 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 10279 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 10280 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10281 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 10282 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10283 | } |
| 10284 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 10285 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 10286 | } |
| 10287 | } |
Neels Hofmeyr | 40a45d1 | 2021-09-23 22:57:12 +0200 | [diff] [blame] | 10288 | f_expect_dlcx_conns(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10289 | |
| 10290 | f_sleep(0.5); |
| 10291 | } |
| 10292 | |
| 10293 | testcase TC_reassignment_fr() runs on test_CT { |
| 10294 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10295 | var MSC_ConnHdlr vc_conn; |
| 10296 | |
| 10297 | f_init(1, true); |
| 10298 | f_sleep(1.0); |
| 10299 | |
Neels Hofmeyr | ac432fa | 2021-11-02 16:45:56 +0100 | [diff] [blame] | 10300 | f_ctrs_bsc_and_bts_handover_init(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10301 | |
| 10302 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10303 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 10304 | vc_conn.done; |
| 10305 | |
| 10306 | /* from f_establish_fully() */ |
| 10307 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 10308 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 10309 | /* from re-assignment */ |
| 10310 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 10311 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 10312 | f_ctrs_bsc_and_bts_verify(); |
| 10313 | f_shutdown_helper(); |
| 10314 | } |
| 10315 | |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10316 | const charstring REEST_LOST_CONNECTION := "REEST_LOST_CONNECTION"; |
| 10317 | const charstring REEST_CLEAR := "REEST_CLEAR"; |
| 10318 | const charstring REEST_CLEAR_DONE := "REEST_CLEAR_DONE"; |
| 10319 | |
| 10320 | /* CM Re-Establishment, 3GPP TS 24.008 4.5.1.6. |
| 10321 | * The MS <-> BTS loses radio connection, MS shows up on second BTS and asks for CM Re-Establishment. |
| 10322 | * BSC should establish a separate A conn for the same MS, the original A conn is then cleared by |
| 10323 | * the MSC as the CM Re-Establishment is handled. |
| 10324 | * |
| 10325 | * MS bts0 bts1 bsc msc test-component |
| 10326 | * |<----->|<----------------->|<-0-->| _1 Establish channel on bts 0 |
| 10327 | * | | _1 wait a bit, to settle down |
| 10328 | * |<-x x--| | _1 "lose connection" |
| 10329 | * | | REEST_LOST_CONNECTION |
| 10330 | * |----------------->|------->|--1-->| _2 new A-conn: Chan Rqd, Imm Ass, Compl L3 with CM Re-Establishment Req |
| 10331 | * | | REEST_CLEAR |
| 10332 | * | |<-0---| _1 Clear Command on first A-conn |
| 10333 | * | |--0-->| _1 Clear Complete |
| 10334 | * | |<----------------->| | _1 Release first channel |
| 10335 | * | | REEST_CLEAR_DONE |
| 10336 | * |<-----------------|<-------|<-1---| _2 Chan Activ, Assignment Command |
| 10337 | * |<-----------------|<-------|<-1---| _2 Clear Command, Release |
| 10338 | * |
| 10339 | */ |
| 10340 | private function f_tc_cm_reestablishment_1(charstring id) runs on MSC_ConnHdlr { |
| 10341 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 10342 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10343 | |
| 10344 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10345 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10346 | |
| 10347 | f_establish_fully(ass_cmd, exp_compl); |
| 10348 | |
| 10349 | /* The original channel loses connection, MS attemts CM Re-Establishment on another cell, see |
| 10350 | * f_tc_cm_reestablishment_2(). This established channel stays active until MSC sends a Clear Command. The time |
| 10351 | * when exactly that happens is determined by f_tc_cm_reestablishment_2(). */ |
| 10352 | f_sleep(2.0); |
| 10353 | COORD.send(REEST_LOST_CONNECTION); |
| 10354 | |
| 10355 | alt { |
| 10356 | [] COORD.receive(REEST_CLEAR); |
| 10357 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 10358 | setverdict(fail, "Unexpected channel release"); |
| 10359 | mtc.stop; |
| 10360 | } |
| 10361 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 10362 | setverdict(fail, "Unexpected channel release"); |
| 10363 | mtc.stop; |
| 10364 | } |
| 10365 | } |
| 10366 | f_perform_clear() |
Neels Hofmeyr | 969abd0 | 2021-09-23 22:24:08 +0200 | [diff] [blame] | 10367 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10368 | COORD.send(REEST_CLEAR_DONE); |
| 10369 | } |
| 10370 | |
| 10371 | private function f_tc_cm_reestablishment_2(charstring id) runs on MSC_ConnHdlr { |
| 10372 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 10373 | |
| 10374 | /* The MS lost the connection on the first channel, now establishes another one */ |
| 10375 | COORD.receive(REEST_LOST_CONNECTION); |
| 10376 | |
| 10377 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 10378 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REESTABL_REQ(mi)); |
| 10379 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 10380 | |
| 10381 | f_create_bssmap_exp(l3_enc); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10382 | 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] | 10383 | BSSAP.receive(tr_BSSMAP_ComplL3(l3_enc)); |
| 10384 | |
| 10385 | /* MSC got the CM Re-Establishment request and first off clears the previous conn. */ |
| 10386 | COORD.send(REEST_CLEAR); |
| 10387 | COORD.receive(REEST_CLEAR_DONE); |
| 10388 | |
| 10389 | f_sleep(2.0); |
| 10390 | |
| 10391 | /* Answer the CM Re-Establishment with an Assignment Command. */ |
| 10392 | var template PDU_BSSAP expect_assignment_compl := f_gen_exp_compl(); |
| 10393 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10394 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10395 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10396 | |
| 10397 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
| 10398 | st.voice_call := true; |
| 10399 | st.is_assignment := true; |
| 10400 | |
| 10401 | var ExpectCriteria mgcpcrit := { |
| 10402 | connid := omit, |
| 10403 | endpoint := omit, |
| 10404 | transid := omit |
| 10405 | }; |
| 10406 | f_create_mgcp_expect(mgcpcrit); |
| 10407 | |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10408 | f_rslem_dchan_queue_enable(RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10409 | |
| 10410 | BSSAP.send(ass_cmd); |
| 10411 | |
| 10412 | var PDU_BSSAP bssap; |
| 10413 | |
| 10414 | alt { |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10415 | [] as_assignment(st, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
| 10416 | [] as_Media_ipacc(RSL1, RSL2); |
| 10417 | [] as_Media_mgw(); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10418 | [st.assignment_done] BSSAP.receive(expect_assignment_compl) { |
| 10419 | break; |
| 10420 | } |
| 10421 | } |
| 10422 | |
| 10423 | f_sleep(3.0); |
| 10424 | |
| 10425 | f_logp(BSCVTY, "f_tc_cm_reestablishment_2 clearing"); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 10426 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10427 | } |
| 10428 | |
| 10429 | testcase TC_cm_reestablishment() runs on test_CT { |
| 10430 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 10431 | var MSC_ConnHdlr vc_conn1; |
| 10432 | |
| 10433 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 10434 | var MSC_ConnHdlr vc_conn2; |
| 10435 | pars2.imsi := pars1.imsi; |
| 10436 | pars2.media_nr := 2; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 10437 | pars2.expect_tsc := BTS_TSC[1]; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10438 | |
| 10439 | f_init(2, true, guard_timeout := 40.0); |
| 10440 | f_sleep(1.0); |
| 10441 | |
| 10442 | vc_conn1 := f_start_handler_create(pars1); |
| 10443 | vc_conn2 := f_start_handler_create(pars2); |
| 10444 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 10445 | f_start_handler_run(vc_conn1, refers(f_tc_cm_reestablishment_1), pars1); |
| 10446 | f_start_handler_run(vc_conn2, refers(f_tc_cm_reestablishment_2), pars2); |
| 10447 | vc_conn1.done; |
| 10448 | vc_conn2.done; |
| 10449 | |
| 10450 | f_shutdown_helper(); |
| 10451 | } |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10452 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10453 | function f_exp_ipa_rx_nonfatal(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, |
| 10454 | IpaStreamId sid := IPAC_PROTO_RSL_TRX0, boolean ignore_other_rx := true) |
| 10455 | runs on test_CT return template (omit) RSL_Message { |
| 10456 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10457 | timer T := t_secs; |
| 10458 | |
| 10459 | T.start; |
| 10460 | alt { |
| 10461 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
| 10462 | T.stop; |
| 10463 | } |
| 10464 | [ignore_other_rx] IPA_RSL[bts_nr].receive { repeat; } |
| 10465 | [not ignore_other_rx] IPA_RSL[bts_nr].receive { |
| 10466 | log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx); |
| 10467 | T.stop; |
| 10468 | return omit; |
| 10469 | } |
| 10470 | [] T.timeout { |
| 10471 | return omit; |
| 10472 | } |
| 10473 | } |
| 10474 | return rx_rsl_ud.rsl; |
| 10475 | } |
| 10476 | |
| 10477 | private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") { |
| 10478 | f_vty_enter_cfg_bts(pt, bts_nr); |
| 10479 | f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting); |
| 10480 | f_vty_transceive(pt, "exit"); |
| 10481 | f_vty_transceive(pt, "exit"); |
| 10482 | f_vty_transceive(pt, "exit"); |
| 10483 | } |
| 10484 | |
| 10485 | private function f_verify_imm_ass(RSL_Message imm_ass, template uint8_t ra := ?, template GsmFrameNumber fn := ?, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10486 | template RslChannelNr chan_nr := ?, |
| 10487 | template (present) uint12_t arfcn := ?, |
| 10488 | template (present) uint3_t tsc := ?) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10489 | { |
| 10490 | var RSL_IE_Body full_imm_ass_info; |
| 10491 | if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) { |
| 10492 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 10493 | mtc.stop; |
| 10494 | } |
| 10495 | |
| 10496 | var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload); |
| 10497 | var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra, |
| 10498 | fn := fn, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10499 | ch_desc := tr_ChanDescH0(chan_nr, arfcn, tsc), |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10500 | page_mode := ?); |
| 10501 | if (not match(rr_imm_ass, expect_imm_ass)) { |
| 10502 | log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass); |
| 10503 | setverdict(fail, "Failed to match Immediate Assignment"); |
| 10504 | mtc.stop; |
| 10505 | } |
| 10506 | } |
| 10507 | |
| 10508 | testcase TC_imm_ass_post_chan_ack() runs on test_CT { |
| 10509 | var RSL_Message chan_act; |
| 10510 | var RSL_Message imm_ass; |
| 10511 | |
| 10512 | f_init(1, false); |
| 10513 | f_sleep(1.0); |
| 10514 | |
| 10515 | /* (should be the default anyway, just to make things clear) */ |
| 10516 | f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack"); |
| 10517 | |
| 10518 | /* RA containing reason=LU */ |
| 10519 | var GsmFrameNumber fn := 2342; |
| 10520 | var uint8_t ra := 2; |
| 10521 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10522 | |
| 10523 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10524 | |
| 10525 | /* First send the Chan Act ACK */ |
| 10526 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10527 | var DchanTuple dt; |
| 10528 | dt.rsl_chan_nr := chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10529 | var RSL_IE_Body chan_ident_ie; |
| 10530 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10531 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10532 | mtc.stop; |
| 10533 | } |
| 10534 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10535 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10)); |
| 10536 | |
| 10537 | /* Then expect the Immediate Assignment, after we ACKed the chan act */ |
| 10538 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10539 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10540 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10541 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10542 | |
| 10543 | /* Check that the lchan is working */ |
| 10544 | var octetstring l3 := '00010203040506'O; |
| 10545 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10546 | |
| 10547 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10548 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10549 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10550 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10551 | |
| 10552 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10553 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10554 | f_shutdown_helper(); |
| 10555 | } |
| 10556 | |
| 10557 | testcase TC_imm_ass_pre_chan_ack() runs on test_CT { |
| 10558 | var RSL_Message chan_act; |
| 10559 | var RSL_Message imm_ass; |
| 10560 | |
| 10561 | f_init(1, false); |
| 10562 | f_sleep(1.0); |
| 10563 | |
| 10564 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 10565 | |
| 10566 | /* RA containing reason=LU */ |
| 10567 | var GsmFrameNumber fn := 2342; |
| 10568 | var uint8_t ra := 2; |
| 10569 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10570 | |
| 10571 | /* (set bts 0 cfg back to default) */ |
| 10572 | f_vty_set_imm_ass(BSCVTY); |
| 10573 | |
| 10574 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10575 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10576 | var DchanTuple dt; |
| 10577 | dt.rsl_chan_nr := chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10578 | var RSL_IE_Body chan_ident_ie; |
| 10579 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10580 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10581 | mtc.stop; |
| 10582 | } |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10583 | |
| 10584 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10585 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10586 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10587 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10588 | |
| 10589 | /* Only now send the Chan Act ACK */ |
| 10590 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10591 | |
| 10592 | /* Check that the lchan is working */ |
| 10593 | var octetstring l3 := '00010203040506'O; |
| 10594 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10595 | |
| 10596 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10597 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10598 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10599 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10600 | |
| 10601 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10602 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10603 | f_shutdown_helper(); |
| 10604 | } |
| 10605 | |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10606 | testcase TC_imm_ass_pre_ts_ack() runs on test_CT { |
| 10607 | var RSL_Message chan_act; |
| 10608 | var RSL_Message imm_ass; |
| 10609 | |
| 10610 | f_init(1, false); |
| 10611 | f_sleep(1.0); |
| 10612 | |
| 10613 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 10614 | |
| 10615 | /* RA containing reason=LU */ |
| 10616 | var GsmFrameNumber fn := 2342; |
| 10617 | var uint8_t ra := 2; |
| 10618 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10619 | |
| 10620 | /* (set bts 0 cfg back to default) */ |
| 10621 | f_vty_set_imm_ass(BSCVTY); |
| 10622 | |
| 10623 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 10624 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10625 | var DchanTuple dt; |
| 10626 | dt.rsl_chan_nr := chan_nr; |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10627 | var RSL_IE_Body chan_ident_ie; |
| 10628 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10629 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10630 | mtc.stop; |
| 10631 | } |
| 10632 | |
| 10633 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10634 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10635 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10636 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
| 10637 | |
| 10638 | /* Only now send the Chan Act ACK */ |
| 10639 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10640 | |
| 10641 | /* Check that the lchan is working */ |
| 10642 | var octetstring l3 := '00010203040506'O; |
| 10643 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10644 | |
| 10645 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10646 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10647 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10648 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10649 | |
| 10650 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10651 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10652 | f_shutdown_helper(); |
| 10653 | } |
| 10654 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10655 | testcase TC_imm_ass_pre_chan_ack_dyn_ts() runs on test_CT { |
| 10656 | /* change Timeslot 6 before f_init() starts RSL */ |
| 10657 | f_init_vty(); |
| 10658 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 10659 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10660 | |
| 10661 | f_init(1, false); |
| 10662 | f_sleep(1.0); |
| 10663 | |
| 10664 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 10665 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10666 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10667 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10668 | |
| 10669 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10670 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10671 | |
| 10672 | /* block all static timeslots so that the dyn TS will be used */ |
| 10673 | f_disable_all_tch_f(); |
| 10674 | f_disable_all_tch_h(); |
| 10675 | f_disable_all_sdcch(); |
| 10676 | |
| 10677 | var RSL_Message chan_act; |
| 10678 | var RSL_Message imm_ass; |
| 10679 | |
| 10680 | f_init(1, false); |
| 10681 | f_sleep(1.0); |
| 10682 | |
| 10683 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 10684 | |
| 10685 | /* RA containing reason=LU */ |
| 10686 | var GsmFrameNumber fn := 2342; |
| 10687 | var uint8_t ra := 2; |
| 10688 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10689 | |
| 10690 | /* (set bts 0 cfg back to default) */ |
| 10691 | f_vty_set_imm_ass(BSCVTY); |
| 10692 | |
| 10693 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10694 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10695 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10696 | |
| 10697 | /* Now activation as SDCCH8 */ |
| 10698 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10699 | var DchanTuple dt; |
| 10700 | dt.rsl_chan_nr := chan_nr; |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10701 | |
| 10702 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10703 | var RSL_IE_Body chan_ident_ie; |
| 10704 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10705 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10706 | mtc.stop; |
| 10707 | } |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10708 | |
| 10709 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10710 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10711 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10712 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10713 | |
| 10714 | /* Only now send the Chan Act ACK */ |
| 10715 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10716 | |
| 10717 | /* Check that the lchan is working */ |
| 10718 | var octetstring l3 := '00010203040506'O; |
| 10719 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10720 | |
| 10721 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10722 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10723 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10724 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10725 | |
| 10726 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10727 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10728 | f_shutdown_helper(); |
| 10729 | } |
| 10730 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10731 | testcase TC_imm_ass_pre_ts_ack_dyn_ts() runs on test_CT { |
| 10732 | /* change Timeslot 6 before f_init() starts RSL */ |
| 10733 | f_init_vty(); |
| 10734 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 10735 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10736 | |
| 10737 | f_init(1, false); |
| 10738 | f_sleep(1.0); |
| 10739 | |
| 10740 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 10741 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 10742 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10743 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10744 | |
| 10745 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10746 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10747 | |
| 10748 | /* block all static timeslots so that the dyn TS will be used */ |
| 10749 | f_disable_all_tch_f(); |
| 10750 | f_disable_all_tch_h(); |
| 10751 | f_disable_all_sdcch(); |
| 10752 | |
| 10753 | var RSL_Message chan_act; |
| 10754 | var RSL_Message imm_ass; |
| 10755 | |
| 10756 | f_init(1, false); |
| 10757 | f_sleep(1.0); |
| 10758 | |
| 10759 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 10760 | |
| 10761 | /* RA containing reason=LU */ |
| 10762 | var GsmFrameNumber fn := 2342; |
| 10763 | var uint8_t ra := 2; |
| 10764 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10765 | |
| 10766 | /* (set bts 0 cfg back to default) */ |
| 10767 | f_vty_set_imm_ass(BSCVTY); |
| 10768 | |
| 10769 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10770 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10771 | |
| 10772 | /* And already the Immediate Assignment even before the PDCH Deact ACK */ |
| 10773 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10774 | |
| 10775 | /* continue the Osmo style PDCH Deact (usual chan rel) */ |
| 10776 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10777 | |
| 10778 | /* Now activation as SDCCH8 */ |
| 10779 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10780 | var DchanTuple dt; |
| 10781 | dt.rsl_chan_nr := chan_nr; |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10782 | |
| 10783 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10784 | var RSL_IE_Body chan_ident_ie; |
| 10785 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10786 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10787 | mtc.stop; |
| 10788 | } |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10789 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10790 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10791 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10792 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10793 | |
| 10794 | /* Check that the lchan is working */ |
| 10795 | var octetstring l3 := '00010203040506'O; |
| 10796 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10797 | |
| 10798 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10799 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10800 | dt.sccp_conn_id := rx_c_ind.connectionId; |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10801 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10802 | |
| 10803 | f_sleep(1.0); |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 10804 | f_perform_clear_test_ct(dt); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10805 | f_shutdown_helper(); |
| 10806 | } |
| 10807 | |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 10808 | /* GET and SET the bts.N.trx.M.rf_locked CTRL variable */ |
| 10809 | testcase TC_ctrl_trx_rf_locked() runs on test_CT { |
| 10810 | var MSC_ConnHdlr vc_conn; |
| 10811 | |
| 10812 | f_init(nr_bts := 2, handler_mode := true, nr_msc := 1); |
| 10813 | f_sleep(1.0); |
| 10814 | |
| 10815 | /* BTS 0, 1, 2 are OML unlocked, only BTS 0, 1 are actually connected to RSL. */ |
| 10816 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10817 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10818 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10819 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10820 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10821 | |
| 10822 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock BTS 1 TRX 0"); |
| 10823 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10824 | /* give it a moment to settle the FSM status */ |
| 10825 | f_sleep(1.0); |
| 10826 | |
| 10827 | /* Now BTS 1 TRX 0 should reflect "locked". Note the RF policy stays "on", because this is still handled |
| 10828 | * globally in osmo-bsc. Probably after sending "rf_locked 1" for a TRX, that TRX should reflect an RF policy |
| 10829 | * of "off"? But that's for a future patch if at all. */ |
| 10830 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10831 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10832 | "1,0,operational,locked,on,rsl-up;" & |
| 10833 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10834 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10835 | |
| 10836 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock the already locked TRX, nothing should change"); |
| 10837 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10838 | f_sleep(1.0); |
| 10839 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10840 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10841 | "1,0,operational,locked,on,rsl-up;" & |
| 10842 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10843 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10844 | |
| 10845 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock BTS 1 TRX 0"); |
| 10846 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "0"); |
| 10847 | f_sleep(1.0); |
| 10848 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10849 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10850 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10851 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10852 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10853 | |
| 10854 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an already unlocked TRX, nothing should change"); |
| 10855 | f_ctrl_set(IPA_CTRL, "bts.0.trx.0.rf_locked", "0"); |
| 10856 | f_sleep(1.0); |
| 10857 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10858 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10859 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10860 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10861 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10862 | |
| 10863 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an inoperational TRX"); |
| 10864 | f_ctrl_set(IPA_CTRL, "bts.3.trx.0.rf_locked", "0"); |
| 10865 | f_sleep(1.0); |
| 10866 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10867 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10868 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10869 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10870 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10871 | |
| 10872 | f_shutdown_helper(); |
| 10873 | } |
| 10874 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10875 | const CounterNameVals counternames_cm_serv_rej := { |
| 10876 | { "cm_serv_rej", 0 }, |
| 10877 | { "cm_serv_rej:imsi_unknown_in_hlr", 0 }, |
| 10878 | { "cm_serv_rej:illegal_ms", 0 }, |
| 10879 | { "cm_serv_rej:imsi_unknown_in_vlr", 0 }, |
| 10880 | { "cm_serv_rej:imei_not_accepted", 0 }, |
| 10881 | { "cm_serv_rej:illegal_me", 0 }, |
| 10882 | { "cm_serv_rej:plmn_not_allowed", 0 }, |
| 10883 | { "cm_serv_rej:loc_not_allowed", 0 }, |
| 10884 | { "cm_serv_rej:roaming_not_allowed", 0 }, |
| 10885 | { "cm_serv_rej:network_failure", 0 }, |
| 10886 | { "cm_serv_rej:synch_failure", 0 }, |
| 10887 | { "cm_serv_rej:congestion", 0 }, |
| 10888 | { "cm_serv_rej:srv_opt_not_supported", 0 }, |
| 10889 | { "cm_serv_rej:rqd_srv_opt_not_supported", 0 }, |
| 10890 | { "cm_serv_rej:srv_opt_tmp_out_of_order", 0 }, |
| 10891 | { "cm_serv_rej:call_can_not_be_identified", 0 }, |
| 10892 | { "cm_serv_rej:incorrect_message", 0 }, |
| 10893 | { "cm_serv_rej:invalid_mandantory_inf", 0 }, |
| 10894 | { "cm_serv_rej:msg_type_not_implemented", 0 }, |
| 10895 | { "cm_serv_rej:msg_type_not_compatible", 0 }, |
| 10896 | { "cm_serv_rej:inf_eleme_not_implemented", 0 }, |
| 10897 | { "cm_serv_rej:condtional_ie_error", 0 }, |
| 10898 | { "cm_serv_rej:msg_not_compatible", 0 }, |
| 10899 | { "cm_serv_rej:protocol_error", 0 }, |
| 10900 | { "cm_serv_rej:retry_in_new_cell", 0 } |
| 10901 | }; |
| 10902 | |
| 10903 | private function f_TC_cm_serv_rej(charstring id) runs on MSC_ConnHdlr |
| 10904 | { |
| 10905 | f_create_chan_and_exp(); |
Vadim Yanitskiy | a7fc5a6 | 2021-12-04 20:10:08 +0300 | [diff] [blame] | 10906 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10907 | 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] | 10908 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_CM_SERV_REJ)); |
| 10909 | f_perform_clear(); |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 10910 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10911 | } |
| 10912 | testcase TC_cm_serv_rej() runs on test_CT { |
| 10913 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10914 | var MSC_ConnHdlr vc_conn; |
| 10915 | |
| 10916 | f_init(1, true); |
| 10917 | f_sleep(1.0); |
| 10918 | |
| 10919 | f_ctrs_bts_init(1, counternames_cm_serv_rej); |
| 10920 | |
| 10921 | vc_conn := f_start_handler(refers(f_TC_cm_serv_rej), pars); |
| 10922 | vc_conn.done; |
| 10923 | |
| 10924 | f_ctrs_bts_add(0, "cm_serv_rej", 1); |
| 10925 | f_ctrs_bts_add(0, "cm_serv_rej:imsi_unknown_in_hlr", 1); |
| 10926 | f_ctrs_bts_verify(); |
| 10927 | |
Neels Hofmeyr | 87a6561 | 2021-11-16 15:56:45 +0100 | [diff] [blame] | 10928 | f_sleep(1.0); |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 10929 | f_shutdown_helper(); |
| 10930 | } |
| 10931 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10932 | /* Reproduce a segfault happening when the SDCCH (primary) lchan is lost in-between a TCH Channel Activ and its Channel |
| 10933 | * Activ Ack (SYS#5627). */ |
| 10934 | private function f_TC_lost_sdcch_during_assignment(charstring id) runs on MSC_ConnHdlr { |
| 10935 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Vadim Yanitskiy | f0310e3 | 2021-10-26 00:30:59 +0300 | [diff] [blame] | 10936 | |
| 10937 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 10938 | 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] | 10939 | |
| 10940 | var BSSMAP_FIELD_CodecType codecType; |
| 10941 | codecType := valueof(ass_cmd.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType); |
| 10942 | |
| 10943 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 10944 | |
| 10945 | /* First establish a signalling lchan */ |
| 10946 | f_create_chan_and_exp(); |
| 10947 | f_rslem_dchan_queue_enable(); |
| 10948 | |
| 10949 | /* we should now have a COMPL_L3 at the MSC */ |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10950 | |
| 10951 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 10952 | activate(as_Media_mgw()); |
| 10953 | |
| 10954 | var RslChannelNr chan_nr := { u := { ch0 := RSL_CHAN_NR_Bm_ACCH }, tn := 1 }; |
| 10955 | f_rslem_register(0, chan_nr); |
| 10956 | |
| 10957 | f_rslem_set_auto_chan_act_ack(RSL_PROC, false); |
| 10958 | BSSAP.send(ass_cmd); |
| 10959 | |
| 10960 | |
| 10961 | /* Wait for the Channel Activ for the TCH channel */ |
| 10962 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10963 | RSL.receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), sid := ?)) -> value rx_rsl_ud; |
| 10964 | |
| 10965 | /* make the original SDCCH disappear */ |
| 10966 | RSL.send(ts_RSL_REL_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 10967 | |
| 10968 | /* and ACK the TCH channel activation. This caused a segfault up to OsmoBSC 1.7.0 (SYS#5627) */ |
| 10969 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_ACK(chan_nr, 23), rx_rsl_ud.streamId)); |
| 10970 | |
| 10971 | interleave { |
| 10972 | [] BSSAP.receive(tr_BSSMAP_AssignmentFail); |
| 10973 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 10974 | } |
| 10975 | |
| 10976 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 10977 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 10978 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 10979 | |
| 10980 | var MgcpCommand mgcp; |
| 10981 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 10982 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 10983 | }; |
| 10984 | |
| 10985 | f_sleep(0.5); |
| 10986 | } |
| 10987 | testcase TC_lost_sdcch_during_assignment() runs on test_CT { |
| 10988 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10989 | var MSC_ConnHdlr vc_conn; |
| 10990 | |
| 10991 | f_init(1, true); |
| 10992 | f_sleep(1.0); |
| 10993 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10994 | vc_conn := f_start_handler(refers(f_TC_lost_sdcch_during_assignment), pars); |
| 10995 | vc_conn.done; |
| 10996 | |
| 10997 | f_shutdown_helper(); |
| 10998 | } |
| 10999 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11000 | const CounterNameVals counternames_bsc_bts_all_available_allocated := { |
| 11001 | { "all_allocated:sdcch", 0 }, |
| 11002 | { "all_allocated:static_sdcch", 0 }, |
| 11003 | { "all_allocated:tch", 0 }, |
| 11004 | { "all_allocated:static_tch", 0 } |
| 11005 | } |
| 11006 | |
| 11007 | private function f_all_allocated_expect_counter_change(charstring_list expect_changed) runs on test_CT |
| 11008 | { |
| 11009 | /* Make sure counters settle first */ |
| 11010 | f_sleep(1.0); |
| 11011 | |
| 11012 | /* Take a baseline of counters */ |
| 11013 | f_ctrs_bsc_and_bts_init(1, counternames_bsc_bts_all_available_allocated); |
| 11014 | |
| 11015 | /* Elapse some time so that we see changes in counters, hopefully where expected */ |
| 11016 | f_sleep(2.0); |
| 11017 | |
| 11018 | /* Get new counters */ |
| 11019 | var charstring_list all_changed := {}; |
| 11020 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 11021 | all_changed := all_changed & f_counter_name_vals_get_changed_n(IPA_CTRL, "bts", g_ctr_bts); |
| 11022 | |
| 11023 | /* Compare with expectations */ |
| 11024 | var charstring_list all_expect_changed := {}; |
| 11025 | for (var integer i := 0; i < lengthof(expect_changed); i := i + 1) { |
| 11026 | all_expect_changed := all_expect_changed & { "bsc.0." & expect_changed[i], "bts.0." & expect_changed[i] }; |
| 11027 | } |
| 11028 | f_counter_name_vals_expect_changed_list(all_changed, all_expect_changed); |
| 11029 | } |
| 11030 | |
| 11031 | testcase TC_ratectr_all_available_allocated() runs on test_CT { |
| 11032 | var ASP_RSL_Unitdata rsl_ud; |
| 11033 | var integer i; |
| 11034 | var integer chreq_total, chreq_nochan; |
| 11035 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11036 | f_init(1, guard_timeout := 60.0); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11037 | f_sleep(1.0); |
| 11038 | |
| 11039 | /* Exhaust all dedicated SDCCH lchans. |
| 11040 | /* GSM 44.018 Table 9.1.8.2: |
| 11041 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 11042 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11043 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11044 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11045 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11046 | } |
| 11047 | |
| 11048 | /* Since only bts 0 is connected, expecting all_allocated to become true for both bts 0 and the "global" bsc |
| 11049 | * level. |
| 11050 | * All SDCCH are now occupied. */ |
| 11051 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 11052 | |
| 11053 | /* Also fill up all remaining (TCH) channels */ |
| 11054 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11055 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11056 | } |
| 11057 | |
| 11058 | /* All TCH are now also occupied */ |
| 11059 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 11060 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11061 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11062 | /* Clean up SDCCH lchans */ |
| 11063 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 11064 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 11065 | } |
| 11066 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11067 | f_shutdown_helper(); |
| 11068 | } |
| 11069 | |
| 11070 | testcase TC_ratectr_all_available_allocated_dyn() runs on test_CT { |
| 11071 | var ASP_RSL_Unitdata rsl_ud; |
| 11072 | var integer i; |
| 11073 | var integer chreq_total, chreq_nochan; |
| 11074 | |
| 11075 | f_init_vty(); |
| 11076 | f_ts_set_chcomb(0, 0, 2, "TCH/F_TCH/H_PDCH"); |
| 11077 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 11078 | /* Now we have 3 TCH/F, 1 OSMO_DYN, 1 TCH/H */ |
| 11079 | |
| 11080 | f_init(1, guard_timeout := 60.0); |
| 11081 | f_sleep(1.0); |
| 11082 | |
| 11083 | /* The dyn TS wants to activate PDCH mode, ACK that. */ |
| 11084 | var RslChannelNr chan_nr; |
| 11085 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 11086 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11087 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 11088 | |
| 11089 | /* Exhaust all dedicated SDCCH lchans. |
| 11090 | /* GSM 44.018 Table 9.1.8.2: |
| 11091 | * RA = '13'O -> Establishment cause = 0001xxxx (MS dual rate capable and asks for "SDCCH"). |
| 11092 | */ |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11093 | var DchanTuples chan_cleanup := {}; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11094 | for (i := 0; i < NUM_SDCCH_PER_BTS; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11095 | chan_cleanup := chan_cleanup & { f_est_dchan('13'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11096 | } |
| 11097 | |
| 11098 | /* The static SDCCH should now be occupied, while still 3x8 dynamic SDCCH potentially remain. So only |
| 11099 | * all_allocated:static_sdcch is counted, all_allocated:sdcch remains zero. */ |
| 11100 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch"}); |
| 11101 | |
| 11102 | /* Request more SDCCH, hence convert the first dyn TS to SDCCH8. |
| 11103 | * Will release them later, so remember all the DchanTuples. */ |
| 11104 | var DchanTuples dyn_sddch := {}; |
| 11105 | dyn_sddch := dyn_sddch & { f_est_dchan_dyn('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
| 11106 | |
| 11107 | /* Also occupy the seven other SDCCH of the dyn TS */ |
| 11108 | for (i := 0; i < 7; i := i+1) { |
| 11109 | dyn_sddch := dyn_sddch & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
| 11110 | } |
| 11111 | |
| 11112 | /* Now all dynamic SDCCH are also occupied, so for the first time all_allocated:sdcch will trigger... */ |
| 11113 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch"}); |
| 11114 | |
| 11115 | /* occupy the remaining TCH, three TCH/F and two TCH/H lchans */ |
| 11116 | for (i := 0; i < 5; i := i+1) { |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11117 | chan_cleanup := chan_cleanup & { f_est_dchan('33'O, NUM_SDCCH_PER_BTS + i, '00010203040506'O) }; |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11118 | } |
| 11119 | |
| 11120 | /* All TCH lchans are now also occupied, both static and dynamic */ |
| 11121 | f_all_allocated_expect_counter_change({"all_allocated:sdcch", "all_allocated:static_sdcch", |
| 11122 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11123 | |
| 11124 | /* Starting to release the dyn TS: as soon as the first SDCCH gets released, all_allocated:sdcch stops |
| 11125 | * incrementing. */ |
| 11126 | var BssmapCause cause := 0; |
| 11127 | var DchanTuple dt := dyn_sddch[0]; |
| 11128 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 11129 | f_exp_chan_rel_and_clear(dt, 0); |
| 11130 | |
| 11131 | /* one dyn TS SDCCH is free again, so only the static_sdcch should increment. For tch, both static and dynamic |
| 11132 | * count as occupied, so those still both increment. */ |
| 11133 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", |
| 11134 | "all_allocated:tch", "all_allocated:static_tch"}); |
| 11135 | |
| 11136 | /* Release the remaining SDCCH of the dyn TS, so it becomes available as TCH again */ |
| 11137 | for (i := 1; i < lengthof(dyn_sddch); i := i+1) { |
| 11138 | dt := dyn_sddch[i]; |
| 11139 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 11140 | f_exp_chan_rel_and_clear(dt, 0); |
| 11141 | } |
| 11142 | |
| 11143 | /* All SDCCH on the dyn TS are released, the dyn TS wants to activate PDCH again */ |
| 11144 | chan_nr := valueof(t_RslChanNr_PDCH(2)); |
Vadim Yanitskiy | 58b1653 | 2021-10-09 20:27:39 +0600 | [diff] [blame] | 11145 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr)); |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11146 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 11147 | |
| 11148 | /* Now all channels are occupied except the dyn TS, so expecting only the static counters to increment */ |
| 11149 | f_all_allocated_expect_counter_change({"all_allocated:static_sdcch", "all_allocated:static_tch"}); |
| 11150 | |
Neels Hofmeyr | 4d4cd7e | 2021-12-14 17:25:36 +0100 | [diff] [blame] | 11151 | /* Clean up SDCCH lchans */ |
| 11152 | for (i := 0; i < lengthof(chan_cleanup); i := i + 1) { |
| 11153 | f_perform_clear_test_ct(chan_cleanup[i]); |
| 11154 | } |
| 11155 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11156 | /* clean up config */ |
| 11157 | f_ts_reset_chcomb(0); |
| 11158 | |
| 11159 | f_shutdown_helper(); |
| 11160 | } |
| 11161 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 11162 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11163 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 11164 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 11165 | execute( TC_ctrl_msc0_connection_status() ); |
Neels Hofmeyr | f65ce87 | 2021-09-23 18:40:10 +0200 | [diff] [blame] | 11166 | /* In SCCPlite tests, only one MSC is configured. These tests assume that three MSCs are configured, so only run |
| 11167 | * these in the AoIP test suite. */ |
| 11168 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 11169 | execute( TC_stat_num_msc_connected_1() ); |
| 11170 | execute( TC_stat_num_msc_connected_2() ); |
| 11171 | execute( TC_stat_num_msc_connected_3() ); |
| 11172 | } |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 11173 | execute( TC_stat_num_bts_connected_1() ); |
| 11174 | execute( TC_stat_num_bts_connected_2() ); |
| 11175 | execute( TC_stat_num_bts_connected_3() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 11176 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 11177 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 11178 | execute( TC_ctrl_location() ); |
| 11179 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11180 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 11181 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 11182 | execute( TC_si2quater_2_earfcns() ); |
| 11183 | execute( TC_si2quater_3_earfcns() ); |
| 11184 | execute( TC_si2quater_4_earfcns() ); |
| 11185 | execute( TC_si2quater_5_earfcns() ); |
| 11186 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 11187 | execute( TC_si2quater_12_earfcns() ); |
| 11188 | execute( TC_si2quater_23_earfcns() ); |
| 11189 | execute( TC_si2quater_32_earfcns() ); |
| 11190 | execute( TC_si2quater_33_earfcns() ); |
| 11191 | execute( TC_si2quater_42_earfcns() ); |
| 11192 | execute( TC_si2quater_48_earfcns() ); |
| 11193 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 11194 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 11195 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 11196 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11197 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 11198 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 11199 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 11200 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 11201 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 11202 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 11203 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 11204 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 11205 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 11206 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 11207 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 11208 | execute( TC_chan_rel_rll_rel_ind() ); |
| 11209 | execute( TC_chan_rel_conn_fail() ); |
| 11210 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 11211 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 11212 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 11213 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 11214 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 11215 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 11216 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 11217 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 11218 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 11219 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 11220 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11221 | |
| 11222 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 11223 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 11224 | execute( TC_assignment_csd() ); |
| 11225 | execute( TC_assignment_ctm() ); |
| 11226 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 11227 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 11228 | execute( TC_assignment_aoip_tla_v6() ); |
| 11229 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 11230 | execute( TC_assignment_fr_a5_0() ); |
| 11231 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 11232 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 11233 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 11234 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 11235 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 11236 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 11237 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 11238 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 11239 | execute( TC_ciph_mode_a5_0() ); |
| 11240 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 11241 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 11242 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 11243 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 11244 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 11245 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 11246 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 11247 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 11248 | execute( TC_assignment_codec_hr() ); |
| 11249 | execute( TC_assignment_codec_efr() ); |
| 11250 | execute( TC_assignment_codec_amr_f() ); |
| 11251 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 11252 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 11253 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 11254 | execute( TC_assignment_codec_amr_f_S1() ); |
| 11255 | execute( TC_assignment_codec_amr_h_S1() ); |
| 11256 | execute( TC_assignment_codec_amr_f_S124() ); |
| 11257 | execute( TC_assignment_codec_amr_h_S124() ); |
| 11258 | execute( TC_assignment_codec_amr_f_S0() ); |
| 11259 | execute( TC_assignment_codec_amr_f_S02() ); |
| 11260 | execute( TC_assignment_codec_amr_f_S024() ); |
| 11261 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 11262 | execute( TC_assignment_codec_amr_h_S0() ); |
| 11263 | execute( TC_assignment_codec_amr_h_S02() ); |
| 11264 | execute( TC_assignment_codec_amr_h_S024() ); |
| 11265 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 11266 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 11267 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 11268 | execute( TC_assignment_codec_amr_f_zero() ); |
| 11269 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 11270 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 11271 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 11272 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 11273 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 11274 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 11275 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 11276 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 11277 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 11278 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 11279 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 11280 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 11281 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 11282 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 11283 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 11284 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 11285 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 11286 | execute( TC_assignment_codec_req_hr_fr() ); |
| 11287 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 11288 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 11289 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 11290 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 11291 | |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 11292 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 11293 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11294 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 11295 | execute( TC_rll_est_ind_inact_lchan() ); |
| 11296 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 11297 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 11298 | execute( TC_rll_est_ind_inval_sacch() ); |
| 11299 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 11300 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 11301 | execute( TC_tch_dlci_link_id_sapi() ); |
| 11302 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 11303 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 11304 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 11305 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 11306 | execute( TC_rll_timeout_sapi_n_reject() ); |
Vadim Yanitskiy | 999ceb6 | 2020-10-04 00:04:49 +0700 | [diff] [blame] | 11307 | execute( TC_rll_sapi_n_reject_dlci_cc() ); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 11308 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11309 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 11310 | execute( TC_paging_imsi_nochan() ); |
| 11311 | execute( TC_paging_tmsi_nochan() ); |
| 11312 | execute( TC_paging_tmsi_any() ); |
| 11313 | execute( TC_paging_tmsi_sdcch() ); |
| 11314 | execute( TC_paging_tmsi_tch_f() ); |
| 11315 | execute( TC_paging_tmsi_tch_hf() ); |
| 11316 | execute( TC_paging_imsi_nochan_cgi() ); |
| 11317 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 11318 | execute( TC_paging_imsi_nochan_ci() ); |
| 11319 | execute( TC_paging_imsi_nochan_lai() ); |
| 11320 | execute( TC_paging_imsi_nochan_lac() ); |
| 11321 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 11322 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 11323 | execute( TC_paging_imsi_nochan_rnc() ); |
| 11324 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 11325 | execute( TC_paging_imsi_nochan_lacs() ); |
| 11326 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 11327 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 11328 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 11329 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 11330 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 11331 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 11332 | |
| 11333 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 11334 | execute( TC_rsl_unknown_unit_id() ); |
| 11335 | |
| 11336 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11337 | |
| 11338 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 11339 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 11340 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 11341 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 11342 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 11343 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 11344 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 11345 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 11346 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 11347 | execute( TC_ho_int_a5_0() ); |
| 11348 | execute( TC_ho_int_a5_1() ); |
| 11349 | execute( TC_ho_int_a5_3() ); |
| 11350 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 11351 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 11352 | |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 11353 | /* TC_ho_out_of_this_bsc is run last, see comment below */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 11354 | execute( TC_ho_out_fail_no_msc_response() ); |
| 11355 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 11356 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 11357 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 11358 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 11359 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 11360 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 11361 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 11362 | execute( TC_ho_into_this_bsc_a5_4() ); |
Neels Hofmeyr | 93182e0 | 2022-02-17 21:59:07 +0100 | [diff] [blame] | 11363 | execute( TC_ho_into_this_bsc_a5_1_3_no_chosen_enc_alg() ); |
| 11364 | execute( TC_ho_into_this_bsc_a5_1_3() ); |
Neels Hofmeyr | 907b23b | 2022-02-17 21:58:47 +0100 | [diff] [blame] | 11365 | execute( TC_ho_into_this_bsc_a5_mismatch() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 11366 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 11367 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 11368 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 11369 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | a8ef3be | 2022-02-16 16:21:17 +0100 | [diff] [blame] | 11370 | execute( TC_srvcc_eutran_to_geran_src_sai() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 11371 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 11372 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 11373 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 11374 | execute( TC_ho_in_fail_msc_clears() ); |
| 11375 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 11376 | execute( TC_ho_in_fail_no_detect() ); |
| 11377 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | a23f3b1 | 2022-03-02 19:57:12 +0100 | [diff] [blame] | 11378 | execute( TC_ho_into_this_bsc_sccp_cr_without_bssap() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 11379 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 11380 | execute( TC_ho_neighbor_config_1() ); |
| 11381 | execute( TC_ho_neighbor_config_2() ); |
| 11382 | execute( TC_ho_neighbor_config_3() ); |
| 11383 | execute( TC_ho_neighbor_config_4() ); |
| 11384 | execute( TC_ho_neighbor_config_5() ); |
| 11385 | execute( TC_ho_neighbor_config_6() ); |
| 11386 | execute( TC_ho_neighbor_config_7() ); |
| 11387 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 11388 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 11389 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 11390 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 11391 | |
| 11392 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 11393 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 11394 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 11395 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | 37a4c15 | 2021-11-16 19:02:23 +0100 | [diff] [blame] | 11396 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 11397 | execute( TC_dyn_ts_sdcch8_all_subslots_used() ); |
| 11398 | execute( TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 11399 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11400 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 11401 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 11402 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 11403 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 11404 | /* Power control related */ |
| 11405 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 11406 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 11407 | |
| 11408 | /* MSC pooling */ |
| 11409 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 11410 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 11411 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 11412 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 11413 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 11414 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 11415 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 11416 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 11417 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 11418 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 11419 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 11420 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 11421 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 11422 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 11423 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 11424 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 11425 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 11426 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 11427 | } |
| 11428 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11429 | execute( TC_early_conn_fail() ); |
| 11430 | execute( TC_late_conn_fail() ); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 11431 | execute( TC_stats_conn_fail() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 11432 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 11433 | /* Emergency call handling (deny / allow) */ |
| 11434 | execute( TC_assignment_emerg_setup_allow() ); |
| 11435 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 11436 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 11437 | execute( TC_emerg_premption() ); |
| 11438 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 11439 | /* Frequency hopping parameters handling */ |
| 11440 | execute( TC_fh_params_chan_activ() ); |
| 11441 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 11442 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 11443 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 11444 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 11445 | |
| 11446 | if (mp_enable_lcs_tests) { |
| 11447 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 11448 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 11449 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 11450 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 11451 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 11452 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 11453 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 11454 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 11455 | execute( TC_ho_during_lcs_loc_req() ); |
| 11456 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 11457 | |
| 11458 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 11459 | |
| 11460 | execute( TC_refuse_chan_act_to_vamos() ); |
| 11461 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 11462 | |
| 11463 | execute( TC_reassignment_fr() ); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 11464 | |
| 11465 | execute( TC_cm_reestablishment() ); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 11466 | |
| 11467 | execute( TC_imm_ass_post_chan_ack() ); |
| 11468 | execute( TC_imm_ass_pre_chan_ack() ); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 11469 | execute( TC_imm_ass_pre_ts_ack() ); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 11470 | execute( TC_imm_ass_pre_chan_ack_dyn_ts() ); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 11471 | execute( TC_imm_ass_pre_ts_ack_dyn_ts() ); |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 11472 | |
| 11473 | execute( TC_ctrl_trx_rf_locked() ); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11474 | |
Neels Hofmeyr | bd94fe7 | 2021-10-26 22:04:53 +0200 | [diff] [blame] | 11475 | execute( TC_ratectr_all_available_allocated() ); |
| 11476 | execute( TC_ratectr_all_available_allocated_dyn() ); |
| 11477 | |
Neels Hofmeyr | b758187 | 2021-11-07 14:02:49 +0100 | [diff] [blame] | 11478 | execute( TC_cm_serv_rej() ); |
| 11479 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 11480 | execute( TC_lost_sdcch_during_assignment() ); |
Neels Hofmeyr | afe2ea5 | 2021-11-24 15:16:12 +0100 | [diff] [blame] | 11481 | |
| 11482 | /* Run TC_ho_out_of_this_bsc last, because it may trigger a segfault before osmo-bsc's patch |
| 11483 | * with change-id I5a3345ab0005a73597f5c27207480912a2f5aae6 */ |
| 11484 | execute( TC_ho_out_of_this_bsc() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 11485 | } |
| 11486 | |
| 11487 | } |