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 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 78 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 79 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 80 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 81 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 82 | /* 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] | 83 | const integer NUM_TCHH_PER_BTS := 2; |
| 84 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 85 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 86 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 87 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 89 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 90 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 91 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 92 | } |
| 93 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 94 | /* Default list of counters for an 'msc' entity. */ |
| 95 | const CounterNameVals counternames_msc_mscpool := { |
| 96 | { "mscpool:subscr:new", 0 }, |
| 97 | { "mscpool:subscr:known", 0 }, |
| 98 | { "mscpool:subscr:reattach", 0 }, |
| 99 | { "mscpool:subscr:attach_lost", 0 }, |
| 100 | { "mscpool:subscr:paged", 0 } |
| 101 | }; |
| 102 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 103 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 104 | const CounterNameVals counternames_bsc_mscpool := { |
| 105 | { "mscpool:subscr:no_msc", 0 } |
| 106 | }; |
| 107 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 108 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 109 | const CounterNameVals counternames_bsc_bts_handover := { |
| 110 | { "assignment:attempted", 0 }, |
| 111 | { "assignment:completed", 0 }, |
| 112 | { "assignment:stopped", 0 }, |
| 113 | { "assignment:no_channel", 0 }, |
| 114 | { "assignment:timeout", 0 }, |
| 115 | { "assignment:failed", 0 }, |
| 116 | { "assignment:error", 0 }, |
| 117 | |
| 118 | { "handover:attempted", 0 }, |
| 119 | { "handover:completed", 0 }, |
| 120 | { "handover:stopped", 0 }, |
| 121 | { "handover:no_channel", 0 }, |
| 122 | { "handover:timeout", 0 }, |
| 123 | { "handover:failed", 0 }, |
| 124 | { "handover:error", 0 }, |
| 125 | |
| 126 | { "intra_cell_ho:attempted", 0 }, |
| 127 | { "intra_cell_ho:completed", 0 }, |
| 128 | { "intra_cell_ho:stopped", 0 }, |
| 129 | { "intra_cell_ho:no_channel", 0 }, |
| 130 | { "intra_cell_ho:timeout", 0 }, |
| 131 | { "intra_cell_ho:failed", 0 }, |
| 132 | { "intra_cell_ho:error", 0 }, |
| 133 | |
| 134 | { "intra_bsc_ho:attempted", 0 }, |
| 135 | { "intra_bsc_ho:completed", 0 }, |
| 136 | { "intra_bsc_ho:stopped", 0 }, |
| 137 | { "intra_bsc_ho:no_channel", 0 }, |
| 138 | { "intra_bsc_ho:timeout", 0 }, |
| 139 | { "intra_bsc_ho:failed", 0 }, |
| 140 | { "intra_bsc_ho:error", 0 }, |
| 141 | |
| 142 | { "interbsc_ho_out:attempted", 0 }, |
| 143 | { "interbsc_ho_out:completed", 0 }, |
| 144 | { "interbsc_ho_out:stopped", 0 }, |
| 145 | { "interbsc_ho_out:timeout", 0 }, |
| 146 | { "interbsc_ho_out:failed", 0 }, |
| 147 | { "interbsc_ho_out:error", 0 }, |
| 148 | |
| 149 | { "interbsc_ho_in:attempted", 0 }, |
| 150 | { "interbsc_ho_in:completed", 0 }, |
| 151 | { "interbsc_ho_in:stopped", 0 }, |
| 152 | { "interbsc_ho_in:no_channel", 0 }, |
| 153 | { "interbsc_ho_in:timeout", 0 }, |
| 154 | { "interbsc_ho_in:failed", 0 }, |
| 155 | { "interbsc_ho_in:error", 0 } |
| 156 | }; |
| 157 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 158 | /* Set of all System Information received during one RSL port's startup. |
| 159 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 160 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 161 | */ |
| 162 | type record SystemInformationConfig { |
| 163 | SystemInformationType1 si1 optional, |
| 164 | SystemInformationType2 si2 optional, |
| 165 | SystemInformationType2bis si2bis optional, |
| 166 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 167 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 168 | SystemInformationType3 si3 optional, |
| 169 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 170 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 171 | SystemInformationType5 si5 optional, |
| 172 | SystemInformationType5bis si5bis optional, |
| 173 | SystemInformationType5ter si5ter optional, |
| 174 | SystemInformationType6 si6 optional |
| 175 | }; |
| 176 | |
| 177 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 178 | si1 := omit, |
| 179 | si2 := omit, |
| 180 | si2bis := omit, |
| 181 | si2ter := omit, |
| 182 | si2quater := omit, |
| 183 | si3 := omit, |
| 184 | si4 := omit, |
| 185 | si13 := omit, |
| 186 | si5 := omit, |
| 187 | si5bis := omit, |
| 188 | si5ter := omit, |
| 189 | si6 := omit |
| 190 | }; |
| 191 | |
| 192 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 193 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 194 | template uint3_t meas_bw := 3) |
| 195 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 196 | meas_bw_presence := '1'B, |
| 197 | meas_bw := meas_bw); |
| 198 | |
| 199 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 200 | 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] | 201 | template uint3_t prio := 3, |
| 202 | template (present) uint5_t thresh_high := 20, |
| 203 | template uint5_t thresh_low := 10, |
| 204 | template uint5_t qrxlevmin := 22) |
| 205 | := tr_EUTRAN_NeighbourCells( |
| 206 | cell_desc_list := cell_desc_list, |
| 207 | prio_presence := '1'B, |
| 208 | prio := prio, |
| 209 | thresh_high := thresh_high, |
| 210 | thresh_low_presence := '1'B, |
| 211 | thresh_low := thresh_low, |
| 212 | qrxlevmin_presence := '1'B, |
| 213 | qrxlevmin := qrxlevmin); |
| 214 | |
| 215 | template SystemInformationConfig SystemInformationConfig_default := { |
| 216 | si1 := { |
| 217 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 218 | rach_control := { |
| 219 | max_retrans := RACH_MAX_RETRANS_7, |
| 220 | tx_integer := '1001'B, |
| 221 | cell_barr_access := false, |
| 222 | re_not_allowed := true, |
| 223 | acc := '0000010000000000'B |
| 224 | }, |
| 225 | rest_octets := ? |
| 226 | }, |
| 227 | si2 := { |
| 228 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 229 | ncc_permitted := '11111111'B, |
| 230 | rach_control := { |
| 231 | max_retrans := RACH_MAX_RETRANS_7, |
| 232 | tx_integer := '1001'B, |
| 233 | cell_barr_access := false, |
| 234 | re_not_allowed := true, |
| 235 | acc := '0000010000000000'B |
| 236 | } |
| 237 | }, |
| 238 | si2bis := omit, |
| 239 | si2ter := { |
| 240 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 241 | rest_octets := ? |
| 242 | }, |
| 243 | si2quater := { |
| 244 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 245 | }, |
| 246 | si3 := { |
| 247 | cell_id := 0, |
| 248 | lai := { |
| 249 | mcc_mnc := '001F01'H, |
| 250 | lac := 1 |
| 251 | }, |
| 252 | ctrl_chan_desc := { |
| 253 | msc_r99 := true, |
| 254 | att := true, |
| 255 | bs_ag_blks_res := 1, |
| 256 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 257 | si22ind := false, |
| 258 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 259 | spare := '00'B, |
| 260 | bs_pa_mfrms := 3, |
| 261 | t3212 := 30 |
| 262 | }, |
| 263 | cell_options := { |
| 264 | dn_ind := false, |
| 265 | pwrc := false, |
| 266 | dtx := MS_SHALL_USE_UL_DTX, |
| 267 | radio_link_tout_div4 := 7 |
| 268 | }, |
| 269 | cell_sel_par := { |
| 270 | cell_resel_hyst_2dB := 2, |
| 271 | ms_txpwr_max_cch := 7, |
| 272 | acs := '0'B, |
| 273 | neci := true, |
| 274 | rxlev_access_min := 0 |
| 275 | }, |
| 276 | rach_control := { |
| 277 | max_retrans := RACH_MAX_RETRANS_7, |
| 278 | tx_integer := '1001'B, |
| 279 | cell_barr_access := false, |
| 280 | re_not_allowed := true, |
| 281 | acc := '0000010000000000'B |
| 282 | }, |
| 283 | rest_octets := { |
| 284 | sel_params := { |
| 285 | presence := '0'B, |
| 286 | params := omit |
| 287 | }, |
| 288 | pwr_offset := { |
| 289 | presence := '0'B, |
| 290 | offset := omit |
| 291 | }, |
| 292 | si_2ter_ind := '1'B, |
| 293 | early_cm_ind := '0'B, |
| 294 | sched_where := { |
| 295 | presence := '0'B, |
| 296 | where := omit |
| 297 | }, |
| 298 | gprs_ind := { |
| 299 | presence := '1'B, |
| 300 | ind := { |
| 301 | ra_colour := 0, |
| 302 | si13_pos := '0'B |
| 303 | } |
| 304 | }, |
| 305 | umts_early_cm_ind := '1'B, |
| 306 | si2_quater_ind := { |
| 307 | presence := '1'B, |
| 308 | ind := '0'B |
| 309 | }, |
| 310 | iu_mode_ind := omit, |
| 311 | si21_ind := { |
| 312 | presence := '0'B, |
| 313 | pos := omit |
| 314 | } |
| 315 | } |
| 316 | }, |
| 317 | si4 := { |
| 318 | lai := { |
| 319 | mcc_mnc := '001F01'H, |
| 320 | lac := 1 |
| 321 | }, |
| 322 | cell_sel_par := { |
| 323 | cell_resel_hyst_2dB := 2, |
| 324 | ms_txpwr_max_cch := 7, |
| 325 | acs := '0'B, |
| 326 | neci := true, |
| 327 | rxlev_access_min := 0 |
| 328 | }, |
| 329 | rach_control := { |
| 330 | max_retrans := RACH_MAX_RETRANS_7, |
| 331 | tx_integer := '1001'B, |
| 332 | cell_barr_access := false, |
| 333 | re_not_allowed := true, |
| 334 | acc := '0000010000000000'B |
| 335 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 336 | cbch_chan_desc := { |
| 337 | iei := '64'O, |
| 338 | v := { |
| 339 | chan_nr := { |
| 340 | u := { |
| 341 | sdcch4 := { |
| 342 | tag := '001'B, |
| 343 | sub_chan := 2 |
| 344 | } |
| 345 | }, |
| 346 | tn := 0 |
| 347 | }, |
| 348 | tsc := 2, |
| 349 | h := false, |
| 350 | arfcn := 871, |
| 351 | maio_hsn := omit |
| 352 | } |
| 353 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 354 | cbch_mobile_alloc := omit, |
| 355 | rest_octets := { |
| 356 | sel_params := { |
| 357 | presence := '0'B, |
| 358 | params := omit |
| 359 | }, |
| 360 | pwr_offset := { |
| 361 | presence := '0'B, |
| 362 | offset := omit |
| 363 | }, |
| 364 | gprs_ind := { |
| 365 | presence := '1'B, |
| 366 | ind := { |
| 367 | ra_colour := 0, |
| 368 | si13_pos := '0'B |
| 369 | } |
| 370 | }, |
| 371 | s_presence := '0'B, |
| 372 | s := omit |
| 373 | } |
| 374 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 375 | si13 := { |
| 376 | rest_octets := { |
| 377 | presence := '1'B, |
| 378 | bcch_change_mark := ?, |
| 379 | si_change_field := '0000'B, |
| 380 | presence2 := '0'B, |
| 381 | si13_change_mark := omit, |
| 382 | gprs_ma := omit, |
| 383 | zero := '0'B, /* PBCCH not present in cell */ |
| 384 | rac := 0, |
| 385 | spgc_ccch_sup := '0'B, |
| 386 | priority_access_thr := '110'B, |
| 387 | network_control_order := '00'B, |
| 388 | gprs_cell_opts := { |
| 389 | nmo := '01'B, |
| 390 | t3168 := '011'B, |
| 391 | t3192 := '010'B, |
| 392 | drx_timer_max := '011'B, |
| 393 | access_burst_type := '0'B, |
| 394 | control_ack_type := '1'B, |
| 395 | bs_cv_max := 15, |
| 396 | pan_presence := '1'B, |
| 397 | pan_dec := 1, |
| 398 | pan_inc := 1, |
| 399 | pan_max := '111'B, |
| 400 | ext_info_presence := ?, |
| 401 | ext_info_length := *, |
| 402 | ext_info := * |
| 403 | }, |
| 404 | gprs_pwr_ctrl_params := { |
| 405 | alpha := 0, |
| 406 | t_avg_w := '10000'B, |
| 407 | t_avg_t := '10000'B, |
| 408 | pc_meas_chan := '0'B, |
| 409 | n_avg_i := '1000'B |
| 410 | } |
| 411 | } |
| 412 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 413 | si5 := { |
| 414 | bcch_freq_list := '10000000000000000000000000000000'O |
| 415 | }, |
| 416 | si5bis := omit, |
| 417 | si5ter := { |
| 418 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 419 | }, |
| 420 | si6 := { |
| 421 | cell_id := 0, |
| 422 | lai := { |
| 423 | mcc_mnc := '001F01'H, |
| 424 | lac := 1 |
| 425 | }, |
| 426 | cell_options := { |
| 427 | dtx_ext := '1'B, |
| 428 | pwrc := false, |
| 429 | dtx := '01'B, |
| 430 | radio_link_timeout := '0111'B |
| 431 | }, |
| 432 | ncc_permitted := '11111111'B, |
| 433 | rest_octets := ? |
| 434 | } |
| 435 | }; |
| 436 | |
| 437 | |
| 438 | /* List of all the System Information received on all RSL ports */ |
| 439 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 440 | |
| 441 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 442 | { |
| 443 | var RSL_IE_Body sysinfo_type_ie; |
| 444 | var RSL_IE_SysinfoType si_type; |
| 445 | var octetstring data; |
| 446 | |
| 447 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 448 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 449 | mtc.stop; |
| 450 | } |
| 451 | si_type := sysinfo_type_ie.sysinfo_type; |
| 452 | |
| 453 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 454 | var RSL_IE_Body bcch_ie; |
| 455 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 456 | data := bcch_ie.other.payload; |
| 457 | } |
| 458 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 459 | var RSL_IE_Body l3_ie; |
| 460 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 461 | data := l3_ie.l3_info.payload; |
| 462 | } |
| 463 | } else { |
| 464 | setverdict(fail, "Don't understand this System Information message"); |
| 465 | mtc.stop; |
| 466 | } |
| 467 | |
| 468 | var boolean handled := false; |
| 469 | |
| 470 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 471 | handled := true; |
| 472 | |
| 473 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 474 | if (not isbound(data)) { |
| 475 | si.si1 := omit; |
| 476 | } else { |
| 477 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 478 | } |
| 479 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 480 | if (not isbound(data)) { |
| 481 | si.si2 := omit; |
| 482 | } else { |
| 483 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 484 | } |
| 485 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 486 | if (not isbound(data)) { |
| 487 | si.si2bis := omit; |
| 488 | } else { |
| 489 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 490 | } |
| 491 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 492 | if (not isbound(data)) { |
| 493 | si.si2ter := omit; |
| 494 | } else { |
| 495 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 496 | } |
| 497 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 498 | if (not isbound(data)) { |
| 499 | si.si2quater := {}; |
| 500 | } else { |
| 501 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 502 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 503 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 504 | } |
| 505 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 506 | if (not isbound(data)) { |
| 507 | si.si3 := omit; |
| 508 | } else { |
| 509 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 510 | } |
| 511 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 512 | if (not isbound(data)) { |
| 513 | si.si4 := omit; |
| 514 | } else { |
| 515 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 516 | } |
| 517 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 518 | if (not isbound(data)) { |
| 519 | si.si13 := omit; |
| 520 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 521 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 522 | } |
| 523 | } else { |
| 524 | handled := false; |
| 525 | } |
| 526 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 527 | handled := true; |
| 528 | |
| 529 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 530 | if (not isbound(data)) { |
| 531 | si.si5 := omit; |
| 532 | } else { |
| 533 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 534 | } |
| 535 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 536 | if (not isbound(data)) { |
| 537 | si.si5bis := omit; |
| 538 | } else { |
| 539 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 540 | } |
| 541 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 542 | if (not isbound(data)) { |
| 543 | si.si5ter := omit; |
| 544 | } else { |
| 545 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 546 | } |
| 547 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 548 | if (not isbound(data)) { |
| 549 | si.si6 := omit; |
| 550 | } else { |
| 551 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 552 | } |
| 553 | } else { |
| 554 | handled := false; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | if (not handled) { |
| 559 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 560 | } |
| 561 | } |
| 562 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 563 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 564 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 565 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 566 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 567 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 568 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 569 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 570 | 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] | 571 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 572 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 573 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 574 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 575 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 576 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 577 | /* StatsD */ |
| 578 | var StatsD_Checker_CT vc_STATSD; |
| 579 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 580 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 581 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 582 | /* for old legacy-tests only */ |
| 583 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 584 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 585 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 586 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 587 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 588 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 589 | /* Osmux is enabled through VTY */ |
| 590 | var boolean g_osmux_enabled := false; |
| 591 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 592 | /*Configure T(tias) over VTY, seconds */ |
| 593 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 594 | /*Configure T(tiar) over VTY, seconds */ |
| 595 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 596 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 597 | /* 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] | 598 | timer T_guard := 30.0; |
| 599 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 600 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 601 | var CounterNameValsList g_ctr_bsc; |
| 602 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 603 | |
| 604 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 605 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 606 | } |
| 607 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 608 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 609 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 610 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 611 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 612 | /* port number to which to establish the IPA OML connections */ |
| 613 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 614 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 615 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 616 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 617 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 618 | /* port number to which to listen for STATSD metrics */ |
| 619 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 620 | /* IP address at which the test binds */ |
| 621 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 622 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 623 | RAN_Configurations mp_bssap_cfg := { |
| 624 | { |
| 625 | transport := BSSAP_TRANSPORT_AoIP, |
| 626 | sccp_service_type := "mtp3_itu", |
| 627 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 628 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 629 | own_ssn := 254, |
| 630 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 631 | peer_ssn := 254, |
| 632 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 633 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 634 | }, |
| 635 | { |
| 636 | transport := BSSAP_TRANSPORT_AoIP, |
| 637 | sccp_service_type := "mtp3_itu", |
| 638 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 639 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 640 | own_ssn := 254, |
| 641 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 642 | peer_ssn := 254, |
| 643 | sio := '83'O, |
| 644 | rctx := 2 |
| 645 | }, |
| 646 | { |
| 647 | transport := BSSAP_TRANSPORT_AoIP, |
| 648 | sccp_service_type := "mtp3_itu", |
| 649 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 650 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 651 | own_ssn := 254, |
| 652 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 653 | peer_ssn := 254, |
| 654 | sio := '83'O, |
| 655 | rctx := 3 |
| 656 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 657 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 658 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 659 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 660 | phys_chan_configs phys_chan_config := { |
| 661 | "CCCH+SDCCH4+CBCH", |
| 662 | "TCH/F", |
| 663 | "TCH/F", |
| 664 | "TCH/F", |
| 665 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 666 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 667 | "PDCH", |
| 668 | "PDCH" |
| 669 | }; |
| 670 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 671 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 672 | sccp_service_type := "mtp3_itu", |
| 673 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 674 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 675 | own_ssn := 252, /* SMLC side SSN */ |
| 676 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 677 | peer_ssn := 250, /* BSC side SSN */ |
| 678 | sio := '83'O, |
| 679 | rctx := 6 |
| 680 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 681 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 682 | |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 683 | /* Whether to enable dyn TS SDCCH8 tests. Can be dropped completely and enable |
| 684 | unconditionally once new version of osmo-bsc is released (current |
| 685 | version: 1.7.0) */ |
| 686 | boolean mp_enable_dyn_sdcch8_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 687 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 688 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 689 | } |
| 690 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 691 | 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] | 692 | |
| 693 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 694 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 695 | pars.aoip := true; |
| 696 | } else { |
| 697 | pars.aoip := false; |
| 698 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 699 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 700 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 701 | |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 702 | /* BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2 */ |
| 703 | pars.expect_tsc := 2; |
| 704 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 705 | return pars; |
| 706 | } |
| 707 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 708 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 709 | |
| 710 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 711 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 712 | log("initial msc rate counters: ", g_ctr_msc); |
| 713 | } |
| 714 | |
| 715 | 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] | 716 | 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] | 717 | } |
| 718 | |
| 719 | /* f_ctrs_msc_init(); |
| 720 | * f_do_thing(on_msc := 0); |
| 721 | * f_do_thing(on_msc := 0); |
| 722 | * f_do_other(on_msc := 1); |
| 723 | * f_ctrs_msc_add(0, "thing", 2); |
| 724 | * f_ctrs_msc_add(1, "other"); |
| 725 | * f_ctrs_msc_verify(); |
| 726 | */ |
| 727 | private function f_ctrs_msc_verify() runs on test_CT { |
| 728 | log("verifying msc rate counters: ", g_ctr_msc); |
| 729 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 730 | } |
| 731 | |
| 732 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 733 | * f_ctrs_msc_init(); |
| 734 | * f_do_thing(on_msc := 0); |
| 735 | * f_do_thing(on_msc := 0); |
| 736 | * f_do_thing(on_msc := 0); |
| 737 | * f_ctrs_msc_expect(0, "thing", 3); |
| 738 | */ |
| 739 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 740 | f_ctrs_msc_add(msc_nr, countername, val); |
| 741 | f_ctrs_msc_verify(); |
| 742 | } |
| 743 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 744 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 745 | |
| 746 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 747 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 748 | log("initial bts rate counters: ", g_ctr_bts); |
| 749 | f_ctrs_bsc_init(counternames); |
| 750 | } |
| 751 | |
| 752 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 753 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 754 | f_ctrs_bsc_add(countername, val); |
| 755 | } |
| 756 | |
| 757 | /* f_ctrs_bsc_and_bts_init(); |
| 758 | * f_do_thing(on_bts := 0); |
| 759 | * f_do_thing(on_bts := 0); |
| 760 | * f_do_other(on_bts := 1); |
| 761 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 762 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 763 | * f_ctrs_bsc_and_bts_verify(); |
| 764 | */ |
| 765 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 766 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 767 | f_ctrs_bsc_verify(); |
| 768 | } |
| 769 | |
| 770 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 771 | * f_ctrs_bsc_and_bts_init(); |
| 772 | * f_do_thing(on_bts := 0); |
| 773 | * f_do_thing(on_bts := 0); |
| 774 | * f_do_thing(on_bts := 0); |
| 775 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 776 | */ |
| 777 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 778 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 779 | f_ctrs_bsc_and_bts_verify(); |
| 780 | } |
| 781 | |
| 782 | |
| 783 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 784 | |
| 785 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 786 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 787 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 788 | } |
| 789 | |
| 790 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 791 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 792 | } |
| 793 | |
| 794 | /* f_ctrs_bsc_init(); |
| 795 | * f_do_thing(); |
| 796 | * f_do_thing(); |
| 797 | * f_do_other(); |
| 798 | * f_ctrs_bsc_add("thing", 2); |
| 799 | * f_ctrs_bsc_add("other"); |
| 800 | * f_ctrs_bsc_verify(); |
| 801 | */ |
| 802 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 803 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 804 | } |
| 805 | |
| 806 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 807 | * f_ctrs_bsc_init(); |
| 808 | * f_do_thing(); |
| 809 | * f_ctrs_bsc_expect("thing", 1); |
| 810 | */ |
| 811 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 812 | f_ctrs_bsc_add(countername, val); |
| 813 | f_ctrs_bsc_verify(); |
| 814 | } |
| 815 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 816 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 817 | friend function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 818 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 819 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 820 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 821 | } |
| 822 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 823 | 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] | 824 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 825 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 826 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 827 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 828 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 829 | T.start; |
| 830 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 831 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 832 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 833 | 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] | 834 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 835 | [] 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] | 836 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 837 | 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] | 838 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 839 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 840 | repeat; |
| 841 | } |
| 842 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 843 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 844 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 845 | /* If we received a RESET after ours was sent, it |
| 846 | may be a race condition where the other peer beacame |
| 847 | available after we sent it, but we are in a desired |
| 848 | state anyway, so go forward. */ |
| 849 | if (not reset_received) { |
| 850 | setverdict(fail); |
| 851 | } |
| 852 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 853 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 854 | } |
| 855 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 856 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 857 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 858 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 859 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 860 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 861 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 862 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 863 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 864 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 865 | } |
| 866 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 867 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 868 | * \param clnt IPA_Client for which to establish |
| 869 | * \param bsc_host IP address / hostname of the BSC |
| 870 | * \param bsc_port TCP port number of the BSC |
| 871 | * \param i number identifying this BTS |
| 872 | * \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] | 873 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 874 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 875 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 876 | timer T := 10.0; |
| 877 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 878 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 879 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 880 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 881 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 882 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 883 | if (handler_mode) { |
| 884 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 885 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 886 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 887 | |
| 888 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 889 | if (handler_mode) { |
| 890 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 891 | } else { |
| 892 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 893 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 894 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 895 | 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] | 896 | if (handler_mode) { |
| 897 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 898 | return; |
| 899 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 900 | |
| 901 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 902 | T.start; |
| 903 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 904 | [] 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] | 905 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 906 | 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] | 907 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 908 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 909 | [] IPA_RSL[i].receive { repeat } |
| 910 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 911 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 912 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 913 | } |
| 914 | } |
| 915 | } |
| 916 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 917 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 918 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 919 | return; |
| 920 | } |
| 921 | clnt.vc_IPA.stop; |
| 922 | if (isbound(clnt.vc_RSL)) { |
| 923 | clnt.vc_RSL.stop; |
| 924 | } |
| 925 | } |
| 926 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 927 | /* 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] | 928 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 929 | timer T := secs_max; |
| 930 | T.start; |
| 931 | while (true) { |
| 932 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 933 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 934 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 935 | * until all MO's are initialized */ |
| 936 | T.start(1.0); |
| 937 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 938 | return; |
| 939 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 940 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 941 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 942 | 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] | 943 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 944 | } |
| 945 | } |
| 946 | } |
| 947 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 948 | /* 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] | 949 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 950 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 951 | [] T_guard.timeout { |
| 952 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 953 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 954 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 955 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 956 | [] 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] | 957 | 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] | 958 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 959 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 960 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 961 | } |
| 962 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 963 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 964 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 965 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 966 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 967 | } |
| 968 | } |
| 969 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 970 | function f_init_mgcp(charstring id) runs on test_CT { |
| 971 | id := id & "-MGCP"; |
| 972 | |
| 973 | var MGCPOps ops := { |
| 974 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 975 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 976 | }; |
| 977 | var MGCP_conn_parameters mgcp_pars := { |
| 978 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 979 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 980 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 981 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 982 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 983 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 984 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 985 | }; |
| 986 | |
| 987 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 988 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 989 | } |
| 990 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 991 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 992 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 993 | * OsmuxCID IE. |
| 994 | */ |
| 995 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 996 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 997 | if (allow) { |
| 998 | f_vty_transceive(BSCVTY, "osmux on"); |
| 999 | } else { |
| 1000 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1001 | } |
| 1002 | f_vty_transceive(BSCVTY, "exit"); |
| 1003 | f_vty_transceive(BSCVTY, "exit"); |
| 1004 | g_osmux_enabled := allow; |
| 1005 | } |
| 1006 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1007 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1008 | if (BSCVTY.checkstate("Mapped")) { |
| 1009 | /* skip initialization if already executed once */ |
| 1010 | return; |
| 1011 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1012 | map(self:BSCVTY, system:BSCVTY); |
| 1013 | f_vty_set_prompts(BSCVTY); |
| 1014 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1015 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1016 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1017 | } |
| 1018 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1019 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1020 | { |
| 1021 | // log on TTCN3 log output |
| 1022 | log(log_msg); |
| 1023 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1024 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1025 | } |
| 1026 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1027 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1028 | { |
| 1029 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1030 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1031 | } |
| 1032 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1033 | } |
| 1034 | |
| 1035 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1036 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1037 | |
| 1038 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1039 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1040 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1041 | repeat; |
| 1042 | } |
| 1043 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1044 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1045 | repeat; |
| 1046 | } |
| 1047 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1048 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1049 | repeat; |
| 1050 | } |
| 1051 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1052 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1053 | repeat; |
| 1054 | } |
| 1055 | |
| 1056 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1057 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1058 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1059 | repeat; |
| 1060 | } |
| 1061 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1062 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1063 | repeat; |
| 1064 | } |
| 1065 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1066 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1067 | repeat; |
| 1068 | } |
| 1069 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1070 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1071 | repeat; |
| 1072 | } |
| 1073 | } |
| 1074 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1075 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1076 | private type record of boolean my_BooleanList; |
| 1077 | |
| 1078 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1079 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1080 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1081 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1082 | 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] | 1083 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1084 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1085 | * stepping into that config node. */ |
| 1086 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1087 | continue; |
| 1088 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1089 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1090 | if (allow_attach_list[msc_nr]) { |
| 1091 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1092 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1093 | } else { |
| 1094 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1095 | } |
| 1096 | f_vty_transceive(pt, "exit"); |
| 1097 | f_vty_transceive(pt, "exit"); |
| 1098 | } |
| 1099 | } |
| 1100 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1101 | /* global initialization function |
| 1102 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1103 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1104 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1105 | */ |
| 1106 | 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] | 1107 | 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] | 1108 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1109 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1110 | if (g_initialized) { |
| 1111 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1112 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1113 | g_initialized := true; |
| 1114 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1115 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1116 | activate(as_Tguard()); |
| 1117 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1118 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 1119 | f_vty_allow_osmux(allow_osmux); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1120 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1121 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1122 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1123 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1124 | 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] | 1125 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1126 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1127 | * MSC-side BSSAP emulation */ |
| 1128 | if (handler_mode) { |
| 1129 | var RanOps ranops := MSC_RanOps; |
| 1130 | ranops.use_osmux := g_osmux_enabled; |
| 1131 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1132 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1133 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1134 | } else { |
| 1135 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1136 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1137 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1138 | f_legacy_bssap_reset(); |
| 1139 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1140 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1141 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1142 | if (mp_enable_lcs_tests) { |
| 1143 | if (handler_mode) { |
| 1144 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1145 | } else { |
| 1146 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1147 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1148 | } |
| 1149 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1150 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1151 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1152 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1153 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1154 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1155 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1156 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1157 | f_init_mgcp("VirtMSC"); |
| 1158 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1159 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1160 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1161 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1162 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1163 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1164 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1165 | runs on test_CT { |
| 1166 | /* wait until osmo-bts-omldummy has respawned */ |
| 1167 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1168 | |
| 1169 | /* start RSL connection */ |
| 1170 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1171 | /* wait until BSC tells us "connected" */ |
| 1172 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1173 | } |
| 1174 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1175 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1176 | template SystemInformationConfig expect_si) |
| 1177 | runs on test_CT { |
| 1178 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1179 | |
| 1180 | f_init_bts(bts_idx, handler_mode); |
| 1181 | |
| 1182 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1183 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1184 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1185 | */ |
| 1186 | f_sleep(5.0); |
| 1187 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1188 | |
| 1189 | deactivate(sysinfo); |
| 1190 | |
| 1191 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1192 | setverdict(pass); |
| 1193 | } else { |
| 1194 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1195 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1196 | setverdict(fail, "received SI does not match expectations"); |
| 1197 | return; |
| 1198 | } |
| 1199 | } |
| 1200 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1201 | /* 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] | 1202 | 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] | 1203 | runs on test_CT return RSL_Message { |
| 1204 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1205 | timer T := t_secs; |
| 1206 | |
| 1207 | T.start; |
| 1208 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1209 | [] 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] | 1210 | T.stop; |
| 1211 | } |
| 1212 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1213 | [] T.timeout { |
| 1214 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1215 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1216 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1217 | } |
| 1218 | return rx_rsl_ud.rsl; |
| 1219 | } |
| 1220 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1221 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1222 | 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] | 1223 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1224 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1228 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1229 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1230 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1231 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1232 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1233 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1234 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1235 | 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] | 1236 | 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] | 1237 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1238 | } |
| 1239 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1240 | /* verify if the "chreq:total" counter increments as expected */ |
| 1241 | testcase TC_chan_act_counter() runs on test_CT { |
| 1242 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1243 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1244 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1245 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1246 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1247 | |
| 1248 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1249 | 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] | 1250 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1251 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1252 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1253 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1254 | } |
| 1255 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1256 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1257 | 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] | 1258 | var RSL_Message rx_rsl; |
| 1259 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1260 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1261 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | |
| 1263 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1264 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1265 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1266 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1267 | } |
| 1268 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1269 | /* Normal variant */ |
| 1270 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1271 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1272 | f_TC_chan_act_ack_noest(); |
| 1273 | } |
| 1274 | |
| 1275 | /* Emergency call variant */ |
| 1276 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1277 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1278 | f_init(1); |
| 1279 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1280 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1281 | } |
| 1282 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1283 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1284 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1285 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1286 | |
| 1287 | var RSL_Message rx_rsl; |
| 1288 | var GsmRrMessage rr; |
| 1289 | |
| 1290 | f_init(1); |
| 1291 | f_vty_allow_emerg_bts(false, 0); |
| 1292 | |
| 1293 | IPA_RSL[0].clear; |
| 1294 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1295 | |
| 1296 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1297 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1298 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1299 | setverdict(pass); |
| 1300 | } else { |
| 1301 | setverdict(fail, "immediate assignment not rejected"); |
| 1302 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1303 | |
| 1304 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1305 | } |
| 1306 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1307 | /* Test behavior if MSC never answers to CR */ |
| 1308 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1309 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1310 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1311 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1312 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1313 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1314 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1315 | |
| 1316 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1317 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1318 | |
| 1319 | var octetstring l3 := '00010203040506'O |
| 1320 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1321 | |
| 1322 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1323 | |
| 1324 | /* 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] | 1325 | /* 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] | 1326 | 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] | 1327 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1328 | } |
| 1329 | |
| 1330 | /* Test behavior if MSC answers with CREF to CR */ |
| 1331 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1332 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1333 | var RSL_Message rx_rsl; |
| 1334 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1335 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1336 | |
| 1337 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1338 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1339 | |
| 1340 | var octetstring l3 := '00010203040506'O |
| 1341 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1342 | |
| 1343 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1344 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1345 | |
| 1346 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1347 | 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] | 1348 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1349 | } |
| 1350 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1351 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1352 | testcase TC_chan_act_nack() runs on test_CT { |
| 1353 | var RSL_Message rx_rsl; |
| 1354 | var integer chact_nack; |
| 1355 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1356 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1357 | |
| 1358 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1359 | |
| 1360 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1361 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1362 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1363 | |
| 1364 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1365 | |
| 1366 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1367 | f_sleep(0.5); |
| 1368 | |
| 1369 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1370 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1371 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1372 | } |
| 1373 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1374 | /* Test for channel exhaustion due to RACH overload */ |
| 1375 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1376 | var ASP_RSL_Unitdata rsl_ud; |
| 1377 | var integer i; |
| 1378 | var integer chreq_total, chreq_nochan; |
| 1379 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1380 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1381 | |
| 1382 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1383 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1384 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1385 | /* GSM 04.08 Table 9.9a: |
| 1386 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1387 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1388 | 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] | 1389 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1390 | } |
| 1391 | |
| 1392 | IPA_RSL[0].clear; |
| 1393 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1394 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1395 | 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] | 1396 | |
| 1397 | /* now expect additional channel activations to fail */ |
| 1398 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1399 | |
| 1400 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1401 | [] 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] | 1402 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1403 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1404 | [] 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] | 1405 | var GsmRrMessage rr; |
| 1406 | /* match on IMM ASS REJ */ |
| 1407 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1408 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1409 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1410 | 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] | 1411 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1412 | chreq_nochan+1); |
| 1413 | setverdict(pass); |
| 1414 | } else { |
| 1415 | repeat; |
| 1416 | } |
| 1417 | } |
| 1418 | [] IPA_RSL[0].receive { repeat; } |
| 1419 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1420 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1421 | } |
| 1422 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1423 | /* Test channel deactivation due to silence from MS */ |
| 1424 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1425 | var RslChannelNr chan_nr; |
| 1426 | |
| 1427 | f_init(1); |
| 1428 | |
| 1429 | /* Request for a dedicated channel */ |
| 1430 | chan_nr := f_chreq_act_ack('23'O); |
| 1431 | |
| 1432 | /* Wait some time until the channel is released */ |
| 1433 | f_sleep(2.0); |
| 1434 | |
| 1435 | /* Expect CHANnel RELease */ |
| 1436 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1437 | [] 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] | 1438 | log("Received CHANnel RELease"); |
| 1439 | setverdict(pass); |
| 1440 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1441 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1442 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1443 | * Assignment Reject since a dedicated channel was |
| 1444 | * already allocated, and Immediate Assignment was |
| 1445 | * already sent. */ |
| 1446 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1447 | } |
| 1448 | [] IPA_RSL[0].receive { |
| 1449 | setverdict(fail, "Unexpected RSL message!"); |
| 1450 | } |
| 1451 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1452 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1453 | } |
| 1454 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1455 | /*********************************************************************** |
| 1456 | * Assignment Testing |
| 1457 | ***********************************************************************/ |
| 1458 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1459 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1460 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1461 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1462 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1463 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1464 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1465 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1466 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1467 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1468 | } |
| 1469 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1470 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1471 | 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] | 1472 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1473 | var RSL_Message rx_rsl; |
| 1474 | var DchanTuple dt; |
| 1475 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1476 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1477 | |
| 1478 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1479 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1480 | /* send assignment without AoIP IEs */ |
| 1481 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1482 | } else { |
| 1483 | /* Send assignmetn without CIC in IPA case */ |
| 1484 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1485 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1486 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1487 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1488 | alt { |
| 1489 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1490 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1491 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1492 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1493 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1494 | setverdict(pass); |
| 1495 | } |
| 1496 | [] BSSAP.receive { repeat; } |
| 1497 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1498 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1499 | } |
| 1500 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1501 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1502 | 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] | 1503 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1504 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1505 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1506 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1507 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1508 | if (osmux_enabled) { |
| 1509 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1510 | } else { |
| 1511 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1512 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1513 | } else { |
| 1514 | 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] | 1515 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1516 | } |
| 1517 | return ass_cmd; |
| 1518 | } |
| 1519 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1520 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1521 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1522 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1523 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1524 | |
| 1525 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1526 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
| 1527 | var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1528 | var template BSSMAP_IE_KC128 kc128 := omit; |
| 1529 | if (ispresent(enc)) { |
| 1530 | var TestHdlrEncrParams v_enc := valueof(enc); |
| 1531 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg)); |
| 1532 | chosenEncryptionAlgorithm := valueof( |
| 1533 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
Oliver Smith | 598e1ed | 2021-07-09 10:28:40 +0200 | [diff] [blame] | 1534 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg)), 1))); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1535 | if (ispresent(v_enc.enc_kc128)) { |
| 1536 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1537 | } |
| 1538 | } |
| 1539 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1540 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1541 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1542 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1543 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1544 | encryptionInformation := encryptionInformation, |
| 1545 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1546 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1547 | } else { |
| 1548 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1549 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1550 | encryptionInformation := encryptionInformation, |
| 1551 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1552 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1553 | } |
| 1554 | return ho_req; |
| 1555 | } |
| 1556 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1557 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1558 | 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] | 1559 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1560 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1561 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1562 | if (expect_osmux) { |
| 1563 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1564 | } else { |
| 1565 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1566 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1567 | } else { |
| 1568 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1569 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1570 | } |
| 1571 | return exp_compl; |
| 1572 | } |
| 1573 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1574 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1575 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1576 | runs on test_CT { |
| 1577 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1578 | var RSL_Message rx_rsl; |
| 1579 | var DchanTuple dt; |
| 1580 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1581 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1582 | |
| 1583 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1584 | /* send assignment without AoIP IEs */ |
| 1585 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1586 | alt { |
| 1587 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1588 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1589 | setverdict(pass); |
| 1590 | } else { |
| 1591 | setverdict(fail, fail_text); |
| 1592 | } |
| 1593 | } |
| 1594 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1595 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1596 | setverdict(pass); |
| 1597 | } else { |
| 1598 | setverdict(fail, fail_text); |
| 1599 | } |
| 1600 | } |
| 1601 | [] BSSAP.receive { repeat; } |
| 1602 | } |
| 1603 | } |
| 1604 | testcase TC_assignment_csd() runs on test_CT { |
| 1605 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1606 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1607 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1608 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1609 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1610 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1611 | } |
| 1612 | |
| 1613 | testcase TC_assignment_ctm() runs on test_CT { |
| 1614 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1615 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1616 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1617 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1618 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1619 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1620 | } |
| 1621 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1622 | type record DchanTuple { |
| 1623 | integer sccp_conn_id, |
| 1624 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1625 | } |
| 1626 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1627 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1628 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1629 | runs on test_CT return RslChannelNr { |
| 1630 | var RSL_Message rx_rsl; |
| 1631 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1632 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1633 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1634 | 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] | 1635 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1636 | return chan_nr; |
| 1637 | } |
| 1638 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1639 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1640 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1641 | runs on test_CT return DchanTuple { |
| 1642 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1643 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1644 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1645 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1646 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1647 | |
| 1648 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1649 | |
| 1650 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1651 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1652 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1653 | |
| 1654 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1655 | } |
| 1656 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1657 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1658 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1659 | var RSL_Message rx_rsl; |
| 1660 | /* expect BSC to disable the channel */ |
| 1661 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1662 | /* respond with CHAN REL ACK */ |
| 1663 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1664 | |
| 1665 | /* expect Clear Complete from BSC */ |
| 1666 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1667 | |
| 1668 | /* MSC disconnects as instructed. */ |
| 1669 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1670 | } |
| 1671 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1672 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1673 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1674 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1675 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1676 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1677 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1678 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1679 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1680 | |
| 1681 | /* simulate RLL REL IND */ |
| 1682 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1683 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1684 | /* expect Clear Request on MSC side */ |
| 1685 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1686 | |
| 1687 | /* Instruct BSC to clear channel */ |
| 1688 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1689 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1690 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1691 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1692 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1693 | |
| 1694 | /* wait for SCCP emulation to do its job */ |
| 1695 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1696 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1697 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1701 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1702 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1703 | var DchanTuple dt; |
| 1704 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1705 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1706 | |
| 1707 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1708 | |
| 1709 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1710 | 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] | 1711 | /* TODO: different cause values? */ |
| 1712 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1713 | /* expect Clear Request from BSC */ |
| 1714 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1715 | |
| 1716 | /* Instruct BSC to clear channel */ |
| 1717 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1718 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1719 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1720 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1721 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1722 | |
| 1723 | /* wait for SCCP emulation to do its job */ |
| 1724 | f_sleep(1.0); |
| 1725 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1726 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1727 | } |
| 1728 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1729 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1730 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1731 | testcase TC_early_conn_fail() runs on test_CT { |
| 1732 | var RSL_Message rx_rsl; |
| 1733 | var DchanTuple dt; |
| 1734 | |
| 1735 | f_init(1); |
| 1736 | |
| 1737 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1738 | 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] | 1739 | |
| 1740 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1741 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1742 | |
| 1743 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1744 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1745 | |
| 1746 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1747 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1748 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1749 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1750 | } |
| 1751 | |
| 1752 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1753 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1754 | testcase TC_late_conn_fail() runs on test_CT { |
| 1755 | var RSL_Message rx_rsl; |
| 1756 | var DchanTuple dt; |
| 1757 | |
| 1758 | f_init(1); |
| 1759 | |
| 1760 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1761 | |
| 1762 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1763 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1764 | |
| 1765 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1766 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1767 | |
| 1768 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1769 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1770 | |
| 1771 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1772 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1773 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1774 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1775 | |
| 1776 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1777 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1778 | |
| 1779 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1780 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1781 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1782 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1783 | } |
| 1784 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1785 | private function f_TC_stats_conn_fail(charstring id) runs on MSC_ConnHdlr { |
| 1786 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 1787 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1788 | |
| 1789 | f_statsd_reset(); |
| 1790 | |
| 1791 | /* Establish SDCCH */ |
| 1792 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1793 | f_establish_fully(ass_cmd, exp_fail); |
| 1794 | |
| 1795 | /* Expect stats to be 0 */ |
| 1796 | var StatsDExpects expect := { |
| 1797 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 0, max := 0}, |
| 1798 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 0, max := 0} |
| 1799 | }; |
| 1800 | f_statsd_expect(expect); |
| 1801 | |
| 1802 | /* Simulate CONN FAIL IND on SDCCH */ |
| 1803 | RSL.send(ts_ASP_RSL_UD( |
| 1804 | ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL), |
| 1805 | IPAC_PROTO_RSL_TRX0)); |
| 1806 | |
| 1807 | /* Expect stats to be 1 */ |
| 1808 | expect := { |
| 1809 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 1, max := 1}, |
| 1810 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 1, max := 1} |
| 1811 | }; |
| 1812 | f_statsd_expect(expect); |
| 1813 | } |
| 1814 | testcase TC_stats_conn_fail() runs on test_CT { |
| 1815 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 1816 | var MSC_ConnHdlr vc_conn; |
| 1817 | |
| 1818 | f_init(1, true); |
| 1819 | f_sleep(1.0); |
| 1820 | |
| 1821 | vc_conn := f_start_handler(refers(f_TC_stats_conn_fail), pars); |
| 1822 | vc_conn.done; |
| 1823 | |
| 1824 | f_shutdown_helper(); |
| 1825 | } |
| 1826 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1827 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1828 | boolean expect_deact_sacch := true, |
| 1829 | boolean expect_rr_chan_rel := true, |
| 1830 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1831 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1832 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1833 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1834 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1835 | |
| 1836 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1837 | var boolean got_deact_sacch := false; |
| 1838 | var boolean got_rr_chan_rel := false; |
| 1839 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1840 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1841 | var RSL_IE_Body l3_ie; |
| 1842 | var PDU_ML3_NW_MS l3; |
| 1843 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1844 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1845 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1846 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1847 | [] 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] | 1848 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1849 | repeat; |
| 1850 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1851 | [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] | 1852 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1853 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1854 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1855 | setverdict(fail, "cannot find L3"); |
| 1856 | mtc.stop; |
| 1857 | } |
| 1858 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1859 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1860 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1861 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1862 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1863 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1864 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 1865 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1866 | setverdict(pass); |
| 1867 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1868 | log("EXPECTED CELLS: ", expect_cells); |
| 1869 | 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] | 1870 | } |
| 1871 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1872 | |
| 1873 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1874 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1875 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1876 | if (match(got_cause, expect_rr_cause)) { |
| 1877 | setverdict(pass); |
| 1878 | } else { |
| 1879 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1880 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1881 | } |
| 1882 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1883 | repeat; |
| 1884 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1885 | [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] | 1886 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1887 | |
| 1888 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1889 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1890 | setverdict(fail, "cannot find L3"); |
| 1891 | mtc.stop; |
| 1892 | } |
| 1893 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1894 | |
| 1895 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1896 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1897 | if (match(got_cause, expect_rr_cause)) { |
| 1898 | setverdict(pass); |
| 1899 | } else { |
| 1900 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1901 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1902 | } |
| 1903 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1904 | repeat; |
| 1905 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1906 | [] 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] | 1907 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1908 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1909 | if (handle_rll_rel) { |
| 1910 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1911 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1912 | repeat; |
| 1913 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1914 | [] 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] | 1915 | /* respond with CHAN REL ACK */ |
| 1916 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1917 | } |
| 1918 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1919 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1920 | repeat; |
| 1921 | } |
| 1922 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1923 | |
| 1924 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1925 | " got_rll_rel_req=", got_rll_rel_req); |
| 1926 | |
| 1927 | if (expect_deact_sacch != got_deact_sacch) { |
| 1928 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1929 | } |
| 1930 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1931 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1932 | } |
| 1933 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1934 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1935 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1936 | } |
| 1937 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1938 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1939 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1940 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1941 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1942 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1943 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1944 | |
| 1945 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1946 | |
| 1947 | /* Instruct BSC to clear channel */ |
| 1948 | var BssmapCause cause := 0; |
| 1949 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1950 | |
| 1951 | /* expect Clear Complete from BSC on A */ |
| 1952 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1953 | /* release the SCCP connection */ |
| 1954 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1955 | } |
| 1956 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1957 | 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] | 1958 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1959 | } |
| 1960 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1961 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 1962 | var BSSAP_N_DATA_ind rx_di; |
| 1963 | var DchanTuple dt; |
| 1964 | |
| 1965 | f_init(1); |
| 1966 | |
| 1967 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1968 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 1969 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 1970 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 1971 | |
| 1972 | /* Instruct BSC to clear channel */ |
| 1973 | var BssmapCause cause := 0; |
| 1974 | if (tx_csfb_ind) { |
| 1975 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1976 | } else { |
| 1977 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1978 | } |
| 1979 | |
| 1980 | /* expect Clear Complete from BSC on A */ |
| 1981 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1982 | /* release the SCCP connection */ |
| 1983 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1984 | } |
| 1985 | |
| 1986 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 1987 | SystemInformationConfig_default, use that: */ |
| 1988 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 1989 | |
| 1990 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 1991 | f_shutdown_helper(); |
| 1992 | } |
| 1993 | |
| 1994 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 1995 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 1996 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 1997 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 1998 | Indicator or not shouldn't matter at all. */ |
| 1999 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 2000 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 2001 | } |
| 2002 | |
| 2003 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 2004 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2005 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2006 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 2007 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 2008 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 2009 | } |
| 2010 | |
| 2011 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 2012 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2013 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 2014 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 2015 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 2016 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2017 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 2018 | var BSSAP_N_DATA_ind rx_di; |
| 2019 | var DchanTuple dt; |
| 2020 | |
| 2021 | f_init(1); |
| 2022 | |
| 2023 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2024 | |
| 2025 | /* Instruct BSC to clear channel */ |
| 2026 | var BssmapCause cause := 0; |
| 2027 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2028 | |
| 2029 | /* expect Clear Complete from BSC on A */ |
| 2030 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2031 | /* release the SCCP connection */ |
| 2032 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2033 | } |
| 2034 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2035 | 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] | 2036 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2037 | } |
| 2038 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2039 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 2040 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2041 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2042 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2043 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2044 | |
| 2045 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2046 | |
| 2047 | /* release the SCCP connection */ |
| 2048 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2049 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2050 | 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] | 2051 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2052 | } |
| 2053 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2054 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2055 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2056 | var DchanTuple dt; |
| 2057 | |
| 2058 | f_init(1); |
| 2059 | |
| 2060 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2061 | |
| 2062 | /* release the SCCP connection */ |
| 2063 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2064 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2065 | 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] | 2066 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2067 | } |
| 2068 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2069 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2070 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2071 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2072 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2073 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2074 | |
| 2075 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2076 | |
| 2077 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2078 | IPA_RSL[0].clear; |
| 2079 | |
| 2080 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2081 | 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] | 2082 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2083 | [] 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] | 2084 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2085 | } |
| 2086 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2087 | 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] | 2088 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2089 | } |
| 2090 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2091 | /* Verify T(iar) triggers and releases the channel */ |
| 2092 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2093 | var DchanTuple dt; |
| 2094 | |
| 2095 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2096 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2097 | T(iar) >= T(ias)*2 */ |
| 2098 | g_bsc_sccp_timer_ias := 2; |
| 2099 | g_bsc_sccp_timer_iar := 5; |
| 2100 | |
| 2101 | f_init(1); |
| 2102 | |
| 2103 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2104 | 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] | 2105 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2106 | } |
| 2107 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2108 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2109 | runs on test_CT |
| 2110 | { |
| 2111 | var DchanTuple dt; |
| 2112 | |
| 2113 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2114 | var BssmapCause cause := 0; |
| 2115 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2116 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2117 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2118 | } |
| 2119 | |
| 2120 | 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] | 2121 | } |
| 2122 | |
| 2123 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2124 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2125 | f_init(1); |
| 2126 | |
| 2127 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2128 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2129 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2130 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2131 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2132 | 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] | 2133 | |
| 2134 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2135 | } |
| 2136 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2137 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2138 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2139 | timer T := 2.0; |
| 2140 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2141 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2142 | |
| 2143 | var octetstring l3 := '00010203040506'O; |
| 2144 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2145 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2146 | |
| 2147 | T.start; |
| 2148 | alt { |
| 2149 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2150 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2151 | } |
| 2152 | [] BSSAP.receive {} |
| 2153 | [] IPA_RSL[0].receive {} |
| 2154 | [] T.timeout {} |
| 2155 | } |
| 2156 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2157 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2158 | } |
| 2159 | |
| 2160 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2161 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2162 | var RslChannelNr chan_nr; |
| 2163 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2164 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2165 | |
| 2166 | chan_nr := f_chreq_act_ack() |
| 2167 | |
| 2168 | var octetstring l3 := '00010203040506'O; |
| 2169 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2170 | |
| 2171 | timer T := 2.0; |
| 2172 | T.start; |
| 2173 | alt { |
| 2174 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2175 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2176 | } |
| 2177 | [] BSSAP.receive { repeat; } |
| 2178 | [] IPA_RSL[0].receive { repeat; } |
| 2179 | [] T.timeout {} |
| 2180 | } |
| 2181 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2182 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2183 | } |
| 2184 | |
| 2185 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2186 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2187 | timer T := 2.0; |
| 2188 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2189 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2190 | |
| 2191 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2192 | |
| 2193 | var octetstring l3 := '00010203040506'O; |
| 2194 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2195 | |
| 2196 | T.start; |
| 2197 | alt { |
| 2198 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2199 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2200 | } |
| 2201 | [] BSSAP.receive { repeat; } |
| 2202 | [] IPA_RSL[0].receive { repeat; } |
| 2203 | [] T.timeout {} |
| 2204 | } |
| 2205 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2206 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2207 | } |
| 2208 | |
| 2209 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2210 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2211 | timer T := 2.0; |
| 2212 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2213 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2214 | |
| 2215 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2216 | |
| 2217 | var octetstring l3 := '00010203040506'O; |
| 2218 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2219 | |
| 2220 | T.start; |
| 2221 | alt { |
| 2222 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2223 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2224 | } |
| 2225 | [] BSSAP.receive { repeat; } |
| 2226 | [] IPA_RSL[0].receive { repeat; } |
| 2227 | [] T.timeout {} |
| 2228 | } |
| 2229 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2230 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2231 | } |
| 2232 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2233 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2234 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2235 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2236 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2237 | |
| 2238 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2239 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2240 | |
| 2241 | f_establish_fully(ass_cmd, exp_compl); |
| 2242 | |
| 2243 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2244 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2245 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2246 | BSSAP.receive(PDU_BSSAP:{ |
| 2247 | discriminator := '1'B, |
| 2248 | spare := '0000000'B, |
| 2249 | dlci := 'C3'O, |
| 2250 | lengthIndicator := ?, |
| 2251 | pdu := { dtap := '0904'O } |
| 2252 | }); |
| 2253 | |
| 2254 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2255 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2256 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2257 | var template (value) RslLinkId link_id; |
| 2258 | var template (value) OCT1 dlci; |
| 2259 | |
| 2260 | if (i mod 2 == 0) { |
| 2261 | /* SAPI0 on FACCH or SDCCH */ |
| 2262 | link_id := ts_RslLinkID_DCCH(0); |
| 2263 | dlci := '80'O; |
| 2264 | } else { |
| 2265 | /* SAPI3 on SACCH */ |
| 2266 | link_id := ts_RslLinkID_SACCH(3); |
| 2267 | dlci := 'C3'O; |
| 2268 | } |
| 2269 | |
| 2270 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2271 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2272 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2273 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2274 | } |
| 2275 | } |
| 2276 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2277 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2278 | var MSC_ConnHdlr vc_conn; |
| 2279 | |
| 2280 | f_init(1, true); |
| 2281 | f_sleep(1.0); |
| 2282 | |
| 2283 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2284 | vc_conn.done; |
| 2285 | |
| 2286 | f_shutdown_helper(); |
| 2287 | } |
| 2288 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2289 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2290 | template myBSSMAP_Cause cause := ?, |
| 2291 | float T_val := 2.0) |
| 2292 | runs on test_CT { |
| 2293 | var BSSAP_N_DATA_ind rx_di; |
| 2294 | timer T; |
| 2295 | |
| 2296 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2297 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2298 | |
| 2299 | T.start(T_val); |
| 2300 | alt { |
| 2301 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2302 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2303 | if (not match(rx_cause, tr_cause)) { |
| 2304 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2305 | rx_cause, " vs expected ", tr_cause); |
| 2306 | } |
| 2307 | setverdict(pass); |
| 2308 | } |
| 2309 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2310 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2311 | } |
| 2312 | [] T.timeout { |
| 2313 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2314 | } |
| 2315 | } |
| 2316 | } |
| 2317 | |
| 2318 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2319 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2320 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2321 | var RSL_Message rx_rsl; |
| 2322 | var DchanTuple dt; |
| 2323 | |
| 2324 | f_init(1); |
| 2325 | |
| 2326 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2327 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2328 | |
| 2329 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2330 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2331 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2332 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2333 | |
| 2334 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2335 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2336 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2337 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2338 | |
| 2339 | /* Clean up the connection */ |
| 2340 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2341 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2342 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2343 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2344 | } |
| 2345 | |
| 2346 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2347 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2348 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2349 | var RSL_Message rx_rsl; |
| 2350 | var DchanTuple dt; |
| 2351 | |
| 2352 | f_init(1); |
| 2353 | |
| 2354 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2355 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2356 | |
| 2357 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2358 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2359 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2360 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2361 | |
| 2362 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2363 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2364 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2365 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2366 | |
| 2367 | /* Clean up the connection */ |
| 2368 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2369 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2370 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2371 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2372 | } |
| 2373 | |
| 2374 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2375 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2376 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2377 | var RSL_Message rx_rsl; |
| 2378 | var DchanTuple dt; |
| 2379 | |
| 2380 | f_init(1); |
| 2381 | |
| 2382 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2383 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2384 | |
| 2385 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2386 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2387 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2388 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2389 | |
| 2390 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2391 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2392 | |
| 2393 | /* Clean up the connection */ |
| 2394 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2395 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2396 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2397 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2398 | } |
| 2399 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2400 | testcase TC_si_default() runs on test_CT { |
| 2401 | f_init(0); |
| 2402 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2403 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2404 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2405 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2406 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2407 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2408 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2409 | { |
| 2410 | select (earfcn_index) { |
| 2411 | case (0) { |
| 2412 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2413 | return 111; |
| 2414 | } |
| 2415 | case (1) { |
| 2416 | return 1; |
| 2417 | } |
| 2418 | case (2) { |
| 2419 | return 0; |
| 2420 | } |
| 2421 | case (3) { |
| 2422 | return 65535; |
| 2423 | } |
| 2424 | case else { |
| 2425 | return 23 * (earfcn_index - 3); |
| 2426 | } |
| 2427 | } |
| 2428 | } |
| 2429 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2430 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2431 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2432 | |
| 2433 | f_init(0); |
| 2434 | |
| 2435 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2436 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2437 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2438 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2439 | } |
| 2440 | |
| 2441 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2442 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2443 | if (not istemplatekind(expect_cells, "omit")) { |
| 2444 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2445 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2446 | var BSSAP_N_DATA_ind rx_di; |
| 2447 | var DchanTuple dt; |
| 2448 | |
| 2449 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2450 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2451 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2452 | 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] | 2453 | |
| 2454 | /* Instruct BSC to clear channel */ |
| 2455 | var BssmapCause cause := 0; |
| 2456 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2457 | |
| 2458 | /* expect Clear Complete from BSC on A */ |
| 2459 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2460 | /* release the SCCP connection */ |
| 2461 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2462 | } |
| 2463 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2464 | 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] | 2465 | } |
| 2466 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2467 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2468 | 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] | 2469 | } |
| 2470 | } |
| 2471 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2472 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2473 | { |
| 2474 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2475 | var integer si2quater_count := (count + 2) / 3; |
| 2476 | |
| 2477 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2478 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2479 | var integer index := i / 3; |
| 2480 | var integer earfcn_index := i mod 3; |
| 2481 | if (index >= lengthof(si2quater)) { |
| 2482 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2483 | } |
| 2484 | 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); |
| 2485 | } |
| 2486 | |
| 2487 | return si2quater; |
| 2488 | } |
| 2489 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2490 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2491 | { |
| 2492 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2493 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2494 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2495 | for (var integer i := 0; i < count; i := i + 1) { |
| 2496 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2497 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2498 | } |
| 2499 | |
| 2500 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2501 | } |
| 2502 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2503 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2504 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2505 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2506 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2507 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2508 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2509 | } |
| 2510 | |
| 2511 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2512 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2513 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2514 | } |
| 2515 | |
| 2516 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2517 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2518 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2519 | } |
| 2520 | |
| 2521 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2522 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2523 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2524 | } |
| 2525 | |
| 2526 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2527 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2528 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2529 | } |
| 2530 | |
| 2531 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2532 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2533 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2537 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2538 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2542 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2543 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2544 | } |
| 2545 | |
| 2546 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2547 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2548 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2549 | } |
| 2550 | |
| 2551 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2552 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2553 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2554 | } |
| 2555 | |
| 2556 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2557 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2558 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2559 | } |
| 2560 | |
| 2561 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2562 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2563 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2564 | } |
| 2565 | |
| 2566 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2567 | * 48 EARFCNs. */ |
| 2568 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2569 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2570 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2571 | f_init(0); |
| 2572 | |
| 2573 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2574 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2575 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2576 | } |
| 2577 | |
| 2578 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2579 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2580 | var charstring vty_error; |
| 2581 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2582 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2583 | f_vty_transceive(BSCVTY, "end"); |
| 2584 | |
| 2585 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2586 | log("Got expected VTY error: ", vty_error); |
| 2587 | setverdict(pass); |
| 2588 | } else { |
| 2589 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2590 | } |
| 2591 | |
| 2592 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2593 | |
| 2594 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2595 | 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] | 2596 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2597 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2598 | } |
| 2599 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2600 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2601 | { |
| 2602 | var uint8_t count := 0; |
| 2603 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2604 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2605 | count := count + 1; |
| 2606 | } |
| 2607 | } |
| 2608 | return count; |
| 2609 | } |
| 2610 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2611 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2612 | { |
| 2613 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2614 | var SystemInformationType1 last_si1; |
| 2615 | |
| 2616 | timer T := 30.0; |
| 2617 | T.start; |
| 2618 | alt { |
| 2619 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2620 | tr_RSL_BCCH_INFO, |
| 2621 | tr_RSL_NO_SACCH_FILL, |
| 2622 | tr_RSL_SACCH_FILL)) |
| 2623 | ) -> value rx_rsl_ud { |
| 2624 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2625 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2626 | repeat; |
| 2627 | } |
| 2628 | last_si1 := g_system_information[rsl_idx].si1; |
| 2629 | g_system_information[rsl_idx].si1 := omit; |
| 2630 | T.stop; |
| 2631 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2632 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2633 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2634 | } |
| 2635 | return last_si1; |
| 2636 | } |
| 2637 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2638 | /* verify ACC rotate feature */ |
| 2639 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2640 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2641 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2642 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2643 | var uint8_t count; |
| 2644 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2645 | |
| 2646 | f_init(0, guard_timeout := 60.0); |
| 2647 | |
| 2648 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2649 | "access-control-class-rotate 3", |
| 2650 | "access-control-class-rotate-quantum 1"}); |
| 2651 | |
| 2652 | /* Init and get first sysinfo */ |
| 2653 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2654 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2655 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2656 | last_si1 := f_recv_next_si1(0); |
| 2657 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2658 | count := f_acc09_count_allowed(acc); |
| 2659 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2660 | |
| 2661 | if (count != 3) { |
| 2662 | log("RSL: EXPECTED SI ACC len=3"); |
| 2663 | setverdict(fail, "received SI does not match expectations"); |
| 2664 | break; |
| 2665 | } |
| 2666 | |
| 2667 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2668 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2669 | times_allowed[j] := times_allowed[j] + 1; |
| 2670 | } |
| 2671 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2672 | } |
| 2673 | |
| 2674 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2675 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2676 | if (j != 5 and times_allowed[j] < 3) { |
| 2677 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2678 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2679 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2680 | } |
| 2681 | } |
| 2682 | |
| 2683 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2684 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2685 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2686 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2687 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2688 | /* verify ACC startup ramp+rotate feature */ |
| 2689 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2690 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2691 | var SystemInformationType1 last_si1; |
| 2692 | var AccessControlClass acc; |
| 2693 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2694 | var uint8_t count; |
| 2695 | var uint8_t prev_count; |
| 2696 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2697 | |
| 2698 | f_init(0, guard_timeout := 80.0); |
| 2699 | |
| 2700 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2701 | "access-control-class-rotate 0", |
| 2702 | "access-control-class-rotate-quantum 1", |
| 2703 | "access-control-class-ramping", |
| 2704 | "access-control-class-ramping-step-interval 5", |
| 2705 | "access-control-class-ramping-step-size 5"}); |
| 2706 | |
| 2707 | /* Init and get first sysinfo */ |
| 2708 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2709 | last_si1 := g_system_information[0].si1; |
| 2710 | acc := last_si1.rach_control.acc; |
| 2711 | count := f_acc09_count_allowed(acc); |
| 2712 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2713 | while (count > 0) { |
| 2714 | last_si1 := f_recv_next_si1(0); |
| 2715 | acc := last_si1.rach_control.acc; |
| 2716 | count := f_acc09_count_allowed(acc); |
| 2717 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2718 | } |
| 2719 | |
| 2720 | /* Increase adm subset size, we should see ramping start up */ |
| 2721 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2722 | prev_count := 0; |
| 2723 | while (true) { |
| 2724 | last_si1 := f_recv_next_si1(0); |
| 2725 | acc := last_si1.rach_control.acc; |
| 2726 | count := f_acc09_count_allowed(acc); |
| 2727 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2728 | |
| 2729 | if (prev_count > count) { |
| 2730 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2731 | break; |
| 2732 | } |
| 2733 | |
| 2734 | if (count == 9) { |
| 2735 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2736 | } |
| 2737 | |
| 2738 | prev_count := count; |
| 2739 | } |
| 2740 | |
| 2741 | setverdict(pass); |
| 2742 | |
| 2743 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2744 | "rach access-control-class 4 allowed", |
| 2745 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2746 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2747 | } |
| 2748 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2749 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2750 | var charstring ctrl_resp; |
| 2751 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2752 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2753 | |
| 2754 | /* See https://osmocom.org/issues/2729 */ |
| 2755 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2756 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2757 | } |
| 2758 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2759 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2760 | var charstring ctrl_resp; |
| 2761 | |
| 2762 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2763 | |
| 2764 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2765 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2766 | } |
| 2767 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2768 | testcase TC_ctrl() runs on test_CT { |
| 2769 | var charstring ctrl_resp; |
| 2770 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2771 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2772 | |
| 2773 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2774 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2775 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2776 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2777 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2778 | |
| 2779 | var integer bts_nr := 0; |
| 2780 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2781 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2782 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2783 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2784 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2785 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2786 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2787 | |
| 2788 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2789 | f_sleep(2.0); |
| 2790 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2791 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2792 | } |
| 2793 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2794 | |
| 2795 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2796 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2797 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2798 | } |
| 2799 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2800 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2801 | "location-state" over the SCCPlite IPA conn */ |
| 2802 | testcase TC_ctrl_location() runs on test_CT { |
| 2803 | var MSC_ConnHdlr vc_conn; |
| 2804 | var integer bts_nr := 0; |
| 2805 | |
| 2806 | f_init(1, true); |
| 2807 | f_sleep(1.0); |
| 2808 | |
| 2809 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2810 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2811 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2812 | |
| 2813 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2814 | f_sleep(2.0); |
| 2815 | |
| 2816 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2817 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2818 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2819 | |
| 2820 | /* should match the one from config */ |
| 2821 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2822 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2823 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2824 | } |
| 2825 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2826 | |
| 2827 | /*********************************************************************** |
| 2828 | * Paging Testing |
| 2829 | ***********************************************************************/ |
| 2830 | |
| 2831 | type record Cell_Identity { |
| 2832 | GsmMcc mcc, |
| 2833 | GsmMnc mnc, |
| 2834 | GsmLac lac, |
| 2835 | GsmCellId ci |
| 2836 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2837 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2838 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2839 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2840 | type set of integer BtsIdList; |
| 2841 | |
| 2842 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2843 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2844 | if (bts_id == bts_ids[j]) { |
| 2845 | return true; |
| 2846 | } |
| 2847 | } |
| 2848 | return false; |
| 2849 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2850 | |
| 2851 | /* core paging test helper function; used by most paging test cases */ |
| 2852 | private function f_pageing_helper(hexstring imsi, |
| 2853 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2854 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2855 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2856 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2857 | { |
| 2858 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2859 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2860 | var RSL_Message rx_rsl; |
| 2861 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2862 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2863 | |
| 2864 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2865 | |
| 2866 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2867 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2868 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2869 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2870 | |
| 2871 | if (isvalue(rsl_chneed)) { |
| 2872 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2873 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2874 | } else { |
| 2875 | bssmap_chneed := omit; |
| 2876 | } |
| 2877 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2878 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2879 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2880 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2881 | if (not istemplatekind(tmsi, "omit")) { |
| 2882 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2883 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2884 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2885 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2886 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2887 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2888 | 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] | 2889 | /* check channel type, paging group */ |
| 2890 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2891 | setverdict(fail, "Paging for wrong paging group"); |
| 2892 | } |
| 2893 | if (ispresent(rsl_chneed) and |
| 2894 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2895 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2896 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2897 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2898 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2899 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2900 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2901 | timer T := 0.1; |
| 2902 | if (f_bts_in_list(i, bts_ids)) { |
| 2903 | continue; |
| 2904 | } |
| 2905 | T.start; |
| 2906 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2907 | [] 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] | 2908 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2909 | } |
| 2910 | [] IPA_RSL[i].receive { repeat; } |
| 2911 | [] T.timeout { } |
| 2912 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2913 | } |
| 2914 | |
| 2915 | setverdict(pass); |
| 2916 | } |
| 2917 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2918 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2919 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2920 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2921 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2922 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2923 | /* PAGING by IMSI + TMSI */ |
| 2924 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2925 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2926 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2927 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2928 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2929 | } |
| 2930 | |
| 2931 | /* PAGING by IMSI + TMSI */ |
| 2932 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2933 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2934 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2935 | 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] | 2936 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2937 | } |
| 2938 | |
| 2939 | /* Paging with different "channel needed' values */ |
| 2940 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2941 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2942 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2943 | 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] | 2944 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2945 | } |
| 2946 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2947 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2948 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2949 | 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] | 2950 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2951 | } |
| 2952 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2953 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2954 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2955 | 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] | 2956 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2957 | } |
| 2958 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2959 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2960 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2961 | 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] | 2962 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2963 | } |
| 2964 | |
| 2965 | /* Paging by CGI */ |
| 2966 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2967 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2968 | 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] | 2969 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2970 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2971 | } |
| 2972 | |
| 2973 | /* Paging by LAC+CI */ |
| 2974 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2975 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2976 | 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] | 2977 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2978 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2979 | } |
| 2980 | |
| 2981 | /* Paging by CI */ |
| 2982 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2983 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2984 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2985 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2986 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2987 | } |
| 2988 | |
| 2989 | /* Paging by LAI */ |
| 2990 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2991 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2992 | 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] | 2993 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2994 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2995 | } |
| 2996 | |
| 2997 | /* Paging by LAC */ |
| 2998 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2999 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3000 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3001 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3002 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3003 | } |
| 3004 | |
| 3005 | /* Paging by "all in BSS" */ |
| 3006 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 3007 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3008 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3009 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3010 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3011 | } |
| 3012 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3013 | /* 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] | 3014 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 3015 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3016 | 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] | 3017 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3018 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3019 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3020 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3021 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3022 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 3023 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3024 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3025 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3026 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3027 | } |
| 3028 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3029 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3030 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 3031 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3032 | 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] | 3033 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3034 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3035 | } |
| 3036 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3037 | /* 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] | 3038 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 3039 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3040 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 3041 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3042 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3043 | } |
| 3044 | |
| 3045 | /* Paging on empty list: Verify none of them page */ |
| 3046 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3047 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3048 | cid_list := { cIl_LAC := { } }; |
| 3049 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3050 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3051 | } |
| 3052 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3053 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3054 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3055 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3056 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3057 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3058 | f_shutdown_helper(); |
| 3059 | } |
| 3060 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3061 | /* Verify paging retransmission interval + count */ |
| 3062 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3063 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3064 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3065 | /* Verify PCH load */ |
| 3066 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3067 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3068 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3069 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3070 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3071 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3072 | |
| 3073 | /* tell BSC there is no paging space anymore */ |
| 3074 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3075 | f_sleep(0.2); |
| 3076 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3077 | |
| 3078 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3079 | * there would be 8 retransmissions during 4 seconds */ |
| 3080 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3081 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3082 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3083 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3084 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3085 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3086 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3087 | [] T_retrans.timeout { |
| 3088 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3089 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3090 | T_retrans.start; |
| 3091 | repeat; |
| 3092 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3093 | [] T.timeout { |
| 3094 | setverdict(pass); |
| 3095 | } |
| 3096 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3097 | |
| 3098 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3099 | } |
| 3100 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3101 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3102 | testcase TC_paging_counter() runs on test_CT { |
| 3103 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3104 | timer T := 4.0; |
| 3105 | var integer i; |
| 3106 | var integer paging_attempted_bsc; |
| 3107 | var integer paging_attempted_bts[NUM_BTS]; |
| 3108 | var integer paging_expired_bts[NUM_BTS]; |
| 3109 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3110 | |
| 3111 | f_init(); |
| 3112 | |
| 3113 | /* read counters before paging */ |
| 3114 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 3115 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3116 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3117 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3118 | } |
| 3119 | |
| 3120 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3121 | |
| 3122 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3123 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3124 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3125 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3126 | paging_attempted_bts[i]+1); |
| 3127 | } |
| 3128 | |
| 3129 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3130 | f_sleep(12.0); |
| 3131 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3132 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3133 | paging_expired_bts[i]+1); |
| 3134 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3135 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3136 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3137 | } |
| 3138 | |
| 3139 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3140 | /* Verify paging stops after A-RESET */ |
| 3141 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3142 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3143 | timer T := 3.0; |
| 3144 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3145 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3146 | |
| 3147 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3148 | 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] | 3149 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3150 | [] 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] | 3151 | [] BSSAP.receive { repeat; } |
| 3152 | } |
| 3153 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3154 | /* Wait to avoid a possible race condition if a paging message is |
| 3155 | * received right before the reset ACK. */ |
| 3156 | f_sleep(0.2); |
| 3157 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3158 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3159 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3160 | IPA_RSL[i].clear; |
| 3161 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3162 | |
| 3163 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3164 | T.start; |
| 3165 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3166 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3167 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3168 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3169 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3170 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3171 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3172 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3173 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3174 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3175 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3176 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3177 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3178 | [] T.timeout { |
| 3179 | setverdict(pass); |
| 3180 | } |
| 3181 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3182 | |
| 3183 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3184 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3185 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3186 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3187 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3188 | * pick the first configured MSC. This behavior is required in order to make |
| 3189 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3190 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3191 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3192 | */ |
| 3193 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3194 | |
| 3195 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3196 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3197 | |
| 3198 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3199 | var DchanTuple dt; |
| 3200 | 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] | 3201 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3202 | |
| 3203 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3204 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3205 | |
| 3206 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3207 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3208 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3209 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3210 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3211 | T.start; |
| 3212 | alt { |
| 3213 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3214 | setverdict(pass); |
| 3215 | } |
| 3216 | [] BSSAP.receive { |
| 3217 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3218 | } |
| 3219 | [] T.timeout { |
| 3220 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3221 | } |
| 3222 | } |
| 3223 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3224 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3225 | } |
| 3226 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3227 | /* Test RSL link drop causes counter increment */ |
| 3228 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3229 | var integer rsl_fail; |
| 3230 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3231 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3232 | |
| 3233 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3234 | |
| 3235 | bts[0].rsl.vc_IPA.stop; |
| 3236 | |
| 3237 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3238 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3239 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3240 | } |
| 3241 | |
| 3242 | /* TODO: Test OML link drop causes counter increment */ |
| 3243 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3244 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3245 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3246 | timer T := 10.0; |
| 3247 | |
| 3248 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3249 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3250 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3251 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3252 | 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] | 3253 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3254 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3255 | |
| 3256 | f_init_mgcp("VirtMSC"); |
| 3257 | |
| 3258 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3259 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3260 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3261 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3262 | |
| 3263 | /* wait for IPA OML link to connect and then disconnect */ |
| 3264 | T.start; |
| 3265 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3266 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3267 | T.stop; |
| 3268 | return true; |
| 3269 | } |
| 3270 | [] IPA_RSL[0].receive { repeat } |
| 3271 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3272 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3273 | } |
| 3274 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3275 | return false; |
| 3276 | } |
| 3277 | |
| 3278 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3279 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3280 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3281 | setverdict(pass); |
| 3282 | } else { |
| 3283 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3284 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3285 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3286 | } |
| 3287 | |
| 3288 | |
| 3289 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3290 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3291 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3292 | setverdict(pass); |
| 3293 | } else { |
| 3294 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3295 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3296 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3297 | } |
| 3298 | |
| 3299 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3300 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3301 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3302 | ***********************************************************************/ |
| 3303 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3304 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3305 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3306 | import from RSL_Emulation all; |
| 3307 | import from MSC_ConnectionHandler all; |
| 3308 | |
| 3309 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3310 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3311 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3312 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3313 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3314 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3315 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3316 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3317 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3318 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3319 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3320 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3321 | if (isvalue(bts[2])) { |
| 3322 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3323 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3324 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3325 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3326 | if (mp_enable_lcs_tests) { |
| 3327 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3328 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3329 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3330 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3331 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3332 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3333 | } |
| 3334 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3335 | function f_start_handler_create(template (omit) TestHdlrParams pars := omit) |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3336 | runs on test_CT return MSC_ConnHdlr { |
| 3337 | var charstring id := testcasename(); |
| 3338 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3339 | var integer bssap_idx := 0; |
| 3340 | if (isvalue(pars)) { |
| 3341 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3342 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3343 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3344 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3345 | return vc_conn; |
| 3346 | } |
| 3347 | |
| 3348 | function f_start_handler_run(MSC_ConnHdlr vc_conn, void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3349 | runs on test_CT return MSC_ConnHdlr { |
| 3350 | var charstring id := testcasename(); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3351 | /* Emit a marker to appear in the SUT's own logging output */ |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3352 | f_logp(BSCVTY, id & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3353 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3354 | return vc_conn; |
| 3355 | } |
| 3356 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3357 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3358 | runs on test_CT return MSC_ConnHdlr { |
| 3359 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 3360 | } |
| 3361 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3362 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3363 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3364 | runs on MSC_ConnHdlr { |
| 3365 | if (isvalue(pars)) { |
| 3366 | g_pars := valueof(pars); |
| 3367 | } |
| 3368 | fn.apply(id); |
| 3369 | } |
| 3370 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3371 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 3372 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 3373 | f_vty_transceive(BSCVTY, "network"); |
| 3374 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 3375 | f_vty_transceive(BSCVTY, "exit"); |
| 3376 | f_vty_transceive(BSCVTY, "exit"); |
| 3377 | } |
| 3378 | |
| 3379 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 3380 | /* keep in sync with docker-playground.git ttcn3-bsc-test/osmo-bsc.cfg */ |
| 3381 | f_vty_encryption_a5("0 1 3"); |
| 3382 | } |
| 3383 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3384 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3385 | 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] | 3386 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3387 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3388 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3389 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3390 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3391 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3392 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3393 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3394 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3395 | } |
| 3396 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3397 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3398 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3399 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3400 | |
| 3401 | f_init(1, true); |
| 3402 | f_sleep(1.0); |
| 3403 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3404 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3405 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3406 | } |
| 3407 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3408 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3409 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3410 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3411 | |
| 3412 | f_init(1, true); |
| 3413 | f_sleep(1.0); |
| 3414 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3415 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3416 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3417 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 3418 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 3419 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 3420 | var MSC_ConnHdlr vc_conn; |
| 3421 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3422 | |
| 3423 | pars.encr := valueof(t_EncrParams('05'O, f_rnd_octstring(8))); /* A5/0 and A5/2 (0x01|0x04)*/ |
| 3424 | pars.encr_exp_enc_alg := '04'O; /* A5/2 */ |
| 3425 | |
| 3426 | f_init(1, true); |
| 3427 | f_vty_encryption_a5("0 1 2 3"); |
| 3428 | f_sleep(1.0); |
| 3429 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3430 | vc_conn.done; |
| 3431 | f_vty_encryption_a5_reset(); |
| 3432 | f_shutdown_helper(); |
| 3433 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 3434 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 3435 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 3436 | var MSC_ConnHdlr vc_conn; |
| 3437 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3438 | |
| 3439 | pars.encr := valueof(t_EncrParams('06'O, f_rnd_octstring(8))); /* A5/1 and A5/2 (0x02|0x04)*/ |
| 3440 | pars.encr_exp_enc_alg := '02'O; /* A5/1 */ |
| 3441 | |
| 3442 | f_init(1, true); |
| 3443 | f_vty_encryption_a5("1 2"); |
| 3444 | f_sleep(1.0); |
| 3445 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3446 | vc_conn.done; |
| 3447 | f_vty_encryption_a5_reset(); |
| 3448 | f_shutdown_helper(); |
| 3449 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3450 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3451 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3452 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3453 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3454 | |
| 3455 | f_init(1, true); |
| 3456 | f_sleep(1.0); |
| 3457 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3458 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3459 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3460 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3461 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 3462 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 3463 | var MSC_ConnHdlr vc_conn; |
| 3464 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3465 | 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] | 3466 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3467 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3468 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3469 | f_sleep(1.0); |
| 3470 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3471 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3472 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3473 | f_shutdown_helper(); |
| 3474 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3475 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3476 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3477 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3478 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3479 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3480 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3481 | |
| 3482 | f_establish_fully(ass_cmd, exp_compl); |
| 3483 | } |
| 3484 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3485 | var MSC_ConnHdlr vc_conn; |
| 3486 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3487 | |
| 3488 | f_init(1, true); |
| 3489 | f_sleep(1.0); |
| 3490 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3491 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3492 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3493 | } |
| 3494 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3495 | |
| 3496 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3497 | 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] | 3498 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3499 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3500 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3501 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3502 | 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] | 3503 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3504 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3505 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3506 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3507 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3508 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3509 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3510 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3511 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3512 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3513 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3514 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3515 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3516 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3517 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3518 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3519 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3520 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3521 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3522 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3523 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3524 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3525 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3526 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3527 | } |
| 3528 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3529 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3530 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3531 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3532 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3533 | f_init(1, true); |
| 3534 | f_sleep(1.0); |
| 3535 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3536 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3537 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3538 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3539 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 3540 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3541 | var MSC_ConnHdlr vc_conn; |
| 3542 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3543 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 3544 | |
| 3545 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3546 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3547 | f_sleep(1.0); |
| 3548 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3549 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3550 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3551 | f_shutdown_helper(); |
| 3552 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3553 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 3554 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 3555 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 3556 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3557 | var MSC_ConnHdlr vc_conn; |
| 3558 | |
| 3559 | f_init(1, true); |
| 3560 | f_sleep(1.0); |
| 3561 | |
| 3562 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 3563 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 3564 | vc_conn.done; |
| 3565 | f_shutdown_helper(); |
| 3566 | } |
| 3567 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3568 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3569 | 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] | 3570 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3571 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3572 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3573 | |
| 3574 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3575 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3576 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3577 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3578 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3579 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3580 | var MSC_ConnHdlr vc_conn; |
| 3581 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3582 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3583 | f_sleep(1.0); |
| 3584 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3585 | 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] | 3586 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3587 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3588 | } |
| 3589 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3590 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 3591 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 3592 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3593 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3594 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3595 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3596 | |
| 3597 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 3598 | |
| 3599 | var BSSMAP_FIELD_CodecType codecType; |
| 3600 | timer T := 10.0; |
| 3601 | |
| 3602 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 3603 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 3604 | |
| 3605 | f_create_chan_and_exp(); |
| 3606 | /* we should now have a COMPL_L3 at the MSC */ |
| 3607 | |
| 3608 | var template PDU_BSSAP exp_l3_compl; |
| 3609 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 3610 | if (g_pars.aoip == false) { |
| 3611 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 3612 | } else { |
| 3613 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 3614 | } |
| 3615 | T.start; |
| 3616 | alt { |
| 3617 | [] BSSAP.receive(exp_l3_compl); |
| 3618 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 3619 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 3620 | } |
| 3621 | [] T.timeout { |
| 3622 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 3623 | } |
| 3624 | } |
| 3625 | |
| 3626 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 3627 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3628 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3629 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 3630 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3631 | var MSC_ConnHdlr vc_conn; |
| 3632 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3633 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3634 | f_sleep(1.0); |
| 3635 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 3636 | 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] | 3637 | 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] | 3638 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3639 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3640 | } |
| 3641 | |
| 3642 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3643 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3644 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3645 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3646 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3647 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3648 | |
| 3649 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3650 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3651 | |
| 3652 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3653 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3654 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3655 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3656 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3657 | }; |
| 3658 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3659 | } |
| 3660 | |
| 3661 | testcase TC_assignment_sign() runs on test_CT { |
| 3662 | var MSC_ConnHdlr vc_conn; |
| 3663 | |
| 3664 | f_init(1, true); |
| 3665 | f_sleep(1.0); |
| 3666 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3667 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3668 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3669 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3670 | } |
| 3671 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3672 | /*********************************************************************** |
| 3673 | * Codec (list) testing |
| 3674 | ***********************************************************************/ |
| 3675 | |
| 3676 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3677 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3678 | return boolean { |
| 3679 | select (a_elem.codecType) { |
| 3680 | case (GSM_FR) { |
| 3681 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3682 | return true; |
| 3683 | } |
| 3684 | } |
| 3685 | case (GSM_HR) { |
| 3686 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3687 | return true; |
| 3688 | } |
| 3689 | } |
| 3690 | case (GSM_EFR) { |
| 3691 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3692 | return true; |
| 3693 | } |
| 3694 | } |
| 3695 | case (FR_AMR) { |
| 3696 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3697 | return true; |
| 3698 | } |
| 3699 | } |
| 3700 | case (HR_AMR) { |
| 3701 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3702 | return true; |
| 3703 | } |
| 3704 | } |
| 3705 | case else { } |
| 3706 | } |
| 3707 | return false; |
| 3708 | } |
| 3709 | |
| 3710 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3711 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3712 | return boolean { |
| 3713 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3714 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3715 | return true; |
| 3716 | } |
| 3717 | } |
| 3718 | return false; |
| 3719 | } |
| 3720 | |
| 3721 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3722 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3723 | return BSSMAP_IE_ChannelType { |
| 3724 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3725 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3726 | select (a_elem.codecType) { |
| 3727 | case (GSM_FR) { |
| 3728 | ret.channelRateAndType := ChRate_TCHF; |
| 3729 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3730 | } |
| 3731 | case (GSM_HR) { |
| 3732 | ret.channelRateAndType := ChRate_TCHH; |
| 3733 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3734 | } |
| 3735 | case (GSM_EFR) { |
| 3736 | ret.channelRateAndType := ChRate_TCHF; |
| 3737 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3738 | } |
| 3739 | case (FR_AMR) { |
| 3740 | ret.channelRateAndType := ChRate_TCHF; |
| 3741 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3742 | } |
| 3743 | case (HR_AMR) { |
| 3744 | ret.channelRateAndType := ChRate_TCHH; |
| 3745 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3746 | } |
| 3747 | case else { |
| 3748 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3749 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3750 | } |
| 3751 | } |
| 3752 | return ret; |
| 3753 | } |
| 3754 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3755 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3756 | return template RSL_IE_Body { |
| 3757 | var template RSL_IE_Body mode_ie := { |
| 3758 | chan_mode := { |
| 3759 | len := ?, |
| 3760 | reserved := ?, |
| 3761 | dtx_d := ?, |
| 3762 | dtx_u := ?, |
| 3763 | spd_ind := RSL_SPDI_SPEECH, |
| 3764 | ch_rate_type := -, |
| 3765 | coding_alg_rate := - |
| 3766 | } |
| 3767 | } |
| 3768 | |
| 3769 | select (a_elem.codecType) { |
| 3770 | case (GSM_FR) { |
| 3771 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3772 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3773 | } |
| 3774 | case (GSM_HR) { |
| 3775 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3776 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3777 | } |
| 3778 | case (GSM_EFR) { |
| 3779 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3780 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3781 | } |
| 3782 | case (FR_AMR) { |
| 3783 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3784 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3785 | } |
| 3786 | case (HR_AMR) { |
| 3787 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3788 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3789 | } |
| 3790 | } |
| 3791 | return mode_ie; |
| 3792 | } |
| 3793 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3794 | type record CodecListTest { |
| 3795 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3796 | charstring id |
| 3797 | } |
| 3798 | type record of CodecListTest CodecListTests |
| 3799 | |
| 3800 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 3801 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3802 | 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] | 3803 | |
| 3804 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3805 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3806 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3807 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3808 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3809 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3810 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3811 | g_pars.expect_mr_s0_s7; |
| 3812 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3813 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3814 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3815 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3816 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3817 | |
| 3818 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3819 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3820 | if (not g_pars.expect_channel_mode_modify) { |
| 3821 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3822 | 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] | 3823 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3824 | var RSL_IE_Body mode_ie; |
| 3825 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3826 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3827 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3828 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3829 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3830 | if (not match(mode_ie, t_mode_ie)) { |
| 3831 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 3832 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3833 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3834 | |
| 3835 | var RSL_IE_Body mr_conf; |
| 3836 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3837 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3838 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 3839 | mtc.stop; |
| 3840 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3841 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3842 | |
| 3843 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3844 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3845 | g_pars.expect_mr_conf_ie); |
| 3846 | } |
| 3847 | } else { |
| 3848 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3849 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3850 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 3851 | mtc.stop; |
| 3852 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3853 | } |
| 3854 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3855 | } |
| 3856 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3857 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3858 | |
| 3859 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3860 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3861 | |
| 3862 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3863 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3864 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3865 | } |
| 3866 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3867 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3868 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3869 | |
| 3870 | f_establish_fully(ass_cmd, exp_fail); |
| 3871 | } |
| 3872 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3873 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3874 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3875 | var MSC_ConnHdlr vc_conn; |
| 3876 | |
| 3877 | f_init(1, true); |
| 3878 | f_sleep(1.0); |
| 3879 | |
| 3880 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3881 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3882 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3883 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3884 | } |
| 3885 | |
| 3886 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3887 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3888 | var MSC_ConnHdlr vc_conn; |
| 3889 | |
| 3890 | f_init(1, true); |
| 3891 | f_sleep(1.0); |
| 3892 | |
| 3893 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3894 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3895 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3896 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3897 | } |
| 3898 | |
| 3899 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3900 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3901 | var MSC_ConnHdlr vc_conn; |
| 3902 | |
| 3903 | f_init(1, true); |
| 3904 | f_sleep(1.0); |
| 3905 | |
| 3906 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3907 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3908 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3909 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3910 | } |
| 3911 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3912 | /* Allow 5,90k only (current default config) */ |
| 3913 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3914 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3915 | "amr-config 12_2k forbidden", |
| 3916 | "amr-config 10_2k forbidden", |
| 3917 | "amr-config 7_95k forbidden", |
| 3918 | "amr-config 7_40k forbidden", |
| 3919 | "amr-config 6_70k forbidden", |
| 3920 | "amr-config 5_90k allowed", |
| 3921 | "amr-config 5_15k forbidden", |
| 3922 | "amr-config 4_75k forbidden" |
| 3923 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3924 | } |
| 3925 | |
| 3926 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3927 | * ("Config-NB-Code = 1") */ |
| 3928 | 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] | 3929 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3930 | "amr-config 12_2k allowed", |
| 3931 | "amr-config 10_2k forbidden", |
| 3932 | "amr-config 7_95k forbidden", |
| 3933 | "amr-config 7_40k allowed", |
| 3934 | "amr-config 6_70k forbidden", |
| 3935 | "amr-config 5_90k allowed", |
| 3936 | "amr-config 5_15k forbidden", |
| 3937 | "amr-config 4_75k allowed" |
| 3938 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3939 | } |
| 3940 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3941 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 3942 | var charstring tch; |
| 3943 | if (fr) { |
| 3944 | tch := "tch-f"; |
| 3945 | } else { |
| 3946 | tch := "tch-h"; |
| 3947 | } |
| 3948 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 3949 | } |
| 3950 | |
| 3951 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 3952 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 3953 | f_vty_amr_start_mode_set(fr, "auto"); |
| 3954 | } |
| 3955 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3956 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3957 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3958 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3959 | |
| 3960 | /* Note: This setups the codec configuration. The parameter payload in |
| 3961 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3962 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3963 | var RSL_IE_Body mr_conf := { |
| 3964 | other := { |
| 3965 | len := 2, |
| 3966 | payload := '2804'O |
| 3967 | } |
| 3968 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3969 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3970 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3971 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3972 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3973 | pars.expect_mr_conf_ie := mr_conf; |
| 3974 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3975 | f_init(1, true); |
| 3976 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3977 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3978 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3979 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3980 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3981 | |
| 3982 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3983 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3984 | } |
| 3985 | |
| 3986 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3987 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3988 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3989 | |
| 3990 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3991 | var RSL_IE_Body mr_conf := { |
| 3992 | other := { |
| 3993 | len := 2, |
| 3994 | payload := '2804'O |
| 3995 | } |
| 3996 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3997 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3998 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3999 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4000 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4001 | pars.expect_mr_conf_ie := mr_conf; |
| 4002 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4003 | f_init(1, true); |
| 4004 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4005 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4006 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4007 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4008 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4009 | |
| 4010 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4011 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4012 | } |
| 4013 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4014 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 4015 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 4016 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4017 | var MSC_ConnHdlr vc_conn; |
| 4018 | |
| 4019 | f_init(1, true); |
| 4020 | f_sleep(1.0); |
| 4021 | |
| 4022 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 4023 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 4024 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 4025 | f_disable_all_sdcch(); |
| 4026 | f_disable_all_tch_h(); |
| 4027 | |
| 4028 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4029 | pars.expect_channel_mode_modify := true; |
| 4030 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4031 | vc_conn.done; |
| 4032 | |
| 4033 | f_enable_all_sdcch(); |
| 4034 | f_enable_all_tch(); |
| 4035 | f_shutdown_helper(); |
| 4036 | } |
| 4037 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4038 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 4039 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 4040 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4041 | var MSC_ConnHdlr vc_conn; |
| 4042 | |
| 4043 | var RSL_IE_Body mr_conf := { |
| 4044 | other := { |
| 4045 | len := 2, |
| 4046 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 4047 | } |
| 4048 | }; |
| 4049 | |
| 4050 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4051 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4052 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4053 | pars.expect_mr_conf_ie := mr_conf; |
| 4054 | |
| 4055 | f_init(1, true); |
| 4056 | f_sleep(1.0); |
| 4057 | |
| 4058 | /* First set nonzero start mode bits */ |
| 4059 | f_vty_amr_start_mode_set(true, "4"); |
| 4060 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4061 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4062 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4063 | f_vty_amr_start_mode_set(true, "auto"); |
| 4064 | |
| 4065 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4066 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4067 | |
| 4068 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4069 | f_vty_amr_start_mode_set(true, "1"); |
| 4070 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4071 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4072 | } |
| 4073 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4074 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 4075 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4076 | runs on test_CT { |
| 4077 | |
| 4078 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4079 | var MSC_ConnHdlr vc_conn; |
| 4080 | |
| 4081 | /* See note above */ |
| 4082 | var RSL_IE_Body mr_conf := { |
| 4083 | other := { |
| 4084 | len := lengthof(mrconf), |
| 4085 | payload := mrconf |
| 4086 | } |
| 4087 | }; |
| 4088 | |
| 4089 | if (fr) { |
| 4090 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4091 | } else { |
| 4092 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4093 | } |
| 4094 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4095 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4096 | pars.expect_mr_conf_ie := mr_conf; |
| 4097 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4098 | |
| 4099 | f_init(1, true); |
| 4100 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4101 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4102 | f_sleep(1.0); |
| 4103 | |
| 4104 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4105 | vc_conn.done; |
| 4106 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4107 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4108 | } |
| 4109 | |
| 4110 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4111 | runs on test_CT { |
| 4112 | |
| 4113 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4114 | var MSC_ConnHdlr vc_conn; |
| 4115 | |
| 4116 | if (fr) { |
| 4117 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4118 | } else { |
| 4119 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4120 | } |
| 4121 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4122 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4123 | |
| 4124 | f_init(1, true); |
| 4125 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4126 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4127 | f_sleep(1.0); |
| 4128 | |
| 4129 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4130 | vc_conn.done; |
| 4131 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4132 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4133 | } |
| 4134 | |
| 4135 | |
| 4136 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4137 | * set. */ |
| 4138 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4139 | 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] | 4140 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4141 | } |
| 4142 | |
| 4143 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4144 | * rates set. */ |
| 4145 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4146 | 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] | 4147 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4148 | } |
| 4149 | |
| 4150 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4151 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4152 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4153 | 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] | 4154 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4155 | } |
| 4156 | |
| 4157 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4158 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4159 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4160 | 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] | 4161 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4162 | } |
| 4163 | |
| 4164 | /* The following block of tests selects more and more rates until all four |
| 4165 | * possible rates are in the active set (full rate) */ |
| 4166 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4167 | 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] | 4168 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4169 | } |
| 4170 | |
| 4171 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4172 | 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] | 4173 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4174 | } |
| 4175 | |
| 4176 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4177 | 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] | 4178 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4179 | } |
| 4180 | |
| 4181 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4182 | 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] | 4183 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4184 | } |
| 4185 | |
| 4186 | /* The following block of tests selects more and more rates until all three |
| 4187 | * possible rates are in the active set (half rate) */ |
| 4188 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4189 | 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] | 4190 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4191 | } |
| 4192 | |
| 4193 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4194 | 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] | 4195 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4196 | } |
| 4197 | |
| 4198 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4199 | 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] | 4200 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4201 | } |
| 4202 | |
| 4203 | /* The following block tests what happens when the MSC does offer rate |
| 4204 | * configurations that are not supported by the BSC. Normally such situations |
| 4205 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4206 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4207 | * to offer rates that are not applicable anyway. */ |
| 4208 | |
| 4209 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4210 | /* Try to include 12,2k in into the active set even though the channel |
| 4211 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4212 | 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] | 4213 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4214 | } |
| 4215 | |
| 4216 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4217 | /* See what happens when all rates are selected at once. Since then |
| 4218 | * Also S1 is selected, this setting will be prefered and we should |
| 4219 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4220 | 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] | 4221 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4222 | } |
| 4223 | |
| 4224 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4225 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4226 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4227 | * 5,90k, and 4,75k, into the active set. */ |
| 4228 | 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] | 4229 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4230 | } |
| 4231 | |
| 4232 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4233 | /* Try to select no rates at all */ |
| 4234 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4235 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4236 | } |
| 4237 | |
| 4238 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4239 | /* Try to select only unsupported rates */ |
| 4240 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4241 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4242 | } |
| 4243 | |
| 4244 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4245 | /* Try to select 12,2k for half rate */ |
| 4246 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4247 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4248 | } |
| 4249 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4250 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4251 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4252 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4253 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4254 | } |
| 4255 | |
| 4256 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4257 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4258 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4259 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4260 | } |
| 4261 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4262 | 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] | 4263 | /* "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] | 4264 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4265 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4266 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4267 | } |
| 4268 | |
| 4269 | 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] | 4270 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4271 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4272 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4273 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4274 | } |
| 4275 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4276 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4277 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4278 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4279 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4280 | 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] | 4281 | } |
| 4282 | |
| 4283 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4284 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4285 | 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] | 4286 | } |
| 4287 | |
| 4288 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4289 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4290 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4291 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4292 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4293 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4294 | 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] | 4295 | } |
| 4296 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4297 | private function f_disable_all_sdcch() runs on test_CT { |
| 4298 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4299 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4300 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4301 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4302 | } |
| 4303 | |
| 4304 | private function f_enable_all_sdcch() runs on test_CT { |
| 4305 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4306 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4307 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4308 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4309 | } |
| 4310 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4311 | /* Allow HR only */ |
| 4312 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4313 | g_pars := f_gen_test_hdlr_pars(); |
| 4314 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4315 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4316 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4317 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4318 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4319 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4320 | f_establish_fully(ass_cmd, exp_compl); |
| 4321 | } |
| 4322 | |
| 4323 | /* Allow FR only */ |
| 4324 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4325 | g_pars := f_gen_test_hdlr_pars(); |
| 4326 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4327 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4328 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4329 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4330 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4331 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4332 | f_establish_fully(ass_cmd, exp_compl); |
| 4333 | } |
| 4334 | |
| 4335 | /* Allow HR only (expect assignment failure) */ |
| 4336 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4337 | g_pars := f_gen_test_hdlr_pars(); |
| 4338 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4339 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4340 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4341 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4342 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4343 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4344 | f_establish_fully(ass_cmd, exp_fail); |
| 4345 | } |
| 4346 | |
| 4347 | /* Allow FR only (expect assignment failure) */ |
| 4348 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4349 | g_pars := f_gen_test_hdlr_pars(); |
| 4350 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4351 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4352 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4353 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4354 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4355 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4356 | f_establish_fully(ass_cmd, exp_fail); |
| 4357 | } |
| 4358 | |
| 4359 | /* Allow FR and HR, but prefer FR */ |
| 4360 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4361 | g_pars := f_gen_test_hdlr_pars(); |
| 4362 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4363 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4364 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4365 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4366 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4367 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4368 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4369 | f_establish_fully(ass_cmd, exp_compl); |
| 4370 | } |
| 4371 | |
| 4372 | /* Allow FR and HR, but prefer HR */ |
| 4373 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4374 | g_pars := f_gen_test_hdlr_pars(); |
| 4375 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4376 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4377 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4378 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4379 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4380 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4381 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4382 | f_establish_fully(ass_cmd, exp_compl); |
| 4383 | } |
| 4384 | |
| 4385 | /* Allow FR and HR, but prefer FR */ |
| 4386 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4387 | g_pars := f_gen_test_hdlr_pars(); |
| 4388 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4389 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4390 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4391 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4392 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4393 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4394 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4395 | f_establish_fully(ass_cmd, exp_compl); |
| 4396 | } |
| 4397 | |
| 4398 | /* Allow FR and HR, but prefer HR */ |
| 4399 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4400 | g_pars := f_gen_test_hdlr_pars(); |
| 4401 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4402 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4403 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4404 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4405 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4406 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4407 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4408 | f_establish_fully(ass_cmd, exp_compl); |
| 4409 | } |
| 4410 | |
| 4411 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4412 | * to work without conflicts */ |
| 4413 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4414 | var MSC_ConnHdlr vc_conn; |
| 4415 | f_init(1, true); |
| 4416 | f_sleep(1.0); |
| 4417 | f_enable_all_tch(); |
| 4418 | f_disable_all_tch_f(); |
| 4419 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4420 | vc_conn.done; |
| 4421 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4422 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4423 | } |
| 4424 | |
| 4425 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4426 | * to fail. */ |
| 4427 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4428 | var MSC_ConnHdlr vc_conn; |
| 4429 | f_init(1, true); |
| 4430 | f_sleep(1.0); |
| 4431 | f_enable_all_tch(); |
| 4432 | f_disable_all_tch_f(); |
| 4433 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4434 | vc_conn.done; |
| 4435 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4436 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4437 | } |
| 4438 | |
| 4439 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4440 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4441 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4442 | var MSC_ConnHdlr vc_conn; |
| 4443 | f_init(1, true); |
| 4444 | f_sleep(1.0); |
| 4445 | f_enable_all_tch(); |
| 4446 | f_disable_all_tch_f(); |
| 4447 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4448 | vc_conn.done; |
| 4449 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4450 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4451 | } |
| 4452 | |
| 4453 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4454 | * are exhausted, this is expected to work without conflicts. */ |
| 4455 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4456 | var MSC_ConnHdlr vc_conn; |
| 4457 | f_init(1, true); |
| 4458 | f_sleep(1.0); |
| 4459 | f_enable_all_tch(); |
| 4460 | f_disable_all_tch_f(); |
| 4461 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4462 | vc_conn.done; |
| 4463 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4464 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4465 | } |
| 4466 | |
| 4467 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4468 | * to work without conflicts */ |
| 4469 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4470 | var MSC_ConnHdlr vc_conn; |
| 4471 | f_init(1, true); |
| 4472 | f_sleep(1.0); |
| 4473 | f_enable_all_tch(); |
| 4474 | f_disable_all_tch_h(); |
| 4475 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4476 | vc_conn.done; |
| 4477 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4478 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4479 | } |
| 4480 | |
| 4481 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4482 | * to fail. */ |
| 4483 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4484 | var MSC_ConnHdlr vc_conn; |
| 4485 | f_init(1, true); |
| 4486 | f_sleep(1.0); |
| 4487 | f_enable_all_tch(); |
| 4488 | f_disable_all_tch_h(); |
| 4489 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4490 | vc_conn.done; |
| 4491 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4492 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4493 | } |
| 4494 | |
| 4495 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4496 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4497 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4498 | var MSC_ConnHdlr vc_conn; |
| 4499 | f_init(1, true); |
| 4500 | f_sleep(1.0); |
| 4501 | f_enable_all_tch(); |
| 4502 | f_disable_all_tch_h(); |
| 4503 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4504 | vc_conn.done; |
| 4505 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4506 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4507 | } |
| 4508 | |
| 4509 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4510 | * are exhausted, this is expected to work without conflicts. */ |
| 4511 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4512 | var MSC_ConnHdlr vc_conn; |
| 4513 | f_init(1, true); |
| 4514 | f_sleep(1.0); |
| 4515 | f_enable_all_tch(); |
| 4516 | f_disable_all_tch_h(); |
| 4517 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4518 | vc_conn.done; |
| 4519 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4520 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4521 | } |
| 4522 | |
| 4523 | /* Allow FR and HR, but prefer HR */ |
| 4524 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4525 | g_pars := f_gen_test_hdlr_pars(); |
| 4526 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4527 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4528 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4529 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4530 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4531 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4532 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4533 | f_establish_fully(ass_cmd, exp_compl); |
| 4534 | } |
| 4535 | |
| 4536 | /* Allow FR and HR, but prefer FR */ |
| 4537 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4538 | g_pars := f_gen_test_hdlr_pars(); |
| 4539 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4540 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4541 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4542 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4543 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4544 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4545 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4546 | f_establish_fully(ass_cmd, exp_compl); |
| 4547 | } |
| 4548 | |
| 4549 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4550 | * HR, which is the prefered type, is selected. */ |
| 4551 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4552 | var MSC_ConnHdlr vc_conn; |
| 4553 | f_init(1, true); |
| 4554 | f_sleep(1.0); |
| 4555 | f_enable_all_tch(); |
| 4556 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4557 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4558 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4559 | } |
| 4560 | |
| 4561 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4562 | * FR, which is the prefered type, is selected. */ |
| 4563 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4564 | var MSC_ConnHdlr vc_conn; |
| 4565 | f_init(1, true); |
| 4566 | f_sleep(1.0); |
| 4567 | f_enable_all_tch(); |
| 4568 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4569 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4570 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4571 | } |
| 4572 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 4573 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 4574 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 4575 | g_pars := f_gen_test_hdlr_pars(); |
| 4576 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 4577 | |
| 4578 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4579 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4580 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4581 | var template uint3_t tsc := ?; |
| 4582 | |
| 4583 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4584 | f_create_bssmap_exp(l3_enc); |
| 4585 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4586 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4587 | |
| 4588 | /* we should now have a COMPL_L3 at the MSC */ |
| 4589 | timer T := 10.0; |
| 4590 | T.start; |
| 4591 | alt { |
| 4592 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4593 | [] T.timeout { |
| 4594 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4595 | } |
| 4596 | } |
| 4597 | } |
| 4598 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 4599 | var MSC_ConnHdlr vc_conn; |
| 4600 | f_init(1, true); |
| 4601 | f_sleep(1.0); |
| 4602 | f_disable_all_sdcch(); |
| 4603 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 4604 | vc_conn.done; |
| 4605 | f_enable_all_sdcch(); |
| 4606 | f_shutdown_helper(); |
| 4607 | } |
| 4608 | |
| 4609 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 4610 | expected that no TCH will be selected for signalling and assigment will fail |
| 4611 | because it's dictated by VTY config */ |
| 4612 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 4613 | var RSL_Message rsl_unused, rsl_msg; |
| 4614 | var GsmRrMessage rr; |
| 4615 | f_init(1, false); |
| 4616 | f_sleep(1.0); |
| 4617 | f_vty_allow_tch_for_signalling(false, 0); |
| 4618 | f_disable_all_sdcch(); |
| 4619 | |
| 4620 | /* RA containing reason=LU */ |
| 4621 | f_ipa_tx(0, ts_RSL_CHAN_RQD('02'O, 2342)); |
| 4622 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 4623 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 4624 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 4625 | setverdict(fail, "Expected reject"); |
| 4626 | } |
| 4627 | |
| 4628 | f_vty_allow_tch_for_signalling(true, 0); |
| 4629 | f_enable_all_sdcch(); |
| 4630 | f_shutdown_helper(); |
| 4631 | } |
| 4632 | |
| 4633 | /* Request a voice channel with all SDCCH exhausted, it is |
| 4634 | * expected that TCH channel will be allocated since the VTY option is only |
| 4635 | * aimed at signalling requests */ |
| 4636 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 4637 | g_pars := f_gen_test_hdlr_pars(); |
| 4638 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 4639 | |
| 4640 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4641 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4642 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4643 | var template uint3_t tsc := ?; |
| 4644 | |
| 4645 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4646 | f_create_bssmap_exp(l3_enc); |
| 4647 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4648 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4649 | |
| 4650 | /* we should now have a COMPL_L3 at the MSC */ |
| 4651 | timer T := 10.0; |
| 4652 | T.start; |
| 4653 | alt { |
| 4654 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4655 | [] T.timeout { |
| 4656 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4657 | } |
| 4658 | } |
| 4659 | } |
| 4660 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 4661 | var MSC_ConnHdlr vc_conn; |
| 4662 | f_init(1, true); |
| 4663 | f_sleep(1.0); |
| 4664 | f_vty_allow_tch_for_signalling(false, 0); |
| 4665 | f_disable_all_sdcch(); |
| 4666 | |
| 4667 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 4668 | vc_conn.done; |
| 4669 | |
| 4670 | f_vty_allow_tch_for_signalling(true, 0); |
| 4671 | f_enable_all_sdcch(); |
| 4672 | f_shutdown_helper(); |
| 4673 | } |
| 4674 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4675 | testcase TC_assignment_osmux() runs on test_CT { |
| 4676 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4677 | var MSC_ConnHdlr vc_conn; |
| 4678 | |
| 4679 | /* See note above */ |
| 4680 | var RSL_IE_Body mr_conf := { |
| 4681 | other := { |
| 4682 | len := 2, |
| 4683 | payload := '2804'O |
| 4684 | } |
| 4685 | }; |
| 4686 | |
| 4687 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4688 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4689 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4690 | pars.expect_mr_conf_ie := mr_conf; |
| 4691 | pars.use_osmux := true; |
| 4692 | |
| 4693 | f_init(1, true, true); |
| 4694 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4695 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4696 | |
| 4697 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4698 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4699 | |
| 4700 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4701 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4702 | } |
| 4703 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4704 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4705 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4706 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4707 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4708 | g_pars := f_gen_test_hdlr_pars(); |
| 4709 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4710 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4711 | /* we should now have a COMPL_L3 at the MSC */ |
| 4712 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4713 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4714 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4715 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4716 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4717 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4718 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4719 | setverdict(pass); |
| 4720 | } |
| 4721 | testcase TC_classmark() runs on test_CT { |
| 4722 | var MSC_ConnHdlr vc_conn; |
| 4723 | f_init(1, true); |
| 4724 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4725 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4726 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4727 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4728 | } |
| 4729 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4730 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4731 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4732 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4733 | g_pars := f_gen_test_hdlr_pars(); |
| 4734 | f_MscConnHdlr_init_vty(); |
| 4735 | |
| 4736 | f_create_chan_and_exp(); |
| 4737 | /* we should now have a COMPL_L3 at the MSC */ |
| 4738 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4739 | |
| 4740 | /* Send CommonID */ |
| 4741 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4742 | |
| 4743 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4744 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4745 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4746 | |
| 4747 | setverdict(pass); |
| 4748 | } |
| 4749 | testcase TC_common_id() runs on test_CT { |
| 4750 | var MSC_ConnHdlr vc_conn; |
| 4751 | f_init(1, true); |
| 4752 | f_sleep(1.0); |
| 4753 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4754 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4755 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4756 | } |
| 4757 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4758 | 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] | 4759 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4760 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4761 | /* we should now have a COMPL_L3 at the MSC */ |
| 4762 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4763 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4764 | /* send the single message we want to send */ |
| 4765 | f_rsl_send_l3(l3); |
| 4766 | } |
| 4767 | |
| 4768 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4769 | timer T := sec; |
| 4770 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4771 | T.start; |
| 4772 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4773 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4774 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4775 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4776 | } |
| 4777 | [] T.timeout { |
| 4778 | setverdict(pass); |
| 4779 | } |
| 4780 | } |
| 4781 | } |
| 4782 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4783 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4784 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4785 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4786 | f_bssap_expect_nothing(); |
| 4787 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4788 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4789 | var MSC_ConnHdlr vc_conn; |
| 4790 | f_init(1, true); |
| 4791 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4792 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4793 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4794 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4795 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4796 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4797 | |
| 4798 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4799 | 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] | 4800 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4801 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4802 | } |
| 4803 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4804 | var MSC_ConnHdlr vc_conn; |
| 4805 | f_init(1, true); |
| 4806 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4807 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4808 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4809 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4810 | } |
| 4811 | |
| 4812 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4813 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4814 | 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] | 4815 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4816 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4817 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4818 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4819 | var MSC_ConnHdlr vc_conn; |
| 4820 | f_init(1, true); |
| 4821 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4822 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4823 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4824 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4825 | } |
| 4826 | |
| 4827 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4828 | /* short message from MS should be ignored */ |
| 4829 | 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] | 4830 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4831 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4832 | /* we should now have a COMPL_L3 at the MSC */ |
| 4833 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4834 | |
| 4835 | /* send short message */ |
| 4836 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4837 | f_bssap_expect_nothing(); |
| 4838 | } |
| 4839 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4840 | var MSC_ConnHdlr vc_conn; |
| 4841 | f_init(1, true); |
| 4842 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4843 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4844 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4845 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4846 | } |
| 4847 | |
| 4848 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4849 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4850 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4851 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4852 | timer T := 3.0 |
| 4853 | alt { |
| 4854 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4855 | setverdict(pass); |
| 4856 | } |
| 4857 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4858 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4859 | } |
| 4860 | } |
| 4861 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4862 | var MSC_ConnHdlr vc_conn; |
| 4863 | f_init(1, true); |
| 4864 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4865 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4866 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4867 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4868 | } |
| 4869 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4870 | /*********************************************************************** |
| 4871 | * Handover |
| 4872 | ***********************************************************************/ |
| 4873 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4874 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4875 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4876 | runs on test_CT { |
| 4877 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4878 | " timeslot "&int2str(ts_nr)&" "; |
| 4879 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4880 | } |
| 4881 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4882 | /* 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] | 4883 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4884 | uint8_t bts_nr, uint8_t trx_nr, |
| 4885 | in RslChannelNr chan_nr) |
| 4886 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4887 | /* FIXME: resolve those from component-global state */ |
| 4888 | var integer ts_nr := chan_nr.tn; |
| 4889 | var integer ss_nr; |
| 4890 | if (ischosen(chan_nr.u.ch0)) { |
| 4891 | ss_nr := 0; |
| 4892 | } else if (ischosen(chan_nr.u.lm)) { |
| 4893 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4894 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4895 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4896 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4897 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4898 | } else { |
| 4899 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4900 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4901 | } |
| 4902 | |
| 4903 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4904 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4905 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4906 | } |
| 4907 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4908 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4909 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4910 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4911 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4912 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4913 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4914 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4915 | { |
| 4916 | 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] | 4917 | } |
| 4918 | |
| 4919 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4920 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4921 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4922 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4923 | |
| 4924 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4925 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4926 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4927 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4928 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4929 | |
| 4930 | var HandoverState hs := { |
| 4931 | rr_ho_cmpl_seen := false, |
| 4932 | handover_done := false, |
| 4933 | old_chan_nr := - |
| 4934 | }; |
| 4935 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4936 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4937 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4938 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4939 | |
| 4940 | /* From the MGW perspective, a handover is is characterized by |
| 4941 | * performing one MDCX operation with the MGW. So we expect to see |
| 4942 | * one more MDCX during handover. */ |
| 4943 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4944 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4945 | alt { |
| 4946 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4947 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4948 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4949 | /* Since this is an internal handover we expect the BSC to inform the |
| 4950 | * MSC about the event */ |
| 4951 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4952 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4953 | /* Check the amount of MGCP transactions is still consistant with the |
| 4954 | * test expectation */ |
| 4955 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4956 | |
| 4957 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 4958 | * g_chan_nr to the new lchan that was handed over to. It lives in bts 1, so look it up at RSL1_PROC. */ |
| 4959 | f_verify_encr_info(f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr)); |
| 4960 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4961 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4962 | } |
| 4963 | |
| 4964 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 4965 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4966 | var MSC_ConnHdlr vc_conn; |
| 4967 | f_init(2, true); |
| 4968 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4969 | |
| 4970 | f_ctrs_bsc_and_bts_init(); |
| 4971 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 4972 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4973 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4974 | |
| 4975 | /* from f_establish_fully() */ |
| 4976 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4977 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4978 | /* from handover */ |
| 4979 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4980 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4981 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4982 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4983 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4984 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4985 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4986 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4987 | 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] | 4988 | var MSC_ConnHdlr vc_conn; |
| 4989 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4990 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 4991 | |
| 4992 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4993 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4994 | f_sleep(1.0); |
| 4995 | |
| 4996 | f_ctrs_bsc_and_bts_init(); |
| 4997 | |
| 4998 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 4999 | vc_conn.done; |
| 5000 | |
| 5001 | /* from f_establish_fully() */ |
| 5002 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5003 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5004 | /* from handover */ |
| 5005 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5006 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5007 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5008 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 5009 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5010 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5011 | f_shutdown_helper(); |
| 5012 | } |
| 5013 | |
| 5014 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 5015 | f_tc_ho_int_a5('01'O); |
| 5016 | } |
| 5017 | |
| 5018 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 5019 | f_tc_ho_int_a5('02'O); |
| 5020 | } |
| 5021 | |
| 5022 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 5023 | f_tc_ho_int_a5('08'O); |
| 5024 | } |
| 5025 | |
| 5026 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5027 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5028 | } |
| 5029 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5030 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 5031 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 5032 | g_pars := f_gen_test_hdlr_pars(); |
| 5033 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5034 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5035 | |
| 5036 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5037 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5038 | |
| 5039 | f_establish_fully(ass_cmd, exp_compl); |
| 5040 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 5041 | |
| 5042 | var HandoverState hs := { |
| 5043 | rr_ho_cmpl_seen := false, |
| 5044 | handover_done := false, |
| 5045 | old_chan_nr := - |
| 5046 | }; |
| 5047 | /* issue hand-over command on VTY */ |
| 5048 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 5049 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5050 | f_rslem_suspend(RSL1_PROC); |
| 5051 | |
| 5052 | /* From the MGW perspective, a handover is is characterized by |
| 5053 | * performing one MDCX operation with the MGW. So we expect to see |
| 5054 | * one more MDCX during handover. */ |
| 5055 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5056 | |
| 5057 | var RSL_Message rsl; |
| 5058 | var PDU_ML3_NW_MS l3; |
| 5059 | var RslChannelNr new_chan_nr; |
| 5060 | var GsmArfcn arfcn; |
| 5061 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5062 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5063 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5064 | setverdict(fail, "Expected handoverCommand"); |
| 5065 | mtc.stop; |
| 5066 | } |
| 5067 | } |
| 5068 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5069 | new_chan_nr, arfcn); |
| 5070 | |
| 5071 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5072 | |
| 5073 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5074 | * before performing a hand-over */ |
| 5075 | f_rslem_resume(RSL1_PROC); |
| 5076 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5077 | |
| 5078 | f_sleep(1.0); |
| 5079 | |
| 5080 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5081 | * and the old lchan reports a Radio Link Failure. */ |
| 5082 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5083 | |
| 5084 | var PDU_BSSAP rx_clear_request; |
| 5085 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5086 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5087 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5088 | |
| 5089 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5090 | |
| 5091 | var MgcpCommand mgcp; |
| 5092 | interleave { |
| 5093 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5094 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5095 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5096 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5097 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5098 | } |
| 5099 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5100 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5101 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5102 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5103 | } |
| 5104 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 5105 | } |
| 5106 | |
| 5107 | f_sleep(0.5); |
| 5108 | setverdict(pass); |
| 5109 | } |
| 5110 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5111 | var MSC_ConnHdlr vc_conn; |
| 5112 | f_init(2, true); |
| 5113 | f_sleep(1.0); |
| 5114 | |
| 5115 | f_ctrs_bsc_and_bts_init(); |
| 5116 | |
| 5117 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5118 | vc_conn.done; |
| 5119 | |
| 5120 | /* from f_establish_fully() */ |
| 5121 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5122 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5123 | /* from handover */ |
| 5124 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5125 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5126 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5127 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 5128 | f_ctrs_bsc_and_bts_verify(); |
| 5129 | f_shutdown_helper(); |
| 5130 | } |
| 5131 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5132 | /* 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] | 5133 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5134 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5135 | var template MgcpResponse mgcp_resp; |
| 5136 | var MGCP_RecvFrom mrf; |
| 5137 | var template MgcpMessage msg_resp; |
| 5138 | var template MgcpMessage msg_dlcx := { |
| 5139 | command := tr_DLCX() |
| 5140 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5141 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5142 | if (g_pars.aoip) { |
| 5143 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5144 | log("Got first DLCX: ", mgcp); |
| 5145 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5146 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5147 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5148 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 5149 | log("Got second DLCX: ", mgcp); |
| 5150 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 5151 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5152 | } else { |
| 5153 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 5154 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 5155 | log("Got first DLCX: ", mrf.msg.command); |
| 5156 | msg_resp := { |
| 5157 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 5158 | } |
| 5159 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 5160 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5161 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5162 | } |
| 5163 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5164 | 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] | 5165 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5166 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5167 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5168 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5169 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5170 | |
| 5171 | f_sleep(0.5); |
| 5172 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5173 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5174 | * containing an RR Handover Command coming from the target BSS... */ |
| 5175 | |
| 5176 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5177 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5178 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5179 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5180 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5181 | |
| 5182 | /* expect the Handover Command to go out on RR */ |
| 5183 | var RSL_Message rsl_ho_cmd |
| 5184 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5185 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5186 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5187 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5188 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5189 | setverdict(fail); |
| 5190 | } else { |
| 5191 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5192 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5193 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5194 | setverdict(fail); |
| 5195 | } else { |
| 5196 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5197 | setverdict(pass); |
| 5198 | } |
| 5199 | } |
| 5200 | |
| 5201 | /* When the other BSS has reported a completed handover, this side is |
| 5202 | * torn down. */ |
| 5203 | |
| 5204 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 5205 | var BssmapCause cause := enum2int(cause_val); |
| 5206 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5207 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5208 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5209 | |
| 5210 | interleave { |
| 5211 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 5212 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 5213 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5214 | [] BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5215 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5216 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5217 | } |
| 5218 | |
| 5219 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5220 | g_pars := f_gen_test_hdlr_pars(); |
| 5221 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5222 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5223 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5224 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5225 | f_establish_fully(ass_req, exp_compl); |
| 5226 | |
| 5227 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5228 | } |
| 5229 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 5230 | var MSC_ConnHdlr vc_conn; |
| 5231 | |
| 5232 | f_init(1, true); |
| 5233 | f_sleep(1.0); |
| 5234 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5235 | f_ctrs_bsc_and_bts_init(); |
| 5236 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5237 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 5238 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5239 | |
| 5240 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5241 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5242 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5243 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5244 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5245 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 5246 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5247 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5248 | } |
| 5249 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5250 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5251 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 5252 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5253 | octetstring l3 := '0123456789'O) |
| 5254 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5255 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 5256 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5257 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5258 | var template PDU_BSSAP exp_data := { |
| 5259 | discriminator := '1'B, |
| 5260 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5261 | dlci := dlci, |
| 5262 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5263 | pdu := { |
| 5264 | dtap := l3 |
| 5265 | } |
| 5266 | }; |
| 5267 | BSSAP.receive(exp_data); |
| 5268 | setverdict(pass); |
| 5269 | } |
| 5270 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5271 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5272 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5273 | template (value) OCT1 dlci := '00'O, |
| 5274 | octetstring l3 := '0123456789'O) |
| 5275 | runs on MSC_ConnHdlr { |
| 5276 | BSSAP.send(PDU_BSSAP:{ |
| 5277 | discriminator := '1'B, |
| 5278 | spare := '0000000'B, |
| 5279 | dlci := dlci, |
| 5280 | lengthIndicator := lengthof(l3), |
| 5281 | pdu := { |
| 5282 | dtap := l3 |
| 5283 | } |
| 5284 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5285 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5286 | setverdict(pass); |
| 5287 | } |
| 5288 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5289 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 5290 | * simply never sends a BSSMAP Handover Command. */ |
| 5291 | 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] | 5292 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5293 | |
| 5294 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5295 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5296 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5297 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5298 | f_establish_fully(ass_req, exp_compl); |
| 5299 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5300 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5301 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5302 | |
| 5303 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5304 | |
| 5305 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 5306 | * Let's give it a bit extra. */ |
| 5307 | f_sleep(15.0); |
| 5308 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5309 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5310 | f_sleep(1.0); |
| 5311 | } |
| 5312 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 5313 | var MSC_ConnHdlr vc_conn; |
| 5314 | |
| 5315 | f_init(1, true); |
| 5316 | f_sleep(1.0); |
| 5317 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5318 | f_ctrs_bsc_and_bts_init(); |
| 5319 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5320 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 5321 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5322 | |
| 5323 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5324 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5325 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5326 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5327 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5328 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5329 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5330 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5331 | } |
| 5332 | |
| 5333 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 5334 | * RR Handover Failure. */ |
| 5335 | 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] | 5336 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5337 | |
| 5338 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5339 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5340 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5341 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5342 | f_establish_fully(ass_req, exp_compl); |
| 5343 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5344 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5345 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5346 | |
| 5347 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5348 | |
| 5349 | f_sleep(0.5); |
| 5350 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5351 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5352 | * containing an RR Handover Command coming from the target BSS... */ |
| 5353 | |
| 5354 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5355 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5356 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5357 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5358 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5359 | |
| 5360 | /* expect the Handover Command to go out on RR */ |
| 5361 | var RSL_Message rsl_ho_cmd |
| 5362 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5363 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5364 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5365 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5366 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5367 | setverdict(fail); |
| 5368 | } else { |
| 5369 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5370 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5371 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5372 | setverdict(fail); |
| 5373 | } else { |
| 5374 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5375 | setverdict(pass); |
| 5376 | } |
| 5377 | } |
| 5378 | |
| 5379 | f_sleep(0.2); |
| 5380 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5381 | |
| 5382 | /* Should tell the MSC about the failure */ |
| 5383 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5384 | |
| 5385 | f_sleep(1.0); |
| 5386 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5387 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5388 | f_sleep(1.0); |
| 5389 | |
| 5390 | setverdict(pass); |
| 5391 | f_sleep(1.0); |
| 5392 | } |
| 5393 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5394 | var MSC_ConnHdlr vc_conn; |
| 5395 | |
| 5396 | f_init(1, true); |
| 5397 | f_sleep(1.0); |
| 5398 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5399 | f_ctrs_bsc_and_bts_init(); |
| 5400 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5401 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5402 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5403 | |
| 5404 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5405 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5406 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5407 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5408 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5409 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5410 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5411 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5412 | } |
| 5413 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5414 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5415 | * (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] | 5416 | * and the lchan is released. */ |
| 5417 | 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] | 5418 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5419 | |
| 5420 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5421 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5422 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5423 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5424 | f_establish_fully(ass_req, exp_compl); |
| 5425 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5426 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5427 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5428 | |
| 5429 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5430 | |
| 5431 | f_sleep(0.5); |
| 5432 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5433 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5434 | * containing an RR Handover Command coming from the target BSS... */ |
| 5435 | |
| 5436 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5437 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5438 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5439 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5440 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5441 | |
| 5442 | /* expect the Handover Command to go out on RR */ |
| 5443 | var RSL_Message rsl_ho_cmd |
| 5444 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5445 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5446 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5447 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5448 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5449 | setverdict(fail); |
| 5450 | } else { |
| 5451 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5452 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5453 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5454 | setverdict(fail); |
| 5455 | } else { |
| 5456 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5457 | setverdict(pass); |
| 5458 | } |
| 5459 | } |
| 5460 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5461 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5462 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5463 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5464 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5465 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5466 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5467 | log("Got BSSMAP Clear Request"); |
| 5468 | /* Instruct BSC to clear channel */ |
| 5469 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5470 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5471 | |
| 5472 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5473 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5474 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5475 | log("Got Deact SACCH"); |
| 5476 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5477 | [] 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] | 5478 | log("Got RR Release"); |
| 5479 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5480 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5481 | log("Got RF Chan Rel"); |
| 5482 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5483 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5484 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5485 | } |
| 5486 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5487 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5488 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5489 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5490 | setverdict(pass); |
| 5491 | f_sleep(1.0); |
| 5492 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5493 | 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] | 5494 | var MSC_ConnHdlr vc_conn; |
| 5495 | |
| 5496 | f_init(1, true); |
| 5497 | f_sleep(1.0); |
| 5498 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5499 | f_ctrs_bsc_and_bts_init(); |
| 5500 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5501 | 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] | 5502 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5503 | |
| 5504 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5505 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5506 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5507 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5508 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5509 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5510 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5511 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5512 | } |
| 5513 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5514 | private function f_ho_into_this_bsc(charstring id, template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5515 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5516 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5517 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5518 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5519 | * before we get started. */ |
| 5520 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5521 | f_rslem_register(0, new_chan_nr); |
| 5522 | g_chan_nr := new_chan_nr; |
| 5523 | f_sleep(1.0); |
| 5524 | |
| 5525 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5526 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5527 | activate(as_Media()); |
| 5528 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5529 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5530 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5531 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 5532 | enc := g_pars.encr))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5533 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5534 | |
| 5535 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5536 | |
| 5537 | var PDU_BSSAP rx_bssap; |
| 5538 | var octetstring ho_command_str; |
| 5539 | |
| 5540 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5541 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5542 | /* we're sure that the channel activation is done now, verify the encryption parameters in it */ |
| 5543 | f_verify_encr_info(f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr)); |
| 5544 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5545 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5546 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5547 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5548 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5549 | |
| 5550 | var GsmArfcn arfcn; |
| 5551 | var RslChannelNr actual_new_chan_nr; |
| 5552 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5553 | actual_new_chan_nr, arfcn); |
| 5554 | |
| 5555 | if (actual_new_chan_nr != new_chan_nr) { |
| 5556 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5557 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5558 | setverdict(fail); |
| 5559 | return; |
| 5560 | } |
| 5561 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5562 | |
| 5563 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5564 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5565 | * the new lchan with a Handover RACH: */ |
| 5566 | |
| 5567 | /* send handover detect */ |
| 5568 | |
| 5569 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5570 | |
| 5571 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5572 | |
| 5573 | /* send handover complete over the new channel */ |
| 5574 | |
| 5575 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5576 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5577 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5578 | |
| 5579 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5580 | setverdict(pass); |
| 5581 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5582 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5583 | 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] | 5584 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5585 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 5586 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 5587 | 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] | 5588 | } |
| 5589 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5590 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5591 | } else { |
| 5592 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5593 | } |
| 5594 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 5595 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5596 | setverdict(pass); |
| 5597 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5598 | function f_tc_ho_into_this_bsc_main(TestHdlrParams pars) runs on test_CT { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5599 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5600 | |
| 5601 | f_init(1, true); |
| 5602 | f_sleep(1.0); |
| 5603 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5604 | f_ctrs_bsc_and_bts_init(); |
| 5605 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5606 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5607 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5608 | |
| 5609 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5610 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5611 | |
| 5612 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5613 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5614 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5615 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5616 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5617 | } |
| 5618 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5619 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5620 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5621 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5622 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5623 | } |
| 5624 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5625 | function f_tc_ho_into_this_bsc_a5(OCT1 encr_alg) runs on test_CT { |
| 5626 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5627 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5628 | f_tc_ho_into_this_bsc_main(pars); |
| 5629 | f_shutdown_helper(); |
| 5630 | } |
| 5631 | |
| 5632 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
| 5633 | f_tc_ho_into_this_bsc_a5('01'O); |
| 5634 | } |
| 5635 | |
| 5636 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
| 5637 | f_tc_ho_into_this_bsc_a5('02'O); |
| 5638 | } |
| 5639 | |
| 5640 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
| 5641 | f_tc_ho_into_this_bsc_a5('08'O); |
| 5642 | } |
| 5643 | |
| 5644 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
| 5645 | f_tc_ho_into_this_bsc_a5('10'O); |
| 5646 | } |
| 5647 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5648 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5649 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5650 | pars.host_aoip_tla := "::6"; |
| 5651 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5652 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5653 | } |
| 5654 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5655 | /* 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] | 5656 | 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] | 5657 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 5658 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 5659 | neighbors. */ |
| 5660 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 5661 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5662 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5663 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5664 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 5665 | |
| 5666 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 5667 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 5668 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5669 | f_shutdown_helper(); |
| 5670 | } |
| 5671 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5672 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 5673 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 5674 | list when the channel is released. */ |
| 5675 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 5676 | f_init_vty(); |
| 5677 | f_vty_allow_srvcc_fast_return(true, 0) |
| 5678 | |
| 5679 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5680 | pars.last_used_eutran_plmn := '323454'O; |
| 5681 | pars.exp_fast_return := false; |
| 5682 | f_tc_ho_into_this_bsc_main(pars); |
| 5683 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5684 | f_shutdown_helper(); |
| 5685 | } |
| 5686 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5687 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 5688 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 5689 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 5690 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 5691 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 5692 | setverdict(pass); |
| 5693 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5694 | |
| 5695 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 5696 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5697 | var MSC_ConnHdlr vc_conn; |
| 5698 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5699 | |
| 5700 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5701 | if (disable_fast_return) { |
| 5702 | f_vty_allow_srvcc_fast_return(true, 0); |
| 5703 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5704 | f_sleep(1.0); |
| 5705 | |
| 5706 | f_ctrs_bsc_and_bts_init(); |
| 5707 | |
| 5708 | pars.last_used_eutran_plmn := '323454'O; |
| 5709 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5710 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 5711 | |
| 5712 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 5713 | vc_conn.done; |
| 5714 | |
| 5715 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 5716 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 5717 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 5718 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 5719 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 5720 | 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] | 5721 | |
| 5722 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 5723 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5724 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5725 | |
| 5726 | if (disable_fast_return) { |
| 5727 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5728 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5729 | f_shutdown_helper(); |
| 5730 | } |
| 5731 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5732 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 5733 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 5734 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 5735 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 5736 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 5737 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 5738 | } |
| 5739 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 5740 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 5741 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 5742 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 5743 | } |
| 5744 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5745 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5746 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5747 | f_rslem_register(0, new_chan_nr); |
| 5748 | g_chan_nr := new_chan_nr; |
| 5749 | f_sleep(1.0); |
| 5750 | |
| 5751 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5752 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5753 | activate(as_Media()); |
| 5754 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5755 | 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] | 5756 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5757 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5758 | |
| 5759 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5760 | |
| 5761 | var PDU_BSSAP rx_bssap; |
| 5762 | var octetstring ho_command_str; |
| 5763 | |
| 5764 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5765 | |
| 5766 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5767 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5768 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5769 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5770 | |
| 5771 | var GsmArfcn arfcn; |
| 5772 | var RslChannelNr actual_new_chan_nr; |
| 5773 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5774 | actual_new_chan_nr, arfcn); |
| 5775 | |
| 5776 | if (actual_new_chan_nr != new_chan_nr) { |
| 5777 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5778 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5779 | setverdict(fail); |
| 5780 | return; |
| 5781 | } |
| 5782 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5783 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5784 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5785 | f_sleep(1.0); |
| 5786 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5787 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5788 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5789 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5790 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5791 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5792 | * BSSMAP Clear Command: */ |
| 5793 | |
| 5794 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5795 | var BssmapCause cause := enum2int(cause_val); |
| 5796 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5797 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5798 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5799 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5800 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5801 | setverdict(pass); |
| 5802 | f_sleep(1.0); |
| 5803 | |
| 5804 | setverdict(pass); |
| 5805 | } |
| 5806 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5807 | var MSC_ConnHdlr vc_conn; |
| 5808 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5809 | |
| 5810 | f_init(1, true); |
| 5811 | f_sleep(1.0); |
| 5812 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5813 | f_ctrs_bsc_and_bts_init(); |
| 5814 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5815 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5816 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5817 | |
| 5818 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5819 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5820 | |
| 5821 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5822 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5823 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5824 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5825 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5826 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5827 | } |
| 5828 | |
| 5829 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5830 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5831 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5832 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5833 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5834 | * before we get started. */ |
| 5835 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5836 | f_rslem_register(0, new_chan_nr); |
| 5837 | g_chan_nr := new_chan_nr; |
| 5838 | f_sleep(1.0); |
| 5839 | |
| 5840 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5841 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5842 | activate(as_Media()); |
| 5843 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5844 | 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] | 5845 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5846 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5847 | |
| 5848 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5849 | |
| 5850 | var PDU_BSSAP rx_bssap; |
| 5851 | var octetstring ho_command_str; |
| 5852 | |
| 5853 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5854 | |
| 5855 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5856 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5857 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5858 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5859 | |
| 5860 | var GsmArfcn arfcn; |
| 5861 | var RslChannelNr actual_new_chan_nr; |
| 5862 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5863 | actual_new_chan_nr, arfcn); |
| 5864 | |
| 5865 | if (actual_new_chan_nr != new_chan_nr) { |
| 5866 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5867 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5868 | setverdict(fail); |
| 5869 | return; |
| 5870 | } |
| 5871 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5872 | |
| 5873 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5874 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5875 | * the new lchan with a Handover RACH: */ |
| 5876 | |
| 5877 | /* send handover detect */ |
| 5878 | |
| 5879 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5880 | |
| 5881 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5882 | |
| 5883 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5884 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5885 | * Failure to the old BSS? */ |
| 5886 | |
| 5887 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5888 | var BssmapCause cause := enum2int(cause_val); |
| 5889 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5890 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5891 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5892 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5893 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5894 | f_sleep(1.0); |
| 5895 | } |
| 5896 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5897 | var MSC_ConnHdlr vc_conn; |
| 5898 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5899 | |
| 5900 | f_init(1, true); |
| 5901 | f_sleep(1.0); |
| 5902 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5903 | f_ctrs_bsc_and_bts_init(); |
| 5904 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5905 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5906 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5907 | |
| 5908 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5909 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5910 | |
| 5911 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5912 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5913 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5914 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5915 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5916 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5917 | } |
| 5918 | |
| 5919 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5920 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5921 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5922 | f_rslem_register(0, new_chan_nr); |
| 5923 | g_chan_nr := new_chan_nr; |
| 5924 | f_sleep(1.0); |
| 5925 | |
| 5926 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5927 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5928 | activate(as_Media()); |
| 5929 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5930 | 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] | 5931 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5932 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5933 | |
| 5934 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5935 | |
| 5936 | var PDU_BSSAP rx_bssap; |
| 5937 | var octetstring ho_command_str; |
| 5938 | |
| 5939 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5940 | |
| 5941 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5942 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5943 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5944 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5945 | |
| 5946 | var GsmArfcn arfcn; |
| 5947 | var RslChannelNr actual_new_chan_nr; |
| 5948 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5949 | actual_new_chan_nr, arfcn); |
| 5950 | |
| 5951 | if (actual_new_chan_nr != new_chan_nr) { |
| 5952 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5953 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5954 | setverdict(fail); |
| 5955 | return; |
| 5956 | } |
| 5957 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5958 | |
| 5959 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5960 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5961 | * on the new lchan. */ |
| 5962 | |
| 5963 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5964 | |
| 5965 | /* Did osmo-bsc also send a Clear Request? */ |
| 5966 | timer T := 0.5; |
| 5967 | T.start; |
| 5968 | alt { |
| 5969 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5970 | [] T.timeout { } |
| 5971 | } |
| 5972 | |
| 5973 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5974 | * asked for it, this is a Handover Failure after all). */ |
| 5975 | |
| 5976 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5977 | var BssmapCause cause := enum2int(cause_val); |
| 5978 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5979 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5980 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5981 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5982 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5983 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5984 | } |
| 5985 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5986 | var MSC_ConnHdlr vc_conn; |
| 5987 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5988 | |
| 5989 | f_init(1, true); |
| 5990 | f_sleep(1.0); |
| 5991 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5992 | f_ctrs_bsc_and_bts_init(); |
| 5993 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5994 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5995 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5996 | |
| 5997 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5998 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5999 | |
| 6000 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6001 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6002 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6003 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6004 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6005 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6006 | } |
| 6007 | |
| 6008 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 6009 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 6010 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6011 | f_rslem_register(0, new_chan_nr); |
| 6012 | g_chan_nr := new_chan_nr; |
| 6013 | f_sleep(1.0); |
| 6014 | |
| 6015 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6016 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6017 | activate(as_Media()); |
| 6018 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6019 | 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] | 6020 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6021 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6022 | |
| 6023 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6024 | |
| 6025 | var PDU_BSSAP rx_bssap; |
| 6026 | var octetstring ho_command_str; |
| 6027 | |
| 6028 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6029 | |
| 6030 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6031 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6032 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6033 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6034 | |
| 6035 | var GsmArfcn arfcn; |
| 6036 | var RslChannelNr actual_new_chan_nr; |
| 6037 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6038 | actual_new_chan_nr, arfcn); |
| 6039 | |
| 6040 | if (actual_new_chan_nr != new_chan_nr) { |
| 6041 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6042 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6043 | setverdict(fail); |
| 6044 | return; |
| 6045 | } |
| 6046 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6047 | |
| 6048 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6049 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6050 | * on the new lchan. */ |
| 6051 | |
| 6052 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6053 | |
| 6054 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6055 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6056 | |
| 6057 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6058 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6059 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6060 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6061 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6062 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6063 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6064 | f_sleep(1.0); |
| 6065 | } |
| 6066 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 6067 | var MSC_ConnHdlr vc_conn; |
| 6068 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6069 | |
| 6070 | f_init(1, true); |
| 6071 | f_sleep(1.0); |
| 6072 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6073 | f_ctrs_bsc_and_bts_init(); |
| 6074 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6075 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6076 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6077 | |
| 6078 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 6079 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6080 | |
| 6081 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6082 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6083 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6084 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6085 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6086 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6087 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6088 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6089 | type record of charstring Commands; |
| 6090 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6091 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6092 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6093 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6094 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6095 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6096 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6097 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6098 | } |
| 6099 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 6100 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 6101 | { |
| 6102 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 6103 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 6104 | f_vty_transceive(pt, cmds[i]); |
| 6105 | } |
| 6106 | f_vty_transceive(pt, "end"); |
| 6107 | } |
| 6108 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6109 | private function f_probe_for_handover(charstring log_label, |
| 6110 | charstring log_descr, |
| 6111 | charstring handover_vty_cmd, |
| 6112 | boolean expect_handover, |
| 6113 | boolean is_inter_bsc_handover := false) |
| 6114 | runs on MSC_ConnHdlr |
| 6115 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 6116 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 6117 | * lchans to be established on bts 1 or bts 2. */ |
| 6118 | f_rslem_suspend(RSL1_PROC); |
| 6119 | f_rslem_suspend(RSL2_PROC); |
| 6120 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6121 | var RSL_Message rsl; |
| 6122 | |
| 6123 | var charstring log_msg := " (expecting handover)" |
| 6124 | if (not expect_handover) { |
| 6125 | log_msg := " (expecting NO handover)"; |
| 6126 | } |
| 6127 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 6128 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 6129 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6130 | timer T := 2.0; |
| 6131 | T.start; |
| 6132 | |
| 6133 | alt { |
| 6134 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 6135 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 6136 | log("Rx L3 from net: ", l3); |
| 6137 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 6138 | var RslChannelNr new_chan_nr; |
| 6139 | var GsmArfcn arfcn; |
| 6140 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 6141 | new_chan_nr, arfcn); |
| 6142 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 6143 | log(l3.msgs.rrm.handoverCommand); |
| 6144 | |
| 6145 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 6146 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 6147 | * anyway. */ |
| 6148 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 6149 | f_rslem_resume(RSL1_PROC); |
| 6150 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 6151 | f_rslem_resume(RSL2_PROC); |
| 6152 | |
| 6153 | if (expect_handover and not is_inter_bsc_handover) { |
| 6154 | setverdict(pass); |
| 6155 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 6156 | } else { |
| 6157 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 6158 | & log_label & ": " & log_descr); |
| 6159 | } |
| 6160 | |
| 6161 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 6162 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 6163 | * Handover Failure. */ |
| 6164 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6165 | |
| 6166 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 6167 | f_sleep(0.5); |
| 6168 | RSL1.clear; |
| 6169 | RSL2.clear; |
| 6170 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 6171 | break; |
| 6172 | } else { |
| 6173 | repeat; |
| 6174 | } |
| 6175 | } |
| 6176 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 6177 | if (expect_handover and is_inter_bsc_handover) { |
| 6178 | setverdict(pass); |
| 6179 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 6180 | } else { |
| 6181 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 6182 | & log_label & ": " & log_descr); |
| 6183 | } |
| 6184 | |
| 6185 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 6186 | |
| 6187 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 6188 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 6189 | * setting a short timeout and waiting is the only way. */ |
| 6190 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 6191 | f_sleep(1.5); |
| 6192 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 6193 | |
| 6194 | break; |
| 6195 | } |
| 6196 | [] T.timeout { |
| 6197 | if (expect_handover) { |
| 6198 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 6199 | & log_label & ": " & log_descr); |
| 6200 | } else { |
| 6201 | setverdict(pass); |
| 6202 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 6203 | } |
| 6204 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 6205 | break; |
| 6206 | } |
| 6207 | } |
| 6208 | |
| 6209 | f_rslem_resume(RSL1_PROC); |
| 6210 | f_rslem_resume(RSL2_PROC); |
| 6211 | f_sleep(3.0); |
| 6212 | RSL.clear; |
| 6213 | |
| 6214 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 6215 | } |
| 6216 | |
| 6217 | /* Test the effect of various neighbor configuration scenarios: |
| 6218 | * |
| 6219 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 6220 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 6221 | */ |
| 6222 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 6223 | g_pars := f_gen_test_hdlr_pars(); |
| 6224 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6225 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6226 | |
| 6227 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6228 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6229 | |
| 6230 | /* Establish lchan at bts 0 */ |
| 6231 | f_establish_fully(ass_cmd, exp_compl); |
| 6232 | |
| 6233 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 6234 | f_vty_enter_cfg_network(BSCVTY); |
| 6235 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 6236 | f_vty_transceive(BSCVTY, "end"); |
| 6237 | } |
| 6238 | |
| 6239 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 6240 | f_tc_ho_neighbor_config_start(); |
| 6241 | |
| 6242 | /* |
| 6243 | * bts 0 ARFCN 871 BSIC 10 |
| 6244 | * bts 1 ARFCN 871 BSIC 11 |
| 6245 | * bts 2 ARFCN 871 BSIC 12 |
| 6246 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6247 | */ |
| 6248 | |
| 6249 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6250 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6251 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 6252 | "handover any to arfcn 871 bsic 11", |
| 6253 | true); |
| 6254 | |
| 6255 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 6256 | "handover any to arfcn 13 bsic 39", |
| 6257 | false); |
| 6258 | |
| 6259 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 6260 | "handover any to arfcn 871 bsic 12", |
| 6261 | false); |
| 6262 | |
| 6263 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 6264 | "handover any to arfcn 871 bsic 11", |
| 6265 | true); |
| 6266 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6267 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 6268 | var MSC_ConnHdlr vc_conn; |
| 6269 | f_init(3, true, guard_timeout := 60.0); |
| 6270 | f_sleep(1.0); |
| 6271 | f_ctrs_bsc_and_bts_init(); |
| 6272 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 6273 | vc_conn.done; |
| 6274 | |
| 6275 | /* f_tc_ho_neighbor_config_start() */ |
| 6276 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6277 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6278 | |
| 6279 | /* 1.a */ |
| 6280 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6281 | * handover quickly by sending a Handover Failure message. */ |
| 6282 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6283 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6284 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6285 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6286 | |
| 6287 | /* 1.b */ |
| 6288 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6289 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6290 | |
| 6291 | /* 1.c */ |
| 6292 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6293 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6294 | |
| 6295 | /* 1.d */ |
| 6296 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6297 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6298 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6299 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6300 | |
| 6301 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6302 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6303 | } |
| 6304 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6305 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 6306 | f_tc_ho_neighbor_config_start(); |
| 6307 | |
| 6308 | /* |
| 6309 | * bts 0 ARFCN 871 BSIC 10 |
| 6310 | * bts 1 ARFCN 871 BSIC 11 |
| 6311 | * bts 2 ARFCN 871 BSIC 12 |
| 6312 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6313 | */ |
| 6314 | |
| 6315 | 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] | 6316 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6317 | f_sleep(0.5); |
| 6318 | |
| 6319 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 6320 | "handover any to arfcn 871 bsic 11", |
| 6321 | true); |
| 6322 | |
| 6323 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6324 | "handover any to arfcn 871 bsic 12", |
| 6325 | false); |
| 6326 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6327 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 6328 | var MSC_ConnHdlr vc_conn; |
| 6329 | f_init(3, true, guard_timeout := 50.0); |
| 6330 | f_sleep(1.0); |
| 6331 | f_ctrs_bsc_and_bts_init(); |
| 6332 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 6333 | vc_conn.done; |
| 6334 | |
| 6335 | /* f_tc_ho_neighbor_config_start() */ |
| 6336 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6337 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6338 | |
| 6339 | /* 2.a */ |
| 6340 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6341 | * handover quickly by sending a Handover Failure message. */ |
| 6342 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6343 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6344 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6345 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6346 | |
| 6347 | /* 2.b */ |
| 6348 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6349 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6350 | |
| 6351 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6352 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6353 | } |
| 6354 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6355 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 6356 | f_tc_ho_neighbor_config_start(); |
| 6357 | |
| 6358 | /* |
| 6359 | * bts 0 ARFCN 871 BSIC 10 |
| 6360 | * bts 1 ARFCN 871 BSIC 11 |
| 6361 | * bts 2 ARFCN 871 BSIC 12 |
| 6362 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6363 | */ |
| 6364 | |
| 6365 | 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] | 6366 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6367 | f_sleep(0.5); |
| 6368 | |
| 6369 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6370 | "handover any to arfcn 871 bsic 11", |
| 6371 | false); |
| 6372 | 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", |
| 6373 | "handover any to arfcn 871 bsic 12", |
| 6374 | true); |
| 6375 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6376 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 6377 | var MSC_ConnHdlr vc_conn; |
| 6378 | f_init(3, true, guard_timeout := 50.0); |
| 6379 | f_sleep(1.0); |
| 6380 | f_ctrs_bsc_and_bts_init(); |
| 6381 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 6382 | vc_conn.done; |
| 6383 | |
| 6384 | /* f_tc_ho_neighbor_config_start() */ |
| 6385 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6386 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6387 | |
| 6388 | /* 3.a */ |
| 6389 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6390 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6391 | |
| 6392 | /* 3.b */ |
| 6393 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6394 | * handover quickly by sending a Handover Failure message. */ |
| 6395 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6396 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6397 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6398 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6399 | |
| 6400 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6401 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6402 | } |
| 6403 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6404 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 6405 | f_tc_ho_neighbor_config_start(); |
| 6406 | |
| 6407 | /* |
| 6408 | * bts 0 ARFCN 871 BSIC 10 |
| 6409 | * bts 1 ARFCN 871 BSIC 11 |
| 6410 | * bts 2 ARFCN 871 BSIC 12 |
| 6411 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6412 | */ |
| 6413 | |
| 6414 | 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] | 6415 | 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] | 6416 | f_sleep(0.5); |
| 6417 | |
| 6418 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6419 | "handover any to arfcn 871 bsic 11", |
| 6420 | false); |
| 6421 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6422 | "handover any to arfcn 871 bsic 12", |
| 6423 | false); |
| 6424 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 6425 | "handover any to arfcn 123 bsic 45", |
| 6426 | true, true); |
| 6427 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6428 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 6429 | var MSC_ConnHdlr vc_conn; |
| 6430 | f_init(3, true, guard_timeout := 50.0); |
| 6431 | f_sleep(1.0); |
| 6432 | f_ctrs_bsc_and_bts_init(); |
| 6433 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 6434 | vc_conn.done; |
| 6435 | |
| 6436 | /* f_tc_ho_neighbor_config_start() */ |
| 6437 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6438 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6439 | |
| 6440 | /* 4.a */ |
| 6441 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6442 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6443 | |
| 6444 | /* 4.b */ |
| 6445 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6446 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6447 | |
| 6448 | /* 4.c */ |
| 6449 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6450 | * handover quickly by timing out after the Handover Required message */ |
| 6451 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6452 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6453 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6454 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6455 | |
| 6456 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6457 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6458 | } |
| 6459 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6460 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 6461 | f_tc_ho_neighbor_config_start(); |
| 6462 | |
| 6463 | /* |
| 6464 | * bts 0 ARFCN 871 BSIC 10 |
| 6465 | * bts 1 ARFCN 871 BSIC 11 |
| 6466 | * bts 2 ARFCN 871 BSIC 12 |
| 6467 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6468 | */ |
| 6469 | |
| 6470 | 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] | 6471 | 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] | 6472 | f_sleep(0.5); |
| 6473 | |
| 6474 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 6475 | "handover any to arfcn 871 bsic 12", |
| 6476 | true, true); |
| 6477 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6478 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 6479 | var MSC_ConnHdlr vc_conn; |
| 6480 | f_init(3, true); |
| 6481 | f_sleep(1.0); |
| 6482 | f_ctrs_bsc_and_bts_init(); |
| 6483 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 6484 | vc_conn.done; |
| 6485 | |
| 6486 | /* f_tc_ho_neighbor_config_start() */ |
| 6487 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6488 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6489 | |
| 6490 | /* 5 */ |
| 6491 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6492 | * handover quickly by timing out after the Handover Required message */ |
| 6493 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6494 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6495 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6496 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6497 | |
| 6498 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6499 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6500 | } |
| 6501 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6502 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 6503 | f_tc_ho_neighbor_config_start(); |
| 6504 | |
| 6505 | /* |
| 6506 | * bts 0 ARFCN 871 BSIC 10 |
| 6507 | * bts 1 ARFCN 871 BSIC 11 |
| 6508 | * bts 2 ARFCN 871 BSIC 12 |
| 6509 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6510 | */ |
| 6511 | |
| 6512 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 6513 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6514 | 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] | 6515 | f_sleep(0.5); |
| 6516 | |
| 6517 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 6518 | "handover any to arfcn 871 bsic 12", |
| 6519 | false); |
| 6520 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6521 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 6522 | var MSC_ConnHdlr vc_conn; |
| 6523 | f_init(3, true); |
| 6524 | f_sleep(1.0); |
| 6525 | f_ctrs_bsc_and_bts_init(); |
| 6526 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 6527 | vc_conn.done; |
| 6528 | |
| 6529 | /* f_tc_ho_neighbor_config_start() */ |
| 6530 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6531 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6532 | |
| 6533 | /* 6.a */ |
| 6534 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6535 | * handover quickly by timing out after the Handover Required message */ |
| 6536 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6537 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6538 | |
| 6539 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6540 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6541 | } |
| 6542 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6543 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 6544 | f_tc_ho_neighbor_config_start(); |
| 6545 | |
| 6546 | /* |
| 6547 | * bts 0 ARFCN 871 BSIC 10 |
| 6548 | * bts 1 ARFCN 871 BSIC 11 |
| 6549 | * bts 2 ARFCN 871 BSIC 12 |
| 6550 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6551 | */ |
| 6552 | |
| 6553 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 6554 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6555 | 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] | 6556 | f_sleep(0.5); |
| 6557 | |
| 6558 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 6559 | "handover any to arfcn 871 bsic 12", |
| 6560 | true); |
| 6561 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 6562 | "handover any to arfcn 123 bsic 45", |
| 6563 | true, true); |
| 6564 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6565 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 6566 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 6567 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6568 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6569 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6570 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 6571 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6572 | |
| 6573 | /* f_tc_ho_neighbor_config_start() */ |
| 6574 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6575 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6576 | |
| 6577 | /* 7.a */ |
| 6578 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6579 | * handover quickly by sending a Handover Failure message. */ |
| 6580 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6581 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6582 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6583 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6584 | |
| 6585 | /* 7.b */ |
| 6586 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6587 | * handover quickly by timing out after the Handover Required message */ |
| 6588 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6589 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6590 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6591 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6592 | |
| 6593 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6594 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6595 | } |
| 6596 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6597 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6598 | * BSSMAP Reset just because of that. */ |
| 6599 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 6600 | var default d; |
| 6601 | var integer i; |
| 6602 | var DchanTuple dt; |
| 6603 | |
| 6604 | f_init(); |
| 6605 | |
| 6606 | /* Wait for initial BSSMAP Reset to pass */ |
| 6607 | f_sleep(4.0); |
| 6608 | |
| 6609 | d := activate(no_bssmap_reset()); |
| 6610 | |
| 6611 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6612 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6613 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 6614 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6615 | /* Since we're doing a lot of runs, give each one a fresh |
| 6616 | * T_guard from the top. */ |
| 6617 | T_guard.start; |
| 6618 | |
| 6619 | /* Setup a BSSAP connection and clear it right away. This is |
| 6620 | * the MSC telling the BSC about a planned release, it's not an |
| 6621 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6622 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6623 | |
| 6624 | /* MSC disconnects (RLSD). */ |
| 6625 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 6626 | } |
| 6627 | |
| 6628 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6629 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6630 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6631 | f_sleep(4.0); |
| 6632 | |
| 6633 | deactivate(d); |
| 6634 | f_shutdown_helper(); |
| 6635 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6636 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6637 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6638 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6639 | * the MSC. */ |
| 6640 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6641 | var default d; |
| 6642 | var integer i; |
| 6643 | var DchanTuple dt; |
| 6644 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6645 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6646 | var BssmapCause cause := enum2int(cause_val); |
| 6647 | |
| 6648 | f_init(); |
| 6649 | |
| 6650 | /* Wait for initial BSSMAP Reset to pass */ |
| 6651 | f_sleep(4.0); |
| 6652 | |
| 6653 | d := activate(no_bssmap_reset()); |
| 6654 | |
| 6655 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6656 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6657 | * Let's do it some more times for good measure. */ |
| 6658 | for (i := 0; i < 8; i := i+1) { |
| 6659 | /* Since we're doing a lot of runs, give each one a fresh |
| 6660 | * T_guard from the top. */ |
| 6661 | T_guard.start; |
| 6662 | |
| 6663 | /* Setup a BSSAP connection and clear it right away. This is |
| 6664 | * the MSC telling the BSC about a planned release, it's not an |
| 6665 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6666 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6667 | |
| 6668 | /* Instruct BSC to clear channel */ |
| 6669 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6670 | |
| 6671 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6672 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6673 | } |
| 6674 | |
| 6675 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6676 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6677 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6678 | f_sleep(4.0); |
| 6679 | |
| 6680 | deactivate(d); |
| 6681 | f_shutdown_helper(); |
| 6682 | } |
| 6683 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6684 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6685 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6686 | * Release Ind on RSL. */ |
| 6687 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6688 | var default d; |
| 6689 | var integer i; |
| 6690 | var DchanTuple dt; |
| 6691 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6692 | var integer j; |
| 6693 | |
| 6694 | f_init(); |
| 6695 | |
| 6696 | /* Wait for initial BSSMAP Reset to pass */ |
| 6697 | f_sleep(4.0); |
| 6698 | |
| 6699 | d := activate(no_bssmap_reset()); |
| 6700 | |
| 6701 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6702 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6703 | * Let's do it some more times for good measure. */ |
| 6704 | for (i := 0; i < 8; i := i+1) { |
| 6705 | /* Since we're doing a lot of runs, give each one a fresh |
| 6706 | * T_guard from the top. */ |
| 6707 | T_guard.start; |
| 6708 | |
| 6709 | /* Setup a BSSAP connection and clear it right away. This is |
| 6710 | * the MSC telling the BSC about a planned release, it's not an |
| 6711 | * erratic loss of a connection. */ |
| 6712 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6713 | |
| 6714 | /* simulate RLL REL IND */ |
| 6715 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6716 | |
| 6717 | /* expect Clear Request on MSC side */ |
| 6718 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6719 | |
| 6720 | /* Instruct BSC to clear channel */ |
| 6721 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6722 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6723 | |
| 6724 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6725 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6726 | } |
| 6727 | |
| 6728 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6729 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6730 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6731 | f_sleep(4.0); |
| 6732 | |
| 6733 | deactivate(d); |
| 6734 | f_shutdown_helper(); |
| 6735 | } |
| 6736 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6737 | /*********************************************************************** |
| 6738 | * IPA style dynamic PDCH |
| 6739 | ***********************************************************************/ |
| 6740 | |
| 6741 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6742 | template (omit) RSL_Cause nack := omit) |
| 6743 | runs on test_CT { |
| 6744 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6745 | var RSL_Message rsl_unused; |
| 6746 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6747 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6748 | /* expect the BSC to issue the related RSL command */ |
| 6749 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6750 | if (istemplatekind(nack, "omit")) { |
| 6751 | /* respond with a related acknowledgement */ |
| 6752 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6753 | } else { |
| 6754 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6755 | } |
| 6756 | } |
| 6757 | |
| 6758 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6759 | template (omit) RSL_Cause nack := omit) |
| 6760 | runs on test_CT { |
| 6761 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6762 | var RSL_Message rsl_unused; |
| 6763 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6764 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6765 | /* expect the BSC to issue the related RSL command */ |
| 6766 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6767 | if (istemplatekind(nack, "omit")) { |
| 6768 | /* respond with a related acknowledgement */ |
| 6769 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6770 | } else { |
| 6771 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6772 | } |
| 6773 | } |
| 6774 | |
| 6775 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6776 | runs on test_CT return charstring { |
| 6777 | var charstring cmd, resp; |
| 6778 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6779 | 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] | 6780 | } |
| 6781 | |
| 6782 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6783 | template charstring exp) |
| 6784 | runs on test_CT { |
| 6785 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6786 | if (not match(mode, exp)) { |
| 6787 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6788 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6789 | } |
| 6790 | } |
| 6791 | |
| 6792 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6793 | runs on test_CT { |
| 6794 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6795 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6796 | f_vty_transceive(BSCVTY, "end"); |
| 6797 | } |
| 6798 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 6799 | |
| 6800 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 6801 | var integer i; |
| 6802 | for (i := 0; i < 8; i := i + 1) { |
| 6803 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 6804 | } |
| 6805 | } |
| 6806 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6807 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6808 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6809 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6810 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 6811 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6812 | |
| 6813 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6814 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6815 | var RSL_Message rsl_unused; |
| 6816 | |
| 6817 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6818 | f_init_vty(); |
| 6819 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6820 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6821 | |
| 6822 | f_init(1, false); |
| 6823 | f_sleep(1.0); |
| 6824 | |
| 6825 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6826 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6827 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6828 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6829 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6830 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6831 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6832 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6833 | 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] | 6834 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6835 | |
| 6836 | /* De-activate it via VTY */ |
| 6837 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6838 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6839 | 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] | 6840 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6841 | |
| 6842 | /* re-activate it via VTY */ |
| 6843 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6844 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6845 | 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] | 6846 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6847 | |
| 6848 | /* and finally de-activate it again */ |
| 6849 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6850 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6851 | 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] | 6852 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6853 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6854 | /* clean up config */ |
| 6855 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6856 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6857 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6858 | } |
| 6859 | |
| 6860 | /* Test IPA PDCH activation NACK */ |
| 6861 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6862 | var RSL_Message rsl_unused; |
| 6863 | |
| 6864 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6865 | f_init_vty(); |
| 6866 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6867 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6868 | |
| 6869 | f_init(1, false); |
| 6870 | f_sleep(1.0); |
| 6871 | |
| 6872 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6873 | |
| 6874 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6875 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6876 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6877 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6878 | f_sleep(1.0); |
| 6879 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6880 | |
| 6881 | /* De-activate it via VTY */ |
| 6882 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6883 | f_sleep(1.0); |
| 6884 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6885 | |
| 6886 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6887 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6888 | f_sleep(1.0); |
| 6889 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6890 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6891 | /* clean up config */ |
| 6892 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6893 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6894 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6895 | } |
| 6896 | |
| 6897 | |
| 6898 | /*********************************************************************** |
| 6899 | * Osmocom style dynamic PDCH |
| 6900 | ***********************************************************************/ |
| 6901 | |
| 6902 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6903 | template (omit) RSL_Cause nack := omit) |
| 6904 | runs on test_CT { |
| 6905 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6906 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 6907 | /* 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] | 6908 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6909 | /* expect the BSC to issue the related RSL command */ |
| 6910 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6911 | if (istemplatekind(nack, "omit")) { |
| 6912 | /* respond with a related acknowledgement */ |
| 6913 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6914 | } else { |
| 6915 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6916 | } |
| 6917 | } |
| 6918 | |
| 6919 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6920 | template (omit) RSL_Cause nack := omit) |
| 6921 | runs on test_CT { |
| 6922 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6923 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 6924 | /* 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] | 6925 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6926 | /* expect the BSC to issue the related RSL command */ |
| 6927 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6928 | if (istemplatekind(nack, "omit")) { |
| 6929 | /* respond with a related acknowledgement */ |
| 6930 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6931 | } else { |
| 6932 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6933 | } |
| 6934 | } |
| 6935 | |
| 6936 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6937 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6938 | var RSL_Message rsl_unused; |
| 6939 | |
| 6940 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6941 | f_init_vty(); |
| 6942 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6943 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6944 | |
| 6945 | f_init(1, false); |
| 6946 | f_sleep(1.0); |
| 6947 | |
| 6948 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6949 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6950 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6951 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6952 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6953 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6954 | |
| 6955 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6956 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6957 | 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] | 6958 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6959 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6960 | /* clean up config */ |
| 6961 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6962 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6963 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6964 | } |
| 6965 | |
| 6966 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6967 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6968 | var RSL_Message rsl_unused; |
| 6969 | |
| 6970 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6971 | f_init_vty(); |
| 6972 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6973 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6974 | |
| 6975 | f_init(1, false); |
| 6976 | f_sleep(1.0); |
| 6977 | |
| 6978 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6979 | |
| 6980 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6981 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6982 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6983 | |
| 6984 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6985 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6986 | f_sleep(1.0); |
| 6987 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6988 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6989 | /* clean up config */ |
| 6990 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6991 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6992 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6993 | } |
| 6994 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 6995 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 6996 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 6997 | var RSL_Message rsl_unused, rsl_msg; |
| 6998 | var DchanTuple dt; |
| 6999 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7000 | |
| 7001 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7002 | f_init_vty(); |
| 7003 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7004 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7005 | |
| 7006 | f_init(1, false); |
| 7007 | f_sleep(1.0); |
| 7008 | |
| 7009 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7010 | |
| 7011 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7012 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7013 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7014 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7015 | |
| 7016 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7017 | f_sleep(1.0); |
| 7018 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7019 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7020 | |
| 7021 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7022 | * on CCCH+SDCCH4+CBCH) */ |
| 7023 | var integer i; |
| 7024 | for (i := 0; i < 3; i := i + 1) { |
| 7025 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7026 | } |
| 7027 | |
| 7028 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7029 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7030 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7031 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7032 | |
| 7033 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7034 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7035 | |
| 7036 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7037 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7038 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7039 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7040 | |
| 7041 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7042 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7043 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7044 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7045 | |
| 7046 | /* Instruct BSC to clear channel */ |
| 7047 | var BssmapCause cause := 0; |
| 7048 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7049 | f_exp_chan_rel_and_clear(dt, 0); |
| 7050 | |
| 7051 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7052 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7053 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7054 | f_sleep(1.0); |
| 7055 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7056 | |
| 7057 | /* clean up config */ |
| 7058 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7059 | |
| 7060 | f_shutdown_helper(); |
| 7061 | } |
| 7062 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7063 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 7064 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 7065 | it as TCH directly instead. SYS#5309. */ |
| 7066 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 7067 | var RSL_Message rsl_unused, rsl_msg; |
| 7068 | var DchanTuple dt; |
| 7069 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7070 | var integer i; |
| 7071 | |
| 7072 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7073 | f_init_vty(); |
| 7074 | for (i := 1; i < 8; i := i + 1) { |
| 7075 | if (i == 6) { |
| 7076 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7077 | } else { |
| 7078 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7079 | } |
| 7080 | } |
| 7081 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7082 | |
| 7083 | f_init(1, false); |
| 7084 | f_sleep(1.0); |
| 7085 | |
| 7086 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7087 | |
| 7088 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7089 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7090 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7091 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7092 | |
| 7093 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7094 | f_sleep(1.0); |
| 7095 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7096 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7097 | |
| 7098 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7099 | * on CCCH+SDCCH4+CBCH) */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7100 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7101 | for (i := 0; i < 3; i := i + 1) { |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7102 | dt := f_est_dchan(ra, i, '00010203040506'O); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7103 | } |
| 7104 | |
| 7105 | /* 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] | 7106 | 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] | 7107 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7108 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7109 | |
| 7110 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7111 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7112 | |
| 7113 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7114 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7115 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7116 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7117 | |
| 7118 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7119 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7120 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7121 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7122 | |
| 7123 | /* Instruct BSC to clear channel */ |
| 7124 | var BssmapCause cause := 0; |
| 7125 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7126 | f_exp_chan_rel_and_clear(dt, 0); |
| 7127 | |
| 7128 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7129 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7130 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7131 | f_sleep(1.0); |
| 7132 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7133 | |
| 7134 | /* clean up config */ |
| 7135 | f_ts_reset_chcomb(0); |
| 7136 | /* TODO: clean up other channels? */ |
| 7137 | |
| 7138 | f_shutdown_helper(); |
| 7139 | } |
| 7140 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7141 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 7142 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 7143 | var RSL_Message rsl_unused, rsl_msg; |
| 7144 | var DchanTuple dt; |
| 7145 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7146 | var GsmRrMessage rr; |
| 7147 | |
| 7148 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7149 | f_init_vty(); |
| 7150 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7151 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7152 | |
| 7153 | f_init(1, false); |
| 7154 | f_sleep(1.0); |
| 7155 | |
| 7156 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7157 | |
| 7158 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7159 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7160 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7161 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7162 | |
| 7163 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7164 | f_sleep(1.0); |
| 7165 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7166 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7167 | |
| 7168 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7169 | * on CCCH+SDCCH4+CBCH) */ |
| 7170 | var integer i; |
| 7171 | for (i := 0; i < 3; i := i + 1) { |
| 7172 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7173 | } |
| 7174 | |
| 7175 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7176 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7177 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7178 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7179 | |
| 7180 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7181 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7182 | |
| 7183 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7184 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7185 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7186 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 7187 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 7188 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 7189 | } |
| 7190 | |
| 7191 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 7192 | |
| 7193 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7194 | /* rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7195 | * f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7196 | * f_sleep(1.0); |
| 7197 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 7198 | */ |
| 7199 | |
| 7200 | /* clean up config */ |
| 7201 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7202 | |
| 7203 | f_shutdown_helper(); |
| 7204 | } |
| 7205 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7206 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 7207 | 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] | 7208 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7209 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7210 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7211 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7212 | } |
| 7213 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7214 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 7215 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 7216 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 7217 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7218 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7219 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7220 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7221 | } |
| 7222 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7223 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 7224 | the BTS does autonomous MS power control loop */ |
| 7225 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 7226 | var MSC_ConnHdlr vc_conn; |
| 7227 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7228 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 7229 | pars.exp_ms_power_params := true; |
| 7230 | |
| 7231 | f_init(1, true); |
| 7232 | f_sleep(1.0); |
| 7233 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 7234 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7235 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7236 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7237 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 7238 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 7239 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 7240 | f_init(1); |
| 7241 | |
| 7242 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 7243 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 7244 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 7245 | |
| 7246 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
| 7247 | var template RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
| 7248 | chan_nr := t_RslChanNr_BCCH(0), |
| 7249 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 7250 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
| 7251 | var RSL_Message unused := f_exp_ipa_rx(0, tr_rsl_pdu); |
| 7252 | |
| 7253 | /* Additionally verify the applied value over the CTRL interface */ |
| 7254 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 7255 | if (cred != int2str(red)) { |
| 7256 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 7257 | cred, " (expected ", red, ")"); |
| 7258 | } |
| 7259 | } |
| 7260 | |
| 7261 | f_shutdown_helper(); |
| 7262 | } |
| 7263 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7264 | /*********************************************************************** |
| 7265 | * MSC Pooling |
| 7266 | ***********************************************************************/ |
| 7267 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7268 | 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] | 7269 | 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] | 7270 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7271 | 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] | 7272 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7273 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7274 | [] 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] | 7275 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 7276 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7277 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7278 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 7279 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7280 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7281 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7282 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7283 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7284 | break; |
| 7285 | } |
| 7286 | } |
| 7287 | } |
| 7288 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7289 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
| 7290 | 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] | 7291 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7292 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7293 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 7294 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7295 | [] 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] | 7296 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7297 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7298 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7299 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7300 | } |
| 7301 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7302 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7303 | /* Also drop the SCCP connection */ |
| 7304 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7305 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7306 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7307 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7308 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7309 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7310 | } |
| 7311 | } |
| 7312 | } |
| 7313 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7314 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 7315 | 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] | 7316 | runs on MSC_ConnHdlr { |
| 7317 | timer T := 10.0; |
| 7318 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 7319 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7320 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7321 | f_create_bssmap_exp(l3_enc); |
| 7322 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7323 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 7324 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7325 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 7326 | */ |
| 7327 | var RSL_Message rx_rsl; |
| 7328 | var GsmRrMessage rr; |
| 7329 | |
| 7330 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7331 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7332 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7333 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7334 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 7335 | */ |
| 7336 | timer Tt := 10.0; |
| 7337 | |
| 7338 | /* request a channel to be established */ |
| 7339 | Tt.start; |
| 7340 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7341 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7342 | Tt.stop; |
| 7343 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7344 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7345 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 7346 | mtc.stop; |
| 7347 | } |
| 7348 | [] Tt.timeout { |
| 7349 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 7350 | mtc.stop; |
| 7351 | } |
| 7352 | } |
| 7353 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 7354 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7355 | 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] | 7356 | |
| 7357 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7358 | if (expect_bssmap_l3) { |
| 7359 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 7360 | var template PDU_BSSAP exp_l3_compl; |
| 7361 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 7362 | if (g_pars.aoip == false) { |
| 7363 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 7364 | } else { |
| 7365 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 7366 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7367 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7368 | var PDU_BSSAP bssap; |
| 7369 | T.start; |
| 7370 | alt { |
| 7371 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 7372 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 7373 | log("rx exp_l3_compl = ", bssap); |
| 7374 | } |
| 7375 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 7376 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 7377 | } |
| 7378 | [] T.timeout { |
| 7379 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 7380 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7381 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7382 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7383 | /* start ciphering, if requested */ |
| 7384 | if (ispresent(g_pars.encr)) { |
| 7385 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7386 | 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] | 7387 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7388 | } |
| 7389 | |
| 7390 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7391 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7392 | } |
| 7393 | setverdict(pass); |
| 7394 | f_sleep(1.0); |
| 7395 | } |
| 7396 | |
| 7397 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 7398 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7399 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7400 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7401 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7402 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7403 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7404 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7405 | } |
| 7406 | } |
| 7407 | |
| 7408 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 7409 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 7410 | 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] | 7411 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 7412 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 7413 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 7414 | 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] | 7415 | } |
| 7416 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 7417 | |
| 7418 | f_init(1, true); |
| 7419 | f_sleep(1.0); |
| 7420 | var MSC_ConnHdlr vc_conn; |
| 7421 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7422 | |
| 7423 | f_ctrs_msc_init(); |
| 7424 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7425 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 7426 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7427 | |
| 7428 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7429 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7430 | } |
| 7431 | |
| 7432 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 7433 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7434 | * just as well using only RSL. */ |
| 7435 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 7436 | |
| 7437 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7438 | f_sleep(1.0); |
| 7439 | |
| 7440 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7441 | * would be randomly affected by which other tests ran before this. */ |
| 7442 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7443 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7444 | f_ctrs_msc_init(); |
| 7445 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7446 | var MSC_ConnHdlr vc_conn1; |
| 7447 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7448 | pars1.mscpool.rsl_idx := 0; |
| 7449 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7450 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7451 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7452 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7453 | |
| 7454 | var MSC_ConnHdlr vc_conn2; |
| 7455 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7456 | pars2.mscpool.rsl_idx := 1; |
| 7457 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7458 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7459 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7460 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7461 | |
| 7462 | /* Test round-robin wrap to the first MSC */ |
| 7463 | var MSC_ConnHdlr vc_conn3; |
| 7464 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7465 | pars3.mscpool.rsl_idx := 2; |
| 7466 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7467 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7468 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7469 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7470 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7471 | } |
| 7472 | |
| 7473 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 7474 | * (configured in osmo-bsc.cfg). */ |
| 7475 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7476 | * just as well using only RSL. */ |
| 7477 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 7478 | |
| 7479 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7480 | f_sleep(1.0); |
| 7481 | |
| 7482 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7483 | * would be randomly affected by which other tests ran before this. */ |
| 7484 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7485 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7486 | f_ctrs_msc_init(); |
| 7487 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7488 | var MSC_ConnHdlr vc_conn1; |
| 7489 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7490 | pars1.mscpool.rsl_idx := 0; |
| 7491 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7492 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7493 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7494 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7495 | |
| 7496 | var MSC_ConnHdlr vc_conn2; |
| 7497 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7498 | pars2.mscpool.rsl_idx := 1; |
| 7499 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7500 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7501 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7502 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7503 | |
| 7504 | /* Test round-robin wrap to the first MSC */ |
| 7505 | var MSC_ConnHdlr vc_conn3; |
| 7506 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7507 | pars3.mscpool.rsl_idx := 2; |
| 7508 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7509 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7510 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7511 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7512 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7513 | } |
| 7514 | |
| 7515 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 7516 | * (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 |
| 7517 | * NULL-NRI setting is stronger than that. */ |
| 7518 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7519 | * just as well using only RSL. */ |
| 7520 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 7521 | |
| 7522 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7523 | f_sleep(1.0); |
| 7524 | |
| 7525 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7526 | * would be randomly affected by which other tests ran before this. */ |
| 7527 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7528 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7529 | f_ctrs_msc_init(); |
| 7530 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7531 | var MSC_ConnHdlr vc_conn1; |
| 7532 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7533 | pars1.mscpool.rsl_idx := 0; |
| 7534 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7535 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7536 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7537 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7538 | |
| 7539 | var MSC_ConnHdlr vc_conn2; |
| 7540 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7541 | pars2.mscpool.rsl_idx := 1; |
| 7542 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7543 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7544 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7545 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7546 | |
| 7547 | /* Test round-robin wrap to the first MSC */ |
| 7548 | var MSC_ConnHdlr vc_conn3; |
| 7549 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7550 | pars3.mscpool.rsl_idx := 2; |
| 7551 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7552 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7553 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7554 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7555 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7556 | } |
| 7557 | |
| 7558 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 7559 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 7560 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7561 | * just as well using only RSL. */ |
| 7562 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 7563 | |
| 7564 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7565 | f_sleep(1.0); |
| 7566 | |
| 7567 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7568 | * would be randomly affected by which other tests ran before this. */ |
| 7569 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7570 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7571 | f_ctrs_msc_init(); |
| 7572 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7573 | var MSC_ConnHdlr vc_conn1; |
| 7574 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7575 | pars1.mscpool.rsl_idx := 0; |
| 7576 | /* An NRI that is not assigned to any MSC */ |
| 7577 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 7578 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7579 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7580 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7581 | |
| 7582 | var MSC_ConnHdlr vc_conn2; |
| 7583 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7584 | pars2.mscpool.rsl_idx := 1; |
| 7585 | /* An NRI that is not assigned to any MSC */ |
| 7586 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 7587 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7588 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7589 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7590 | |
| 7591 | /* Test round-robin wrap to the first MSC */ |
| 7592 | var MSC_ConnHdlr vc_conn3; |
| 7593 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7594 | pars3.mscpool.rsl_idx := 2; |
| 7595 | /* An NRI that is not assigned to any MSC */ |
| 7596 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 7597 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7598 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7599 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7600 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7601 | } |
| 7602 | |
| 7603 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 7604 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 7605 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7606 | * just as well using only RSL. */ |
| 7607 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 7608 | |
| 7609 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7610 | f_sleep(1.0); |
| 7611 | |
| 7612 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7613 | * would be randomly affected by which other tests ran before this. */ |
| 7614 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7615 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7616 | f_ctrs_msc_init(); |
| 7617 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7618 | var MSC_ConnHdlr vc_conn1; |
| 7619 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7620 | pars1.mscpool.rsl_idx := 0; |
| 7621 | /* An NRI that is assigned to an unconnected MSC */ |
| 7622 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7623 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7624 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7625 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7626 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7627 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7628 | |
| 7629 | var MSC_ConnHdlr vc_conn2; |
| 7630 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7631 | pars2.mscpool.rsl_idx := 1; |
| 7632 | /* An NRI that is assigned to an unconnected MSC */ |
| 7633 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 7634 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7635 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7636 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7637 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 7638 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7639 | |
| 7640 | /* Test round-robin wrap to the first MSC */ |
| 7641 | var MSC_ConnHdlr vc_conn3; |
| 7642 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7643 | pars3.mscpool.rsl_idx := 2; |
| 7644 | /* An NRI that is assigned to an unconnected MSC */ |
| 7645 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 7646 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7647 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7648 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7649 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7650 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7651 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7652 | } |
| 7653 | |
| 7654 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 7655 | * osmo-bsc.cfg). */ |
| 7656 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7657 | * just as well using only RSL. */ |
| 7658 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 7659 | |
| 7660 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7661 | f_sleep(1.0); |
| 7662 | |
| 7663 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 7664 | * this is not using round-robin. */ |
| 7665 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7666 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7667 | f_ctrs_msc_init(); |
| 7668 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7669 | var MSC_ConnHdlr vc_conn1; |
| 7670 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7671 | pars1.mscpool.rsl_idx := 0; |
| 7672 | /* An NRI of the second MSC's range (256-511) */ |
| 7673 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 7674 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7675 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7676 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7677 | |
| 7678 | var MSC_ConnHdlr vc_conn2; |
| 7679 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7680 | pars2.mscpool.rsl_idx := 1; |
| 7681 | /* An NRI of the second MSC's range (256-511) */ |
| 7682 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7683 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7684 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7685 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7686 | |
| 7687 | var MSC_ConnHdlr vc_conn3; |
| 7688 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7689 | pars3.mscpool.rsl_idx := 2; |
| 7690 | /* An NRI of the second MSC's range (256-511) */ |
| 7691 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 7692 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7693 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7694 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7695 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7696 | } |
| 7697 | |
| 7698 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 7699 | * while a round-robin remains unaffected by that. */ |
| 7700 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7701 | * just as well using only RSL. */ |
| 7702 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 7703 | |
| 7704 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7705 | f_sleep(1.0); |
| 7706 | |
| 7707 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 7708 | * this is not using round-robin. */ |
| 7709 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7710 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7711 | f_ctrs_msc_init(); |
| 7712 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7713 | var MSC_ConnHdlr vc_conn1; |
| 7714 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7715 | pars1.mscpool.rsl_idx := 0; |
| 7716 | /* An NRI of the third MSC's range (512-767) */ |
| 7717 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7718 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7719 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7720 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7721 | |
| 7722 | var MSC_ConnHdlr vc_conn2; |
| 7723 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7724 | pars2.mscpool.rsl_idx := 1; |
| 7725 | /* An NRI of the third MSC's range (512-767) */ |
| 7726 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 7727 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7728 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7729 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7730 | |
| 7731 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 7732 | var MSC_ConnHdlr vc_conn3; |
| 7733 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7734 | pars3.mscpool.rsl_idx := 2; |
| 7735 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 7736 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7737 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7738 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7739 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7740 | } |
| 7741 | |
| 7742 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 7743 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7744 | * just as well using only RSL. */ |
| 7745 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 7746 | |
| 7747 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7748 | f_sleep(1.0); |
| 7749 | |
| 7750 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 7751 | * instead, and hits msc 0. */ |
| 7752 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7753 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7754 | f_ctrs_msc_init(); |
| 7755 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7756 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 7757 | var MSC_ConnHdlr vc_conn1; |
| 7758 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7759 | pars1.mscpool.rsl_idx := 0; |
| 7760 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 7761 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7762 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7763 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7764 | |
| 7765 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 7766 | var MSC_ConnHdlr vc_conn2; |
| 7767 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7768 | pars2.mscpool.rsl_idx := 1; |
| 7769 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 7770 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7771 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7772 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7773 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7774 | } |
| 7775 | |
| 7776 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 7777 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7778 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 7779 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7780 | //cid_list := { cIl_allInBSS := ''O }; |
| 7781 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7782 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7783 | var BSSAP_N_UNITDATA_req paging; |
| 7784 | var hexstring imsi := '001010000000123'H; |
| 7785 | |
| 7786 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7787 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7788 | 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] | 7789 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 7790 | BSSAP.send(paging); |
| 7791 | |
| 7792 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7793 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7794 | * channel number is picked here. */ |
| 7795 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7796 | f_rslem_register(0, new_chan_nr); |
| 7797 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 7798 | f_rslem_unregister(0, new_chan_nr); |
| 7799 | |
| 7800 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 7801 | * 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] | 7802 | 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] | 7803 | f_sleep(1.0); |
| 7804 | } |
| 7805 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 7806 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7807 | f_sleep(1.0); |
| 7808 | |
| 7809 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7810 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7811 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7812 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7813 | f_ctrs_msc_init(); |
| 7814 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7815 | var MSC_ConnHdlr vc_conn1; |
| 7816 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7817 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7818 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7819 | 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] | 7820 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 7821 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7822 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7823 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7824 | } |
| 7825 | |
| 7826 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 7827 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7828 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 7829 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7830 | //cid_list := { cIl_allInBSS := ''O }; |
| 7831 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7832 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7833 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 7834 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7835 | var BSSAP_N_UNITDATA_req paging; |
| 7836 | |
| 7837 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7838 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7839 | 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] | 7840 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 7841 | BSSAP.send(paging); |
| 7842 | |
| 7843 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7844 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7845 | * channel number is picked here. */ |
| 7846 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7847 | f_rslem_register(0, new_chan_nr); |
| 7848 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 7849 | f_rslem_unregister(0, new_chan_nr); |
| 7850 | |
| 7851 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 7852 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 7853 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7854 | 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] | 7855 | f_sleep(1.0); |
| 7856 | } |
| 7857 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 7858 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7859 | f_sleep(1.0); |
| 7860 | |
| 7861 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7862 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7863 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 7864 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7865 | f_ctrs_msc_init(); |
| 7866 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7867 | var MSC_ConnHdlr vc_conn1; |
| 7868 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7869 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7870 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7871 | 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] | 7872 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 7873 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7874 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7875 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7876 | } |
| 7877 | |
| 7878 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 7879 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7880 | * just as well using only RSL. */ |
| 7881 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 7882 | |
| 7883 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7884 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7885 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7886 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7887 | |
| 7888 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7889 | * would be randomly affected by which other tests ran before this. */ |
| 7890 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7891 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7892 | f_ctrs_msc_init(); |
| 7893 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7894 | var MSC_ConnHdlr vc_conn1; |
| 7895 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7896 | pars1.mscpool.rsl_idx := 0; |
| 7897 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7898 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7899 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7900 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7901 | |
| 7902 | var MSC_ConnHdlr vc_conn2; |
| 7903 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7904 | pars2.mscpool.rsl_idx := 1; |
| 7905 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7906 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7907 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7908 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7909 | |
| 7910 | var MSC_ConnHdlr vc_conn3; |
| 7911 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7912 | pars3.mscpool.rsl_idx := 2; |
| 7913 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7914 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7915 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7916 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7917 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7918 | } |
| 7919 | |
| 7920 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 7921 | * TMSI NRI. */ |
| 7922 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 7923 | |
| 7924 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7925 | f_sleep(1.0); |
| 7926 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7927 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7928 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 7929 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7930 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7931 | * would be randomly affected by which other tests ran before this. */ |
| 7932 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7933 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7934 | f_ctrs_msc_init(); |
| 7935 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7936 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 7937 | var MSC_ConnHdlr vc_conn1; |
| 7938 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7939 | pars1.mscpool.rsl_idx := 0; |
| 7940 | /* An NRI of the second MSC's range (256-511) */ |
| 7941 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7942 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7943 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7944 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7945 | |
| 7946 | var MSC_ConnHdlr vc_conn2; |
| 7947 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7948 | pars2.mscpool.rsl_idx := 1; |
| 7949 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7950 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7951 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7952 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7953 | |
| 7954 | var MSC_ConnHdlr vc_conn3; |
| 7955 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7956 | pars3.mscpool.rsl_idx := 2; |
| 7957 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7958 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7959 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7960 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7961 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7962 | } |
| 7963 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7964 | /* Allow/Deny emergency calls globally via VTY */ |
| 7965 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 7966 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 7967 | if (allow) { |
| 7968 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 7969 | } else { |
| 7970 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 7971 | } |
| 7972 | f_vty_transceive(BSCVTY, "exit"); |
| 7973 | f_vty_transceive(BSCVTY, "exit"); |
| 7974 | } |
| 7975 | |
| 7976 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7977 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7978 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7979 | if (allow) { |
| 7980 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7981 | } else { |
| 7982 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7983 | } |
| 7984 | f_vty_transceive(BSCVTY, "exit"); |
| 7985 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7986 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7987 | } |
| 7988 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 7989 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 7990 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 7991 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7992 | if (allow) { |
| 7993 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 7994 | } else { |
| 7995 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 7996 | } |
| 7997 | f_vty_transceive(BSCVTY, "exit"); |
| 7998 | f_vty_transceive(BSCVTY, "exit"); |
| 7999 | f_vty_transceive(BSCVTY, "exit"); |
| 8000 | } |
| 8001 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 8002 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 8003 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 8004 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8005 | if (allow) { |
| 8006 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 8007 | } else { |
| 8008 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 8009 | } |
| 8010 | f_vty_transceive(BSCVTY, "exit"); |
| 8011 | f_vty_transceive(BSCVTY, "exit"); |
| 8012 | f_vty_transceive(BSCVTY, "exit"); |
| 8013 | } |
| 8014 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8015 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 8016 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 8017 | var PDU_ML3_MS_NW emerg_setup; |
| 8018 | var octetstring emerg_setup_enc; |
| 8019 | var RSL_Message emerg_setup_data_ind; |
| 8020 | |
| 8021 | f_establish_fully(omit, omit); |
| 8022 | |
| 8023 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 8024 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 8025 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 8026 | |
| 8027 | RSL.send(emerg_setup_data_ind); |
| 8028 | } |
| 8029 | |
| 8030 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 8031 | * CALLS are permitted by the BSC config. */ |
| 8032 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 8033 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8034 | var PDU_ML3_MS_NW emerg_setup; |
| 8035 | timer T := 3.0; |
| 8036 | |
| 8037 | f_assignment_emerg_setup() |
| 8038 | |
| 8039 | T.start; |
| 8040 | alt { |
| 8041 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 8042 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 8043 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 8044 | setverdict(fail, "no emergency setup"); |
| 8045 | } |
| 8046 | } |
| 8047 | [] BSSAP.receive { |
| 8048 | setverdict(fail, "unexpected BSSAP message!"); |
| 8049 | } |
| 8050 | [] T.timeout { |
| 8051 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 8052 | } |
| 8053 | } |
| 8054 | |
| 8055 | setverdict(pass); |
| 8056 | } |
| 8057 | |
| 8058 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 8059 | * forbidden by the BSC config. */ |
| 8060 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 8061 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8062 | timer T := 3.0; |
| 8063 | |
| 8064 | f_assignment_emerg_setup() |
| 8065 | |
| 8066 | T.start; |
| 8067 | alt { |
| 8068 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8069 | setverdict(pass); |
| 8070 | } |
| 8071 | [] RSL.receive { |
| 8072 | setverdict(fail, "unexpected RSL message!"); |
| 8073 | } |
| 8074 | [] T.timeout { |
| 8075 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 8076 | } |
| 8077 | } |
| 8078 | } |
| 8079 | |
| 8080 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 8081 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 8082 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8083 | var MSC_ConnHdlr vc_conn; |
| 8084 | |
| 8085 | f_init(1, true); |
| 8086 | f_sleep(1.0); |
| 8087 | |
| 8088 | f_vty_allow_emerg_msc(true); |
| 8089 | f_vty_allow_emerg_bts(true, 0); |
| 8090 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 8091 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8092 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8093 | } |
| 8094 | |
| 8095 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 8096 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 8097 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8098 | var MSC_ConnHdlr vc_conn; |
| 8099 | |
| 8100 | f_init(1, true); |
| 8101 | f_sleep(1.0); |
| 8102 | |
| 8103 | f_vty_allow_emerg_msc(false); |
| 8104 | f_vty_allow_emerg_bts(true, 0); |
| 8105 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8106 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8107 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8108 | } |
| 8109 | |
| 8110 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 8111 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 8112 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8113 | var MSC_ConnHdlr vc_conn; |
| 8114 | |
| 8115 | /* Note: This simulates a spec violation by the MS, correct MS |
| 8116 | * implementations would not try to establish an emergency call because |
| 8117 | * the system information tells in advance that emergency calls are |
| 8118 | * not forbidden */ |
| 8119 | |
| 8120 | f_init(1, true); |
| 8121 | f_sleep(1.0); |
| 8122 | |
| 8123 | f_vty_allow_emerg_msc(true); |
| 8124 | f_vty_allow_emerg_bts(false, 0); |
| 8125 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8126 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8127 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8128 | } |
| 8129 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8130 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 8131 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 8132 | * emergency call */ |
| 8133 | testcase TC_emerg_premption() runs on test_CT { |
| 8134 | var ASP_RSL_Unitdata rsl_ud; |
| 8135 | var integer i; |
| 8136 | var integer chreq_total, chreq_nochan; |
| 8137 | var RSL_Message rx_rsl; |
| 8138 | var RslChannelNr chan_nr; |
| 8139 | |
| 8140 | f_init(1); |
| 8141 | f_sleep(1.0); |
| 8142 | |
| 8143 | f_vty_allow_emerg_msc(true); |
| 8144 | f_vty_allow_emerg_bts(true, 0); |
| 8145 | |
| 8146 | /* Fill up all channels on the BTS */ |
| 8147 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 8148 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 8149 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 8150 | chan_nr := f_chreq_act_ack('33'O, i); |
| 8151 | } |
| 8152 | IPA_RSL[0].clear; |
| 8153 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 8154 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 8155 | |
| 8156 | /* Send Channel request for emegergency call */ |
| 8157 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 8158 | |
| 8159 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 8160 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 8161 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 8162 | |
| 8163 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 8164 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8165 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 8166 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 8167 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 8168 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8169 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8170 | } |
| 8171 | |
| 8172 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 8173 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8174 | private type record FHParamsTs { |
| 8175 | boolean enabled, |
| 8176 | uint6_t hsn, |
| 8177 | uint6_t maio, |
| 8178 | ArfcnList ma |
| 8179 | }; |
| 8180 | |
| 8181 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8182 | private type record FHParamsTrx { |
| 8183 | GsmArfcn arfcn, |
| 8184 | FHParamsTs ts[8] |
| 8185 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8186 | |
| 8187 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 8188 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 8189 | runs on test_CT return FHParamsTrx { |
| 8190 | var FHParamsTrx fhp; |
| 8191 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8192 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 8193 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8194 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8195 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 8196 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8197 | fhp.ts[tn].enabled := false; |
| 8198 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8199 | continue; |
| 8200 | } |
| 8201 | |
| 8202 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8203 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 8204 | fhp.ts[tn].maio := f_rnd_int(64); |
| 8205 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8206 | |
| 8207 | /* Random Mobile Allocation (hopping channels) */ |
| 8208 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 8209 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 8210 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8211 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8212 | } |
| 8213 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8214 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8215 | } |
| 8216 | |
| 8217 | log("f_TC_fh_params_gen(): ", fhp); |
| 8218 | return fhp; |
| 8219 | } |
| 8220 | |
| 8221 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 8222 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 8223 | { |
| 8224 | var template (present) ChannelDescription tr_cd; |
| 8225 | var template (present) MaioHsn tr_maio_hsn; |
| 8226 | var uint3_t tn := cd.chan_nr.tn; |
| 8227 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8228 | if (fhp.ts[tn].enabled) { |
| 8229 | 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] | 8230 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 8231 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8232 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8233 | } |
| 8234 | |
| 8235 | if (not match(cd, tr_cd)) { |
| 8236 | setverdict(fail, "Channel Description IE does not match: ", |
| 8237 | cd, " vs expected ", tr_cd); |
| 8238 | } |
| 8239 | } |
| 8240 | |
| 8241 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 8242 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8243 | in MobileAllocationLV ma) |
| 8244 | { |
| 8245 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 8246 | |
| 8247 | if (not match(ma, tr_ma)) { |
| 8248 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 8249 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 8250 | } else { |
| 8251 | setverdict(pass); |
| 8252 | } |
| 8253 | } |
| 8254 | |
| 8255 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8256 | in MobileAllocationLV ma) |
| 8257 | return template MobileAllocationLV { |
| 8258 | /* 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] | 8259 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8260 | return { len := 0, ma := ''B }; |
| 8261 | } |
| 8262 | |
| 8263 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 8264 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 8265 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8266 | |
| 8267 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8268 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 8269 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 8270 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8271 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8272 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8273 | } |
| 8274 | } |
| 8275 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8276 | /* Take ARFCN of the TRX itself into account */ |
| 8277 | full_mask[fhp.arfcn] := '1'B; |
| 8278 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8279 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8280 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8281 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8282 | } |
| 8283 | |
| 8284 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8285 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8286 | if (full_mask[i] != '1'B) |
| 8287 | { continue; } |
| 8288 | |
| 8289 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 8290 | if (slot_mask[i] == '1'B) { |
| 8291 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8292 | } else { |
| 8293 | ma_mask := ma_mask & '0'B; |
| 8294 | } |
| 8295 | } |
| 8296 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8297 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 8298 | if (full_mask[0] == '1'B) { |
| 8299 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 8300 | if (slot_mask[0] == '1'B) { |
| 8301 | ma_mask := ma_mask & '1'B; |
| 8302 | } else { |
| 8303 | ma_mask := ma_mask & '0'B; |
| 8304 | } |
| 8305 | } |
| 8306 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8307 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 8308 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8309 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 8310 | |
| 8311 | return { len := ma_mask_len, ma := ma_mask }; |
| 8312 | } |
| 8313 | |
| 8314 | /* Configure the hopping parameters in accordance with the given record */ |
| 8315 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 8316 | uint8_t bts_nr := 0, |
| 8317 | uint8_t trx_nr := 0) |
| 8318 | runs on test_CT { |
| 8319 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8320 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8321 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8322 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 8323 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8324 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8325 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8326 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8327 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8328 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8329 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8330 | continue; |
| 8331 | } |
| 8332 | |
| 8333 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8334 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 8335 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8336 | |
| 8337 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8338 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8339 | 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] | 8340 | } |
| 8341 | |
| 8342 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 8343 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8344 | } |
| 8345 | |
| 8346 | f_vty_transceive(BSCVTY, "end"); |
| 8347 | } |
| 8348 | |
| 8349 | /* Disable frequency hopping on all timeslots */ |
| 8350 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 8351 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8352 | uint8_t trx_nr := 0, |
| 8353 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8354 | runs on test_CT { |
| 8355 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8356 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8357 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8358 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 8359 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8360 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8361 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8362 | |
| 8363 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8364 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8365 | 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] | 8366 | } |
| 8367 | |
| 8368 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8369 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8370 | } |
| 8371 | |
| 8372 | f_vty_transceive(BSCVTY, "end"); |
| 8373 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8374 | } |
| 8375 | |
| 8376 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 8377 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 8378 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 8379 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8380 | var RSL_Message rsl_msg; |
| 8381 | var RSL_IE_Body ie; |
| 8382 | |
| 8383 | f_init_vty(); |
| 8384 | |
| 8385 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8386 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8387 | |
| 8388 | f_init(1); |
| 8389 | |
| 8390 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8391 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8392 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8393 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8394 | |
| 8395 | /* Make sure that Channel Identification IE is present */ |
| 8396 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 8397 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 8398 | continue; |
| 8399 | } |
| 8400 | |
| 8401 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8402 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 8403 | |
| 8404 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 8405 | if (ie.chan_ident.ma.v.len != 0) { |
| 8406 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 8407 | ie.chan_ident.ma, ", despite it shall be"); |
| 8408 | continue; |
| 8409 | } |
| 8410 | } |
| 8411 | |
| 8412 | /* Disable frequency hopping */ |
| 8413 | f_TC_fh_params_unset(fhp); |
| 8414 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8415 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8416 | } |
| 8417 | |
| 8418 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 8419 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 8420 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8421 | var RSL_Message rsl_msg; |
| 8422 | var RSL_IE_Body ie; |
| 8423 | |
| 8424 | f_init_vty(); |
| 8425 | |
| 8426 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8427 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8428 | |
| 8429 | f_init(1); |
| 8430 | |
| 8431 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8432 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8433 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8434 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8435 | |
| 8436 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8437 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 8438 | |
| 8439 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 8440 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 8441 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 8442 | continue; |
| 8443 | } |
| 8444 | |
| 8445 | /* Decode the actual Immediate Assignment message */ |
| 8446 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 8447 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 8448 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 8449 | continue; |
| 8450 | } |
| 8451 | |
| 8452 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8453 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 8454 | |
| 8455 | /* Make sure that the Mobile Allocation IE matches */ |
| 8456 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 8457 | rr_msg.payload.imm_ass.mobile_allocation); |
| 8458 | } |
| 8459 | |
| 8460 | /* Disable frequency hopping */ |
| 8461 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8462 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8463 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8464 | } |
| 8465 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8466 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 8467 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 8468 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8469 | var RSL_Message rsl_msg; |
| 8470 | var RSL_IE_Body ie; |
| 8471 | |
| 8472 | f_init_vty(); |
| 8473 | |
| 8474 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8475 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8476 | |
| 8477 | f_init(1); |
| 8478 | |
| 8479 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 8480 | vc_MGCP.stop; |
| 8481 | |
| 8482 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 8483 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 8484 | |
| 8485 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 8486 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 8487 | for (var integer i := 0; i < 3; i := i + 1) { |
| 8488 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 8489 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8490 | |
| 8491 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 8492 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 8493 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8494 | |
| 8495 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 8496 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8497 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8498 | |
| 8499 | /* Make sure that L3 Information IE is present */ |
| 8500 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8501 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8502 | continue; |
| 8503 | } |
| 8504 | |
| 8505 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 8506 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8507 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 8508 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 8509 | continue; |
| 8510 | } |
| 8511 | |
| 8512 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8513 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 8514 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8515 | |
| 8516 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 8517 | 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] | 8518 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8519 | continue; |
| 8520 | } |
| 8521 | |
| 8522 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 8523 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 8524 | if (chan_desc.h and ma_present) { |
| 8525 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8526 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 8527 | } else if (chan_desc.h and not ma_present) { |
| 8528 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8529 | continue; |
| 8530 | } else if (not chan_desc.h and ma_present) { |
| 8531 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 8532 | continue; |
| 8533 | } |
| 8534 | } |
| 8535 | |
| 8536 | /* Give the IUT some time to release all channels */ |
| 8537 | f_sleep(3.0); |
| 8538 | |
| 8539 | /* Disable frequency hopping */ |
| 8540 | f_TC_fh_params_unset(fhp); |
| 8541 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8542 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8543 | } |
| 8544 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8545 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 8546 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 8547 | runs on test_CT { |
| 8548 | var RSL_Message rsl_msg; |
| 8549 | var RSL_IE_Body ie; |
| 8550 | var DchanTuple dt; |
| 8551 | |
| 8552 | /* Establish a dedicated channel, so we can trigger handover */ |
| 8553 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8554 | |
| 8555 | /* Trigger handover from BTS0 to BTS1 */ |
| 8556 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 8557 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 8558 | |
| 8559 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 8560 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8561 | |
| 8562 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 8563 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8564 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8565 | |
| 8566 | /* Make sure that L3 Information IE is present */ |
| 8567 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8568 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8569 | return; |
| 8570 | } |
| 8571 | |
| 8572 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 8573 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8574 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 8575 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 8576 | return; |
| 8577 | } |
| 8578 | |
| 8579 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 8580 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 8581 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 8582 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 8583 | return; |
| 8584 | } |
| 8585 | |
| 8586 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8587 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8588 | |
| 8589 | /* Make sure that Cell Channel Description IE is present */ |
| 8590 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 8591 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 8592 | return; |
| 8593 | } |
| 8594 | |
| 8595 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 8596 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 8597 | if (ma_present) { |
| 8598 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8599 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 8600 | } else { |
| 8601 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8602 | return; |
| 8603 | } |
| 8604 | } |
| 8605 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 8606 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8607 | |
| 8608 | f_init_vty(); |
| 8609 | |
| 8610 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 8611 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8612 | |
| 8613 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8614 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8615 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8616 | |
| 8617 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8618 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 8619 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8620 | |
| 8621 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 8622 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 8623 | |
| 8624 | f_init(2); |
| 8625 | |
| 8626 | f_TC_fh_params_handover_cmd(fhp); |
| 8627 | |
| 8628 | /* Disable frequency hopping on BTS1 */ |
| 8629 | f_TC_fh_params_unset(fhp, 1); |
| 8630 | |
| 8631 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 8632 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8633 | |
| 8634 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8635 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 8636 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8637 | |
| 8638 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8639 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8640 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8641 | |
| 8642 | f_shutdown_helper(); |
| 8643 | } |
| 8644 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8645 | /* Verify the hopping parameters in System Information Type 4 */ |
| 8646 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 8647 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 8648 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 8649 | timer T := 5.0; |
| 8650 | |
| 8651 | f_init_vty(); |
| 8652 | |
| 8653 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 8654 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8655 | |
| 8656 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8657 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8658 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8659 | |
| 8660 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8661 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 8662 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8663 | |
| 8664 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8665 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8666 | |
| 8667 | f_init(1); |
| 8668 | |
| 8669 | T.start; |
| 8670 | alt { |
| 8671 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 8672 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 8673 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 8674 | |
| 8675 | /* Make sure that what we decoded is System Information Type 4 */ |
| 8676 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 8677 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 8678 | repeat; |
| 8679 | } |
| 8680 | |
| 8681 | /* Make sure that CBCH Channel Description IE is present */ |
| 8682 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 8683 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 8684 | break; |
| 8685 | } |
| 8686 | |
| 8687 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 8688 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 8689 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8690 | |
| 8691 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 8692 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 8693 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8694 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8695 | break; |
| 8696 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8697 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8698 | si.payload.si4.cbch_mobile_alloc.v); |
| 8699 | } |
| 8700 | } |
| 8701 | [] IPA_RSL[0].receive { repeat; } |
| 8702 | [] T.timeout { |
| 8703 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 8704 | } |
| 8705 | } |
| 8706 | |
| 8707 | /* Disable frequency hopping */ |
| 8708 | f_TC_fh_params_unset(fhp); |
| 8709 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8710 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8711 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8712 | |
| 8713 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8714 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8715 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8716 | |
| 8717 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8718 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8719 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8720 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8721 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8722 | } |
| 8723 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8724 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 8725 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 8726 | |
| 8727 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 8728 | template (present) BSSLAP_PDU expect_bsslap) |
| 8729 | { |
| 8730 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 8731 | if (not match(bsslap, expect_bsslap)) { |
| 8732 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 8733 | log("GOT BSSLAP: ", bsslap); |
| 8734 | setverdict(fail, "BSSLAP is not as expected"); |
| 8735 | mtc.stop; |
| 8736 | } |
| 8737 | setverdict(pass); |
| 8738 | } |
| 8739 | |
| 8740 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 8741 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 8742 | |
| 8743 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 8744 | var PDU_BSSAP_LE rx_bsslap; |
| 8745 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 8746 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 8747 | } |
| 8748 | |
| 8749 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8750 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 8751 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 8752 | f_sleep(1.0); |
| 8753 | |
| 8754 | f_establish_fully(omit, omit); |
| 8755 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8756 | |
| 8757 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8758 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8759 | |
| 8760 | var PDU_BSSAP_LE plr; |
| 8761 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8762 | |
| 8763 | if (not do_ta_request) { |
| 8764 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 8765 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 8766 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 8767 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 8768 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 8769 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 8770 | mtc.stop; |
| 8771 | } |
| 8772 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 8773 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 8774 | if (not match(bsslap, expect_ta_layer3)) { |
| 8775 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 8776 | log("GOT BSSLAP: ", bsslap); |
| 8777 | setverdict(fail, "BSSLAP is not as expected"); |
| 8778 | mtc.stop; |
| 8779 | } |
| 8780 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 8781 | * has no need to request the TA from the BSC and directly responds. */ |
| 8782 | } else { |
| 8783 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8784 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8785 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8786 | } |
| 8787 | |
| 8788 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8789 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8790 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8791 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8792 | |
| 8793 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 8794 | f_mo_l3_transceive(); |
| 8795 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8796 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8797 | |
| 8798 | f_sleep(2.0); |
| 8799 | setverdict(pass); |
| 8800 | } |
| 8801 | |
| 8802 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8803 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 8804 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 8805 | f_lcs_loc_req_for_active_ms(false); |
| 8806 | } |
| 8807 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 8808 | var MSC_ConnHdlr vc_conn; |
| 8809 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8810 | |
| 8811 | f_init(1, true); |
| 8812 | f_sleep(1.0); |
| 8813 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 8814 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8815 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8816 | } |
| 8817 | |
| 8818 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8819 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 8820 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 8821 | f_lcs_loc_req_for_active_ms(true); |
| 8822 | } |
| 8823 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 8824 | var MSC_ConnHdlr vc_conn; |
| 8825 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8826 | |
| 8827 | f_init(1, true); |
| 8828 | f_sleep(1.0); |
| 8829 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 8830 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8831 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8832 | } |
| 8833 | |
| 8834 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 8835 | * conn without an active lchan. */ |
| 8836 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 8837 | { |
| 8838 | var BssmapCause cause := 0; |
| 8839 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 8840 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 8841 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8842 | |
| 8843 | timer no_more_bssap := 5.0; |
| 8844 | no_more_bssap.start; |
| 8845 | alt { |
| 8846 | [] no_more_bssap.timeout { break; } |
| 8847 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 8848 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 8849 | mtc.stop; |
| 8850 | } |
| 8851 | } |
| 8852 | setverdict(pass); |
| 8853 | } |
| 8854 | |
| 8855 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 8856 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 8857 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 8858 | { |
| 8859 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 8860 | |
| 8861 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 8862 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 8863 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 8864 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8865 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8866 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 8867 | |
| 8868 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 8869 | f_clear_A_conn(); |
| 8870 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8871 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8872 | } |
| 8873 | |
| 8874 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8875 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 8876 | */ |
| 8877 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 8878 | f_sleep(1.0); |
| 8879 | |
| 8880 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8881 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8882 | |
| 8883 | /* Register to receive the Paging Command */ |
| 8884 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8885 | g_chan_nr := new_chan_nr; |
| 8886 | f_rslem_register(0, g_chan_nr); |
| 8887 | |
| 8888 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8889 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8890 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8891 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8892 | |
| 8893 | var PDU_BSSAP_LE plr; |
| 8894 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8895 | |
| 8896 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8897 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8898 | |
| 8899 | /* OsmoBSC needs to Page */ |
| 8900 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 8901 | f_logp(BSCVTY, "got Paging Command"); |
| 8902 | |
| 8903 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 8904 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8905 | 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); |
| 8906 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8907 | |
| 8908 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 8909 | |
| 8910 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8911 | |
| 8912 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8913 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8914 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8915 | |
| 8916 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8917 | |
| 8918 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 8919 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 8920 | f_verify_active_A_conn_and_clear(); |
| 8921 | |
| 8922 | f_sleep(2.0); |
| 8923 | setverdict(pass); |
| 8924 | } |
| 8925 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 8926 | var MSC_ConnHdlr vc_conn; |
| 8927 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8928 | |
| 8929 | f_init(1, true); |
| 8930 | f_sleep(1.0); |
| 8931 | |
| 8932 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8933 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8934 | |
| 8935 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 8936 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8937 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8938 | } |
| 8939 | |
| 8940 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 8941 | */ |
| 8942 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 8943 | f_sleep(1.0); |
| 8944 | |
| 8945 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8946 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8947 | |
| 8948 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 8949 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8950 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 8951 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 8952 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8953 | |
| 8954 | /* BSC tells MSC about failure */ |
| 8955 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8956 | locationEstimate := omit, positioningData := omit, |
| 8957 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 8958 | |
| 8959 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8960 | f_verify_active_A_conn_and_clear(); |
| 8961 | |
| 8962 | f_sleep(2.0); |
| 8963 | setverdict(pass); |
| 8964 | } |
| 8965 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 8966 | var MSC_ConnHdlr vc_conn; |
| 8967 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8968 | |
| 8969 | f_init(1, true); |
| 8970 | f_sleep(1.0); |
| 8971 | |
| 8972 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8973 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8974 | |
| 8975 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 8976 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8977 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8978 | } |
| 8979 | |
| 8980 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8981 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 8982 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 8983 | f_sleep(1.0); |
| 8984 | |
| 8985 | f_establish_fully(omit, omit); |
| 8986 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8987 | |
| 8988 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8989 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8990 | |
| 8991 | var PDU_BSSAP_LE plr; |
| 8992 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8993 | |
| 8994 | if (do_ta) { |
| 8995 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8996 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8997 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8998 | } |
| 8999 | |
| 9000 | /* SMLC fails to respond, BSC runs into timeout */ |
| 9001 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 9002 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9003 | |
| 9004 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9005 | locationEstimate := omit, positioningData := omit, |
| 9006 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 9007 | |
| 9008 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9009 | f_verify_active_A_conn_and_clear(); |
| 9010 | |
| 9011 | f_sleep(2.0); |
| 9012 | setverdict(pass); |
| 9013 | } |
| 9014 | |
| 9015 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9016 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 9017 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 9018 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 9019 | } |
| 9020 | |
| 9021 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 9022 | var MSC_ConnHdlr vc_conn; |
| 9023 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9024 | |
| 9025 | f_init(1, true); |
| 9026 | f_sleep(1.0); |
| 9027 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 9028 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9029 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9030 | } |
| 9031 | |
| 9032 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9033 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 9034 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 9035 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 9036 | } |
| 9037 | |
| 9038 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 9039 | var MSC_ConnHdlr vc_conn; |
| 9040 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9041 | |
| 9042 | f_init(1, true); |
| 9043 | f_sleep(1.0); |
| 9044 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 9045 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9046 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9047 | } |
| 9048 | |
| 9049 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 9050 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 9051 | f_sleep(1.0); |
| 9052 | |
| 9053 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9054 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9055 | |
| 9056 | /* Register to receive the Paging Command */ |
| 9057 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9058 | g_chan_nr := new_chan_nr; |
| 9059 | f_rslem_register(0, g_chan_nr); |
| 9060 | |
| 9061 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9062 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9063 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9064 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9065 | |
| 9066 | var PDU_BSSAP_LE plr; |
| 9067 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9068 | |
| 9069 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9070 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9071 | |
| 9072 | /* OsmoBSC needs to Page */ |
| 9073 | var PDU_BSSAP_LE rx_bsslap; |
| 9074 | alt { |
| 9075 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 9076 | f_logp(BSCVTY, "got Paging Command"); |
| 9077 | repeat; |
| 9078 | } |
| 9079 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9080 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 9081 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 9082 | } |
| 9083 | } |
| 9084 | |
| 9085 | /* SMLC responds with failure */ |
| 9086 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9087 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9088 | |
| 9089 | /* BSC tells MSC about failure */ |
| 9090 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9091 | locationEstimate := omit, positioningData := omit, |
| 9092 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 9093 | |
| 9094 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9095 | f_verify_active_A_conn_and_clear(); |
| 9096 | |
| 9097 | f_sleep(2.0); |
| 9098 | setverdict(pass); |
| 9099 | } |
| 9100 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 9101 | var MSC_ConnHdlr vc_conn; |
| 9102 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9103 | |
| 9104 | f_init(1, true); |
| 9105 | f_sleep(1.0); |
| 9106 | |
| 9107 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9108 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9109 | |
| 9110 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 9111 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9112 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9113 | } |
| 9114 | |
| 9115 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 9116 | * over. */ |
| 9117 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9118 | f_sleep(1.0); |
| 9119 | |
| 9120 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9121 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9122 | |
| 9123 | /* Register to receive the Paging Command */ |
| 9124 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9125 | g_chan_nr := new_chan_nr; |
| 9126 | f_rslem_register(0, g_chan_nr); |
| 9127 | |
| 9128 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9129 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9130 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9131 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9132 | |
| 9133 | var PDU_BSSAP_LE plr; |
| 9134 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9135 | |
| 9136 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 9137 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9138 | 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] | 9139 | do_clear := false, expect_bssmap_l3 := true); |
| 9140 | |
| 9141 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9142 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9143 | |
| 9144 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 9145 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9146 | |
| 9147 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9148 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9149 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9150 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9151 | |
| 9152 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 9153 | f_mo_l3_transceive(); |
| 9154 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9155 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9156 | |
| 9157 | f_sleep(2.0); |
| 9158 | setverdict(pass); |
| 9159 | } |
| 9160 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 9161 | var MSC_ConnHdlr vc_conn; |
| 9162 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9163 | |
| 9164 | f_init(1, true); |
| 9165 | f_sleep(1.0); |
| 9166 | |
| 9167 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9168 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9169 | |
| 9170 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 9171 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9172 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9173 | } |
| 9174 | |
| 9175 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 9176 | * the new lchan after handover. */ |
| 9177 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9178 | f_sleep(1.0); |
| 9179 | |
| 9180 | f_establish_fully(omit, omit); |
| 9181 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9182 | |
| 9183 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9184 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9185 | |
| 9186 | var PDU_BSSAP_LE plr; |
| 9187 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9188 | |
| 9189 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 9190 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 9191 | |
| 9192 | var HandoverState hs := { |
| 9193 | rr_ho_cmpl_seen := false, |
| 9194 | handover_done := false, |
| 9195 | old_chan_nr := - |
| 9196 | }; |
| 9197 | /* issue hand-over command on VTY */ |
| 9198 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 9199 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 9200 | f_rslem_suspend(RSL1_PROC); |
| 9201 | |
| 9202 | /* From the MGW perspective, a handover is is characterized by |
| 9203 | * performing one MDCX operation with the MGW. So we expect to see |
| 9204 | * one more MDCX during handover. */ |
| 9205 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 9206 | |
| 9207 | alt { |
| 9208 | [] as_handover(hs); |
| 9209 | } |
| 9210 | |
| 9211 | var PDU_BSSAP_LE rx_bsslap; |
| 9212 | |
| 9213 | interleave { |
| 9214 | /* Expect the BSC to inform the MSC about the handover */ |
| 9215 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 9216 | |
| 9217 | /* Expect the BSC to inform the SMLC about the handover */ |
| 9218 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9219 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 9220 | } |
| 9221 | } |
| 9222 | |
| 9223 | /* SMLC now responds with geo information data. */ |
| 9224 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9225 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9226 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9227 | |
| 9228 | /* lchan still active */ |
| 9229 | f_mo_l3_transceive(RSL1); |
| 9230 | |
| 9231 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9232 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9233 | |
| 9234 | f_sleep(2.0); |
| 9235 | setverdict(pass); |
| 9236 | } |
| 9237 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 9238 | var MSC_ConnHdlr vc_conn; |
| 9239 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9240 | |
| 9241 | f_init(2, true); |
| 9242 | f_sleep(1.0); |
| 9243 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 9244 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9245 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9246 | } |
| 9247 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9248 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 9249 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 9250 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9251 | |
| 9252 | /* Also disable attach for the single connected MSC */ |
| 9253 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 9254 | |
| 9255 | 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) )); |
| 9256 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 9257 | |
| 9258 | /* No MSC is found, expecting a proper release on RSL */ |
| 9259 | interleave { |
| 9260 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 9261 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 9262 | } |
| 9263 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9264 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 9265 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9266 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9267 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 9268 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9269 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9270 | } |
| 9271 | } |
| 9272 | setverdict(pass); |
| 9273 | } |
| 9274 | testcase TC_no_msc() runs on test_CT { |
| 9275 | |
| 9276 | f_init(1, true); |
| 9277 | f_sleep(1.0); |
| 9278 | var MSC_ConnHdlr vc_conn; |
| 9279 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9280 | |
| 9281 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 9282 | |
| 9283 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 9284 | vc_conn.done; |
| 9285 | |
| 9286 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 9287 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9288 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9289 | } |
| 9290 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 9291 | /* Dyn PDCH todo: |
| 9292 | * activate OSMO as TCH/F |
| 9293 | * activate OSMO as TCH/H |
| 9294 | * does the BSC-located PCU socket get the updated INFO? |
| 9295 | * what if no PCU is connected at the time? |
| 9296 | * is the info correct on delayed PCU (re)connect? |
| 9297 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 9298 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9299 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 9300 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 9301 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 9302 | |
| 9303 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 9304 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9305 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 9306 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 9307 | g_pars.ass_codec_list.codecElements[0]; |
| 9308 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 9309 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 9310 | g_pars.expect_mr_s0_s7; |
| 9311 | } |
| 9312 | } |
| 9313 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 9314 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 9315 | log("expecting ASS COMPL like this: ", exp_compl); |
| 9316 | |
| 9317 | f_establish_fully(ass_cmd, exp_compl); |
| 9318 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 9319 | 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] | 9320 | |
| 9321 | var RSL_Message rsl; |
| 9322 | |
| 9323 | timer T := 5.0; |
| 9324 | T.start; |
| 9325 | alt { |
| 9326 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 9327 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 9328 | log("Rx L3 from net: ", l3); |
| 9329 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 9330 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9331 | mtc.stop; |
| 9332 | } |
| 9333 | } |
| 9334 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 9335 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9336 | mtc.stop; |
| 9337 | } |
| 9338 | [] T.timeout { |
| 9339 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 9340 | setverdict(pass); |
| 9341 | } |
| 9342 | } |
| 9343 | T.stop; |
| 9344 | } |
| 9345 | |
| 9346 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 9347 | * osmo-bsc. */ |
| 9348 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 9349 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9350 | var MSC_ConnHdlr vc_conn; |
| 9351 | |
| 9352 | f_init(1, true); |
| 9353 | f_sleep(1.0); |
| 9354 | |
| 9355 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9356 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 9357 | vc_conn.done; |
| 9358 | f_shutdown_helper(); |
| 9359 | } |
| 9360 | |
| 9361 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 9362 | */ |
| 9363 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 9364 | f_init_vty(); |
| 9365 | |
| 9366 | f_init(1, false); |
| 9367 | f_sleep(1.0); |
| 9368 | |
| 9369 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 9370 | |
| 9371 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9372 | timer T := 5.0; |
| 9373 | |
| 9374 | T.start; |
| 9375 | alt { |
| 9376 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 9377 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 9378 | T.stop; |
| 9379 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 9380 | mtc.stop; |
| 9381 | } |
| 9382 | repeat; |
| 9383 | } |
| 9384 | [] T.timeout { |
| 9385 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 9386 | setverdict(pass); |
| 9387 | } |
| 9388 | } |
| 9389 | } |
| 9390 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9391 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 9392 | /* First fully set up a speech lchan */ |
| 9393 | f_TC_assignment_codec(id); |
| 9394 | |
| 9395 | /* Trigger re-assignment to another lchan */ |
| 9396 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 9397 | |
| 9398 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 9399 | * one MDCX on MGCP. */ |
| 9400 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 9401 | |
| 9402 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 9403 | * as the old lchan used. */ |
| 9404 | g_media.bts.ipa_crcx_seen := false; |
| 9405 | g_media.bts.ipa_mdcx_seen := false; |
| 9406 | |
| 9407 | /* Send different BTS side RTP port number for the new lchan */ |
| 9408 | g_media.bts.bts.port_nr := 4223; |
| 9409 | |
| 9410 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 9411 | |
| 9412 | /* Trigger re-assignment. */ |
| 9413 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 9414 | |
| 9415 | timer T := 5.0; |
| 9416 | T.start; |
| 9417 | alt { |
| 9418 | [] as_assignment(assignment_st); |
| 9419 | [] as_Media(); |
| 9420 | [] T.timeout { |
| 9421 | break; |
| 9422 | } |
| 9423 | } |
| 9424 | |
| 9425 | if (not assignment_st.assignment_done) { |
| 9426 | setverdict(fail, "Assignment did not complete"); |
| 9427 | mtc.stop; |
| 9428 | } |
| 9429 | |
| 9430 | f_check_mgcp_expectations() |
| 9431 | setverdict(pass); |
| 9432 | |
| 9433 | f_sleep(2.0); |
| 9434 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 9435 | |
| 9436 | /* Instruct BSC to clear channel */ |
| 9437 | var BssmapCause cause := 0; |
| 9438 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9439 | interleave { |
| 9440 | [] MGCP.receive(tr_DLCX) {} |
| 9441 | [] MGCP.receive(tr_DLCX) {} |
| 9442 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 9443 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9444 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9445 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9446 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9447 | } |
| 9448 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 9449 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9450 | } |
| 9451 | } |
| 9452 | |
| 9453 | f_sleep(0.5); |
| 9454 | } |
| 9455 | |
| 9456 | testcase TC_reassignment_fr() runs on test_CT { |
| 9457 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9458 | var MSC_ConnHdlr vc_conn; |
| 9459 | |
| 9460 | f_init(1, true); |
| 9461 | f_sleep(1.0); |
| 9462 | |
| 9463 | f_ctrs_bsc_and_bts_init(); |
| 9464 | |
| 9465 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9466 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 9467 | vc_conn.done; |
| 9468 | |
| 9469 | /* from f_establish_fully() */ |
| 9470 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9471 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9472 | /* from re-assignment */ |
| 9473 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9474 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9475 | f_ctrs_bsc_and_bts_verify(); |
| 9476 | f_shutdown_helper(); |
| 9477 | } |
| 9478 | |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9479 | const charstring REEST_LOST_CONNECTION := "REEST_LOST_CONNECTION"; |
| 9480 | const charstring REEST_CLEAR := "REEST_CLEAR"; |
| 9481 | const charstring REEST_CLEAR_DONE := "REEST_CLEAR_DONE"; |
| 9482 | |
| 9483 | /* CM Re-Establishment, 3GPP TS 24.008 4.5.1.6. |
| 9484 | * The MS <-> BTS loses radio connection, MS shows up on second BTS and asks for CM Re-Establishment. |
| 9485 | * BSC should establish a separate A conn for the same MS, the original A conn is then cleared by |
| 9486 | * the MSC as the CM Re-Establishment is handled. |
| 9487 | * |
| 9488 | * MS bts0 bts1 bsc msc test-component |
| 9489 | * |<----->|<----------------->|<-0-->| _1 Establish channel on bts 0 |
| 9490 | * | | _1 wait a bit, to settle down |
| 9491 | * |<-x x--| | _1 "lose connection" |
| 9492 | * | | REEST_LOST_CONNECTION |
| 9493 | * |----------------->|------->|--1-->| _2 new A-conn: Chan Rqd, Imm Ass, Compl L3 with CM Re-Establishment Req |
| 9494 | * | | REEST_CLEAR |
| 9495 | * | |<-0---| _1 Clear Command on first A-conn |
| 9496 | * | |--0-->| _1 Clear Complete |
| 9497 | * | |<----------------->| | _1 Release first channel |
| 9498 | * | | REEST_CLEAR_DONE |
| 9499 | * |<-----------------|<-------|<-1---| _2 Chan Activ, Assignment Command |
| 9500 | * |<-----------------|<-------|<-1---| _2 Clear Command, Release |
| 9501 | * |
| 9502 | */ |
| 9503 | private function f_tc_cm_reestablishment_1(charstring id) runs on MSC_ConnHdlr { |
| 9504 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 9505 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9506 | |
| 9507 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 9508 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9509 | |
| 9510 | f_establish_fully(ass_cmd, exp_compl); |
| 9511 | |
| 9512 | /* The original channel loses connection, MS attemts CM Re-Establishment on another cell, see |
| 9513 | * f_tc_cm_reestablishment_2(). This established channel stays active until MSC sends a Clear Command. The time |
| 9514 | * when exactly that happens is determined by f_tc_cm_reestablishment_2(). */ |
| 9515 | f_sleep(2.0); |
| 9516 | COORD.send(REEST_LOST_CONNECTION); |
| 9517 | |
| 9518 | alt { |
| 9519 | [] COORD.receive(REEST_CLEAR); |
| 9520 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9521 | setverdict(fail, "Unexpected channel release"); |
| 9522 | mtc.stop; |
| 9523 | } |
| 9524 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 9525 | setverdict(fail, "Unexpected channel release"); |
| 9526 | mtc.stop; |
| 9527 | } |
| 9528 | } |
| 9529 | f_perform_clear() |
| 9530 | f_expect_dlcx_conns(); |
| 9531 | COORD.send(REEST_CLEAR_DONE); |
| 9532 | } |
| 9533 | |
| 9534 | private function f_tc_cm_reestablishment_2(charstring id) runs on MSC_ConnHdlr { |
| 9535 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 9536 | |
| 9537 | /* The MS lost the connection on the first channel, now establishes another one */ |
| 9538 | COORD.receive(REEST_LOST_CONNECTION); |
| 9539 | |
| 9540 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 9541 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REESTABL_REQ(mi)); |
| 9542 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 9543 | |
| 9544 | f_create_bssmap_exp(l3_enc); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9545 | 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] | 9546 | BSSAP.receive(tr_BSSMAP_ComplL3(l3_enc)); |
| 9547 | |
| 9548 | /* MSC got the CM Re-Establishment request and first off clears the previous conn. */ |
| 9549 | COORD.send(REEST_CLEAR); |
| 9550 | COORD.receive(REEST_CLEAR_DONE); |
| 9551 | |
| 9552 | f_sleep(2.0); |
| 9553 | |
| 9554 | /* Answer the CM Re-Establishment with an Assignment Command. */ |
| 9555 | var template PDU_BSSAP expect_assignment_compl := f_gen_exp_compl(); |
| 9556 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9557 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 9558 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9559 | |
| 9560 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
| 9561 | st.voice_call := true; |
| 9562 | st.is_assignment := true; |
| 9563 | |
| 9564 | var ExpectCriteria mgcpcrit := { |
| 9565 | connid := omit, |
| 9566 | endpoint := omit, |
| 9567 | transid := omit |
| 9568 | }; |
| 9569 | f_create_mgcp_expect(mgcpcrit); |
| 9570 | |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9571 | f_rslem_dchan_queue_enable(RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9572 | |
| 9573 | BSSAP.send(ass_cmd); |
| 9574 | |
| 9575 | var PDU_BSSAP bssap; |
| 9576 | |
| 9577 | alt { |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9578 | [] as_assignment(st, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
| 9579 | [] as_Media_ipacc(RSL1, RSL2); |
| 9580 | [] as_Media_mgw(); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9581 | [st.assignment_done] BSSAP.receive(expect_assignment_compl) { |
| 9582 | break; |
| 9583 | } |
| 9584 | } |
| 9585 | |
| 9586 | f_sleep(3.0); |
| 9587 | |
| 9588 | f_logp(BSCVTY, "f_tc_cm_reestablishment_2 clearing"); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9589 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9590 | f_expect_dlcx_conns(); |
| 9591 | } |
| 9592 | |
| 9593 | testcase TC_cm_reestablishment() runs on test_CT { |
| 9594 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 9595 | var MSC_ConnHdlr vc_conn1; |
| 9596 | |
| 9597 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 9598 | var MSC_ConnHdlr vc_conn2; |
| 9599 | pars2.imsi := pars1.imsi; |
| 9600 | pars2.media_nr := 2; |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9601 | /* f_tc_cm_reestablishment_2 uses 'bts 1'. |
| 9602 | * BTS 1 has BSIC 11 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 3 */ |
| 9603 | pars2.expect_tsc := 3; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9604 | |
| 9605 | f_init(2, true, guard_timeout := 40.0); |
| 9606 | f_sleep(1.0); |
| 9607 | |
| 9608 | vc_conn1 := f_start_handler_create(pars1); |
| 9609 | vc_conn2 := f_start_handler_create(pars2); |
| 9610 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 9611 | f_start_handler_run(vc_conn1, refers(f_tc_cm_reestablishment_1), pars1); |
| 9612 | f_start_handler_run(vc_conn2, refers(f_tc_cm_reestablishment_2), pars2); |
| 9613 | vc_conn1.done; |
| 9614 | vc_conn2.done; |
| 9615 | |
| 9616 | f_shutdown_helper(); |
| 9617 | } |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9618 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9619 | function f_exp_ipa_rx_nonfatal(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, |
| 9620 | IpaStreamId sid := IPAC_PROTO_RSL_TRX0, boolean ignore_other_rx := true) |
| 9621 | runs on test_CT return template (omit) RSL_Message { |
| 9622 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9623 | timer T := t_secs; |
| 9624 | |
| 9625 | T.start; |
| 9626 | alt { |
| 9627 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
| 9628 | T.stop; |
| 9629 | } |
| 9630 | [ignore_other_rx] IPA_RSL[bts_nr].receive { repeat; } |
| 9631 | [not ignore_other_rx] IPA_RSL[bts_nr].receive { |
| 9632 | log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx); |
| 9633 | T.stop; |
| 9634 | return omit; |
| 9635 | } |
| 9636 | [] T.timeout { |
| 9637 | return omit; |
| 9638 | } |
| 9639 | } |
| 9640 | return rx_rsl_ud.rsl; |
| 9641 | } |
| 9642 | |
| 9643 | private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") { |
| 9644 | f_vty_enter_cfg_bts(pt, bts_nr); |
| 9645 | f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting); |
| 9646 | f_vty_transceive(pt, "exit"); |
| 9647 | f_vty_transceive(pt, "exit"); |
| 9648 | f_vty_transceive(pt, "exit"); |
| 9649 | } |
| 9650 | |
| 9651 | 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] | 9652 | template RslChannelNr chan_nr := ?, |
| 9653 | template (present) uint12_t arfcn := ?, |
| 9654 | template (present) uint3_t tsc := ?) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9655 | { |
| 9656 | var RSL_IE_Body full_imm_ass_info; |
| 9657 | if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) { |
| 9658 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 9659 | mtc.stop; |
| 9660 | } |
| 9661 | |
| 9662 | var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload); |
| 9663 | var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra, |
| 9664 | fn := fn, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9665 | ch_desc := tr_ChanDescH0(chan_nr, arfcn, tsc), |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9666 | page_mode := ?); |
| 9667 | if (not match(rr_imm_ass, expect_imm_ass)) { |
| 9668 | log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass); |
| 9669 | setverdict(fail, "Failed to match Immediate Assignment"); |
| 9670 | mtc.stop; |
| 9671 | } |
| 9672 | } |
| 9673 | |
| 9674 | testcase TC_imm_ass_post_chan_ack() runs on test_CT { |
| 9675 | var RSL_Message chan_act; |
| 9676 | var RSL_Message imm_ass; |
| 9677 | |
| 9678 | f_init(1, false); |
| 9679 | f_sleep(1.0); |
| 9680 | |
| 9681 | /* (should be the default anyway, just to make things clear) */ |
| 9682 | f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack"); |
| 9683 | |
| 9684 | /* RA containing reason=LU */ |
| 9685 | var GsmFrameNumber fn := 2342; |
| 9686 | var uint8_t ra := 2; |
| 9687 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9688 | |
| 9689 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9690 | |
| 9691 | /* First send the Chan Act ACK */ |
| 9692 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9693 | var RSL_IE_Body chan_ident_ie; |
| 9694 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9695 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9696 | mtc.stop; |
| 9697 | } |
| 9698 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9699 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10)); |
| 9700 | |
| 9701 | /* Then expect the Immediate Assignment, after we ACKed the chan act */ |
| 9702 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 9703 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9704 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9705 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9706 | |
| 9707 | /* Check that the lchan is working */ |
| 9708 | var octetstring l3 := '00010203040506'O; |
| 9709 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9710 | |
| 9711 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9712 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9713 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9714 | |
| 9715 | f_sleep(1.0); |
| 9716 | f_shutdown_helper(); |
| 9717 | } |
| 9718 | |
| 9719 | testcase TC_imm_ass_pre_chan_ack() runs on test_CT { |
| 9720 | var RSL_Message chan_act; |
| 9721 | var RSL_Message imm_ass; |
| 9722 | |
| 9723 | f_init(1, false); |
| 9724 | f_sleep(1.0); |
| 9725 | |
| 9726 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 9727 | |
| 9728 | /* RA containing reason=LU */ |
| 9729 | var GsmFrameNumber fn := 2342; |
| 9730 | var uint8_t ra := 2; |
| 9731 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9732 | |
| 9733 | /* (set bts 0 cfg back to default) */ |
| 9734 | f_vty_set_imm_ass(BSCVTY); |
| 9735 | |
| 9736 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9737 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9738 | var RSL_IE_Body chan_ident_ie; |
| 9739 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9740 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9741 | mtc.stop; |
| 9742 | } |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9743 | |
| 9744 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 9745 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9746 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9747 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9748 | |
| 9749 | /* Only now send the Chan Act ACK */ |
| 9750 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 9751 | |
| 9752 | /* Check that the lchan is working */ |
| 9753 | var octetstring l3 := '00010203040506'O; |
| 9754 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9755 | |
| 9756 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9757 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9758 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9759 | |
| 9760 | f_sleep(1.0); |
| 9761 | f_shutdown_helper(); |
| 9762 | } |
| 9763 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 9764 | testcase TC_imm_ass_pre_chan_ack_dyn_ts() runs on test_CT { |
| 9765 | /* change Timeslot 6 before f_init() starts RSL */ |
| 9766 | f_init_vty(); |
| 9767 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 9768 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9769 | |
| 9770 | f_init(1, false); |
| 9771 | f_sleep(1.0); |
| 9772 | |
| 9773 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 9774 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 9775 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 9776 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 9777 | |
| 9778 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 9779 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 9780 | |
| 9781 | /* block all static timeslots so that the dyn TS will be used */ |
| 9782 | f_disable_all_tch_f(); |
| 9783 | f_disable_all_tch_h(); |
| 9784 | f_disable_all_sdcch(); |
| 9785 | |
| 9786 | var RSL_Message chan_act; |
| 9787 | var RSL_Message imm_ass; |
| 9788 | |
| 9789 | f_init(1, false); |
| 9790 | f_sleep(1.0); |
| 9791 | |
| 9792 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 9793 | |
| 9794 | /* RA containing reason=LU */ |
| 9795 | var GsmFrameNumber fn := 2342; |
| 9796 | var uint8_t ra := 2; |
| 9797 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9798 | |
| 9799 | /* (set bts 0 cfg back to default) */ |
| 9800 | f_vty_set_imm_ass(BSCVTY); |
| 9801 | |
| 9802 | /* Expect the dyn TS to deactivate PDCH first */ |
| 9803 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 9804 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 9805 | |
| 9806 | /* Now activation as SDCCH8 */ |
| 9807 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 9808 | |
| 9809 | 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] | 9810 | var RSL_IE_Body chan_ident_ie; |
| 9811 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9812 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9813 | mtc.stop; |
| 9814 | } |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 9815 | |
| 9816 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 9817 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9818 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9819 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 9820 | |
| 9821 | /* Only now send the Chan Act ACK */ |
| 9822 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 9823 | |
| 9824 | /* Check that the lchan is working */ |
| 9825 | var octetstring l3 := '00010203040506'O; |
| 9826 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9827 | |
| 9828 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9829 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9830 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9831 | |
| 9832 | f_sleep(1.0); |
| 9833 | f_shutdown_helper(); |
| 9834 | } |
| 9835 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 9836 | testcase TC_imm_ass_pre_ts_ack_dyn_ts() runs on test_CT { |
| 9837 | /* change Timeslot 6 before f_init() starts RSL */ |
| 9838 | f_init_vty(); |
| 9839 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 9840 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9841 | |
| 9842 | f_init(1, false); |
| 9843 | f_sleep(1.0); |
| 9844 | |
| 9845 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 9846 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 9847 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 9848 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 9849 | |
| 9850 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 9851 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 9852 | |
| 9853 | /* block all static timeslots so that the dyn TS will be used */ |
| 9854 | f_disable_all_tch_f(); |
| 9855 | f_disable_all_tch_h(); |
| 9856 | f_disable_all_sdcch(); |
| 9857 | |
| 9858 | var RSL_Message chan_act; |
| 9859 | var RSL_Message imm_ass; |
| 9860 | |
| 9861 | f_init(1, false); |
| 9862 | f_sleep(1.0); |
| 9863 | |
| 9864 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 9865 | |
| 9866 | /* RA containing reason=LU */ |
| 9867 | var GsmFrameNumber fn := 2342; |
| 9868 | var uint8_t ra := 2; |
| 9869 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9870 | |
| 9871 | /* (set bts 0 cfg back to default) */ |
| 9872 | f_vty_set_imm_ass(BSCVTY); |
| 9873 | |
| 9874 | /* Expect the dyn TS to deactivate PDCH first */ |
| 9875 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 9876 | |
| 9877 | /* And already the Immediate Assignment even before the PDCH Deact ACK */ |
| 9878 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 9879 | |
| 9880 | /* continue the Osmo style PDCH Deact (usual chan rel) */ |
| 9881 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 9882 | |
| 9883 | /* Now activation as SDCCH8 */ |
| 9884 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 9885 | |
| 9886 | 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] | 9887 | var RSL_IE_Body chan_ident_ie; |
| 9888 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9889 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9890 | mtc.stop; |
| 9891 | } |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 9892 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 9893 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9894 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9895 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 9896 | |
| 9897 | /* Check that the lchan is working */ |
| 9898 | var octetstring l3 := '00010203040506'O; |
| 9899 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9900 | |
| 9901 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9902 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9903 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9904 | |
| 9905 | f_sleep(1.0); |
| 9906 | f_shutdown_helper(); |
| 9907 | } |
| 9908 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 9909 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9910 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9911 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 9912 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 9913 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9914 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 9915 | execute( TC_ctrl_location() ); |
| 9916 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9917 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 9918 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 9919 | execute( TC_si2quater_2_earfcns() ); |
| 9920 | execute( TC_si2quater_3_earfcns() ); |
| 9921 | execute( TC_si2quater_4_earfcns() ); |
| 9922 | execute( TC_si2quater_5_earfcns() ); |
| 9923 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 9924 | execute( TC_si2quater_12_earfcns() ); |
| 9925 | execute( TC_si2quater_23_earfcns() ); |
| 9926 | execute( TC_si2quater_32_earfcns() ); |
| 9927 | execute( TC_si2quater_33_earfcns() ); |
| 9928 | execute( TC_si2quater_42_earfcns() ); |
| 9929 | execute( TC_si2quater_48_earfcns() ); |
| 9930 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 9931 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 9932 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 9933 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9934 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9935 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9936 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9937 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 9938 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 9939 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9940 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 9941 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 9942 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 9943 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 9944 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9945 | execute( TC_chan_rel_rll_rel_ind() ); |
| 9946 | execute( TC_chan_rel_conn_fail() ); |
| 9947 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 9948 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 9949 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 9950 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 9951 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 9952 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 9953 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 9954 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 9955 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 9956 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 9957 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9958 | |
| 9959 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 9960 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9961 | execute( TC_assignment_csd() ); |
| 9962 | execute( TC_assignment_ctm() ); |
| 9963 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 9964 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9965 | execute( TC_assignment_aoip_tla_v6() ); |
| 9966 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9967 | execute( TC_assignment_fr_a5_0() ); |
| 9968 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9969 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 9970 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 9971 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9972 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 9973 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 9974 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 9975 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 9976 | execute( TC_ciph_mode_a5_0() ); |
| 9977 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 9978 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 9979 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 9980 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 9981 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 9982 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 9983 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 9984 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 9985 | execute( TC_assignment_codec_hr() ); |
| 9986 | execute( TC_assignment_codec_efr() ); |
| 9987 | execute( TC_assignment_codec_amr_f() ); |
| 9988 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 9989 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9990 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 9991 | execute( TC_assignment_codec_amr_f_S1() ); |
| 9992 | execute( TC_assignment_codec_amr_h_S1() ); |
| 9993 | execute( TC_assignment_codec_amr_f_S124() ); |
| 9994 | execute( TC_assignment_codec_amr_h_S124() ); |
| 9995 | execute( TC_assignment_codec_amr_f_S0() ); |
| 9996 | execute( TC_assignment_codec_amr_f_S02() ); |
| 9997 | execute( TC_assignment_codec_amr_f_S024() ); |
| 9998 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 9999 | execute( TC_assignment_codec_amr_h_S0() ); |
| 10000 | execute( TC_assignment_codec_amr_h_S02() ); |
| 10001 | execute( TC_assignment_codec_amr_h_S024() ); |
| 10002 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 10003 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 10004 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 10005 | execute( TC_assignment_codec_amr_f_zero() ); |
| 10006 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 10007 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 10008 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 10009 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 10010 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 10011 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 10012 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10013 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10014 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10015 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 10016 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 10017 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 10018 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 10019 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 10020 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 10021 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 10022 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 10023 | execute( TC_assignment_codec_req_hr_fr() ); |
| 10024 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 10025 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 10026 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 10027 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10028 | |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 10029 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 10030 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10031 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 10032 | execute( TC_rll_est_ind_inact_lchan() ); |
| 10033 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 10034 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 10035 | execute( TC_rll_est_ind_inval_sacch() ); |
| 10036 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 10037 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 10038 | execute( TC_tch_dlci_link_id_sapi() ); |
| 10039 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 10040 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 10041 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 10042 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 10043 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 10044 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10045 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 10046 | execute( TC_paging_imsi_nochan() ); |
| 10047 | execute( TC_paging_tmsi_nochan() ); |
| 10048 | execute( TC_paging_tmsi_any() ); |
| 10049 | execute( TC_paging_tmsi_sdcch() ); |
| 10050 | execute( TC_paging_tmsi_tch_f() ); |
| 10051 | execute( TC_paging_tmsi_tch_hf() ); |
| 10052 | execute( TC_paging_imsi_nochan_cgi() ); |
| 10053 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 10054 | execute( TC_paging_imsi_nochan_ci() ); |
| 10055 | execute( TC_paging_imsi_nochan_lai() ); |
| 10056 | execute( TC_paging_imsi_nochan_lac() ); |
| 10057 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 10058 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 10059 | execute( TC_paging_imsi_nochan_rnc() ); |
| 10060 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 10061 | execute( TC_paging_imsi_nochan_lacs() ); |
| 10062 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 10063 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 10064 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 10065 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 10066 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 10067 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 10068 | |
| 10069 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 10070 | execute( TC_rsl_unknown_unit_id() ); |
| 10071 | |
| 10072 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10073 | |
| 10074 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 10075 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10076 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 10077 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 10078 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 10079 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 10080 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10081 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 10082 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 10083 | execute( TC_ho_int_a5_0() ); |
| 10084 | execute( TC_ho_int_a5_1() ); |
| 10085 | execute( TC_ho_int_a5_3() ); |
| 10086 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 10087 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10088 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10089 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 10090 | execute( TC_ho_out_fail_no_msc_response() ); |
| 10091 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 10092 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10093 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10094 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 10095 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 10096 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 10097 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 10098 | execute( TC_ho_into_this_bsc_a5_4() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 10099 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10100 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 10101 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 10102 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 10103 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 10104 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 10105 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10106 | execute( TC_ho_in_fail_msc_clears() ); |
| 10107 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 10108 | execute( TC_ho_in_fail_no_detect() ); |
| 10109 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 10110 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 10111 | execute( TC_ho_neighbor_config_1() ); |
| 10112 | execute( TC_ho_neighbor_config_2() ); |
| 10113 | execute( TC_ho_neighbor_config_3() ); |
| 10114 | execute( TC_ho_neighbor_config_4() ); |
| 10115 | execute( TC_ho_neighbor_config_5() ); |
| 10116 | execute( TC_ho_neighbor_config_6() ); |
| 10117 | execute( TC_ho_neighbor_config_7() ); |
| 10118 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 10119 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 10120 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 10121 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 10122 | |
| 10123 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 10124 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 10125 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 10126 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 10127 | if (mp_enable_dyn_sdcch8_test) { |
| 10128 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 10129 | execute (TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 10130 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
| 10131 | } |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10132 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 10133 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 10134 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 10135 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 10136 | /* Power control related */ |
| 10137 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 10138 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 10139 | |
| 10140 | /* MSC pooling */ |
| 10141 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 10142 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 10143 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 10144 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 10145 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10146 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 10147 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 10148 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 10149 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 10150 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 10151 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 10152 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 10153 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 10154 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 10155 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 10156 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 10157 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 10158 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 10159 | } |
| 10160 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10161 | execute( TC_early_conn_fail() ); |
| 10162 | execute( TC_late_conn_fail() ); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 10163 | execute( TC_stats_conn_fail() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10164 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 10165 | /* Emergency call handling (deny / allow) */ |
| 10166 | execute( TC_assignment_emerg_setup_allow() ); |
| 10167 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 10168 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 10169 | execute( TC_emerg_premption() ); |
| 10170 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 10171 | /* Frequency hopping parameters handling */ |
| 10172 | execute( TC_fh_params_chan_activ() ); |
| 10173 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10174 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10175 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10176 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10177 | |
| 10178 | if (mp_enable_lcs_tests) { |
| 10179 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 10180 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 10181 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 10182 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 10183 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 10184 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 10185 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 10186 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 10187 | execute( TC_ho_during_lcs_loc_req() ); |
| 10188 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10189 | |
| 10190 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10191 | |
| 10192 | execute( TC_refuse_chan_act_to_vamos() ); |
| 10193 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10194 | |
| 10195 | execute( TC_reassignment_fr() ); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10196 | |
| 10197 | execute( TC_cm_reestablishment() ); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10198 | |
| 10199 | execute( TC_imm_ass_post_chan_ack() ); |
| 10200 | execute( TC_imm_ass_pre_chan_ack() ); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10201 | execute( TC_imm_ass_pre_chan_ack_dyn_ts() ); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10202 | execute( TC_imm_ass_pre_ts_ack_dyn_ts() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 10203 | } |
| 10204 | |
| 10205 | } |